on ‎2009 Aug 27 4:13 PM
Hi All,
I would like to retrive material "Basic Data Text" (material master additional data) value form a group of materilas. I tried table STXL but it did not give the text vale as readable.
Please help me for a better solution.
Thanks
John K.
Request clarification before answering.
Hi,
Create an ABAP query with table MARA.
Add a new field like ZBASICTEXT. For this field add code to pull the text from material master basic text using function module READ_TEXT.
In our requirements, I developed a query which pulls the basic data text from material master, which is maintained in language Afrikkan.
Following is the code sample, change the language in this code,
TABLES:
STXH.
DATA:
TDNAME LIKE STXH-TDNAME,
MYLINE LIKE TLINE-TDLINE,
ZE13_LINE(200) 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 ZBASICTEXT.
CLEAR TDNAME.
MOVE MARA-MATNR
TO TDNAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = 'GRUN'
LANGUAGE = 'a'
NAME = TDNAME
OBJECT = 'MATERIAL'
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 ZBASICTEXT."myline.
EXIT.
ENDLOOP.
ENDIF.
Hope this helps. Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Long Text is certainly stored in STXH and STXL.
But you cannot read the text with SE16, because it is stored in binary format.
If you want read it, then you have to use function module READ_TEXT.
So for a download you would need to develope a small ABAP, with a selection screen to enter your material numbers, then you need to loop thru this material numbers and call READ_TEXT for each material followed by a WRITE statement.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
REPORT ztest NO STANDARD PAGE HEADING.
*Read Basic data text for material
PARAMETERS: p_matnr TYPE matnr OBLIGATORY DEFAULT '101-0001'.
DATA: tdname TYPE stxh-tdname,
xline TYPE TABLE OF tline,
wline TYPE tline.
START-OF-SELECTION.
tdname = p_matnr.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'GRUN'
language = sy-langu
name = tdname
object = 'MATERIAL'
TABLES
lines = xline
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 xline INTO wline.
WRITE: / wline-tdline.
ENDLOOP.
ELSE.
WRITE: / 'Error', sy-subrc.
ENDIF.
ULINE.
| User | Count |
|---|---|
| 27 | |
| 11 | |
| 11 | |
| 10 | |
| 6 | |
| 5 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.