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

Fill an internal table

Former Member
0 Likes
1,037

Hi,  for the program I am currently writing, I need to fill an internal tables with all the tables potentially relevant to the creation of a certain type of document. Since I cannot find listings like that in the SAP system - at least I know none and I've never come across any - I have to hard-code lists and save them in an internal table. What I currently do is:

wa_tables = 'BKPF'.

APPEND wa_tables TO Tables_tab.

wa_tables = 'BSEG.

....

I cannot think of a faster way to do this, given I have to type up the lists somewhere.

Can anybody think of a faster way to do this?

Thanks a lot!

Best regards,

Sapperdapper

Hi,  for the program I am currently writing, I need to fill an internal tables with all the tables potentially relevant to the creation of a certain type of document. Since I cannot find listings like that in the SAP system - at least I know none and I've never come across any - I have to hard-code lists and save them in an internal table. What I currently do is:

wa_tables = 'BKPF'.

APPEND wa_tables TO Tables_tab.

wa_tables = 'BSEG.

....

I cannot think of a faster way to do this, given I have to type up the lists somewhere.

Can anybody think of a faster way to do this?

Thanks a lot!

Best regards,

Sapperdapper

2 REPLIES 2
Read only

Former Member
0 Likes
973

Hi Friedrich,

Basically sap provides a better way of fetching data from tables. As your current requirement is not clear to a greater extent, hope this code might helps you.

1. The table values can be maintained in custom table, so that it is easy for maintaining and there may be a need to change the data.

2. Create text element for each table name.

n refers to no of tables and text element should be consecutive.

--------------------------------------------------------------

data number type char03." Refers to text element

do n times.

number = number + 1.

Concatenate 'text-' number  into tablename.

perform fill_tables using table_name.

enddo.

-----------------------------------------------------------

form fill_tables using table_name.

wa_table = table_name.

append wa_tables to tables_tab.

endif.

------------------------------------------------------------

Read only

0 Likes
973

Hi ramya,

I'm afraid I do not quite understand: That FORM routine does the same thing I currently do, namely fill the internal table using the workarea.

I think you have text elements that I can then access using "text-027" or the like, is that what you mean?

Well, that would just "move the workload" so to speak - it might be faster once the text_elements are in place, but I have to put them there first - it is table T100, is it not?

I'm not sure that would make the whole thing faster?

As to my requirement, I just need to get the names of all the tables which are relevant to the creation of a certain kind of document into an internal table which I can then work on. As I don't know of any lists of that kind in the SAP system, I resigned to using lists found on the Internet.

It might be possible, however, to create a DB table with such a list of table_names in a customer's SAP system, then I wouldn't have to rebuild it every time my program is executed. I guess that would speed things up, I'll try it out. Without that possibility, I have to hard-code that list into my program.

Thanks a lot anyway!

Best regards,

Sapperdapper