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

perform statement with tables addition ??

hi all,

can someone help me in understanding perform statements with additions tables.

I know basic perform statement.

like

data : a(5) type c,

b(5) type c,

c(5) type c.

perform add.

write c.

form add.

a = b + c.

endform.

please help mein understanding perform statement with tables, Example would be great.

Thank you.

Madhu.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 01, 2007 at 08:41 PM

    Try the below example program :

    PERFORM get_data TABLES table1.

    PERFORM get_data TABLES table2.

    PERFORM get_data TABLES table3.

    FORM get_data TABLES p_tab_data.

    FIELD-SYMBOLS: <wa> TYPE ANY.

    LOOP AT p_tab_data ASSIGNING <wa>.

    ENDLOOP.

    endform.

    You use tables because reusability .

    Thanks

    Seshu

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi seshu,

      first of all thanks, i saw ur reply in this thread and it solved my problem.

      but i din't understand y v have to use following code.

      FIELD-SYMBOLS: <wa> TYPE ANY.

      LOOP AT p_tab_data ASSIGNING <wa>.

      ENDLOOP.

      can u explain me indetail with example.

      thanks

  • author's profile photo Former Member
    Former Member
    Posted on Nov 01, 2007 at 08:16 PM

    Hi,

    Check this..

    DATA: t_mara TYPE STANDARD TABLE OF mara.
    
    PERFORM display TABLES t_mara.
    
    *---------------------------------------------------------------------*
    *       FORM display                                                  *
    *---------------------------------------------------------------------*
    *       ........                                                      *
    *---------------------------------------------------------------------*
    *  -->  LT_MARA                                                       *
    *---------------------------------------------------------------------*
    FORM display TABLES lt_mara STRUCTURE mara.
    
      LOOP AT lt_mara.
        WRITE: / lt_mara-matnr.
      ENDLOOP.
    
    ENDFORM.
    

    Thanks

    Naren

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 01, 2007 at 08:17 PM

    Madhu,

    In below example we are passing ITAB to the perform & using the contents in between form & end form.

    TYPES: BEGIN OF ITAB_TYPE,

    TEXT(50),

    NUMBER TYPE I,

    END OF ITAB_TYPE.

    DATA: ITAB TYPE STANDARD TABLE OF ITAB_TYPE WITH

    NON-UNIQUE DEFAULT KEY INITIAL SIZE 100,

    BEGIN OF ITAB_LINE,

    TEXT(50),

    NUMBER TYPE I,

    END OF ITAB_LINE,

    STRUC like T005T.

    ...

    PERFORM DISPLAY TABLES ITAB

    USING STRUC.

    FORM DISPLAY TABLES PAR_ITAB STRUCTURE ITAB_LINE

    USING PAR like T005T.

    DATA: LOC_COMPARE LIKE PAR_ITAB-TEXT.

    WRITE: / PAR-LAND1, PAR-LANDX.

    ...

    LOOP AT PAR_ITAB WHERE TEXT = LOC_COMPARE.

    ...

    ENDLOOP.

    ENDFORM.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 01, 2007 at 08:18 PM

    Hi,

    Please try something like this.

    DATA: BEGIN OF ITAB OCCURS 100,
            TEXT(50),
            NUMBER TYPE I,
          END   OF ITAB.
          STRUC LIKE T005T.
    ...
    PERFORM DISPLAY TABLES ITAB
                    USING  STRUC.
    
    FORM DISPLAY TABLES PAR_ITAB STRUCTURE ITAB
                 USING  PAR STRUCTURE T005T.
      DATA LOC_COMPARE LIKE PAR_ITAB-TEXT.
    
      WRITE: / PAR-LAND1, PAR-LANDX.
      ...
      LOOP AT PAR_ITAB WHERE TEXT = LOC_COMPARE.
        ...
      ENDLOOP.
      ...
    ENDFORM.
    

    Regards,

    Ferry Lianto

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 02, 2007 at 01:57 AM

    Hi Check this..

    TABLES allows you to pass internal tables to a subroutine.

    Example

    TYPES: BEGIN OF ITAB_TYPE,

    TEXT(50),

    NUMBER TYPE I,

    END OF ITAB_TYPE.

    DATA: ITAB TYPE STANDARD TABLE OF ITAB_TYPE ,

    BEGIN OF ITAB_LINE,

    TEXT(50),

    NUMBER TYPE I,

    END OF ITAB_LINE,

    STRUC like T005T.

    PERFORM DISPLAY TABLES ITAB

    USING STRUC.

    FORM DISPLAY TABLES PAR_ITAB STRUCTURE ITAB_LINE

    USING PAR like T005T.

    DATA: LOC_COMPARE LIKE PAR_ITAB-TEXT.

    WRITE: / PAR-LAND1, PAR-LANDX.

    ...

    LOOP AT PAR_ITAB WHERE TEXT = LOC_COMPARE.

    ...

    ENDLOOP.

    ENDFORM.

    Within the subroutine DISPLAY, you can use any internal table operation to work with the internal table that you passed to it.

    Note

    If you use TABLES, it must always be the first addition in a PERFORM statement.

    Hope this Helps///

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 07:39 AM

    DATA:

    it_sflight TYPE TABLE OF sflight.

    select carrid connid from sflight into corresponding fields of table it_sflight.

    PERFORM

    display TABLES it_sflight.

    &----


    *& Form display

    &----


    • text

    ----


    • -->P_IT_SFLIGHT text

    ----


    FORM display TABLES p_it_sflight STRUCTURE sflight .

    data:

    wa_sflight like line of p_it_sflight.

    LOOP AT p_it_sflight INTO wa_sflight.

    write : wa_sflight-carrid,wa_sflight-connid .

    write /.

    ENDLOOP.

    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.