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

SAP SCRIPTS : Want to display item data, by using PERFORM from SAP SCRIPT

Hi All,

I am calling a sub-routine in a INCLUDE PROGRAM <b>'ZTEST'</b> form a sap-script using a PERFORM STATEMENT.

The data which i retrive inside this sub-routine in my include<b>'ZTEST'</b> is coming in an internal table and I have to display all the entries of the internal table.

I am trying to define a element <b>'DISPLAY_ITEM'</b> inside the sap-script and trying to call that in a loop inside my INCLUDE program using WRITE_FORM. But nothing getting printed after the new element<b>'DISPLAY_ITEM'</b> which i have defined and was calling from the INCLUDE PROGRAM.

Message was edited by: Kaushal Bhavsar

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 03, 2006 at 02:21 PM

    Hi kaushal,

    1. while calling subroutines from sapscripts,

    there is a special technique,

    which has got its own limitations.

    (It should be program of type 1, and not an include)

    2.

    FORM abc

    TABLES

    in_tab STRUCTURE itcsy

    out_tab STRUCTURE itcsy.

    ENDFORM.

    3. The perform in se38 program should be of the

    above format only.

    4. We cannot pass internal tables.

    5. Rather we need to pass

    VARIABLE NAME

    VARIABLE VALUE

    (see the structure of itcsy in se11)

    6. In this form, we have to read

    the internal table in_tab

    to capture the variable name and its value.

    7. Similary, to return the values,

    we have to put one record (for each variable)

    in out_tab.

    regards,

    amit m.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 03, 2006 at 02:22 PM

    Hi Kaushal,

    You cannot pass/ get values in the form of internal tables using performs in sap scripts.

    Instead you can keep this perform in a text element which is being called in the loop of an internal table.

    Regards,

    Ravi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 03, 2006 at 02:24 PM

    Hi,

    Have a look at the example for calling subroutines from script.

    http://www.sap-basis-abap.com/abap/how-to-call-a-subroutine-form-sapscripts.htm

    Hope this helps.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 03, 2006 at 02:26 PM

    hi,

    A sample code of how to use performs in sap scripts.

    In script program,

    /:PERFORM GET_SBGRP_STEXT IN PROGRAM ZSDSCRIPT

    /:USING &GV_MATNR&

    /:CHANGING &GV_STEXT&

    /:TABLES INPUT_TABLE

    /: OUTPUT_TABLE

    /:ENDPERFORM

    In program ZSDSCRIPT,

    form get_sbgrp_stext tables intab structure itcsy

    outab structure itcsy.

    DATA: LV_MATNR LIKE MARA-MATNR,

    LV_TEXT(3) TYPE C VALUE 'ABC'.

    clear intab.

    read table intab with key name = 'GV_MATNR'.

    if sy-subrc = 0.

    lv_MATNR = intab-value.

    ENDIF.

    CLEAR OUTTAB.

    READ TABLE OUTAB WITH KEY NAME = 'GV_STEXT'.

    IF SY-SUBRC = 0.

    OUTAB-VALUE = LV_TEXT.

    modify outab index sy-tabix.

    ENDIF.

    endform.

    Regards,

    Sailaja.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 03, 2006 at 02:31 PM

    Hi Kaushal,

    when you create Perform and Endperform, you can transfer the fields one by one, you can not transfer entire Internal table in one shot,

    When you write the perform statment in Script, use CHANGING variables

    /: PERFORM <form> IN PROGRAM <prog>

    /: USING &INVAR1&

    /: CHANGING &OUTVAR1&

    /: CHANGING &OUTVAR2&

    /: CHANGING &OUTVAR3&

    /: CHANGING &OUTVAR4&

    ......

    /: ENDPERFORM

    in your Program <b>ZTEST</b>, while calling

    FORM <FORM> TABLES IN_PAR STRUCTURE ITCSY

    OUT_PAR STRUCTURE ITCSY

    Read the IN_PAR table to get the values ..

    while putting the values to outtab, loop that internal table and pass to the Output table to the CHANGING parameters in SCRIPT,

    ENDFORM

    hope you understand

    Regards

    Sudheer

    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.