Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Table update does not work + AUFK

ramiwal_dsilva
Participant
0 Likes
2,196

Hi,

I am trying to update the AUFK table for a service order that just got created in the previous statement. But the Modify nor update statement  does not work.

I have a custom field in the AUFK table that I am trying to update (AUFK-ZFIELD)

Step 1:

CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN' "  This creates a new service order (IW31) and  generates an order number aufk-1234.


Step2:

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.


Step 3


UPDATE aufk

       SET ZZ_FIELD = XXXX

        WHERE aufnr = aufk-1234.


The above statement returns sy-subrc eq 4


I do not want to use the extension BAPI for this custom field update.


Can someone tell me why this doesn't work? I tried using the modify statement likewise with no effect.

4 REPLIES 4
Read only

ArcherZhang
Product and Topic Expert
Product and Topic Expert
0 Likes
1,152

Hi Ramiwal,

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' exporting WAIT = 'X'.


regards,

Archer

Read only

dibyajeeban_jena
Active Participant
0 Likes
1,152

Hi Ramiwal,

Agree with Archer .

Reason why  'UPDATE' is not working is, in database the order number(aufnr = aufk-1234) is not yet created in AUFK  table . When you are trying to update a field of a record which does not exists in database, its showing sy-subrc = 4 .

Use this  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' exporting WAIT = 'X'  for synchronous updating .

Regards

DJ



Read only

0 Likes
1,152

Hi Archer, Jena,

Thank you for the response, but i believe i solved the issue.

It is because the data element referring to  aufk-1234 had a conversion exit , and hence

was required to be converted before passing it to the Update statement.


Issue resolved

Read only

suresh_kutam
Participant
0 Likes
1,152

Hello Ramiwal,

I suggest you do not modify or update AUFK /any SAP standard tables .

During the BAPI process , look for a exit or Enhancement technique to pass the value of your custom field and let BAPI save the data on it own.

Ground rule is we should not write Modify/update on SAP standard tables.

Let me know if you need any further details.

Thanks,

Suresh Kutam