cancel
Showing results for 
Search instead for 
Did you mean: 

How to call a sapscript from a Zprogram

Former Member
0 Kudos

Hi all,

How do I pass the object key information when calling a sapscript form in a Zprogram. For example, where do I indicate the Po number or PR requisition when calling the form.

Thank you.

Monica.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Monica,

You cant directly pass the value of PO, PR or any other value directly to the SAP script. You need to mention those as symbols in the SAP Script editor and use appropriate function modules in your print program (zprogram).

1. Populate all the PO numbers and PR Numbers in an internal table it_tab

2. As usual, use OPEN_FORM, START_FORM to call the SAP script Layout.

3. Later on Loop at the it_Tab and use WRITE FORM.

Loop at it_tab.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'NUM'

WINDOW = 'MAIN' .

ENDLOOP.

4. Call END_FORM, CLOSE_FORM to close the SAP script layout.

4. In your SAP script MAIN window, write something like this..

/E NUM

  • &it_tab-PONUM& &it_Tab-PRNUM&

This should work. If so , pls reward points.

Regards,

Prasad

former_member196280
Active Contributor
0 Kudos

Rough idea, to call SAPScript from your program

CALL FUNCTION 'OPEN_FORM'

EXPORTING

FORM = 'XXX' "GIVe your form name

LANGUAGE = SY-LANGU.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = ELEMENT "IF you have any elements

WINDOW = WINDOW . "your window names, you can call write form many number of times and give all your window names

CALL FUNCTION 'CLOSE_FORM'

.

Regards,

SaiRam

Former Member
0 Kudos

Hi Monica,

You have to pass the value through a 'Text Element' by using the 'write_form' FM in the Zprogram.

For example, code in Zprogram:

number = 12345.

call function 'WRITE_FORM'

exporting

element = 'ZZ'.

Code in SapScrpt:

/E ZZ "ZZ is the text element

AB The PO is &number& "AB is the paragraph

Hope this helps.

Please reward if useful.

Thanks,

Srinivasa