Application Development and Automation 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: 
Read only

PASSING INTERNAL TABLR FROM ONE SUBROUTINE TO OTHER SUBROUTINE

Former Member
0 Kudos
318

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
Read only

Former Member
0 Kudos
300

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
Read only

Former Member
0 Kudos
300

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.

Read only

0 Kudos
300

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

Read only

0 Kudos
300

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

Read only

0 Kudos
300

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

Read only

0 Kudos
300

I gave the answer, but you are not realised.

Read only

Former Member
0 Kudos
300

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

Read only

Former Member
0 Kudos
300

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.

Read only

Former Member
0 Kudos
301

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.

Read only

0 Kudos
300

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

Read only

0 Kudos
300

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.