Application Development 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: 

'Maintain serial numbers for total quantity error in bapi_goodsmvt_create

Former Member
0 Kudos

HI Experts,

I am doing a goods movement programatically by using BAPI_GOODSMVT_CREATE.

Though I am passing the serial no. for the document item still I am getting an error: 'Maintain serial numbers for total quantity'.

My code goes like this:

*-- Read all the items for the item category belonging to the plant

loop at lt_lips into lw_lips where pstyv is not initial.

*-- Process the goods movement - Fill the data

lw_gmvt-material = lw_lips-matnr.

lw_gmvt-plant = lw_cat-werks.

lw_gmvt-stge_loc = lw_cat-lgort.

lw_gmvt-batch = lw_lips-charg.

lw_gmvt-move_type = lw_cat-bwlvs.

lw_gmvt-customer = <st_xvbpa>-kunnr.

lw_gmvt-s_ord_item = lw_lips-posnr.

lw_gmvt-entry_qnt = lw_lips-lfimg.

lw_gmvt-entry_uom = lw_lips-meins.

lw_gmvt-entry_uom_iso = lw_lips-meins.

  • lw_gmvt-ref_doc = xlikp-vbeln.

lw_gmvt-quantity = lw_lips-lfimg.

lw_gmvt-base_uom = lw_lips-meins.

append lw_gmvt to lt_gmvt.

clear: lw_gmvt.

  • BOC for serial numbers

if lt_ser02 is not initial and lt_objk is not initial.

clear: lw_ser02,

lw_objk.

read table lt_ser02 into lw_ser02 with key sdaufnr = cvbak-vbeln

posnr = lw_lips-posnr

sd_postyp = lw_lips-pstyv binary search.

if sy-subrc = 0.

read table lt_objk into lw_objk with key obknr = lw_ser02-obknr binary search.

if sy-subrc = 0.

*-- Check if serial number is populated

if lw_objk-sernr is not initial.

*-- Fill the serial number table for BAPI movement

clear: lw_sno.

lw_sno-matdoc_itm = lw_lips-posnr.

lw_sno-serialno = lw_objk-sernr.

append lw_sno to lt_sno.

endif. "Serial number not initial

endif. "OBJK read

endif. "SER02 read

endif. "SER02 and OBJK is not initial

  • EOC for serial numbers

endif. "Category table read

clear: lw_cat, lw_lips.

endloop.

*-- Execute the BAPI only if item table is filled on the above condition

if lt_gmvt is not initial.

*-- Fill the header details

lw_header-pstng_date = xlikp-erdat.

lw_code-gm_code = lc_03.

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

GOODSMVT_HEADER = lw_header

GOODSMVT_CODE = lw_code

IMPORTING

MATERIALDOCUMENT = lv_mblnr

MATDOCUMENTYEAR = lv_mjahr

TABLES

GOODSMVT_ITEM = lt_gmvt

GOODSMVT_SERIALNUMBER = lt_sno

RETURN = lt_return.

Please suggest.

Regards,

Sangeeta.

3 REPLIES 3

Former Member
0 Kudos

Solved on my own.

Serial numbers should be passed as counter values alogwith material no. like,

001 0010

002 0020

003 0030

004 0040 and so on

0 Kudos

Hi Banerjee,

Actually we are trying to use the same bapi from se37, we are passing all the details which is required to process the bapi_goodmvt_create. But still the bapi returning the same error what sangeeta got in the above. Can you please guide me how to achieve this.

how the values has to pass to the Serial Number?

What exactly meant by Counter Values ?

Regards,

Siva

Former Member
0 Kudos

Hi Sangeetha,

How you got resolved this issue. This is very very urgent because we are doing some integration process so it is really required to know how you done it.

Please explain it clearly..

Regards,

Siva