Skip to Content
author's profile photo Former Member
Former Member

how to call sapscript in dialogue program???

hi how to call SapScript in Dialogue program..

for example i hv created a Print button in my screen and if i will click tat button it should cal my SAP script form(i.e,output of driver program).

Is there any function module to call my script????

Thanks in Advance..

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 12:35 PM

    The FM needed to call the SAPscript are :

    OPEN_FORM

    WRITE_FORM

    CLOSE_FORM

    Hope this helps,

    Erwan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 12:36 PM

    Hi!

    Heres a working example for SAPScript.

    REPORT ZTESZT_2.
    
    DATA: gv_index LIKE sy-index.
    
    BREAK-POINT.
    
    CALL FUNCTION 'OPEN_FORM'
      EXPORTING
        DIALOG                            = 'X'
        FORM                              = 'Z_TEST'
        LANGUAGE                          = SY-LANGU
      EXCEPTIONS
        CANCELED                          = 1.
    IF SY-SUBRC <> 0.
      EXIT.
    ENDIF.
    
    CALL FUNCTION 'START_FORM'
      EXPORTING
        FORM                   = 'Z_TEST'
        LANGUAGE               = sy-langu
      EXCEPTIONS
        FORM                   = 1.
    IF SY-SUBRC <> 0.
      EXIT.
    ENDIF.
    
    * print HEADER 
    CALL FUNCTION 'WRITE_FORM'
      EXPORTING
        FUNCTION                  = 'SET'  "set, append, delete
        WINDOW                    = 'HEADER'
      EXCEPTIONS
        ELEMENT                        = 1.
    IF SY-SUBRC <> 0.
    ENDIF.
    
    * print INFO
    CALL FUNCTION 'WRITE_FORM'
      EXPORTING
        ELEMENT                   = 'INFO_ELEM1'
        FUNCTION                  = 'SET'  "set, append, delete
        WINDOW                    = 'INFO'
      EXCEPTIONS
        ELEMENT                        = 1.
    IF SY-SUBRC <> 0.
    ENDIF.
    
    * print INFO
    CALL FUNCTION 'WRITE_FORM'
      EXPORTING
        ELEMENT                   = 'INFO_ELEM2'
        FUNCTION                  = 'APPEND'  "set, append, delete
        WINDOW                    = 'INFO' "info ablak
      EXCEPTIONS
        ELEMENT                        = 1.
    IF SY-SUBRC <> 0.
    ENDIF.
     
    
    * print FOOTER
    CALL FUNCTION 'WRITE_FORM'
      EXPORTING
        WINDOW                    = 'FOOTER'
      EXCEPTIONS
        ELEMENT                        = 1.
    IF SY-SUBRC <> 0.
    ENDIF.
    
    * print ADDRESS 
    CALL FUNCTION 'WRITE_FORM'
      EXPORTING
        ELEMENT                   = 'ADDRESS_ELEM'
        FUNCTION                  = 'SET'  "set, append, delete 
        WINDOW                    = 'ADDRESS'
      EXCEPTIONS
        ELEMENT                        = 1.
    IF SY-SUBRC <> 0.
    ENDIF.
    
    * print ITEMS
    DO 100 TIMES.
      MOVE sy-index TO gv_index.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          ELEMENT                   = 'ELEM' 
          FUNCTION                  = 'SET'  "set, append, delete 
          TYPE                      = 'BODY' "body, top, bottom 
          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
          OTHERS                         = 10.
      IF SY-SUBRC <> 0.
      ENDIF.
    
    ENDDO.
    
    CALL FUNCTION 'END_FORM'.
    IF SY-SUBRC <> 0.
    ENDIF.
    
    CALL FUNCTION 'CLOSE_FORM'.
    IF SY-SUBRC <> 0.
    ENDIF.
    

    Regards

    Tamás

    Message was edited by:

    Tamás Nyisztor

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 12:36 PM

    Hi,

    When you click the button, lets say the Function code is 'SCRIPT', then

    IF SY-UCOMM = 'SCRIPT'.

    here write the Driver program, i mean the open_form, Start_from, Write_from, Close-from and end_form. so when you click the button, the script will be called

    ENDIF.

    Regards

    Sudheer

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hiiii

      When you click the button, say print then in ur program mention this code

      If u r using case , then write.

      case sy-ucomm.

      WHEN ' PRINT'.

      PERFORM SCRIPT.

      In this form then u can mention the the FM's OPEN FORM , WRITE FORM AND CLOSE FORM ,i.e IN THIS subroutine mention ur code to call uur script.

      Regards ,

      Rupa

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.