cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Script

Former Member
0 Kudos

Is it possible to use OPEN_FORM without START_FORM?

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi brunda,

start_form using this we can open many layouts.

Start_form is used to initialize the layout.

open_form using this we can open the layout

performance will be high

Open_form -- is used to initialize the spool request.

Check this sample code..

TABLES:
      vbak.

SELECT-OPTIONS:
        s_vbeln FOR vbak-vbeln.

DATA:
     BEGIN OF fs_vbak,
       vbeln LIKE vbak-vbeln,
       erdat LIKE vbak-erdat,
       ernam LIKE vbak-ernam,
     END OF fs_vbak.

DATA:
     t_vbak LIKE STANDARD TABLE OF fs_vbak.

START-OF-SELECTION.

  SELECT vbeln
         erdat
         ernam
    INTO TABLE t_vbak
    FROM vbak
   WHERE vbeln IN s_vbeln.


  CALL FUNCTION 'OPEN_FORM'
    EXPORTING
      application                 = 'TX'
      form                        = 'Y_script'
      language                    = sy-langu
    EXCEPTIONS
      canceled                    = 1
      device                      = 2
      form                        = 3
      OPTIONS                     = 4
      unclosed                    = 5
      mail_options                = 6
      archive_error               = 7
      invalid_fax_number          = 8
      more_params_needed_in_batch = 9
      spool_error                 = 10
      codepage                    = 11.

  LOOP AT t_vbak INTO fs_vbak.

    CALL FUNCTION 'WRITE_FORM'
     EXPORTING
       element                        = 'TE1'
*   FUNCTION                       = 'SET'
*   TYPE                           = 'BODY'
       window                         = 'MAIN'
     EXCEPTIONS
       element                        = 1
       function                       = 2
       type                           = 3
       unopened                       = 4
       unstarted                      = 5
       window                         = 6
       bad_pageformat_for_print       = 7
       spool_error                    = 8
       codepage                       = 9
              .

    
  ENDLOOP.


  CALL FUNCTION 'CLOSE_FORM'.

Regards,

Sravanthi

Former Member
0 Kudos

hi,

it is not mandatory to use start_form. If u have to open more than one layout set in your SAP Script then u go for start_form.

it is possible to use OPEN_FORM without START_FORM but you cannot use START_FORM without OPEN_FORM.

For sample code refer.

http://www.sap-img.com/sapscripts/a-sample-sap-scripts-reports.htm

regards,

sreelakashmi

Edited by: Sreelakshmi p on Oct 16, 2008 10:49 AM

Former Member
0 Kudos

Hi Sree

Thanks.

So can we print the script without START_FORM as it initializes the spool request?

I'm using one MAIN window & single layout set.

Former Member
0 Kudos

Hi,

How many pages to do you have? If one page, then you can call OPEN_FORM once, and START_FORM would not be required. The amount of WRITE_FORMs calls would depend on how many elements you have defined, if your script is not based on elements in your MAIN window, then you would only need to call the WRITE_FORM once.

Regards,

Neenu

Former Member
0 Kudos

Hi

I have one MAIN window in my script.

Former Member
0 Kudos

Hi,

Welcome to SDN,

It is not posiible

see below link

http://help.sap.com/saphelp_nw70/helpdata/en/d6/0dba1a494511d182b70000e829fbfe/content.htm

regards

Jana