2014 Jul 07 5:45 AM
Hi friends,
I am very new to ABAP , just now i have started my carrier in SAP-ABAP.
I have to update these three fields MSTAE, EXTWG, MTPOS_MARA in MARA table through bapi. I need to give these values from selection screen followed by Material no.
I already found some program in the forum but that programs are very lenthy , i am not able to understand.
Can anyone help me by giving some idea or sample program so that i can learn how to do this thing.
Thankx in advance...
2014 Jul 07 6:23 AM
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
Hi friends,
I am very new to ABAP , just now i have started my carrier in SAP-ABAP.
I have to update these three fields MSTAE, EXTWG, MTPOS_MARA in MARA table through bapi. I need to give these values from selection screen followed by Material no.
I already found some program in the forum but that programs are very lenthy , i am not able to understand.
Can anyone help me by giving some idea or sample program so that i can learn how to do this thing.
Thankx in advance...
2014 Jul 07 6:23 AM
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
2014 Jul 07 7:45 AM
Hi Prasanna,
Thankyou very much for replying ,,,
I want to ask u Is it the whole program for updation?
And i am not getting what is "ls_material" is here , i have to insert the values of the three fields from selection screen..
Thanku...
2014 Jul 07 8:13 AM
Hello Ritesh,
ls_material is work area of internal table which is upload through excel.if u want pass the screen fields
in the FM "CONVERSION_EXIT_MATN1_INPUT" Just pass the screen fields value in new internal table .
under that loop use the FM and pass the work area values as input to the FM.
I hope this solve u r issue.
Regards,
Ameya Karadkhedkar
2014 Jul 07 9:09 AM
Hi Ritesh,
As said by Ameya Karadkhedkar, if you are going to pass the values using selection screen, then pass those screen fields instead of ls_material.
Parameters: p_matnr type matnr,
p_extwg type extwg,
p_mstae type mstae,
p_mtpos type mtpos_mara.
Replace: ls_material-matnr -> p_matnr
ls_material-extwg -> p_extwg
ls_material-mstae -> p_mstae
ls_material-mtpos_mara -> p_mtpos
Thanks & Regards,
Prasanna
2014 Jul 07 9:37 AM
2014 Oct 26 10:24 AM