08-10-2020 5:30 AM
Hi all,
Previously, I managed to update the BRGEW field using FM 'BAPI_MATERIAL_SAVEDATA' .DATA : nomor TYPE p DECIMALS 2.
DATA: xheaddata LIKE bapimathead OCCURS 0 WITH HEADER LINE,
xclientdata LIKE bapi_mara OCCURS 0 WITH HEADER LINE,
xclientdatax LIKE bapi_marax OCCURS 0 WITH HEADER LINE,
xunitsofmeasure LIKE bapi_marm OCCURS 0 WITH HEADER LINE,
xunitsofmeasurex LIKE bapi_marmx OCCURS 0 WITH HEADER LINE,
xreturn LIKE bapi_matreturn2 OCCURS 0 WITH HEADER LINE,
return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
PARAMETERS p_matnr LIKE mara-matnr.
PARAMETERS p_brgew TYPE i.
REFRESH xheaddata.
xheaddata-material = p_matnr. "<= SET MATERIAL NUMBER HERE
xheaddata-basic_view = 'X'.
xheaddata-inp_fld_check = 'W'.
APPEND xheaddata.
xclientdata-net_weight = '111'. "<= SET NET WEIGHT HERE
xclientdatax-net_weight = 'X'.
xclientdata-unit_of_wt = 'TO'. "<= SET UNIT OF MEASURE HERE
xclientdatax-unit_of_wt = 'X'.
APPEND xclientdata.
APPEND xclientdatax.
xunitsofmeasure-gross_wt = p_brgew. "<= SET GROSS WEIGHT HERE
xunitsofmeasurex-gross_wt = 'X'.
xunitsofmeasure-unit_of_wt = 'TO'. "<= SET UNIT OF MEASURE HERE
xunitsofmeasurex-unit_of_wt = 'X'.
xunitsofmeasure-alt_unit = 'ST'. "<= SET ALT UNIT OF MEASURE HERE
xunitsofmeasurex-alt_unit = 'ST'. "<= SET ALT UNIT OF MEASURE HERE
APPEND xunitsofmeasure. APPEND xunitsofmeasurex.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = xheaddata
clientdata = xclientdata
clientdatax = xclientdatax
TABLES
unitsofmeasure = xunitsofmeasure
unitsofmeasurex = xunitsofmeasurex
returnmessages = xreturn.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
IF return-type = 'S'.
WRITE : 'Material', p_matnr, 'Berhasil di update',/.
ELSEIF return-type = 'E'.
WRITE : 'Gagal',/.
ENDIF.
ENDIF.
08-10-2020 6:37 AM
jandrivay,
Recommend you to kindly go through the OSS note 2215852.
Sap has clearly addressed this gap by introducing field ending with _LONG. In the same BAPI you have referred if you get into the header structure and reach down to last field you can find the required field. Below screen shot for reference, try populating the field and your issue will be resolved.
Regards!
08-10-2020 5:42 AM
Hi jandrivay,
I think its not possible to update the Material Number. You should copy your existing Material Number to a new Material and set the deletion flag to the old Material Number.
08-10-2020 6:22 AM
Hi,
MATNR can be modified only when external number range allowed in material master number range. And changing MATNR in one table (MARA) won't help it flows to multiple areas of system so follow this link Material Number Field Length extension
08-10-2020 6:32 AM
Update the material number length, is not just modifying the value. It is also check all the specific code to be sure you use the correct field size in CALL FUNCTION, in EDI. you did not use the MATN18 ...
Second point, updating the value of the MARA table will have direct impact on all the existing document: Purchase Order, Sales Order, BOM, ... How did you plan to manage this ?
08-10-2020 6:37 AM
jandrivay,
Recommend you to kindly go through the OSS note 2215852.
Sap has clearly addressed this gap by introducing field ending with _LONG. In the same BAPI you have referred if you get into the header structure and reach down to last field you can find the required field. Below screen shot for reference, try populating the field and your issue will be resolved.
Regards!
08-15-2020 7:10 AM