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_GOODSMVT_CREATE material with serial number

Former Member
0 Likes
7,841

hello i'm facing some problems with the bapi BAPI_GOODSMVT_CREATE

with a material with serial number.

in the order i have a material with 10 serial numbers.

i'm calling the BAPI_GOODSMVT_CREATE

like this:

loop at it_zqu14_tabconflmi into wa_zqu14_tabconflmi.

*          it_zqu14_tabconflmi3[] = it_zqu14_tabconflmi2[].

         refresh: i_gm_serialnumber, i_goodsmvt_item.

*header

         clear l_goodsmvt_header.

         l_goodsmvt_header-pstng_date = sy-datum.

         l_goodsmvt_header-doc_date   = sy-datum.

         l_goodsmvt_header-pr_uname   = sy-uname.

*      l_goodsmvt_header-gr_gi_slip_no = wa_zqu14_tabconflmi-bollacons.

*mvt_code

         l_goodsmvt_code = '04'.

*pos

         clear i_goodsmvt_item.

*material

         i_goodsmvt_item-material  = wa_zqu14_tabconflmi-codeart.

*plant

         i_goodsmvt_item-plant     = '1000'.

         loop at it_zqu14_tabconflmi2 into wa_zqu14_tabconflmi2

           where codeart = wa_zqu14_tabconflmi-codeart

           and  testolib1 = wa_zqu14_tabconflmi-testolib1.

           i_goodsmvt_item-batch     = wa_zqu14_tabconflmi2-testolib1.

*storage location

           select single lgort from mseg into v_lgort

           where mblnr = wa_zqu14_tabconflmi2-testolib6

           and mjahr   = wa_zqu14_tabconflmi2-mjahr

           and zeile   = wa_zqu14_tabconflmi2-zeile.

           i_goodsmvt_item-stge_loc  = v_lgort.

           i_goodsmvt_item-vendor    = wa_zqu14_tabconflmi2-codforn.

           i_goodsmvt_item-move_type = '321'.

           i_goodsmvt_item-po_number = wa_zqu14_tabconflmi2-testolib3.

           i_goodsmvt_item-po_item   = wa_zqu14_tabconflmi2-testolib4.

           i_goodsmvt_item-entry_qnt = wa_zqu14_tabconflmi2-qtacons.

*      i_goodsmvt_item-entry_uom = 'ST'.

           if wa_zqu14_tabconflmi2-testolib5 <> ' '.

             i_goodsmvt_item-spec_stock = 'E'.

             i_goodsmvt_item-sales_ord       = wa_zqu14_tabconflmi2-testolib5.

             i_goodsmvt_item-s_ord_item      = wa_zqu14_tabconflmi2-kdpos.

             i_goodsmvt_item-val_sales_ord   = wa_zqu14_tabconflmi2-testolib5.

             i_goodsmvt_item-val_s_ord_item  = wa_zqu14_tabconflmi2-kdpos.

           endif.

           i_gm_serialnumber-serialno = wa_zqu14_tabconflmi2-testolib2.

           i_gm_serialnumber-matdoc_itm = wa_zqu14_tabconflmi2-zeile. "zeile"

           append i_gm_serialnumber.

           append i_goodsmvt_item.

         endloop.

i'm feeling i_gm_serialnumber with all the serial number and considering each serial number like an item

but when i call the bapi

call function 'BAPI_GOODSMVT_CREATE'

           exporting

             goodsmvt_header       = l_goodsmvt_header

             goodsmvt_code         = l_goodsmvt_code

           importing

             goodsmvt_headret      = l_goodsmvt_headret

             materialdocument      = l_materialdocument

             matdocumentyear       = l_matdocumentyear

           tables

             goodsmvt_item         = i_goodsmvt_item

             goodsmvt_serialnumber = i_gm_serialnumber

             return                = i_return.

i have an error message:

ID: IO No.: 212 (select only one serial number instead of 10)

then for all the others items  the message ID: M7 No.: 175

what do i miss?

i tried to call the bapi n times for each serial number but after that the first item i had been moved, for the next items i always have  the message 😧 M7 No.: 022 and i guess it's normal because the batch has been already moved with the fitrst call.

I also found a sap note 1278707 bapi good movements and implemented it , but i still have the issue.

Any clue?

Thanx .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,721

Hi Ebongue,

In BAPI_GOODSMVT_CREATE, the serial number has to be given only once. The system calculates the further serial numbers and puts against the material automatically. The serial number which you give, has to the last serial number of that number range that is used. It should not be the next number of that serial number range. This would be calculated and taken by system automatically during their BDC session (from BAPI)

Regards,

Hardik Mehta

hello i'm facing some problems with the bapi BAPI_GOODSMVT_CREATE

with a material with serial number.

in the order i have a material with 10 serial numbers.

i'm calling the BAPI_GOODSMVT_CREATE

like this:

loop at it_zqu14_tabconflmi into wa_zqu14_tabconflmi.

*          it_zqu14_tabconflmi3[] = it_zqu14_tabconflmi2[].

         refresh: i_gm_serialnumber, i_goodsmvt_item.

*header

         clear l_goodsmvt_header.

         l_goodsmvt_header-pstng_date = sy-datum.

         l_goodsmvt_header-doc_date   = sy-datum.

         l_goodsmvt_header-pr_uname   = sy-uname.

*      l_goodsmvt_header-gr_gi_slip_no = wa_zqu14_tabconflmi-bollacons.

*mvt_code

         l_goodsmvt_code = '04'.

*pos

         clear i_goodsmvt_item.

*material

         i_goodsmvt_item-material  = wa_zqu14_tabconflmi-codeart.

*plant

         i_goodsmvt_item-plant     = '1000'.

         loop at it_zqu14_tabconflmi2 into wa_zqu14_tabconflmi2

           where codeart = wa_zqu14_tabconflmi-codeart

           and  testolib1 = wa_zqu14_tabconflmi-testolib1.

           i_goodsmvt_item-batch     = wa_zqu14_tabconflmi2-testolib1.

*storage location

           select single lgort from mseg into v_lgort

           where mblnr = wa_zqu14_tabconflmi2-testolib6

           and mjahr   = wa_zqu14_tabconflmi2-mjahr

           and zeile   = wa_zqu14_tabconflmi2-zeile.

           i_goodsmvt_item-stge_loc  = v_lgort.

           i_goodsmvt_item-vendor    = wa_zqu14_tabconflmi2-codforn.

           i_goodsmvt_item-move_type = '321'.

           i_goodsmvt_item-po_number = wa_zqu14_tabconflmi2-testolib3.

           i_goodsmvt_item-po_item   = wa_zqu14_tabconflmi2-testolib4.

           i_goodsmvt_item-entry_qnt = wa_zqu14_tabconflmi2-qtacons.

*      i_goodsmvt_item-entry_uom = 'ST'.

           if wa_zqu14_tabconflmi2-testolib5 <> ' '.

             i_goodsmvt_item-spec_stock = 'E'.

             i_goodsmvt_item-sales_ord       = wa_zqu14_tabconflmi2-testolib5.

             i_goodsmvt_item-s_ord_item      = wa_zqu14_tabconflmi2-kdpos.

             i_goodsmvt_item-val_sales_ord   = wa_zqu14_tabconflmi2-testolib5.

             i_goodsmvt_item-val_s_ord_item  = wa_zqu14_tabconflmi2-kdpos.

           endif.

           i_gm_serialnumber-serialno = wa_zqu14_tabconflmi2-testolib2.

           i_gm_serialnumber-matdoc_itm = wa_zqu14_tabconflmi2-zeile. "zeile"

           append i_gm_serialnumber.

           append i_goodsmvt_item.

         endloop.

i'm feeling i_gm_serialnumber with all the serial number and considering each serial number like an item

but when i call the bapi

call function 'BAPI_GOODSMVT_CREATE'

           exporting

             goodsmvt_header       = l_goodsmvt_header

             goodsmvt_code         = l_goodsmvt_code

           importing

             goodsmvt_headret      = l_goodsmvt_headret

             materialdocument      = l_materialdocument

             matdocumentyear       = l_matdocumentyear

           tables

             goodsmvt_item         = i_goodsmvt_item

             goodsmvt_serialnumber = i_gm_serialnumber

             return                = i_return.

i have an error message:

ID: IO No.: 212 (select only one serial number instead of 10)

then for all the others items  the message ID: M7 No.: 175

what do i miss?

i tried to call the bapi n times for each serial number but after that the first item i had been moved, for the next items i always have  the message 😧 M7 No.: 022 and i guess it's normal because the batch has been already moved with the fitrst call.

I also found a sap note 1278707 bapi good movements and implemented it , but i still have the issue.

Any clue?

Thanx .

11 REPLIES 11
Read only

Former Member
0 Likes
4,721

Is it possible to post the content of 'i_gm_serialnumber' ? Make sure that the different serial no. is appended with the same item no.

If your loop is doing something like this I don't see a problem:

           i_gm_serialnumber-serialno = '11111111'

           i_gm_serialnumber-matdoc_itm = '0001'

           append i_gm_serialnumber.

           i_gm_serialnumber-serialno = '222222222'

           i_gm_serialnumber-matdoc_itm = '0001'

           append i_gm_serialnumber.

           i_gm_serialnumber-serialno = '333333333'

           i_gm_serialnumber-matdoc_itm = '0001'

           append i_gm_serialnumber.

           And so on...




Read only

0 Likes
4,721

yup i've checked it in debug i have the serial number appended correctly.

this is the I_GM_SERIALNUMBER

matdoc_item /serialno

00011000
00011001
00011002

and this is the I_GOODSMVT_ITEM

material             plant   stlo   batch

1601S0040B0001000M0010000034742321
1601S0040B0001000M0010000034742321
1601S0040B0001000M0010000034742321
Read only

0 Likes
4,721

Did you check the documentation available for the equipment list?

If the XSAUT indicator is set in the table parameter GoodsmvtItem, the system automatically determines the serial numbers for an item.

When creating a goods movement with serial numbers, various scenarios are possible:

The XSAUT indicator is set:

  • if all the serial numbers for an item are to be determined automatically
  • if serial numbers have been preset for a partial quantity of an item, but the remaining serial numbers are determined automatically.

The XSAUT indicator is not set:

  • if the serial numbers are preset for the complete quantity of an item.
  • if serial numbers are preset for only a partial quantity of an item. However, if you have not specified that the remaining serial numbers are to be determined automatically, an error occurs.
  • an error occurs if the number of serial numbers exceeds the quantity for the item.

Regards,

Felipe

Read only

0 Likes
4,721

the fact is that these are the serial numbers determinated by the system when we do the migo. If the material need a quality control it's been send to the quality check. If the control is ok, we need to do an 321 and the issue is there. The serial has been determinated by the system ( infact the 101 mvt does not create problem) only the 321. If we do manually the 321 there is no issue, there is only when we try to use a job using the bapi.

Read only

4,721

Hi Ebongue,


As per my knowledge matdoc_itm is not the PO item number, but the line number within the GOODSMVT_ITEM table. For example, you create one line in the GOODSMVT_ITEM table, referring to po item 0002, the matdoc_itm field should be 1, not 2.




Sorry if i am Wrong,


Thank you

Read only

Former Member
0 Likes
4,722

Hi Ebongue,

In BAPI_GOODSMVT_CREATE, the serial number has to be given only once. The system calculates the further serial numbers and puts against the material automatically. The serial number which you give, has to the last serial number of that number range that is used. It should not be the next number of that serial number range. This would be calculated and taken by system automatically during their BDC session (from BAPI)

Regards,

Hardik Mehta

Read only

0 Likes
4,721

the fact is that these are the serial numbers determinated by the system when we do the migo. If the material need a quality control it's been send to the quality check. If the control is ok, we need to do an 321 and the issue is there. The serial has been determinated by the system ( infact the 101 mvt does not create problem) only the 321. If we do manually the 321 there is no issue, there is only when we try to use a job using the bapi.

Read only

0 Likes
4,721

So, fill the "i_goodsmvt_item-xsaut = 'X'" and don't pass the table parameter "i_gm_serialnumber" the system should fill automatically. It will be a problem?


Read only

0 Likes
4,721

Won't this create a discrepancy? i mean won't we still see in mmbe the serial number in quality?

Read only

0 Likes
4,721

Sincerly I dont know, maybe the ones that is in quality is not considered by the auto determination. If it's not PRD environment, try it.

Read only

0 Likes
4,721

ok i'll make a test and i'm also writing an OSS note.