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

Order unit is not save using BAPI_MATERIAL_SAVEDATA

palash_mazumder
Participant
0 Likes
2,628

Hi Experts,

I am using  BAPI_MATERIAL_SAVEDATA to create material master.But the Order unit is not save.

I have written this peace of code for order unit,

****************UNIT OF MEASURE***************

     LOOP AT IT_ITEM INTO WA_ITEM WHERE INT_NUM EQ WA_MARA-INT_NUM.

       IF WA_ITEM-MEINH IS NOT INITIAL.

         TRANSLATE WA_ITEM-MEINH TO UPPER CASE.

         CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'

           EXPORTING

             INPUT          = WA_ITEM-MEINH

             LANGUAGE       = SY-LANGU

           IMPORTING

             OUTPUT         = LWA_UNITSOFMEASURE-ALT_UNIT

           EXCEPTIONS

             UNIT_NOT_FOUND = 1

             OTHERS         = 2.

         LWA_UNITSOFMEASURE-DENOMINATR = WA_ITEM-UMREN.

         LWA_UNITSOFMEASURE-NUMERATOR WA_ITEM-UMREZ.

*Add by Palash

*      LWA_UNITSOFMEASURE-ALT_UNIT = 'NOS'.

*        IF LWA_UNITSOFMEASURE-ALT_UNIT = 'ST'.

*          LWA_UNITSOFMEASURE-ALT_UNIT = 'PC'.

*        ENDIF.

*        LWA_UNITSOFMEASURE-DEL_FLAG  = 'X'.

         LWA_UNITSOFMEASURE-ALT_UNIT_ISO = LWA_UNITSOFMEASURE-ALT_UNIT.

*Add by palash

         APPEND LWA_UNITSOFMEASURE TO   LI_UNITSOFMEASURE.

         TRANSLATE WA_ITEM-MEINH TO UPPER CASE.

         CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'

           EXPORTING

             INPUT          = WA_ITEM-MEINH

             LANGUAGE       = SY-LANGU

           IMPORTING

             OUTPUT         = LWA_UNITSOFMEASUREX-ALT_UNIT

           EXCEPTIONS

             UNIT_NOT_FOUND = 1

             OTHERS         = 2.

         IF SY-SUBRC EQ 1.

           MESSAGE 'UNIT NOT FOUND' TYPE 'E'.

         ENDIF.

         LWA_UNITSOFMEASUREX-DENOMINATR = LC_X.

         LWA_UNITSOFMEASUREX-NUMERATOR  = LC_X.

*Add by Palash

*      LWA_UNITSOFMEASUREX-ALT_UNIT = 'NOS'.

*        IF LWA_UNITSOFMEASUREX-ALT_UNIT = 'ST'.

*          LWA_UNITSOFMEASUREX-ALT_UNIT = 'PC'.

*        ENDIF.

         LWA_UNITSOFMEASUREX-ALT_UNIT_ISO = LWA_UNITSOFMEASUREX-ALT_UNIT.

*Add by palash

         APPEND LWA_UNITSOFMEASUREX TO LI_UNITSOFMEASUREX.

       ENDIF.

       CLEAR WA_ITEM.

     ENDLOOP.

****************UNIT OF MEASURE***************



Please help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,476


Please pass 'X' for structure CLIENTDATAX for which input value is given.

20 REPLIES 20
Read only

0 Likes
2,476

After calling BAPI_MATERIAL_SAVEDATA try calling BAPI_TRANSACTION_COMMIT.

Read only

0 Likes
2,476

Yes I have used BAPI_TRANSACTION_COMMIT but only order unit is not saving

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,476

Could you consider using UNIT_OF_MEASURE_SAP_TO_ISO to convert external format of SAP uom to ISO, dod you get some messages in RETURN ?

Regards,

Raymond

Read only

0 Likes
2,476

No,But I have used no after that,but result is same

Read only

0 Likes
2,476

Which values did you pass in CLIENTDATA for PO_UNIT and in PLANTDATA for ISSUE_UNIT (*), else vheck validity of your data, as I don't see any problem in the posted code ?

Regards,

Raymond

(*) What do you call ORDER UNIT ?

Read only

JarosBaw
Active Participant
0 Likes
2,476

What have You got in return from BAPI ?

What have You put in headata parameter ?

Regards,

J.

Read only

0 Likes
2,476

I have put header data correctly.The all header data populated fine.But only order unit is not populating.

The BAPI returns messages is

1HMK102Trying to create: 18000149 1200 1000 1200 __________ 1200 10 ___ ___
2SM3800Material 18000149 created
3HMK103Trying to change: 18000149 1200 1000 1200 __________ 1200 10 ___ ___
4SM3810No changes made
Read only

JarosBaw
Active Participant
0 Likes
2,476

What dou you mean "order unit" ?

Sales unit is in SALESDATA parameter,

Read only

0 Likes
2,476

No unit of measure parameter

Read only

JarosBaw
Active Participant
0 Likes
2,476

Raymond asked You also, what do You call "order unit" in material index data ?

In CLIENTDATA  is PO_UNIT,in PLANTDATA in ISSUE_UNIT and in SALESDATA there is SALES_UNIT and DELY_UNIT.

Read only

0 Likes
2,476

Thanks,,,

Read only

0 Likes
2,476

Actually I did not pass

lwa_clientdata-po_unit = lwa_clientdata-po_unit.

lwa_clientdata-po_unit_iso = lwa_clientdata-po_unit.

   

lwa_clientdatax-po_unit = lc_x.

lwa_clientdatax-po_unit_iso = lc_x.


thats why the record was not saved.After passing the record is saving .


Thanks a lot,,,,


Read only

Former Member
0 Likes
2,476

Hi,

please check, that ALT_UNIT and ALT_UNIT_ISO fields are filled in both tables UNITSOFMEASURE and UNITSOFMEASUREX and have the same content.

Regards,

Klaus

Read only

0 Likes
2,476

Yes I have used it. But the same result come out .

Read only

0 Likes
2,476

I think you only created MARM and conversion factors between units for the material reference, but maybe you did not fill the unit of measure at required organisation levels ?

Regards,

Raymond

Read only

0 Likes
2,476

Kindly give me details

Read only

0 Likes
2,476

Thanks for your suggestion.

Read only

Former Member
0 Likes
2,477


Please pass 'X' for structure CLIENTDATAX for which input value is given.

Read only

0 Likes
2,476

Problem is solved..

Pass the

read table it_item into wa_item with key int_num = wa_mara-int_num.

     if wa_item-meinh is not initial.

       translate wa_item-meinh to upper case.

       call function 'CONVERSION_EXIT_CUNIT_INPUT'

         exporting

           input          = wa_item-meinh

           language       = sy-langu

         importing

           output         = lwa_clientdata-po_unit

         exceptions

           unit_not_found = 1

           others         = 2.

       lwa_clientdata-po_unit = lwa_clientdata-po_unit.

       lwa_clientdata-po_unit_iso = lwa_clientdata-po_unit.

     endif.


lwa_clientdatax-po_unit = lc_x.

lwa_clientdatax-po_unit_iso = lc_x.


Thanks every one

Read only

0 Likes
2,476

Thanks,,,,