Question:
Hi ! Dear All
I want to update a SAP's standard table - GLPCA->the SGTXT field .
Could anyone give me some tips to do it ??
Thanks for your warm help in advance !!
IanLee
Answer:
what do you mean exactly ? - you want to change the current contents of this table or you want to populate this field in future postings? The former is a big no-no for tables such as the one you mention (profit centre posting data) as the consequences are potentially disastrous.
Answer:
Yes ! As you said : the consequences are potentially disastrous !
But why I ask such a question , pls see the following code
FORM lock_table_record USING p_bseg LIKE bseg
p_subrc LIKE sy-subrc.
CALL FUNCTION 'ENQUEUE_EFVIBSEG'
EXPORTING
MODE_BSEG = 'E'
MANDT = SY-MANDT
BUKRS = p_bseg-bukrs
BELNR = p_bseg-belnr
GJAHR = p_bseg-gjahr
BUZEI = p_bseg-buzei
* X_BUKRS = ' '
* X_BELNR = ' '
* X_GJAHR = ' '
* X_BUZEI = ' '
* _SCOPE = '2'
* _WAIT = ' '
* _COLLECT = ' '
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
p_subrc = sy-subrc.
ENDFORM. " lock_table_record
The function can lock table BSEG。 After I finish modifing BSEG , I could call another function to unlock the BSEG table.
FORM unlock_table_record USING p_bseg LIKE bseg.
CALL FUNCTION 'DEQUEUE_EFVIBSEG'
EXPORTING
MODE_BSEG = 'E'
MANDT = SY-MANDT
BUKRS = p_bseg-bukrs
BELNR = p_bseg-belnr
GJAHR = p_bseg-gjahr
BUZEI = p_bseg-buzei
* X_BUKRS = ' '
* X_BELNR = ' '
* X_GJAHR = ' '
* X_BUZEI = ' '
* _SCOPE = '3'
* _SYNCHRON = ' '
* _COLLECT = ' '
.
ENDFORM. " unlock_table_record
That is our ABAP consultant's smaple code ! And the program works fine !!
Now my target table is GLPCA . Who can guide me that :
Is it possible to call some functions helping me like he did on BSEG ??
Thanks in advance !!
Answer:
Ian,
I think you have misunderstood guests comment so I'll put guests comment another way.
Whilst you're quire right in using lock objects to update tables, you should not under any circumstances directly update an SAP Standard table. This compromises your data integrity and as quite rightly pointed out is a big no-no.
If you wish to update certain fields in a table, find a transaction or a bapi that does so and then use those.
_________________
Regards
R
Abap KC
SFMDR