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

Serial Numbers in Smartforms

Former Member
0 Likes
646

Hi,

I am having a problem in smartforms regarding serial numbers. When I print the outbound delivery the serial numbers which are given are printing correctly. When we make Invoice for these O/B delivery the serial numbers are printing correctly in the invoice form also. My problem when they are making partial delivery the serial numbers assigned to the outbound(O/B) delivery are picking up correctly in the form but when we make the invoice for the above partial delivery the invoice are repeating of the previous O/B delivery serial numbers. This problem in repeation of serial numbers in Invoices are happening only in partial deliveries only. Can any one help me how to correct my code in smartforms OR is there other way the partial deliveries to be given so that they print the same serial numbers in both the forms in O/B delivery as well as Invoices.

Awaiting for a quick reply.

regards,

Ram.

3 REPLIES 3
Read only

Former Member
0 Likes
522

can u tell me to get a serial no how u r writing code.

wether ur using the any system variable or ur writing ur own code.

Read only

0 Likes
522

The below is the code return in Smartforms for getting serial numbers. In text i kept the variables to pick the serial numbers &MSRNO1& &MSRNO2& &MSRNO3&. If the delivery is partial the serial numbers assigned to O/B delivery are coming correctly in invoice for the first time. If they make delivery next time the serial numbers assigned in O/B delivery are not coming in the invoice they are repeating from the 1st delivery. If the delivery is not partial then they is no problem only with partial deliveries only. Kindly help me out to solve.

If any one used serial numbers in Invoice kindly give me code so accordingly i ll change to my requirement. Awaiting for a quick reponse.

regards,

Ram

DATA: MSERNP LIKE MARC-SERNP,

MDLVNO LIKE LIPS-VBELN,

MDLVITM LIKE LIPS-POSNR,

MSONO LIKE VBAP-VBELN,

MSOITM LIKE VBAP-POSNR,

MCNTR TYPE I,

MLEN TYPE I,

MCOMMA(1) TYPE C.

DATA: BEGIN OF I_SER01 OCCURS 0,

SERNR LIKE OBJK-SERNR,

END OF I_SER01.

READ TABLE IS_BIL_INVOICE-IT_REFORD INTO GS_IT_REFORD

WITH KEY BIL_NUMBER = GS_IT_GEN-BIL_NUMBER

ITM_NUMBER = GS_IT_GEN-ITM_NUMBER.

MSONO = GS_IT_REFORD-ORDER_NUMB.

MSOITM = GS_IT_REFORD-ITM_NUMBER_ORD.

MSERNP = MDLVNO = MDLVITM = ''.

MSRNO0 = MSRNO1 = MSRNO2 = MSRNO3 = ''.

SELECT SINGLE MARCSERNP LIPSVBELN LIPS~POSNR

INTO (MSERNP, MDLVNO, MDLVITM)

FROM MARC

JOIN LIPS ON LIPSMATNR = MARCMATNR

AND LIPSWERKS = MARCWERKS

WHERE LIPS~VGBEL = MSONO

AND LIPS~VGPOS = MSOITM.

IF NOT MSERNP IS INITIAL.

SELECT OBJK~SERNR

INTO CORRESPONDING FIELDS OF TABLE I_SER01

FROM SER01

JOIN OBJK ON OBJKOBKNR = SER01OBKNR

WHERE SER01~LIEF_NR = MDLVNO

AND SER01~POSNR = MDLVITM.

SORT I_SER01 BY SERNR.

MCNTR = 1.

MSRNO0 = MSRNO1 = MSRNO2 = MSRNO3 = ''.

LOOP AT I_SER01.

IF I_SER01-SERNR(1) = '0'.

IF I_SER01-SERNR CA 'ABCDEFGHIJKLMNOPRSTUVWXYZabcdefghijklmnopqrstuvwxyz-/#,.'.

ENDIF.

IF SY-FDPOS = 0 OR SY-FDPOS = 18.

PACK I_SER01-SERNR TO I_SER01-SERNR.

ENDIF.

CONDENSE I_SER01-SERNR.

ENDIF.

IF MCNTR = 1.

IF NOT MSRNO1 IS INITIAL AND NOT MSRNO0 IS INITIAL.

MCOMMA = ', '.

ELSE.

MCOMMA = ''.

MSRNO1 = ''.

ENDIF.

CONCATENATE MSRNO1 MCOMMA I_SER01-SERNR INTO MSRNO0.

MLEN = STRLEN( MSRNO0 ).

IF MLEN < 255.

CONCATENATE MSRNO1 MCOMMA I_SER01-SERNR INTO MSRNO1.

ELSE.

MCNTR = 2.

MSRNO0 = ''.

ENDIF.

ENDIF.

IF MCNTR = 2.

IF NOT MSRNO2 IS INITIAL AND NOT MSRNO0 IS INITIAL.

MCOMMA = ', '.

ELSE.

MCOMMA = ''.

ENDIF.

CONCATENATE MSRNO2 MCOMMA I_SER01-SERNR INTO MSRNO0.

MLEN = STRLEN( MSRNO0 ).

IF MLEN < 255.

CONCATENATE MSRNO2 MCOMMA I_SER01-SERNR INTO MSRNO2.

ELSE.

MCNTR = 3.

ENDIF.

ENDIF.

IF MCNTR = 3.

IF NOT MSRNO3 IS INITIAL AND NOT MSRNO0 IS INITIAL.

MCOMMA = ','.

ELSE.

MCOMMA = ''.

ENDIF.

CONCATENATE MSRNO3 MCOMMA I_SER01-SERNR INTO MSRNO0.

MLEN = STRLEN( MSRNO0 ).

IF MLEN <= 255.

CONCATENATE MSRNO3 MCOMMA I_SER01-SERNR INTO MSRNO3.

ELSE.

MCNTR = 4.

MSRNO0 = ''.

ENDIF.

ENDIF.

ENDLOOP.

ENDIF.

Read only

0 Likes
522

any clue please....