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

internal table as global attribute

Former Member
0 Likes
1,569

Hi,

I am facing some problem in se24.

please give me sugestion to me.

1. i created one class in se24 named zcl_sid.

2. i created one method name retrive.

3.i created one internal table(ITAB)as parameter for this method.

4. i select the data from but000(crm table) and placed in ineternal table.

5. Now i created one more method disp to display the selectd data.

here the internal table is invisible to this disp method.

how can i make this table visible to another method i.e disp.

is it possible to use single itab for different methods in se24.

is it possible to declare itab as global attribute in class.

How please?

thanks.

swathi

8 REPLIES 8
Read only

Former Member
0 Likes
1,198

Hi,

Declare the internal table as an attribute..And the visibility as private, so that you can access the internal table only within the class..

Thanks,

Naren

Read only

Former Member
0 Likes
1,198

Declare the internal table in the attributes as public.

Create a table type and use that in the attributes for that internal table.

Example:

I_EMPDATA type YPRA_EMPDATA.

Where as YPRA_EMPDATA is a table type with structure YPRA_STR_EMPDATA. Which inturn as 4 fields EMPID, EMPNAME, EXPYEARS, DESIG.

Regards,

Prakash.

Read only

0 Likes
1,198

Thanks for soon reply,

1.I created

itab as instace attribute visibility private,

and assosiated type: bupa_data_all( it is crm structure name.).

2. I created method retrive: instance method visibility public.

implemented like this.

data: begin of itab1,

partner type bu_partner,

name type but000-name_first,

end of itab1.

select partner name_first from but000 into(itab1-partner, itab1-name).

append itab1 to itab.

end method.

i created another method disp.

method disp.

loop at itab into lines

write:/lines-partner, lines-name.

endloop.

when i check.

system giving error

"itab is not an internal table-the occurs n" specification is missing.

please tell me how t rectify it.

endselect

Read only

0 Likes
1,198

In the attributes create a Workarea of the structure which is inside the table type and declare as private.

While looping (loop at itab into wa_itab. endloop.)

Regards,

Prakash.

Read only

0 Likes
1,198

Instead of structure BUPA_DATA_ALL use the table type <b>BU_DATA_ALL_T</b>.

Regards,

Prakash.

Read only

0 Likes
1,198

Your structure <b>bupa_data_all</b> might not be a table type, it might be a structure. Try the following

1) Double Click on <b>bupa_data_all</b>

2) Where-used and in the pop-up select table types

3) If there is one then put that as your type in the attributes.

If you werent able to find a table type, go to your class in SE24 and click Types on the toolbar (the other buttons are Implementation, Macros, Class Documenation) declare your Type here and use it in the attributes. This is not the best way to program as a Class should have only those parameters which are declared in DDIC.

hith

Sunil Achyut

Read only

0 Likes
1,198

thanks,

i solved it.

I gave points to you.

Thanks

swathi

Read only

Former Member
0 Likes
1,198

Hi,

The ITAB has to be a internal table..I believe bupa_data_all is not a table type..

Use the where used list for the structure bupa_data_all and check if the structure is used in any table types..

Otherwise create your own table type with the structure bupa_data_all.

Use the table type for declaring the internal table..

Thanks,

Naren