cancel
Showing results for 
Search instead for 
Did you mean: 

Text printing in SapScript

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

ok guys,

please tell me what is object name in script.

What is the meaning of this code

READ TABLE IN_TAB7 INDEX 1.

EBELN1 = IN_TAB7-VALUE.

READ TABLE IN_TAB7 INDEX 2.

EBELP = IN_TAB7-VALUE.

CONCATENATE EBELN1 EBELP INTO OBJNAME.

As per me EBELN1 ( PO No. ) is coming correctly but EBELP Item No. is not coming correctly.

supposse if PO No. is:- 3500000565

and EBEPL is:- 00001

But the second Read Table Statement gives 00565 instead of 00001.

so OBJNAME becomes 350000056500565 instead of 350000056500001.

<b>can any one send me a tutorial or notes on Script</b>.

My id is:- adams.paul20@gmail.com

regards.

Adams

anversha_s
Active Contributor
0 Kudos

hi,

<b>SAP SCRIPTS TUTORIALS</b>

http://www.sapbrain.com/TUTORIALS/TECHNICAL/SAPSCRIPTS_tutorial.html

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCRPROG/BCSRVSCRPROG.pdf

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCRRDI/BCSRVSCRRDI.pdf

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCREDIT/BCSRVSCREDIT.pdf

http://www.sappoint.com/abap/sscrtpex1.pdf

http://www.sap-img.com/sapscripts.htm

http://www.esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf

http://www.sapbrain.com/TUTORIALS/TECHNICAL/SAPSCRIPTS_tutorial.html

http://www.sap-img.com/sapscripts.htm

http://sappoint.com/abap/

http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm

http://www.henrikfrank.dk/abapexamples/SapScript/symbols.htm

http://sapbrain.com/TUTORIALS/TECHNICAL/SAPSCRIPTS_tutorial.html

http://www.esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf

http://www.esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf

http://www.esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf

http://www.esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf

http://www.esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and...

http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf

http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf

http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf.

http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf

http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf

http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-sub...

Rgds

Anver

<b><i>if hlped pls mark points</i></b>