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 does not update z fields

Former Member
0 Likes
2,444

hi all,

we r using 'BAPI_MATERIAL_SAVEDATA' to update MVKE with 3 custom fields and one standard field.

BAPI_TE_MVKE, BAPI_TE_MVKEX are extended to include the z-fields.

after BAPI call commit is also done. BAPI returns a success message. but finally in table i dont see the update.

what could be the reason ? we have done such things before and succeeded.

<b>but this time the difference is that the z-fields added to MVKE are not present in any view of any transaction.

they are only in the table</b>

any useful info. in this regard is appreciated.

2 REPLIES 2
Read only

Former Member
0 Likes
913

hi,

SDN gurus please have a look at this.

thanks

Read only

dkle
Participant
0 Likes
913

Hello all,

please make sure that customizing is set properly for the Z-fields.

Follow the steps in post:

Important for MVKE extension:

  1. 'field selection group' (T130F-FGRUP) must be set to a valid entry (e.g. 054, 090, 230,... for MVKE extension)
  2. 'maintenance status' (T130F-PSTAT) must contain a 'V'.


Here is a demo report that is working for me (change of existing material) after correct customizing setup:



*&---------------------------------------------------------------------*
*& Report  ZDEMO_BAPI_MATERIAL_SAVEDATA
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT zdemo_bapi_material_savedata.

DATA:   headdata  TYPE  bapimathead,
         lt_extensionin   TYPE STANDARD TABLE OF bapiparex,
         wa_extensionin   LIKE LINE OF lt_extensionin,
         lt_extensioninx  TYPE STANDARD TABLE OF bapiparexx,
         wa_extensioninx  LIKE LINE OF lt_extensioninx,
         wa_bapi_te_mvke  TYPE bapi_te_mvke,
         wa_bapi_te_mvkex TYPE bapi_te_mvkex,
         return    TYPE  bapiret2,
         returnmes TYPE  TABLE OF bapi_matreturn2.

headdata-material = '1N4148'.
headdata-sales_view  = 'X'.

wa_bapi_te_mvke-sales_org  = '0100'.
wa_bapi_te_mvke-distr_chan = '10'.
wa_bapi_te_mvke-zzabcnetwr = 'A'.

wa_bapi_te_mvkex-sales_org  = '0100'.
wa_bapi_te_mvkex-distr_chan = '10'.
wa_bapi_te_mvkex-zzabcnetwr = 'X'.

wa_extensionin-structure    = 'BAPI_TE_MVKE'.
wa_extensionin-valuepart1   = wa_bapi_te_mvke.
APPEND wa_extensionin TO lt_extensionin.

wa_extensioninx-structure   = 'BAPI_TE_MVKEX'.
wa_extensioninx-valuepart1  = wa_bapi_te_mvkex.
APPEND wa_extensioninx TO lt_extensioninx.

* Call the BAPI
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
   EXPORTING
     headdata       = headdata
   IMPORTING
     return         = return
   TABLES
     returnmessages = returnmes
     extensionin    = lt_extensionin
     extensioninx   = lt_extensioninx.

* RETURN-TYPE is 'E' in case of error, else 'S'.
IF return-type = 'E'.
*  le_error_count = le_error_count + 1.
   CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

   LOOP AT returnmes ASSIGNING FIELD-SYMBOL(<return>).
     WRITE: <return>-message, <return>-field.
   ENDLOOP.
ELSE.
*---- Kein Commit nötig??
   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
     EXPORTING
       wait = abap_true.
ENDIF.