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

Re: Populating Additional data in Material master record

Former Member
0 Likes
1,103

Hi,

I am creating material master record using BAPI_MATERIAL_SAVE_DATA. I am using the below function modules to populate date in Additional Data Tab. I am getting the existing material details from BAPI_MATERIAL_GET_ALL and passing it to

BAPI_MATERIAL_SAVE_DATA variables. I can create material successfully, but "PROPORTION/PRODUCT UNIT" TAB in Additional Data Tab is not populating.

Program populates this data for some materials and for some materials not. For example, when I try to create a new material by copying existing details from 1234 , New material will be created with 12345(say), but "PROPORTION/PRODUCT UNIT" TAB in Additional Data Tab is not populating.

Now If I put a break point, to find out what could be the issue , and then press f6 , and re-execute program for the same material 1234, then my custom program can populates data. I know its sound wiered, but I am not able to solve the issue.

CALL FUNCTION 'VBWS_UOM_READ_WITH_MATNR'

EXPORTING

i_matnr = it_mara-matnr

TABLES

e_meinh = gt_meinh

e_meinh_ws = gt_meinh_ws

e_meinh_ws_upd = gt_meinh_ws_upd

e_meinh_ws_updx = gt_meinh_ws_updx

e_message = gt_message

e_return = gt_return

EXCEPTIONS

error = 1

OTHERS = 2.

FREE: gt_message, gt_return.

CLEAR : gt_meinh_ws_upd, gt_meinh_ws_updx.

CALL FUNCTION 'VBWS_UOM_MAINTAIN_DARK'

EXPORTING

i_matnr = lv_matnr

i_kzwsm = it_mara-kzwsm

i_kzwsmx = 'X'

i_exit_by_first_error = 'X'

i_user = sy-uname

i_buffer_refresh = 'X'

i_no_update = ' '

TABLES

i_meinh_ws_upd = gt_meinh_ws_upd[]

i_meinh_ws_updx = gt_meinh_ws_updx[]

e_message = gt_message

e_return = gt_return

EXCEPTIONS

error = 1

OTHERS = 2.

LOOP AT gt_return WHERE type = 'S'.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDLOOP.

Any suggestions ...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
739

Hi,

I have come across such a situation while updating a record. I fixed it by calling the fm twice passing same data and committing after each function call. In simple words, Do your job twice.

Hope this also solves ur problem.

Regards,

Karthik.

2 REPLIES 2
Read only

Former Member
0 Likes
740

Hi,

I have come across such a situation while updating a record. I fixed it by calling the fm twice passing same data and committing after each function call. In simple words, Do your job twice.

Hope this also solves ur problem.

Regards,

Karthik.

Read only

0 Likes
739

Hi Karthik,

Thanks for your reply. It worked. But now I am facing strange issue. As you see my code above, i am using VBWS_UOM_MAINTAIN_DARK to update Addition data tab. however, the values of internaltable gt_meinh_ws_upd was not updated correctly inside the material master.

For example, I am filling gt_meinh_ws_upd table with the below values

gt_meinh_ws_upd-wsm = 'OZT'

gt_meinh_ws_upd-atnam ' ZABCDE'

gt_meinh_ws_upd-atwrt = 0.0023

append gt_meinh_ws_upd.

but when i see in material master, gt_meinh_ws_upd-atwrt = 0.0023 is updated with 23, instead of 0.023. I debugged th func. module many times, I didnot come acroos the code what making it to 23.

Any Idea karthik...

Thanks in Advance