Application Development 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: 

FM to read text from text table

former_member602416
Participant
0 Kudos

Hi,

My requirement is to get text from text table. Text table name is not fixed as I am getting it dynamically based upon the domain name given. I need a generic FM or logic to get text for any text table.

1 ACCEPTED SOLUTION

Sijin_Chandran
Active Contributor

As what I have understood, you need to get information from a Text Table which is assigned to a main Table, if that's the case then:

First get the attached Text Tables for a Table using FM DDUT_TEXTTABLE_GET,

After that as explained by Sandra you can have a Dynamic Select in place which would fetch from the Text Table fetched above.

In addition go through this blog as well if it aligns with your requirement,

https://blogs.sap.com/2018/05/06/how-to-find-a-text-table-if-it-exists/

Thanks,

Sijin

8 REPLIES 8

Jelena
Active Contributor
0 Kudos

"Text table" is for another table, not for a domain. It seems you might be using wrong terminology. Can you clarify what exactly are you looking for?

Sandra_Rossi
Active Contributor
0 Kudos

Are you looking for dynamic SELECT ? Here is the pseudo code:

DATA ref_itab TYPE REF TO DATA.
FIELD-SYMBOLS <itab> TYPE STANDARD TABLE.
DATA tablename TYPE tablename VALUE 'T100'.

CREATE DATA ref_itab TYPE TABLE OF (tablename).
ASSIGN ref_itab->* TO <itab>.
SELECT * FROM (tablename) INTO TABLE <itab>.
LOOP AT <itab> ASSIGNING FIELD-SYMBOL(<line>).
  ASSIGN COMPONENT 1 OF STRUCTURE <line> TO FIELD-SYMBOL(<comp>).
  ...
ENDLOOP.

Sijin_Chandran
Active Contributor

As what I have understood, you need to get information from a Text Table which is assigned to a main Table, if that's the case then:

First get the attached Text Tables for a Table using FM DDUT_TEXTTABLE_GET,

After that as explained by Sandra you can have a Dynamic Select in place which would fetch from the Text Table fetched above.

In addition go through this blog as well if it aligns with your requirement,

https://blogs.sap.com/2018/05/06/how-to-find-a-text-table-if-it-exists/

Thanks,

Sijin

former_member602416
Participant
0 Kudos

Thanks Sandra, your solution is quite right but problem is I just need text from text table but syntax ASSIGNCOMPONENT1OFSTRUCTURE<line>TOFIELD-SYMBOL(<comp>) gives all fields of text table.

As I mentioned my requirement is generic. 1 table can have field TEXT for text and another can have DESC/NAME for text at any position. I just need text from text table not all the fields.

Hope I am clear with my requiremnt.

Sandra_Rossi
Active Contributor
0 Kudos

No, ASSIGN COMPONENT 1 just returns the first component.

former_member602416
Participant
0 Kudos

Sorry I meant to say that position of text field is not known. Text field can be at any column. For example table T100 has text field at 4th coloumn. I need only text field.

Sandra_Rossi
Active Contributor

It's very easy: texts are all columns of a text table which are not part of the primary key. The table DD03L contains all DDIC columns.

former_member602416
Participant
0 Kudos

thanks, You are right!!