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

ABAP Query -basic text data extraction

Shiva_Ram
Active Contributor
0 Likes
1,169

Hi,

I have to extract basic data text from Material master. I have introduced an additional filed in ABAP query apart from tables MARA, MAKT. I have added sample codes like the one in function READ_TEXT. But when I run the query I am not able to extract the text and the assoicated language name (eg:Africaans). So what is the procedure to get the results? I am a functional guy and need to understand how the ABAP code in READ_TEXT extract the data.

Thanks in advance for your time and your effort for descriptive answer.

3 REPLIES 3
Read only

Former Member
0 Likes
726

Hi,

While retrieving the material text you need to pass the language as you find the texts maintained in different languages in table makt.

Check whether the following code works,

select single maktx from makt

into v_maktx (This is the variable used to hold the value of material text)

where matnr = mara-matnr

and spras = 'AF'.

If you write v_maktx, this will have the value of the text in African language, if the text in African language is not maintained in table MAKT for that material then it would be blank. Check the MAKT table entries also before you run the query.

Hope this helps.

Rgds,

Read only

Shiva_Ram
Active Contributor
0 Likes
726

Hi Sailatha,

I have coded for a field like below;

TABLES:

STXH.

DATA:

TDNAME LIKE STXH-TDNAME,

MYLINE LIKE TLINE-TDLINE,

ZE13_LINE(70) TYPE C.

DATA:BEGIN OF LINES OCCURS 0.

INCLUDE STRUCTURE TLINE.

DATA:END OF LINES.

DATA:BEGIN OF MYHEADER.

INCLUDE STRUCTURE THEAD.

DATA:END OF MYHEADER.

CLEAR ZZBASICTEXT.

*CLEAR TDNAME.

*CONCATENATE '000000000000'

*MARA-MATNR

*INTO TDNAME.

*MOVE TDNAME TO ZZTDNAME.

CALL FUNCTION 'READ_TEXT'

EXPORTING

ID = 'ID'

LANGUAGE = SY-LANGU

NAME = TDNAME

OBJECT = 'OBJECT'

IMPORTING

HEADER = MYHEADER

TABLES

LINES = LINES

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8.

IF SY-SUBRC = 0.

LOOP AT LINES.

MOVE LINES-TDLINE(132) TO ZZBASICTEXT."myline.

EXIT.

ENDLOOP.

ENDIF.

But this didnot extract any details. My question is how to relate material master number into the export data and fetch the basic data text from the material master?

Thanks for your information.

Read only

Former Member
0 Likes
726

Hi,

The logon language would be defaulted to sy-langu, hence change it to 'AF' and check, if there is any text maintained in AF language the function module READ_TEXT will return the value, otherwise not.

Rgds,