Skip to Content
0
Jan 26, 2009 at 10:29 AM

Only last record is getting printed in Table in Smartforms

399 Views

Hello Sir,

I am new in ABAP and doing Stock Transport Order in Smartforms.

I have four records in iekpo (Internal Table).

I have checked the data for all four lines in debug mode and is ok.

The problem I am facing is:

(1) Only last record is getting printed four times.

(2) Serial no which should start from 1 in being printed as 4 in all four lines.

(3) Grand Total tmenge & tvalue is not printed.

Please point the error and if possible paste the modified code.

Thanks and regards.

Yogesh Pathak

Following is the loop from which the variables are being printed in text elements.

=========================================================

*& Defining of Variable for Serial No., Total Quantity, Total Basic Value

xln = 0.

tmenge = 0.

tvalue = 0.

*& Loop for printing table

loop at iekpo into wekpo.

*& Serial No. increment

xln = xln + 1.

xmatnr = wekpo-matnr. " Material Number (Code)

xtxz01 = wekpo-txz01. " Material Name

xmenge = wekpo-menge. " Line Quantiy

xbrtwr = wekpo-brtwr. " Basic Rate

*& Pck

read table imarm into wmarm with key matnr = wekpo-matnr.

xpck = wmarm-umren. " Packing Size

*& Num

xnum = xmenge / xpck. " Numbers of Packing

*& Line Value

xvalue = xmenge * xbrtwr. " Line Basic Value

*& Packing Type

read table imara into wmara with key matnr = wekpo-matnr.

xpacktype = wmara-magrv. " Packing Type Code

*& Packing Type Description

select single bezei from tvegrt into xpackdesc where magrv = xpacktype.

*& Receipt Date

read table ieket into weket with key ebeln = v_ebeln.

xrcpdt = weket-eindt. " Receipt Date

*& Report Total

tmenge = tmenge + xmenge.

tvalue = tvalue + xvalue.

endloop.