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

BAPI_MATERIAL_SAVEDATA - in update task?

wolfgang_brunneder
Participant
0 Likes
751

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

3 REPLIES 3
Read only

Former Member
0 Likes
622

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'.

Read only

Former Member
0 Likes
622

Read only

0 Likes
622

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