Skip to Content
author's profile photo
Former Member

How to Call Function from SAPSCRIPT

I want to Call a function from my SAPSCRIPT to get some data and print the same in the form , Can I get an example for this

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • author's profile photo
    Former Member
    Posted on Feb 01, 2005 at 07:23 AM

    Hi Nandan,

    U cannot directly call function from SAPScript... For that u have to create one include in which u need to write the code. Using Perform... EndPerform u can call the same from SAPScript. See the below example

    u need to write this code in SAPScript

    PERFORM formname IN PROGRAM includename

    USING &field1&

    USING &field2&

    CHANGING &field3&

    ENDPERFORM

    Here includename is your include type program.

    u need to write this code in your include type program..

    FORM formname TABLES in_par STRUCTURE itcsy

    out_par STRUCTURE itcsy.

    data : var1 like field1,

    var2 like field2,

    var3 like field3.

    READ TABLE in_par WITH KEY 'field1'.

    CHECK sy-subrc = 0.

    var1 = in_par-value.

    READ TABLE in_par WITH KEY 'field2'.

    CHECK sy-subrc = 0.

    var2 = in_par-value.

    now u can call corresponding function using local VAR1 and VAR2. Here u can pass N no of USING parameters.

    After processing on VAR3...

    READ TABLE out_par WITH KEY 'field3'.

    out_par-value = VAR3.

    MODIFY out_par INDEX sy-tabix.

    EndForm.

    Here in_par and out_par are the structures which will be used to communicate with SAPScript. And this is the only way as per my view.

    I m sure this code will work fine. Here i have used dummy variables that u need to change as per your requirement. If u have more queries write me back.

    And yes if this works than dont forget to give the points.

    Regards,

    Sagar

    Add comment
    10|10000 characters needed characters exceeded