Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9052

Re: updating values in mara table through bapi

$
0
0

Hi Ritesh,

 

Use BAPI_MATERIAL_SAVEDATA to update the entries MSTAE, EXTWG and MTPOS_MARA by passing the following fields:

 

DATA: ls_headdata     TYPE  bapimathead,

       ls_clientdata   TYPE  bapi_mara,

       ls_clientdatax  TYPE  bapi_marax,

       ls_return       TYPE  bapiret2.

 

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

   EXPORTING

     input        = ls_material-matnr

   IMPORTING

     output       = ls_headdata-material

   EXCEPTIONS

     length_error = 1

     OTHERS       = 2.

IF sy-subrc <> 0.

   CLEAR: ls_headdata-material.

ENDIF.

 

ls_clientdata-extmatlgrp  = ls_material-extwg.

ls_clientdata-pur_status  = ls_material-mstae.

ls_clientdata-item_cat    = ls_material-mtpos_mara.

 

ls_clientdatax-extmatlgrp  = 'X'.

ls_clientdatax-pur_status  = 'X'.

ls_clientdatax-item_cat    = 'X'.

 

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

   EXPORTING

     headdata    = ls_headdata

     clientdata  = ls_clientdata

     clientdatax = ls_clientdatax

   IMPORTING

     return      = ls_return.

IF ls_return-type = 'E' OR ls_return-type = 'A'.

   CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

 

ELSE.

   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

     EXPORTING

       wait = 'X'.

ENDIF.


Thanks & Regards,

Prasanna



Viewing all articles
Browse latest Browse all 9052

Trending Articles