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

Problems with: BAPI_MATERIAL_SAVEDATA

Former Member
0 Likes
2,605

Hi

´

i try to update own fields of MARA with BAPI: BAPI_MATERIAL_SAVEDATA.

Here my code:


DATA: WA_HEADDATA LIKE BAPIMATHEAD.
*
DATA: WA_BAPI_TE_MARA  TYPE BAPI_TE_MARA,
      WA_BAPI_TE_MARAX TYPE BAPI_TE_MARAX.
*
DATA: IT_REX           TYPE TABLE OF BAPIPAREX,
      WA_REX           TYPE          BAPIPAREX,
      IT_REXX          TYPE TABLE OF BAPIPAREXX,
      WA_REXX          TYPE          BAPIPAREXX.
*
DATA: WA_RETURN        TYPE          BAPIRET2.
*
* Header
WA_HEADDATA-MATERIAL     = '000000000000000592'.
WA_HEADDATA-BASIC_VIEW   = 'X'.
*
* Kundenfelder
WA_BAPI_TE_MARA-MATERIAL       = '000000000000000592'.
WA_BAPI_TE_MARA-ZTELWSTOFF     = 'eigener Werkstoff'.
WA_BAPI_TE_MARAX-MATERIAL      = '000000000000000592'.
WA_BAPI_TE_MARAX-ZTELWSTOFF    = 'X'.
*
* EXTENSIONIN
WA_REX-STRUCTURE               = 'BAPI_TE_MARA'.
WA_REX-VALUEPART1              = WA_BAPI_TE_MARA.
APPEND WA_REX TO IT_REX.
WA_REXX-STRUCTURE              = 'BAPI_TE_MARAX'.
WA_REXX-VALUEPART1             = WA_BAPI_TE_MARAX.
APPEND WA_REXX TO IT_REXX.
* Save
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
  EXPORTING
    HEADDATA     = WA_HEADDATA
  IMPORTING
    RETURN       = WA_RETURN
  TABLES
    EXTENSIONIN  = IT_REX
    EXTENSIONINX = IT_REXX.
* Commit
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Problem is, the field will NOT be updated. I have searched in SDN, GOOGLE etc.

Structure BAPI_TE_MARA and BAPI_TE_MARAX are filld with field ZTELWSTOFF.

Has anyone an idea?

thanks

Regards, Dieter

5 REPLIES 5
Read only

former_member214857
Contributor
0 Likes
1,597

Hi Dieter

You can collect informations about the errors reading strcuture RETURNMESSAGES or RETURN. Then you can check if there is unexpected behavior

Best regards

Read only

0 Likes
1,597

Hi,

thanks for your answer.

RETURNMESSAGES

MK 102 Trying to create: 592 ____ ____ ____ __________ ____ __ ___ ___

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

MK 103 Trying to change: 592 ____ ____ ____ __________ ____ __ ___ ___

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

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

RETURN

MM 356 The material 592 has been created or extended

Regards, Dieter

Read only

Former Member
0 Likes
1,597

Hi Dieter,

Have you seen this post? It shows a different way of filling EXTENSIONIN and EXTENSIONINX tables. There's also a mention of additional configuration that needs to be done.

[BAPI_MATERIAL_SAVEDATA with custom z-fields|;

Regards,

Brenda

Read only

madhu_vadlamani
Active Contributor
0 Likes
1,597

Hi Dieter,

There are some good threads on this.The way you filling structure is not right.Just go though this [Extension Fields|;

Regards,

Madhu.

Read only

Former Member
0 Likes
1,597

Hi,

thanks to all.

Filling Fields is correct, the problem was

customising (OMSR). I filled T130F and all is OK.

Regards, Dieter