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: Gross Weight Basic Data 1

Former Member
0 Likes
1,038

When I try to create a material using BAPI_MATERIAL_SAVEDATA: , all the fields are getting updated except Gross weight in the tab 'Basic Data1' . When I searched for a solution I found the problem will be resolved when I fill Alternate Unit(ALT_UNIT)with the same value as in Base Unit of Measurement in my BAPI structures.

But my requirement is, the value of ALT_UNIT & Base UOM should be different.

1 ACCEPTED SOLUTION
Read only

chundru_ravindra
Participant
0 Likes
900

Hi Rakhi Nair,

While creating material you should pass all mandatory fields,like

in Import tab:

HEADDATA in this

MATERIAL

IND_SECTOR

MATL_TYPE

BASIC_VIEW(any view)

CLIENTDATA in this

BASE_UOM_ISO

in Tables tab:

MATERIALDESCRIPTION in this

LANGU

MATL_DESC

UNITSOFMEASURE in this

GROSS_WT(your required field)

UNITSOFMEASUREX in this

GROSS_WT as X and create material

Regards,

Ravindra.

Edited by: chundruravindra on Feb 8, 2012 12:07 PM

5 REPLIES 5
Read only

chundru_ravindra
Participant
0 Likes
901

Hi Rakhi Nair,

While creating material you should pass all mandatory fields,like

in Import tab:

HEADDATA in this

MATERIAL

IND_SECTOR

MATL_TYPE

BASIC_VIEW(any view)

CLIENTDATA in this

BASE_UOM_ISO

in Tables tab:

MATERIALDESCRIPTION in this

LANGU

MATL_DESC

UNITSOFMEASURE in this

GROSS_WT(your required field)

UNITSOFMEASUREX in this

GROSS_WT as X and create material

Regards,

Ravindra.

Edited by: chundruravindra on Feb 8, 2012 12:07 PM

Read only

0 Likes
900

My material is already created with all the required data.. but the issue is with the GROSS WGT. The Gross wgt field is not getting updated. I tried and i will get updated once we give Base UOM and ALT_UNIT are same. But in my requirement , those 2 values are different...

Read only

0 Likes
900

Hi,

in the same way i created material GrossWeight field got updated, tell me any other conditions do u have.

Read only

former_member226225
Contributor
0 Likes
900

Hi,

let us try the following code i got it

data : lt_filetable type filetable,

ls_filetable like line of lt_filetable,

lv_rc type i.

types : begin of ty_legacy,

str(100) type c,

end of ty_legacy.

data : lt_legacy type standard table of ty_legacy,

ls_legacy type ty_legacy.

data path type string.

types : begin of ty_material,

material type BAPIMATHEAD-material,

IND_SECTOR type BAPIMATHEAD-ind_sector,

MATL_TYPE type BAPIMATHEAD-matl_type,

MATL_GROUP type BAPI_MARA-matl_group,

BASE_UOM type BAPI_MARA-base_uom,

LANGU type BAPI_MAKT-langu,

LANGU_ISO type BAPI_MAKT-langu_iso,

MATL_DESC type BAPI_MAKT-matl_desc,

end of ty_material.

data : lt_material type standard table of ty_material,

ls_material type ty_material.

data : ls_bapimathead type BAPIMATHEAD,

ls_bapi_mara type BAPI_MARA,

ls_bapi_marax type BAPI_MARAX,

ls_return type BAPIRET2.

data : lt_bapi_makt type table of BAPI_MAKT,

ls_bapi_makt type BAPI_MAKT.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG

CHANGING

FILE_TABLE = lt_filetable

RC = lv_rc.

if lt_filetable is not initial.

read table lt_filetable into ls_filetable index 1.

if sy-subrc eq 0.

path = ls_filetable-filename.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD

EXPORTING

FILENAME = path

FILETYPE = 'ASC'

CHANGING

DATA_TAB = lt_legacy[].

endif.

endif.

if lt_legacy[] is not initial.

loop at lt_legacy into ls_legacy.

split ls_legacy-str at ',' into

ls_material-material

ls_material-ind_sector

ls_material-matl_type

ls_material-matl_group

ls_material-base_uom

ls_material-langu

ls_material-langu_iso

ls_material-matl_desc.

append ls_material to lt_material.

endloop.

endif.

if lt_material[] is not initial.

loop at lt_material into ls_material.

  • prepare Header data

clear ls_bapimathead.

ls_bapimathead-MATERIAL = ls_material-MATERIAL.

ls_bapimathead-IND_SECTOR = ls_material-IND_SECTOR.

ls_bapimathead-MATL_TYPE = ls_material-MATL_TYPE.

ls_bapimathead-BASIC_VIEW = 'X'.

  • prepare bapi_mara parameter

clear ls_bapi_mara.

ls_bapi_mara-MATL_GROUP = ls_material-MATL_GROUP.

ls_bapi_mara-BASE_UOM = ls_material-BASE_UOM.

  • prepare bapi_marax parameter

clear ls_bapi_marax.

ls_bapi_marax-MATL_GROUP = 'X'.

ls_bapi_marax-BASE_UOM = 'X'.

  • prepare BAPI_MAKT internal table

clear ls_bapi_makt.

refresh lt_bapi_makt.

ls_bapi_makt-LANGU = ls_material-LANGU.

ls_bapi_makt-LANGU_ISO = ls_material-LANGU_ISO.

ls_bapi_makt-MATL_DESC = ls_material-MATL_DESC.

append ls_bapi_makt to lt_bapi_makt.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

HEADDATA = ls_bapimathead

CLIENTDATA = ls_bapi_mara

CLIENTDATAX = ls_bapi_marax

IMPORTING

RETURN = ls_return

TABLES

MATERIALDESCRIPTION = lt_bapi_makt.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

write 😕 ls_material-material,

ls_return-type,

ls_return-message.

clear : ls_return,

ls_material.

endloop.

endif.

Thanks & Regards,

Raghunadh .K

Read only

0 Likes
900

Hi Raghunath,

I have issue with the field 'Gross Wgt ' only.