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

SAP SCRIPT

can anyone give me any simple example of how the dialog program call the SAP-SCRIPT???

how it is executed???

give me example please...

thanks

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 14, 2008 at 09:06 AM

    Refer following code

    DATA : G_VAR TYPE char250.

    g_var =

    'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnop'.

    CALL FUNCTION 'OPEN_FORM'

    EXPORTING

    • APPLICATION = 'TX'

    • ARCHIVE_INDEX =

    • ARCHIVE_PARAMS =

    • DEVICE = 'PRINTER'

    DIALOG = 'X'

    FORM = 'ZSAKR'

    LANGUAGE = SY-LANGU

    .

    IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    CALL FUNCTION 'WRITE_FORM'

    EXPORTING

    • ELEMENT = ' '

    • FUNCTION = 'SET'

    TYPE = 'BODY'

    WINDOW = 'VAR'

    • IMPORTING

    • PENDING_LINES =

    • 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.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    CALL FUNCTION 'WRITE_FORM'

    EXPORTING

    • ELEMENT = ' '

    • FUNCTION = 'SET'

    • TYPE = 'BODY'

    WINDOW = 'MAIN'

    • IMPORTING

    • PENDING_LINES =

    • 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.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    CALL FUNCTION 'CLOSE_FORM'

    • IMPORTING

    • RESULT =

    • RDI_RESULT =

    • TABLES

    • OTFDATA =

    • EXCEPTIONS

    • UNOPENED = 1

    • BAD_PAGEFORMAT_FOR_PRINT = 2

    • SEND_ERROR = 3

    • SPOOL_ERROR = 4

    • CODEPAGE = 5

    • OTHERS = 6

    .

    IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 14, 2008 at 09:39 AM

    Hi,

    Just see this Link:

    1.It will give all the details of script.

    http://www.saptechnical.com/Tutorials/Smartforms/SFMain.htm

    2.Generally Any modifications without modifying the driver program , we will writethe logic in subrotine pool with ITCSY structure.

    3.We will call the Form in layout with this:

    perform form_name in program pg_name.

    Regards,

    Kumar.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 14, 2008 at 09:51 AM

    Hi,

    This is a Saple program to call SapScript

    REPORT  zs_sapscript1.
    
    TABLES: vbrk,vbrp.
    TYPES: BEGIN OF t_tab,
    
           vbeln TYPE vbeln_va,
           posnr TYPE posnr,
           matnr TYPE matnr,
           fkimg TYPE fkimg,
           vrkme TYPE vrkme,
           netwr TYPE netwr_ap,
           unit  TYPE p,
           END OF t_tab.
    
    
    DATA: i_tab TYPE STANDARD TABLE OF t_tab,
          wa_tab TYPE t_tab.
    
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
    PARAMETERS : s_vbeln LIKE vbrk-vbeln.
    SELECTION-SCREEN END OF BLOCK b1.
    
    START-OF-SELECTION.
    
      SELECT a~vbeln
             b~posnr
             b~matnr
             b~fkimg
             b~vrkme
             b~netwr
    
             INTO TABLE i_tab FROM vbrk
             AS a INNER JOIN vbrp AS b
             ON a~vbeln EQ b~vbeln WHERE a~vbeln EQ s_vbeln.
    
      LOOP AT i_tab INTO wa_tab.
    
        wa_tab-unit = wa_tab-netwr / wa_tab-fkimg.
    
        MODIFY i_tab FROM wa_tab TRANSPORTING unit.
        CLEAR wa_tab.
      ENDLOOP.
    
    END-OF-SELECTION.
    
    
    
    
      CALL FUNCTION 'OPEN_FORM'
    EXPORTING
    *   APPLICATION                       = 'TX'
    *   ARCHIVE_INDEX                     =
    *   ARCHIVE_PARAMS                    =
    device                            = 'PRINTER'
    dialog                            = 'X'
    form                              = 'ZSASSIGNMENT'        "SAPSCRIPT Name
    language                          = sy-langu
    *   OPTIONS                           =
    *   MAIL_SENDER                       =
    *   MAIL_RECIPIENT                    =
    *   MAIL_APPL_OBJECT                  =
    *   RAW_DATA_INTERFACE                = '*'
    *   SPONUMIV                          =
    * IMPORTING
    *   LANGUAGE                          =
    
    *   NEW_ARCHIVE_PARAMS                =
    *   RESULT                            =
    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
    OTHERS                            = 12
          .
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    
    
      LOOP AT i_tab INTO wa_tab.
    
    
    
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element  = 'ITEM'
            function = 'SET'
            type     = 'BODY'
            window   = 'MAIN'.
        IF sy-subrc <> 0.
    
        ENDIF.
    
    
    
    
      ENDLOOP.
    
      CALL FUNCTION 'CLOSE_FORM'
        .
      IF sy-subrc <> 0.
      ENDIF.
    

    regards

    Sandipan

    Add a comment
    10|10000 characters needed characters exceeded

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.