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

Re: Reading Ext Basic Text of Material from table

Former Member
0 Likes
895

Hi All,

We hav a scenario that to retrevie the extended basic text of a material posted in the Transaction MM03.

We searched in the tables STXH & STXL but still we are unable to find the Additional text defined for that particular material.

Any idea where will it be stored n how can it be retrevied.

If someone has faced similar scenario pls suggest us the solution to retrevie the additional text of tht particular material

Suggestions and Help will be much appreciated.

Regards.

Ramesh.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
842

Hi,

if you are trying to read the 'Basic Data Text', which can be viewed through transaction MM03->Extras->Basic Data Text, then try the following:

DATA lv_name TYPE tdobname.

DATA lt_tline TYPE STANDARD TABLE OF tline.

lv_name = 'your material number'.

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = 'GRUN'

language = sy-langu

name = lv_matnr

object = 'MATERIAL'

TABLES

lines = lt_tline

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

Table lt_tline will contain your description.

Hope this helps.

Regards,

Gabriele

4 REPLIES 4
Read only

Former Member
0 Likes
843

Hi,

if you are trying to read the 'Basic Data Text', which can be viewed through transaction MM03->Extras->Basic Data Text, then try the following:

DATA lv_name TYPE tdobname.

DATA lt_tline TYPE STANDARD TABLE OF tline.

lv_name = 'your material number'.

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = 'GRUN'

language = sy-langu

name = lv_matnr

object = 'MATERIAL'

TABLES

lines = lt_tline

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

Table lt_tline will contain your description.

Hope this helps.

Regards,

Gabriele

Read only

0 Likes
842

Hi,

We tried with the Read_Text FM 1ly but still its not fetching into the Internal Table.

The code we used is given below

<b>THEADIN = THEAD.

LOOP AT IT_MAKT_DETL.

MAT_SPRA = 'E'.

MAT_NAME = IT_MAKT_DETL-MATNR.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'GRUN'

LANGUAGE = MAT_SPRA

NAME = MAT_NAME

OBJECT = 'MATERIAL'

ARCHIVE_HANDLE = 0

IMPORTING

HEADER = THEADIN

TABLES

LINES = MAT_DESC

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.

ADD_DESC = 0.

LOOP AT MAT_DESC WHERE NOT TDLINE IS INITIAL.

IF ADD_DESC = 0.

MOVE MAT_DESC-TDLINE(50) TO ADD_DATA1.

ENDIF.

IF ADD_DESC = 1.

MOVE MAT_DESC-TDLINE(50) TO ADD_DATA2.

ENDIF.

IF ADD_DESC = 2.

MOVE MAT_DESC-TDLINE(50) TO ADD_DATA3.

ENDIF.

IF ADD_DESC = 3.

MOVE MAT_DESC-TDLINE(50) TO ADD_DATA4.

ENDIF.

IF ADD_DESC = 4.

MOVE MAT_DESC-TDLINE(50) TO ADD_DATA5.

ENDIF.

ADD_DESC = ADD_DESC + 1.

IF ADD_DESC = 5.

EXIT.

ENDIF.

ENDLOOP.

ENDIF.

CLEAR ADD_DATA1.

CLEAR ADD_DATA2.

CLEAR ADD_DATA3.

CLEAR ADD_DATA4.

CLEAR ADD_DATA5.

CLEAR MAT_DESC.

REFRESH MAT_DESC.

CLEAR THEADIN.

ENDLOOP.</b>

If there is any defect or bug in the code pls suggest me.

As far as i know it seems to be ok for me.

Regards.

Ramesh.

Read only

0 Likes
842

Hi Ramesh,

there is a defect in your code, after you call FM READ_TEXT you should check if SY_SUBRC = 0 and NOT if SY-SUBRC <> 0 because this would mean that you woudl read table MAT_DESC only if there is an EXCEPTION in which case the table would be empty.

Also, try using transaction SE11/SE16 and check table STXH, insert into field TDNAME your material number with leading zeros (i.e. 000000000000012345) and see if there are any entries and, if so, what 'Text ID' (TDID) have been stored. The 'Text ID' is the value you pass into the parameter ID of FM READ_TEXT.

Hope this will fix your problem.

Regards,

Gabriele

Read only

Former Member
0 Likes
842

Hello,

Use Read text function module.

Example

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = p_var

language = g_f_langu1

name = g_f_tdname1

object = g_f_obj1

TABLES

lines = g_t_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.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Required Parameters:

Id :THEAD-TDID(U can see example in STXH-TDID)

language : Usually the sy-langu is maintained.But depends on the company.So what ever language the text id is maintained us have to give here.

name : This will be the number for which the text is maintained.In ur case it may be material no or item no check.

object:THEAD-TDOBJECT

check it in the function module u will get clear picture.

Check and let me know if u face any problem.

Regards