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

perform subroutine.

Former Member
0 Likes
1,205

Normally we people use perform like below.

Perform zvv using table i_mara

changing ..............

But now a days using table in Perform is obsolete so any guru can tell me what is new statment we use in place of using table in perform.

thanks in advance .

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
0 Likes
1,171

You should define all your table types using the TYPES statement.

TYPES: sorted_mara_type TYPE SORTED TABLE OF mara WITH UNIQUE KEY matnr.
DATA: t_mara TYPE sorted_mara_type.

PERFORM do_stuff USING t_mara.

...

FORM do_stuff USING xt_mara TYPE sorted_mara_type.
  DATA: ls_mara TYPE mara.

  LOOP AT xt_mara INTO ls_mara.
...
  ENDLOOP.

ENDFORM.

So, the TABLES keyword isn't needed any more. Same applies for FUNCTION MODULES. But in some cases there you must use TABLES, even though they are supposedly obsolete. I suggest also you check out my [blog on typing in forms|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/11938] [original link is broken] [original link is broken] [original link is broken];.

11 REPLIES 11
Read only

matt
Active Contributor
0 Likes
1,172

You should define all your table types using the TYPES statement.

TYPES: sorted_mara_type TYPE SORTED TABLE OF mara WITH UNIQUE KEY matnr.
DATA: t_mara TYPE sorted_mara_type.

PERFORM do_stuff USING t_mara.

...

FORM do_stuff USING xt_mara TYPE sorted_mara_type.
  DATA: ls_mara TYPE mara.

  LOOP AT xt_mara INTO ls_mara.
...
  ENDLOOP.

ENDFORM.

So, the TABLES keyword isn't needed any more. Same applies for FUNCTION MODULES. But in some cases there you must use TABLES, even though they are supposedly obsolete. I suggest also you check out my [blog on typing in forms|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/11938] [original link is broken] [original link is broken] [original link is broken];.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,171

Hello Matt,

I just read your blog. The idea you are trying to put across is PERFECT !!!

But what about TABLES?? Can you please elaborate on this one? Can i use the idea for TYPE ANY across to TABLES as well, that we may give our tables in an incorrect sequence and while executing get a DUMP !!!

Plz revert back.

BR,

Suhas

Read only

matt
Active Contributor
0 Likes
1,171

Well, if you insist (or need to) use generic tables, then you can just use something like:

FORM my_form CHANGING xt_table TYPE ANY TABLE.

FORM my_form CHANGING xt_table TYPE STANDARD TABLE.

FORM my_form CHANGING xt_table TYPE INDEX TABLE.

etc.

As ever, the more specific you can be in naming the type, the safer your program is.

matt

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,171

Hello Matt,

I will rather put it this way:

Does using TABLES in Sub-routines, Func. Modules etc. hamper the performance in any way ?

BR,

Suhas

Read only

matt
Active Contributor
0 Likes
1,171

>

> Hello Matt,

>

> I will rather put it this way:

>

>

Does using TABLES in Sub-routines, Func. Modules etc. hamper the performance in any way ?

>

> BR,

> Suhas

No. It makes no difference to how quickly the program runs. There are scenarios where you should uses TABLES still - that is in certain RFCs - search if you want more info - it's well covered.

But that is, most of the time, not the biggest issue for any program. What's important is that errors can be quickly and easily fixed. That means the program should be well designed and well written.

And proper typing is part of that. As I said in my blog - type safety enables you to discover bugs during syntax checking, rather than unit testing/ system testing /production - and so is much cheaper.

All programmers need to understand that first you write the program well then you worry about performance, if and only if there are performance issues. There seems to be an idea that the faster a program runs the better it is. 95% of the time, that simply isn't true.

matt

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,171

Thanks a lot Matt ... One wrong piece of info i had about TABLES stmt done away with )

Read only

Former Member
0 Likes
1,171

Thanks a lot Matt

i need to know whether using table in Perform is obsolete if yes what are we using in place of table.

Read only

Former Member
0 Likes
1,171

Hello Rahul,

Instead of tables you can use changing addition for passing tables.

Thanks,

Augustin.

Read only

matt
Active Contributor
0 Likes
1,171

TABLE in perform is not obsolete in FORMS, as far as I can tell looking at the ABAP notes.

Regards

matt

Read only

Former Member
0 Likes
1,171

Use Table TYPE.

Edited by: harsh bhalla on Jun 12, 2009 1:43 PM

Read only

Former Member
0 Likes
1,171

hi rahul,

u can use perform in the following manner :

FORM test USING p1 TYPE string 
                p2 TYPE string 
          CHANGING value(p3) TYPE string 
                   value(p4) TYPE string. 
  ... 
ENDFORM

reagrds

rahul