Application Development 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: 

Problem with BAPI_MATERIAL_SAVEDATA

wolfgang_brunneder
Participant
0 Kudos

Hello!

I'm using BAPI_MATERIAL_SAVEDATA in order to change the 'cross-plant material status'. Below the relevant code lines:

-

-


DATA: lst_headdata TYPE bapimathead,

lst_clientdata TYPE bapi_mara,

lst_clientdatax TYPE bapi_marax,

lst_return TYPE bapiret2.

DATA: lit_return_msg TYPE TABLE OF bapi_matreturn2.

lst_headdata-material = i_matnr.

lst_headdata-basic_view = 'X'.

lst_clientdata-pur_status = i_new_mstae. " NEW cross-plant material status

lst_clientdatax-pur_status = 'X'.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

headdata = lst_headdata

clientdata = lst_clientdata

clientdatax = lst_clientdatax

IMPORTING

return = lst_return

TABLES

returnmessages = lit_return_msg.

-

-


The error table 'lit_return_msg' of type bapi_matreturn2 contains the following error message:

H MK 102 trying to create: 6000191 ____ ____ ____ __________ ____ __ ___ ___

S MG 160 The material cannot be maintained since no maintainable data transferred

H MK 103 Trying to change: 6000191 ____ ____ ____ __________ ____ __ ___ ___

E 00 001 Falsche Aktivität!

I also tried to test BAPI_MATERIAL_SAVEDATA with transaction SE37 - the same result (in our development system)! Now comes the strange: In our test system the test in SE37 (with an identically created material!) works without an error message - although the two systems are supposed to be identical!

Has somebody any advice? Thanks in advance!

Greetings

Wolfgang

2 REPLIES 2

Former Member
0 Kudos

Hello,

Check this logic you may find any solution.

See how to pass the values to the FM.

SELECT SINGLE

mtart

FROM mara

INTO y_lv_mtart

WHERE matnr EQ y_wa_yrevlev-mat_ref.

IF sy-subrc EQ y_k_zero.

y_wa_bapi_header-material = y_wa_yrevlev-mat_ref.

y_wa_bapi_header-matl_type = y_lv_mtart.

y_wa_bapi_header-mrp_view = y_lk_x.

y_wa_extin-structure = 'BAPI_TE_MARC'.

y_wa_extin-valuepart1+0(4) = y_wa_yrevlev-werks.

y_wa_extin-valuepart1+17(2) = y_wa_yrevlev-rev_lev.

APPEND y_wa_extin TO y_i_extin.

y_wa_extinx-structure = 'BAPI_TE_MARCX'.

y_wa_extin-valuepart1+0(4) = y_wa_yrevlev-werks.

y_wa_extinx-valuepart1+17(2) = y_lk_x.

APPEND y_wa_extinx TO y_i_extinx.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

headdata = y_wa_bapi_header

IMPORTING

return = y_wa_return

TABLES

extensionin = y_i_extin

extensioninx = y_i_extinx.

APPEND y_wa_return TO y_i_return.

  • CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDIF.

0 Kudos

Thanks for your answer, but unfortunately your hint does not solve my problem.

I think the solution depends on the fact why the FM-test with SE37 works in our test-system BUT NOT in our development system. I created to identical material records (in test- and development-system) in order to test the status change with the BAPI in SE37.

Do I have to perform any customizing in order to get the BAPI work?

Thanks!

Greetings

Wolfgang