cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Number for line items problem

Former Member
0 Kudos

displaying the line items in gr slip i have to trace the serial number.i used perform statement but disaplaying only one item's serial number.How to get serial numbers of all items..

and one item have multiple serial numbers..but my code will display only one serial number.

here is the code..

FORM SER_NUM TABLES IN_TAB STRUCTURE ITCSY

OUT_TAB STRUCTURE ITCSY.

DATA : V_SER_NUM(18) TYPE C.

DATA : LS_MBLNR TYPE MSEG-MBLNR.

DATA : LS_OBKNR TYPE SER03-OBKNR.

DATA : LS_EQUNR TYPE OBJK-EQUNR.

READ TABLE IN_TAB INDEX 1.

MOVE IN_TAB-VALUE TO LS_MBLNR .

SELECT SINGLE OBKNR FROM SER03 INTO LS_OBKNR WHERE MBLNR = IN_TAB-VALUE .

IF SY-SUBRC = 0.

SELECT SINGLE EQUNR FROM OBJK INTO LS_EQUNR WHERE OBKNR = LS_OBKNR.

IF SY-SUBRC = 0.

V_SER_NUM = LS_EQUNR .

READ TABLE OUT_TAB INDEX 1 .

MOVE 'SER_NUM' TO OUT_TAB-NAME.

MOVE V_SER_NUM TO OUT_TAB-VALUE.

MODIFY OUT_TAB INDEX 1.

ENDIF.

ENDIF.

ENDFORM. "SER_NUM

Accepted Solutions (0)

Answers (3)

Answers (3)

asik_shameem
Active Contributor
0 Kudos

Hi

Number of Serial numbers depend on the quantity. If you have single line item with 3 quantities, that line item can have 3 serial numbers.

So, there will be more than one object number(OBKNR) for a document(MBLNR).

Dont use SELECT SINGLE.

Use SELECT INTO TABLE, And in WHERE condition put the line number as well.

SELECT OBKNR FROM SER03 INTO TABLE LT_OBKNR 
WHERE MBLNR = IN_TAB-VALUE AND
       ZEILE = IN_TAB-ITEM.

Former Member
0 Kudos

I have only one item value but for that item 2 serial numbers are there. the second serial number should print on next line of same column..

for this is there any change i need to do in form ?

Former Member
0 Kudos

Hi,

The subroutine is getting triggered for only one item.

Try to call this routine for each line item. I mean when ever the line items are getting printed - call this routine.

Regards,

Venkatesh

Former Member
0 Kudos

use field ZEILE-----Item in Material Document also ...

while fetching field from mseg fetch field ZEILE and get ser.no based on OBKNR and ZEILE