‎2009 Mar 18 9:41 AM
Hello!
I would like to change cross-plant material status using function module BAPI_MATERIAL_SAVEDATA. A requirement is that the changes are saved IN UPDATE TASK which means that the changes are not written to db until a BAPI_TRANSACTION_COMMIT.
Unfortunately it seems that BAPI_MATERIAL_SAVEDATA writes changes at an implicit database commit. My questions: Is my assumption right? and does another possibility exist to write the changes IN UPDATE TASK?
Kind regards
Wolfgang
‎2009 Mar 19 12:44 PM
see the following example
Report Z_VMA_MARA_EXT
*& written by : Vivek Amrute.Tested on ECC6 : 20/11/2008
*& Updating values of custom fields added to MARA.
REPORT z_vma_mara_ext.
TABLES : mara, marc.
DATA : rex LIKE bapiparex OCCURS 0 WITH HEADER LINE,
rexx LIKE bapiparexx OCCURS 0 WITH HEADER LINE,
header LIKE bapimathead OCCURS 0 WITH HEADER LINE,
makt1 LIKE bapi_makt OCCURS 0 WITH HEADER LINE,
zbapiret2 LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
PARAMETERS : material LIKE mara-matnr,
val1 TYPE aktvt,
val2 TYPE actname_kk,
val3 TYPE aktvt,
new_desc TYPE maktx.
header-material = material.
rex-structure = 'BAPI_TE_MARA'.
CONCATENATE material val1 val2 val3 INTO rex-valuepart1 RESPECTING BLANKS.
APPEND rex.
rexx-structure = 'BAPI_TE_MARAX'.
CONCATENATE material 'XXX' INTO rexx-valuepart1 RESPECTING BLANKS.
APPEND rexx.
makt1-langu = 'E'.
makt1-langu_iso = 'EN'.
makt1-matl_desc = new_desc.
APPEND makt1.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = header
IMPORTING
return = zbapiret2
TABLES
materialdescription = makt1
extensionin = rex
extensioninx = rexx.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
‎2009 Mar 19 12:45 PM
‎2009 Mar 24 6:36 AM
Hello!
Thanks for your reply! But I'm already able to change the cross-plant material status with this FM. Unfortunatley it seems that BAPI_MATERIAL_SAVEDATA doesn't write the changes using IN UPDATE TASK. As a result the changes get to DB before intended!
My question is: If my assuption is right and (if yes) how I can change material data IN UPDATE TASK?
Thanks in advance!
Regards
Wolfgang