Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Text printing in SapScript

Hi Abapers,

I am chaniging an existing SapScript that was not working properly. Client wants to print "Item Text" in output which is of 3 to 4 page. where as there is only one line item in PO. Also there is "Header Text" of 1 page. Client wants to display all line items then "Item Text" should displayed. and at last the "eader Text". The Format is Like as Follows:-

PO No. 12.12.2006

Vendor Name

Country

S.No. Mat. Desc. Qty. ...............and so on..........

1 abc 11 .....................

Item Text starts from here........................

..........................................

..............................

...............................

  • Problem is here

This text is of 3 page (say).

So text starts from here and est of text goes to next page.

Only 4 Lines are printed properly and rest of lines are not printed.

I also checked in debuging mode.

so attachibng the code for reference kindly go through this.

*........................

.............................................

...........................................................

Header Text Starts from here

..........................................

..............................

...............................

........................

.............................................

...........................................................

Total amt. in words......

FORM READ_TEXTSLO1 TABLES IN_TAB200 STRUCTURE ITCSY

OUT_TAB200 STRUCTURE ITCSY.

READ TABLE IN_TAB200 INDEX 1.

EBELN1 = IN_TAB200-VALUE.

READ TABLE IN_TAB200 INDEX 2.

EBELP = IN_TAB200-VALUE.

CONCATENATE EBELN1 EBELP INTO OBJNAME.

CLEAR WRK_IT1.

CLEAR WRK_IT2.

CLEAR WRK_IT3.

CLEAR WRK_IT4.

CLEAR WRK_IT5.

.............

................

.......................

                                                                                                  • Repeated Code

SELECT SINGLE TDNAME INTO WRK_TDNAME FROM STXH

WHERE TDOBJECT = 'EKPO'

AND TDNAME = OBJNAME

AND TDID EQ 'F01'.

IF SY-SUBRC = 0.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'F01'

LANGUAGE = 'E'

NAME = OBJNAME

OBJECT = 'EKPO'

TABLES

LINES = IT_LINE.

IF SY-SUBRC = 0.

delete it_line where tdline EQ ' '.

BREAK ABAP7.

DESCRIBE TABLE it_line LINES wrk_lines1.

LOOP AT IT_LINE.

CLEAR WRK_TABIX.

WRK_TABIX = SY-TABIX.

IF WRK_TDLINE EQ ' '.

WRK_TDLINE = IT_LINE-TDLINE.

ELSE.

CONCATENATE WRK_TDLINE IT_LINE-TDLINE INTO WRK_TDLINE

SEPARATED BY SPACE.

ENDIF.

Y = STRLEN( WRK_TDLINE ).

CALL FUNCTION 'RKD_WORD_WRAP'

EXPORTING

TEXTLINE = WRK_TDLINE

DELIMITER = ' '

OUTPUTLEN = 100

IMPORTING

OUT_LINE1 = OUT_LINE1

OUT_LINE2 = OUT_LINE2

OUT_LINE3 = OUT_LINE3

  • OUT_LINE3 =

  • TABLES

  • OUT_LINES =

  • EXCEPTIONS

  • OUTPUTLEN_TOO_LARGE = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

*break abap7.

CASE WRK_TABIX.

WHEN 1 .

WRK_IT1 = OUT_LINE1.

WHEN 2 .

WRK_IT2 = OUT_LINE1.

WHEN 3 .

WRK_IT3 = OUT_LINE1.

WHEN 4 .

WRK_IT4 = OUT_LINE1.

ENDCASE.

IF OUT_LINE3 EQ ' '.

WRK_TDLINE = OUT_LINE2.

ELSE.

CONCATENATE OUT_LINE2 OUT_LINE3 INTO WRK_TDLINE

SEPARATED BY SPACE.

ENDIF.

ENDLOOP.

IF WRK_IT4 NE ' '.

Y = STRLEN( WRK_TDLINE ).

IF Y GT 50.

CALL FUNCTION 'RKD_WORD_WRAP'

EXPORTING

TEXTLINE = WRK_TDLINE

DELIMITER = ' '

OUTPUTLEN = 50

IMPORTING

OUT_LINE1 = OUT_LINE1

OUT_LINE2 = OUT_LINE2

OUT_LINE3 = OUT_LINE3

  • OUT_LINE3 =

  • TABLES

  • OUT_LINES =

  • EXCEPTIONS

  • OUTPUTLEN_TOO_LARGE = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

wrk_it4 = out_line1. " Change Uncommented"

WRK_ITA = OUT_LINE1.

WRK_ITA4 = OUT_LINE2.

ELSE.

WRK_ITA = WRK_TDLINE.

ENDIF.

ENDIF.

ENDIF.

CLEAR WRK_TDLINE.

CLEAR OUT_LINE1.

CLEAR OUT_LINE2.

CLEAR OUT_LINE3.

OUT_TAB200-VALUE = WRK_IT1.

MODIFY OUT_TAB200 INDEX 1 TRANSPORTING VALUE.

OUT_TAB200-VALUE = WRK_IT2.

MODIFY OUT_TAB200 INDEX 2 TRANSPORTING VALUE.

OUT_TAB200-VALUE = WRK_IT3.

MODIFY OUT_TAB200 INDEX 3 TRANSPORTING VALUE.

OUT_TAB200-VALUE = WRK_IT4.

MODIFY OUT_TAB200 INDEX 4 TRANSPORTING VALUE.

ENDIF.

*****************************************************************Repeated code

Again the same code is repeated but now the TDID eq F02 in Select Query and also in READ_TEXT Fun. Module. and now in the CASE statement next 4 lines coded as

WHEN 1 .

WRK_IT5 = OUT_LINE1.

WHEN 2 .

WRK_IT6 = OUT_LINE1.

WHEN 3 .

WRK_IT7 = OUT_LINE1.

WHEN 4 .

WRK_IT8 = OUT_LINE1.

..................................

.................

and also these 4 rows modified as follows

OUT_TAB200-VALUE = WRK_IT5.

MODIFY OUT_TAB200 INDEX 5 TRANSPORTING VALUE.

.................

............

Now each time 4 - 4 rows coded as like as above.

upto TDID = F05

So there are total of 20 lines.

Now the text is of 4 to 5 page then its not printed. even 5th line is not printed. control not goes to 2nd Select Query cause the OBJECTNAME does not exist.

<b>for more information write your Email ID . So that i can explain more.</b>

So kindly review this and let me know what should i do ?

Helpful answer rewarded.

---

Regards

Robin

Former Member
Not what you were looking for? View more on this topic or Ask a question