Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP SCRIPT

vallamuthu_madheswaran2
Active Contributor
0 Likes
534

hai friends,

how to print multiple line item in SAPSCRIPT main window i am new in script

thanks & good regards

vallamuthu

6 REPLIES 6
Read only

Former Member
0 Likes
507

Create your text element and call it from the print program in a loop.

Plz reward if its helpful

thnx

Read only

0 Likes
507

Loop through your internal table and use 'WRITE_FORM' to print the data. mention the window name and

'Text Element' to be used.

Example:

loop at itab.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = line_item

window = main

EXCEPTIONS

element = 1

function = 2

type = 3

unopened = 4

unstarted = 5

window = 6

bad_pageformat_for_print = 7

OTHERS = 8.

IF sy-subrc <> 0.

PERFORM protocol_update.

ENDIF.

endloop.

Read only

Former Member
0 Likes
507

within loop call write_Form by passing MAIN window to that.

and place all your fields(item level) in the MAIN window of that layout.

LOOP AT IT_ITEMS.

CALL FUNCTION 'WRITE_FORM'

EXPORTING..

WINDOW = 'MAIN' ..and so onn

ENDLOOP.

regards

srikanth

Read only

Former Member
0 Likes
507

hi,

LOOP AT IT_VBAK.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'DETAILS'

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

WINDOW = 'MAIN'

  • 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.

endloop.

regards,

priya.

Read only

Former Member
0 Likes
507

Hello,

1.In ur program Pass all the line items into internal table,example itab.So itab consists of different fields.

2.In ur form in the main window,place a text element and under that line item details.

Example:

/E Line_items

p1 itab-no,itab-matnr----


3.Now in ur print program.

loop at itab.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = line_items

window = main

EXCEPTIONS

element = 1

function = 2

type = 3

unopened = 4

unstarted = 5

window = 6

bad_pageformat_for_print = 7

OTHERS = 8.

endloop.

Hope this helps.

Regards

Read only

0 Likes
507

I HAVE TWO INCLUDE PROGRM ie 1)YRFFORI01

2)YRFFORI09

IN WHICH INCLUDE PROGRAM I WRITE THE FUNCTION "WRITE_FORM"

TO GET A MULTIPLE LINE ITEM IN MAIN WINDOW