‎2011 Feb 22 10:26 PM
Hey Guys,
Iu2019ve created one new field on VBAK called zzminvaluecheck and then in order to make this able to be changeable by BAPI I have also replicate it on the follow structures:
a) VBAKKOZ ( NEW FIELD WITH 3 CHARACTERS)
b) VBAKKOZX (NEW FIELD WITH 1 CHARACTER)
c) BAPE_VBAK ( NEW FIELD WITH 3 CHARACTERS)
d) BAPE_VBAKX (NEW FIELD WITH 1 CHARACTER)
This is my code:
wa_order_headerx-updateflag = 'U'.
wa_bape_vbak-vbeln = p_wa_output-vbeln.
wa_bape_vbakx-vbeln = p_wa_output-vbeln.
wa_bape_vbak-zzminvaluecheck = c_no.
wa_bape_vbakx-zzminvaluecheck = 'X'.
clear wa_exten.
wa_exten-structure = 'BAPE_VBAK'.
wa_exten-valuepart1 = wa_bape_vbak.
append wa_exten to ti_exten.
clear wa_exten.
wa_exten-structure = 'BAPE_VBAKX'.
wa_exten-valuepart1 = wa_bape_vbakx.
append wa_exten to ti_exten.
call function 'BAPI_SALESORDER_CHANGE'
exporting
salesdocument = p_wa_output-vbeln
order_header_inx = wa_order_headerx
tables
return = ti_return
* ORDER_ITEM_IN =
* ORDER_ITEM_INX =
extensionin = ti_exten.
read table ti_return into wa_return with key type = 'E'.
if sy-subrc eq 0.
wa_output1-mesg = wa_return-message.
call function 'BAPI_TRANSACTION_ROLLBACK'.
else.
wa_output1-mesg = text-021.
call function 'BAPI_TRANSACTION_COMMIT' .
endif.Iu2019ve got the following message:
ORDER_HEADER_IN has been processed successfully
No data was changed.
ACTUALLY NOTHING WAS CHANGED!
I missed something, can any of you guys tell me what is wrong with this code?
Best regards,
Alex
Edited by: ACR on Feb 22, 2011 11:27 PM
Moderator message: please use more descriptive subject lines for your posts.
Edited by: Thomas Zloch on Feb 23, 2011 1:08 PM
‎2011 Feb 23 5:22 AM
You can go like as under --
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = i_vbeln
order_header_in = order_header_in
order_header_inx = order_header_inx
TABLES
return = ti_return
extensionin = ti_exten.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = ret2.
Actually, you need to take care about the Structure ORDER_HEADER_IN.
For better understanding, you can refer following thread -
Hope this may clear your doubts.
Thanks.
Kumar Saurav.
‎2011 Feb 23 5:22 AM
You can go like as under --
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = i_vbeln
order_header_in = order_header_in
order_header_inx = order_header_inx
TABLES
return = ti_return
extensionin = ti_exten.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = ret2.
Actually, you need to take care about the Structure ORDER_HEADER_IN.
For better understanding, you can refer following thread -
Hope this may clear your doubts.
Thanks.
Kumar Saurav.
‎2011 Feb 23 4:03 PM
Actually, you need to take care about the Structure ORDER_HEADER_IN.
@Kumar: No, not true at all. You can make changes to only custom fields as long as the update flag is set in the 'X' structure.
At first glance, the code looks OK. Your best bet is to debug the process and find out why the changes aren't made. Perhaps the flag values aren't being set for some reason. Start with form 'ms_move_extensionin' in SD_SALES_DOCUMENT_CHANGE.
‎2011 Feb 23 5:33 PM
@Brad, I'm used to do it in the creation step in other project. My question is.. has anybody achieve this change before? I mean.. using only the extension?! I will debug it anyway, but any idea will be welcome.
‎2011 Feb 23 11:57 PM
Yes. As I pointed out to the incorrect poster, you are not required to change any other field just to get custom fields changed. I've done it that way many times.
‎2011 Feb 28 4:10 PM
Just figure it out, you must use data elements CHAR1 or CHAR01 on the X structures. Thank you very much.