Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

PASSING INTERNAL TABLR FROM ONE SUBROUTINE TO OTHER SUBROUTINE

Former Member
0 Kudos

hi i want to pass one internal table to other subroutine like this

form abc

data: begin of itab occurs 0.

-


-


end of itab

perform xyz tables itab.

endform.

form xyz tables itab like itab[].

end form

it is giving and error that itab is not defiend by data statement

and also tell how to pass two internal tables to the subroutine

thanx in advance

its very urgent

points wil be rewarded

plz help its very urgent

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

when u r declaring the internal table in the form it have been declared as local variable, if u want to over come the problem then u need declare outside the form

before the start-of-selection.

hope this will help u.

plzz reward points if it helps.

10 REPLIES 10

Former Member
0 Kudos

Hi,

perform xyz tables itab.

form xyz tables itab like itab.

in the above type table will pass the values with header line.

perform xyz using itab.

form xyz using itab like itab[].

in this case the header line will not pass u have explicitly declare the work area.

plzz reward points if it helps.

0 Kudos

internal table is defiend in first soubroutine

and when i use

form for second subroutine then it gives and error

itab is not defiend by data statement

how to overcome this porb

0 Kudos

Hi,

Check this Example

PROGRAM FORM_TEST.

TYPES: BEGIN OF LINE,
COL1 TYPE I,
COL2 TYPE I,
END OF LINE.

DATA: ITAB TYPE STANDARD TABLE OF LINE WITH HEADER LINE,
      JTAB TYPE STANDARD TABLE OF LINE.

PERFORM FILL TABLES ITAB.

MOVE ITAB[] TO JTAB.

PERFORM OUT TABLES JTAB.

FORM FILL TABLES F_ITAB LIKE ITAB[].

  DO 3 TIMES.
    F_ITAB-COL1 = SY-INDEX.
    F_ITAB-COL2 = SY-INDEX ** 2.
    APPEND F_ITAB.
  ENDDO.

ENDFORM.

FORM OUT TABLES F_ITAB LIKE JTAB.

  LOOP AT F_ITAB.
    WRITE: / F_ITAB-COL1, F_ITAB-COL2.
  ENDLOOP.

ENDFORM.

Regards,

Satish

0 Kudos

nooo

look

i m creating an internal table in first subroutine

and then passing it to other subroutine

and then it is givinng error

that internal table is not defiend

0 Kudos

I gave the answer, but you are not realised.

Former Member
0 Kudos

Hi,

Try this

Types: begin of ty_tab,
           end of ty_tab.

data: itab type table of ty_tab.

form abc.
perform xyz tables itab.
endform.

form xyz tables itab type ty_tab.
end form.

Regards,

Satish

Former Member
0 Kudos

Hi,

In the first form call the 2nd form.

for example.

perform xyz.

form xyz .

itab declaration.

perform abc using itab.

endform.

form abc using p_itab like itab[].

endform.

plzz reward points if it is useful.

Former Member
0 Kudos

Hi,

when u r declaring the internal table in the form it have been declared as local variable, if u want to over come the problem then u need declare outside the form

before the start-of-selection.

hope this will help u.

plzz reward points if it helps.

0 Kudos

i think local internal tables can not b passed to other subroutines

0 Kudos

If I remember it right, passing internal tables with <b>TABLES</b> addition has become obsolete. SAP recommends to use the <b>USING</b> addition even with internal tables.

Can anyone confirm this? I donot have access to SAP right now.