cancel
Showing results for 
Search instead for 
Did you mean: 

Form Printing -SAP Scripts

former_member202957
Contributor
0 Kudos
58

Hi all,

Q.There is a problem in Form printing actullay my requirement is to print the material description , net quantity and unit price. There are 2 records in the internal table <b>LT_output</b> but while printing in form it is printing only one record. In debugging the printprogram in internal bale <b>LT_output</b> shows 2 reocrds but while debuggin the SAP Script only 1 record is shown. Could any one please suggest me how to print 2 records from one internal table in the script. Where should be the error?

Useful answers rewarded.

Regards,

K.Sunil Kumar

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Use write_form for calling MAIN window inside loop statement.

loop at itab.

call function 'WRITE_FORM'

element = 'MAIN'

window = "MAIN'

ENDLOOP.

former_member202957
Contributor
0 Kudos

hi debopriyo,

I have already declared write_form in loop as follows...

LOOP AT lt_output FROM l_i1 TO l_r2.

l_charg2 = lt_output-charg.

v_netv2 = lt_output-ntgew.

v_qlty2 = lt_output-mvgr3.

l_d = l_charg2 - l_charg3.

IF v_netv1 <> v_netv2.

CLEAR:l_d.

ELSEIF v_netv1 = v_netv2

AND v_qlty1 <> v_qlty2

AND l_d = 1.

CLEAR:l_d.

ENDIF.

IF l_d = 1.

CLEAR: l_charg3,v_netv1,v_qlty1.

v_qlty1 = v_qlty2.

v_netv1 = v_netv2.

l_charg3 = l_charg2.

CLEAR: l_charg2,v_netv2,v_qlty2.

ADD 1 TO l_i1.

ADD 1 TO l_i2.

ADD 1 TO l_ttl1.

v_ntgew = v_ntgew + lt_output-ntgew.

v_gross = v_gross + lt_output-brgew.

v_zrate = lt_output-zrate.

v_exbas = v_exbas + lt_output-exbas.

ELSEIF ( l_d > 1 OR l_d < 1 ) AND l_charg1 <> 0.

CLEAR:lt_output1.

READ TABLE lt_output INDEX l_i1.

READ TABLE lt_output1 WITH KEY mvgr1 = lt_output-mvgr1

kondm = lt_output-kondm

mvgr3 = v_qlty1

mvgr5 = lt_output-mvgr5

bezei = lt_output-bezei.

IF sy-subrc = 0.

v_zrate1 = lt_output1-zrate.

  • v_zrate1 = v_zrate.

ENDIF.

  • v_exbas = v_ntgew * v_zrate .

READ TABLE lt_output INDEX l_i1.

IF l_ttl1 = 1.

v_ntgew = lt_output-ntgew.

v_exbas = lt_output-exbas.

ENDIF.

l_ttl = l_ttl1.

v_charg1 = l_charg1.

v_charg3 = l_charg3.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'ITEM_VALUES'

EXCEPTIONS

OTHERS = 1.

IF sy-subrc NE 0.

PERFORM protocol_update.

ENDIF.

CLEAR:l_charg1,l_charg2,

l_charg3,l_d,l_ttl1,

v_netv1,v_netv2,

v_qlty1,v_qlty2.

l_ttl1 = 1.

l_r2 = l_i1.

EXIT.

ENDIF.

ENDLOOP.

regards,

K.Sunil kumar.

former_member196280
Active Contributor
0 Kudos

may be this condition failed so it is not printing the second record...<b>IF l_ttl1 = 1.</b>, check in debugging mode.

Regards,

SaiRam

Former Member
0 Kudos

LOOP AT lt_output FROM l_i1 TO l_r2.

and then ur doing a read index l_i1

Does l_i1 change with every iteration ?