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 Problem

Former Member
0 Likes
488

Dear All,

Can some body help me in this

i have write some code to print the data into sap script

i have write select statement and now data is in internal table and i write

Loop
write_form
endloop

it is saying invalid write_form and open_form is missing

Surendra

3 REPLIES 3
Read only

Former Member
0 Likes
457

open form is must in any script. we have to open the script form with open_form statement.that might be the reason for getting open_form is missing.

Form OPEN_FORM .

CALL FUNCTION 'OPEN_FORM'

EXPORTING

Form = 'YKC_FIRST_SCRIPT'.

Endform. "OPEN-FORM

invalid write_form is because,we can not loop at write_form.istead looping can be done at either internal table or database values retrieval.

just check it out..or else.search in sdn.sap.com...we can know the exact method for the above mentioned query.

Read only

Former Member
0 Likes
457

Example:

CALL FUNCTION 'OPEN_FORM'
     EXPORTING
         APPLICATION        = 'TX'
*         ARCHIVE_INDEX      = ' '
*         ARCHIVE_PARAMS     = ' '
         DEVICE             = 'LOCL'
         DIALOG             = ' '
         FORM               = 'Z_XPTO'
         LANGUAGE           = SY-LANGU
         OPTIONS            = Z*OPTION*XPTO
     IMPORTING
          LANGUAGE           = SY-LANGU
       EXCEPTIONS
         OTHERS     = 1.

CALL FUNCTION 'WRITE_FORM'
     EXPORTING
         ELEMENT       = 'HEADER'
*         FUNCTION      = 'SET'
*         TYPE          = 'BODY'
         WINDOW        = 'HEADER'
     EXCEPTIONS
          ELEMENT       = 1.

CALL FUNCTION 'CLOSE_FORM'
     EXCEPTIONS
          UNOPENED = 1
          OTHERS   = 2.

Read only

Former Member
0 Likes
457

The function module OPEN_FORM opens form printing. You must call this function module before you can use any other form function (WRITE_FORM, START_FORM, CONTROL_FORM...).

You need not specify a form name. If you omit the name, you must use the function module START_FORM to open a form before starting the output.

You must end form printing by using the function module CLOSE_FORM. Otherwise, the system does not print or display anything.

Within a program, you can use several OPEN_FORM..CLOSE_FORM pairs. This allows you to write output to several different spool requests from within one program.