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

help with materials

Former Member
0 Likes
809

hi all,

first i need to know in wich table is the long description of a material, i looked in the makt but only has the short description. i found in the mm03 if i look my material that is 111 and i select the tab sales text has a text box where is the description of the material. can anybody helpe telling me where is that value storaged?

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
776

Please see the following program, this is how you will get the text. You need to concatenate the material number with the sales org and distribution channel, this is your NAME, the object is MVKE and the id is 0001.



report zrich_0001.

data: name type thead-tdname.
data: lines type table of  TLINE with header line.

parameters: p_matnr type mvke-matnr,
            p_vkorg type mvke-vkorg,
            p_vtweg type mvke-vtweg.

concatenate p_matnr p_vkorg p_vtweg into name.


call function 'READ_TEXT'
  exporting
    id                            = '0001'
    language                      = sy-langu
    name                          = name
    object                        = 'MVKE'
  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.


loop at lines.
write:/ lines-tdline.

endloop.

Regards,

Rich Heilman

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
776

This long text is stored in sapscript text, tables STXH and STXL, you can't read it directly though. You need to read it via the fucntion module READ_TEXT, you will need to know the object and id and the naming convention.

Regards,

Rich Heilman

Read only

0 Likes
776

hi,

thanks but do you have an example to use this?

Read only

0 Likes
776

For sales text, I believe you'll find your data using:

TDOBJECT = 'MVKE'

TDNAME = concatenate of MATNR, VKORG, VTWEG

TDID = usually '0001', but could be different depending on your system.

TDSPRAS = language

These correspond to OBJECT, NAME, ID, LANGUAGE in the READ_TEXT function.

You can verify that the record exists by looking at STXH.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
777

Please see the following program, this is how you will get the text. You need to concatenate the material number with the sales org and distribution channel, this is your NAME, the object is MVKE and the id is 0001.



report zrich_0001.

data: name type thead-tdname.
data: lines type table of  TLINE with header line.

parameters: p_matnr type mvke-matnr,
            p_vkorg type mvke-vkorg,
            p_vtweg type mvke-vtweg.

concatenate p_matnr p_vkorg p_vtweg into name.


call function 'READ_TEXT'
  exporting
    id                            = '0001'
    language                      = sy-langu
    name                          = name
    object                        = 'MVKE'
  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.


loop at lines.
write:/ lines-tdline.

endloop.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
776

HI,

You have to used the READ_TEXT functions to read the SAP long text. To check your long text header, go into the long text. <b>Click Goto -> Header</b>

Example:

 CALL FUNCTION 'READ_TEXT' 
       EXPORTING 
*           CLIENT                  = SY-MANDT 
          ID                      = <Give the ID> 
          LANGUAGE                = 'E' 
          NAME                    = <Object Name> 
          OBJECT                  = '<Object Name>' 
*         ARCHIVE_HANDLE          = 0 
     IMPORTING 
          HEADER                  = HTEXT 
     TABLES 
          LINES                   = LTEXT 
     EXCEPTIONS 
          ID                      = 1 
          LANGUAGE                = 2 
          NAME                    = 3 
          NOT_FOUND               = 4 
          OBJECT                  = 5 
          REFERENCE_CHECK         = 6 
          WRONG_ACCESS_TO_ARCHIVE = 7 
          OTHERS                  = 8. 

For Header text details, Click Goto -> Header, then you will find the ID,NAme and Object

For details text, Click Goto -> Detail.

<b>

Example Program for your sake:-</b>

REPORT ZTEXT . 
TABLES: PBIM. 
* stxh, stxl, stxb - trans tables for text 
* ttxit - text on text-ids 
* ttxot - Short texts on text objects 
* Transaction MD63 
SELECT-OPTIONS: S_MATNR FOR PBIM-MATNR, 
                S_WERKS FOR PBIM-WERKS. 

DATA: BEGIN OF HTEXT. 
        INCLUDE STRUCTURE THEAD. 
DATA: END OF HTEXT. 

DATA: BEGIN OF LTEXT OCCURS 50. 
        INCLUDE STRUCTURE TLINE. 
DATA: END OF LTEXT. 

DATA: BEGIN OF DTEXT OCCURS 50. 
DATA:   MATNR LIKE PBIM-MATNR. 
        INCLUDE STRUCTURE TLINE. 
DATA: END OF DTEXT. 

DATA: TNAME LIKE THEAD-TDNAME. 

SELECT * FROM PBIM WHERE WERKS IN S_WERKS. 
  MOVE PBIM-BDZEI TO TNAME. 
  CALL FUNCTION 'READ_TEXT' 
       EXPORTING 
*           CLIENT                  = SY-MANDT 
          ID                      = 'PB' 
          LANGUAGE                = 'E' 
          NAME                    = TNAME 
          OBJECT                  = 'PBPT' 
*         ARCHIVE_HANDLE          = 0 
     IMPORTING 
          HEADER                  = HTEXT 
     TABLES 
          LINES                   = LTEXT 
     EXCEPTIONS 
          ID                      = 1 
          LANGUAGE                = 2 
          NAME                    = 3 
          NOT_FOUND               = 4 
          OBJECT                  = 5 
          REFERENCE_CHECK         = 6 
          WRONG_ACCESS_TO_ARCHIVE = 7 
          OTHERS                  = 8. 
  LOOP AT LTEXT. 
    IF LTEXT-TDLINE NE ''. 
      MOVE LTEXT-TDLINE TO DTEXT-TDLINE. 
      MOVE PBIM-MATNR TO DTEXT-MATNR. 
      APPEND DTEXT. 
    ENDIF. 
  ENDLOOP. 
ENDSELECT. 
LOOP AT DTEXT. 
  WRITE:/ DTEXT-MATNR, DTEXT-TDLINE. 
ENDLOOP. 

Mark all the helpful answers

Regards

Sudheer