cancel
Showing results for 
Search instead for 
Did you mean: 

Elements in Sapscripts

Former Member
0 Kudos

/E header

Does header should be name of the window which is created in page windows?Is this name of window which we pass to element parameter in write_form?Can anyone help me with following program,iam not getting the output


REPORT YDEMO_HELLOWORLD .
*----------------------------------------------------------------------*
TABLES: VBAP.
PARAMETERS: FORM LIKE RSSCF-TDFORM DEFAULT 'YDEMO_HELLOWORLD'.
*ARAMETERS: form LIKE rsscf-tdform DEFAULT 'YDEMO_TALLY'.

START-OF-SELECTION.

************************************************************************
* Open the SapScript Form with the "form"                              *
************************************************************************
  CALL FUNCTION 'OPEN_FORM'
       EXPORTING
*           APPLICATION        = 'TX'        " this is SapScript Appl
*           DEVICE             = 'PRINTER'   " allow output to printer
*           DIALOG             = 'X'         " printer dialog requested
            FORM               = FORM        " name of form (SE71)
*           LANGUAGE           = SY-LANGU
*           OPTIONS            = ' '
       EXCEPTIONS
            CANCELED           = 1
            DEVICE             = 2
            FORM               = 3
            OPTIONS            = 4
            UNCLOSED           = 5
            MAIL_OPTIONS       = 6
            OTHERS             = 7.

************************************************************************
* Execute the element "HELLO" in window MAIN
*  - Nothing happens if /E HELLO is not declared in MAIN
************************************************************************
CALL FUNCTION 'WRITE_FORM'
     EXPORTING
          ELEMENT                  = 'HELLO'  "execute element /E HELLO
*         FUNCTION                 = 'SET'
          TYPE                     = 'BODY'   "normal output
*         WINDOW                   = 'MAIN'   "to window MAIN
*    IMPORTING
*         PENDING_LINES            =
     EXCEPTIONS
          ELEMENT                  = 1
          FUNCTION                 = 2
          TYPE                     = 3
          UNOPENED                 = 4
          UNSTARTED                = 5
          WINDOW                   = 6
          BAD_PAGEFORMAT_FOR_PRINT = 7
          OTHERS                   = 8.


************************************************************************
* Close the current SapScript Form
************************************************************************
CALL FUNCTION 'CLOSE_FORM'
     EXCEPTIONS
          UNOPENED                 = 1
          BAD_PAGEFORMAT_FOR_PRINT = 2
          OTHERS                   = 3.


******sap script program
/E   HELLO                                                                   
*    Hello World - This is Main                                              
/:   BOX INTENSITY 10                                                        
*    Today is &SY-DATUM&                                                     
*    The time is &SY-UZEIT&                                                  
/E   SCHLEIFE                                                                
*    Position = &VBAP-POSNR& 

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Here in this case it is the TEXT ELEMENT , it is not a window, if you write as

/E header

it is the text element that is called from the driver program in the Write_form fun module

We call the function module Write_form

perform write_form using 'WINDOW1' 'HEADER'

means we can pass the window name and the text element name

so under this write_form you write the data in this Text element in the script and that will be printed when this fun module is called

Regards

Anji