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

Sub-routine which passes a table as a parameter

Former Member
0 Likes
1,538

Hi all,

I have a sub-routine which passes a table as a parameter.

This routine is called using different tables at different times.

What I want to do is create a work area for this table in the subroutine.

I tried doing it like this:


FORM download TABLES p_down USING p_file.

DATA: wa_tab like line of p_down.
.....

But I am getting a syntax error saying

the field 'P_DOWN' specified under LIKE either has no type or a generic type

Can somebody tell me how to create a workarea of these kinds of tables?

Thanks in advance.

goldie.

Edited by: Alvaro Tejada Galindo on Feb 27, 2008 3:54 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,511

Why don't you use a Field-Symbol...This code works nice -:)


DATA: t_spfli TYPE STANDARD TABLE OF spfli.

PERFORM download TABLES t_spfli USING 'C:\Test\Test.txt'.

FORM download TABLES p_down USING p_file.

  FIELD-SYMBOLS: <fs_down> TYPE ANY.
  ASSIGN p_down TO <fs_down>.

ENDFORM.

<FS_DOWN> will have the structure of T_SPFLI...

Greetings,

Blag.

Goldie...

Just to be sure...Do you need something like this???

[Taking good care of Z Data|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3340] [original link is broken] [original link is broken] [original link is broken];

Greetings,

Blag.

12 REPLIES 12
Read only

SG141
Active Participant
0 Likes
1,511

Try this .


FORM download TABLES p_down structure p_file.
 
DATA: wa_tab like line of p_down.

.....

Read only

Former Member
0 Likes
1,511

Hi Karthik,

The FORM is being called more than once using different tables.

So I don't think we can use the addition structure/ TYPE.

Unless we can declare some thing like ANY TABLE.

Do you think we can do that?

goldie.

Read only

Former Member
0 Likes
1,511

make sure that P_down is defined..

then you can simply use wa_area type p_down...

Read only

0 Likes
1,511

HI sumeet,

Your idea sounds good.

But, how can we declare P_DOWN as a generic type?

Please tell me if you know how to do that?

thanks,

goldie

Read only

Former Member
0 Likes
1,512

Why don't you use a Field-Symbol...This code works nice -:)


DATA: t_spfli TYPE STANDARD TABLE OF spfli.

PERFORM download TABLES t_spfli USING 'C:\Test\Test.txt'.

FORM download TABLES p_down USING p_file.

  FIELD-SYMBOLS: <fs_down> TYPE ANY.
  ASSIGN p_down TO <fs_down>.

ENDFORM.

<FS_DOWN> will have the structure of T_SPFLI...

Greetings,

Blag.

Read only

0 Likes
1,511

Hi Blag,

I tried your suggestion.

But I am still not able to create a work area.


FORM download TABLES p_down USING p_file.
 
  FIELD-SYMBOLS: <fs_down> TYPE ANY.
  ASSIGN p_down TO <fs_down>.
 " DATA: wa_tab LIKE LINE OF <fs>. "

ENDFORM.

Can you tell me if the statement in quotes is right?

because that is where I am getting the error saying that

" <fs_down> is not an internal table."

Thanks,

goldie.

Read only

0 Likes
1,511

Goldie:

You can't create a workarea from a field-symbol...So...Why you need a workarea anyway??? Field-Symbols are better and faster...

Let me do some more tests and write back if I get something new -:)

Greetings,

Blag.

Read only

0 Likes
1,511

if you are using field symbols, why u require a work area.??

Read only

0 Likes
1,511

Blag,

The FORM download uses the method GUI_DOWNLOAD of CL_GUI_FRONTEND_SERVICES

It previously used WS_DOWNLOD.

I changed this, because I am doing unicode conversion.

The tables that are being passed into the form are not compatible with the component DATA_TAB of GUI_DOWNLOAD as a result there was an ABAP DUMP.

That is why I have to create a work area and the create a internal table using that workarea.

So, I hope your tests are successful and you come up with something that works for me

goldie.

Read only

0 Likes
1,511

Goldie...

Just to be sure...Do you need something like this???

[Taking good care of Z Data|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3340] [original link is broken] [original link is broken] [original link is broken];

Greetings,

Blag.

Read only

0 Likes
1,511

This is exactly what I want.

I'll try it right away.

Thanks Blag, you r the man!!

goldie.

Read only

0 Likes
1,511

Goldie:

I'm glad you like it -:)

I have wrote a lot of blogs, so next time you need something, browse them first -;)

[Blag Blogs|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/u/48024] [original link is broken] [original link is broken];

Greetings,

Blag.