Skip to Content
author's profile photo Former Member
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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    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 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.