‎2014 Jun 02 1:48 PM
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.
‎2014 Jun 04 12:56 PM
Please pass 'X' for structure CLIENTDATAX for which input value is given.
‎2014 Jun 02 1:51 PM
After calling BAPI_MATERIAL_SAVEDATA try calling BAPI_TRANSACTION_COMMIT.
‎2014 Jun 02 1:58 PM
Yes I have used BAPI_TRANSACTION_COMMIT but only order unit is not saving
‎2014 Jun 02 3:49 PM
‎2014 Jun 02 9:29 PM
‎2014 Jun 03 1:20 PM
‎2014 Jun 03 10:06 AM
What have You got in return from BAPI ?
What have You put in headata parameter ?
Regards,
J.
‎2014 Jun 03 12:39 PM
I have put header data correctly.The all header data populated fine.But only order unit is not populating.
The BAPI returns messages is
| 1 | H | MK | 102 | Trying to create: 18000149 1200 1000 1200 __________ 1200 10 ___ ___ |
| 2 | S | M3 | 800 | Material 18000149 created |
| 3 | H | MK | 103 | Trying to change: 18000149 1200 1000 1200 __________ 1200 10 ___ ___ |
| 4 | S | M3 | 810 | No changes made |
‎2014 Jun 03 12:55 PM
What dou you mean "order unit" ?
Sales unit is in SALESDATA parameter,
‎2014 Jun 03 2:07 PM
‎2014 Jun 03 2:36 PM
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.
‎2014 Jun 04 6:20 PM
‎2014 Jun 04 6:27 PM
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,,,,
‎2014 Jun 03 1:26 PM
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
‎2014 Jun 03 1:56 PM
‎2014 Jun 03 3:21 PM
‎2014 Jun 03 6:19 PM
‎2014 Jun 04 6:22 PM
‎2014 Jun 04 12:56 PM
Please pass 'X' for structure CLIENTDATAX for which input value is given.
‎2014 Jun 04 5:30 PM
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
‎2014 Jun 04 6:22 PM