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

subroutine

Former Member
0 Likes
541

hi sapiens,

is there any syntax for using same subroutine for different internal tables of different structures .

thanks,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
507

Hi ramesh,

This worked for me:

data: it_mara type table of mara,

it_marc type table of marc.

perform example tables it_mara.

perform example tables it_marc.

&----


*& Form example

&----


  • text

FORM example TABLES P_IT_MARA." STRUCTURE any.

ENDFORM. " example

Regards,

Ravi

4 REPLIES 4
Read only

Former Member
0 Likes
507

Hi ramesh,

1. If we want to use the FIELDNAME

inside the subroutine,

then its not possible.

(it will give syntax error when we do

itab-fieldname,

inside the subroutine)

2. However, if fieldsymbols and other such things are used,

then still it can be done.

regards,

amit m.

Read only

andreas_mann3
Active Contributor
0 Likes
507

hi,

try that sample:

perform pack_kunnr:  tables ktab using kwa kdid,
                       tables atab using adrwa adid.


FORM pack_kunnr TABLES   tab type table
                USING    WA kunden_id.

  loop at tab into wa.

...

A.

Read only

Former Member
0 Likes
507

FORM DEMO USING P TYPE ANY TABLE.

...

READ TABLE P WITH TABLE KEY (KEY) = 'X' INTO WA.

...

ENDFORM.

http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db984635c111d1829f0000e829fbfe/content.htm

Read only

Former Member
0 Likes
508

Hi ramesh,

This worked for me:

data: it_mara type table of mara,

it_marc type table of marc.

perform example tables it_mara.

perform example tables it_marc.

&----


*& Form example

&----


  • text

FORM example TABLES P_IT_MARA." STRUCTURE any.

ENDFORM. " example

Regards,

Ravi