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

print multiple records using sapscript

Former Member
0 Likes
1,005

Hai gurus,

I am new to SAPSCRIPT. and My probelm is printing only one record in a window.

My code is :

In window i have written :

/E ELE1

  • EID : &ZEMP-EID&

  • ENAME : &ZEMP-ENAME&

AND IN SE38.

select eid ename from zemp into table itab.

loop at itab.

AND IN the loop i have written START_FORM,WRITE_FORM

i have written ....

BUT IT DISPLAYS ONLY ONE RECORD ,

HOW CAN I DISPLAY MULTIPLE RECORDS.

PLEASE HELP ME.

4 REPLIES 4
Read only

Former Member
Read only

Former Member
0 Likes
656

Hi,

In the print program..

CALL FUNCTION 'OPEN_FORM'

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

LOOP AT ITAB.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

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

ENDLOOP.

also make sure to have the following code in the main window of the sapscript form..

/E ELE1

  • EID : &ZEMP-EID&

  • ENAME : &ZEMP-ENAME&

Thanks

Naren

Read only

Former Member
0 Likes
656

Hi,

You need to make following change to your layout code -

/E ELE1

  • EID : &ITAB-EID&

  • ENAME : &ITAB-ENAME&

As you are getting data from Z table to internal table ITAB and you will be calling WRITE_FORM in LOOP ENDLOOP of ITAB, you need to make above change.

Hope this helps.

ashish

Read only

varma_narayana
Active Contributor
0 Likes
656

Hi..

1.Place this Element in MAIN window ...Hope u have done it.

/E ELE1

  • EID : &ZEMP-EID&

  • ENAME : &ZEMP-ENAME&

2. In the Print program .

There is no need to Call Start_Form and End_form inside the Loop.

You have to call the WRITE_FORM inside the Loop.

EG:

LOOP AT ITAB.

<b>

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ELE1'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

.</b>

ENDLOOP.

Then it will print all the lines stored in ITAB.

REWARD IF HELPFUL.