Skip to Content
0
Jul 23, 2009 at 05:50 PM

REg: In the script the entries are over writing..

36 Views

Hi ALL,

I have developed a script. And the final data is having in the final tab. Assume ITAB is the final tab. In the final tab iam having 20 entries.i am writning these 20 records in layout. By loop u2026..endloop. but in the layout the last entry only printing remaining 19 entries are missing..please help me in this issue.

Here iam sending example code.

DATA: BEGIN OF ITAB OCCURS 0,

VBELN LIKE VBAK-VBELN,

POSNR LIKE VBAP-POSNR,

MATNR LIKE VBAP-MATNR,

KWMENG LIKE VBAP-KWMENG,

END OF ITAB.

DATA: V_QTY(19).

PARAMETERS: P_VBELN LIKE VBAP-VBELN OBLIGATORY.

SELECT VBELN

POSNR

MATNR

KWMENG

FROM VBAP

INTO TABLE ITAB

WHERE VBELN = P_VBELN.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

  • APPLICATION = 'TX'

  • ARCHIVE_INDEX =

  • ARCHIVE_PARAMS =

  • DEVICE = 'PRINTER'

  • DIALOG = 'X'

FORM = 'Z_form_S'

LANGUAGE = SY-LANGU

  • OPTIONS =

  • MAIL_SENDER =

  • MAIL_RECIPIENT =

  • MAIL_APPL_OBJECT =

  • RAW_DATA_INTERFACE = '*'

  • SPONUMIV =

  • IMPORTING

  • LANGUAGE =

  • NEW_ARCHIVE_PARAMS =

  • RESULT =

EXCEPTIONS

CANCELED = 1

DEVICE = 2

FORM = 3

OPTIONS = 4

UNCLOSED = 5

MAIL_OPTIONS = 6

ARCHIVE_ERROR = 7

INVALID_FAX_NUMBER = 8

MORE_PARAMS_NEEDED_IN_BATCH = 9

SPOOL_ERROR = 10

CODEPAGE = 11

OTHERS = 12

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LOOP AT ITAB.

V_QTY = ITAB-KWMENG.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ELM1'

  • FUNCTION = 'APPEND'

  • TYPE = 'BODY'

WINDOW = 'MAIN2'

FUNCTION = 'APPEND'

  • IMPORTING

  • PENDING_LINES =

EXCEPTIONS

ELEMENT = 1

FUNCTION = 2

TYPE = 3

UNOPENED = 4

UNSTARTED = 5

WINDOW = 6

BAD_PAGEFORMAT_FOR_PRINT = 7

SPOOL_ERROR = 8

CODEPAGE = 9

OTHERS = 10

.

  • IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

clear sy-subrc.

ENDLOOP.

CALL FUNCTION 'CLOSE_FORM'

  • IMPORTING

  • RESULT =

  • RDI_RESULT =

  • TABLES

  • OTFDATA =

EXCEPTIONS

UNOPENED = 1

BAD_PAGEFORMAT_FOR_PRINT = 2

SEND_ERROR = 3

SPOOL_ERROR = 4

CODEPAGE = 5

OTHERS = 6 .

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

And in the layout iam having the window with name MAIN2. and in the layout editor I wrote the code;

This is the main2 window.

/E ELM1

  • <C2> ITEM MATERIAL TARGETQTY </>*

· *

but in my layout the last entry only prining. The first 19 entries are overwring..can you please check it and help me on this..

thanks,