08-22-2016 12:56 PM
I am using BAPI BAPI_GOODSMVT_CREATE for posting of goods issue using movement type 261. I am getting following error = Order 801135 does not exist.
t_gmcode-gm_code = '03'.
t_gmhead-pstng_date = sy-datum.
t_gmhead-doc_date = sy-datum.
APPEND t_gmhead.
LOOP AT t_final INTO w_final.
t_item-item_text = w_final-header_txt.
t_item-move_type = w_final-move_type.
* t_item-mvt_ind = 'F'. " F : Goods movement for production order
t_item-plant = w_final-plant.
t_item-stge_loc = w_final-stge_loc.
CONCATENATE '00000000' w_final-material INTO g_mat.
CONDENSE g_mat.
t_item-material = g_mat.
***Function block for material number conversion
* CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
* EXPORTING
* input = t_item-material " 000000002804010005
* IMPORTING
* output = t_item-material " 2804010005
* .
g_erfmg = w_final-entry_qnt.
SHIFT g_erfmg LEFT DELETING LEADING '0'.
t_item-entry_qnt = g_erfmg.
* t_item-entry_qnt = w_final-entry_qnt.
* t_item-entry_uom = w_final-entry_uom.
***Conversion exit for commercial (3-char) measurement unit OUTPUT
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT'
EXPORTING
input = w_final-entry_uom
* LANGUAGE = SY-LANGU
IMPORTING
output = t_item-entry_uom
.
* t_item-entry_uom = g_erfmg.
t_item-batch = w_final-batch .
t_item-orderid = w_final-orderid.
APPEND t_item.
CLEAR : g_mat , w_final , g_erfmg , t_item.
ENDLOOP.
SORT t_item BY material.
LOOP AT t_item.
WRITE:/ t_item-item_text,
t_item-material,
t_item-plant,
t_item-stge_loc,
t_item-move_type,
t_item-entry_qnt,
t_item-entry_uom,
t_item-batch,
t_item-orderid.
ENDLOOP.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = t_gmhead
goodsmvt_code = t_gmcode
* TESTRUN = ' '
IMPORTING
goodsmvt_headret = t_mthead
* materialdocument = g_mat_doc
* matdocumentyear = g_doc_yr
TABLES
goodsmvt_item = t_item[]
* goodsmvt_serialnumber = t_gmsn
return = t_errmsg[]
.
08-22-2016 1:01 PM
Does it exist like you have entered it or does it as well need leading zeros?
08-22-2016 1:01 PM
Does it exist like you have entered it or does it as well need leading zeros?
08-22-2016 1:07 PM
08-22-2016 1:16 PM
i am uploading below file having 5 line items for same order 801135. from here i am getting the material number.
Hdr Text | mvt type | Plant | Sto Loc | Material | Qty | UnE | Batch | Order No |
Prod Issue DEV | 261 | 5110 | PH01 | 2804010005 | 0.2 | MT | DOM-C | 801135 |
Prod Issue DEV | 261 | 5110 | PH01 | 2804010005 | 0.4 | MT | DOM-C | 801135 |
Prod Issue DEV | 261 | 5110 | PH01 | 2804010005 | 0.55 | MT | DOM-C | 801135 |
Prod Issue DEV | 261 | 5110 | PH01 | 2804010006 | 0.66 | MT | DOM-C | 801135 |
Prod Issue DEV | 261 | 5110 | PH01 | 2804010006 | 0.67 | MT | DOM-C | 801135 |
08-22-2016 1:28 PM
My order numbers have leading zeros.
Just use SE16N for table AUFK and check yours.
Don't forget to press CTRL+F12 and put a check mark in the box for "Display without conversion exit"
08-22-2016 1:53 PM
Hi Juergan L,
Thank you so much for your support.
Now its working fine.