cancel
Showing results for 
Search instead for 
Did you mean: 

Passing data from driver program to sapscript form

Former Member
0 Kudos

Hi all,

I have a doubt regarding passing data from driver program to the sapscript form.

Generally, the datas we wanted to display for a particular text element in the form, we will generate it in an internal table in the

driver program. Finally,we need to pass this internal table to the form through some function module. When i searched the

standard driver program(eg: sapfm06p) i am not able to find how the internal table is passed. Can you please suggest, what is the

logic behind this(ie to pass data from driver program into the form.

Regards,

Mani

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Goto sapfm06p , put write_form in the gobal search (main program), you will find the text elements will be passed to sap scripts on basis of window.

this is the way you can transfer data from print program to scipts.

sample code:

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'NEXTPAGE'

WINDOW = 'NEXTPAGE'

EXCEPTIONS

OTHERS = 01.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'REFERENCE'

WINDOW = 'REFERENC'

EXCEPTIONS

OTHERS = 01.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'HEADER_DELADDRESS'

WINDOW = 'CONSGNEE'

EXCEPTIONS

OTHERS = 01.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'HEADER_DATES'

WINDOW = 'DELDATE'

FUNCTION = 'APPEND'

EXCEPTIONS

OTHERS = 01.

Former Member
0 Kudos

Hi,

Thanks for response. But my question is, we need to just give only the text element in the function module write_form, or need to pass the internal table also along with it. then how the data gets passed from internal table to the respective text element in the sap script form.

Regards,

Mani

Former Member
0 Kudos

Hi Mani,

You ask an interesting question, and you probably deserve a better answer than I'm about to give.

The documentation on SAPscript refers to the 'SAPscript composer' which is essentially invoked by SAPscript function modules (OPEN_FORM etc) and manages the overall form. Your question could equally ask how when you call WRITE_FORM you don't need to specify the form name, it is the SAPscript composer that manages this sequence of function modules and the data in the calling program.

However, I can't give you a transaction code where you can look at the SAPscript composer, probably the nearest you'll get to it is the SAPscript debugger.

As the SAP help says "The SAPscript composer is invisible on the outside".

Very enigmatic.

Regards,

Nick

Answers (2)

Answers (2)

Former Member

Hi Mani,

See the Code Below:

Inside SE38 Driver Program:

Loop at Itab into wa.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'NEXTPAGE'

WINDOW = 'NEXTPAGE'

EXCEPTIONS

OTHERS = 01.

Endloop.

Inside SAP Script:

/E NEXTPAGE

&wa-f1&

&wa-f2&

&wa-f3&

CONCEPT BEHIND:

After the Loop statement, when it encounters the Write form it will search for the Text Element 'NEXTPAGE' in the SAP Script form. Now the values in the workarea will be visible in the form and it gets printed when we specify the particulat field in between &&.

please REWARD Points if useful.

Thanks,

Karthik

Former Member
0 Kudos

Hi,

In evry Driver program we have a form ENTRY_NEW, if you look at the Program sapfm06p you will find the form also, whatever you declare the variables before this form those data will be avialble in the Layout automatically, because those variables will be Global and we can use directly in the Layout, no need to pass the variables to the Layout because this Layout will be called after these declarations

Regards

Sudheer