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

FM Read_Text Problem

former_member302911
Active Participant
0 Likes
2,005

Hi Guru's,

I've a problem with Read_Text when i try to extract the Overview Text. The SELECT from STHX fails, the parameters are correct but in the STHX the record there isn't.

I notice that in the ME23 , Item -> Text -> Text Overview , in 'Material PO Text' in the Status, there is this symbol ' * ', it is possible that this symbol is a problem when using the Read_Text FM ?

Are there any anothers idea or solution for this problem ?

Regards.

Angelo.

14 REPLIES 14
Read only

Former Member
0 Likes
1,526

HI,

Kindly go through this below sample code:



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. 

To find the Text id these are the following steps. Let us take an example of Billing document Header text.

1. goto VF03, enter Billing doc Number

2. from menuselect Goto>Header-->header Text..... New window will be displayed

3. select the Header Text. here you can see all the text.

4. click on the TEXT (which you want to know the Text id) , then press log ICON (you can find in bottom right of the text window) it looks like a rolled paper.

5. in the Next window you will find Text Name. Text ID, Language. etc...

Hope it helps

Regrds

Mansi

Read only

Former Member
0 Likes
1,526

Hi

It could be possible that the Text that your are seeing in ME23n is really existing under a different TEXT ID, i.e. the text might be a reference text from another document.

As described above, you can find the correct parameters of the TEXT and then use these in READ_TEXT.

Cheers

Ravish

Read only

former_member302911
Active Participant
0 Likes
1,526

In me23 the parameters for READ_TEXT are correct.

In ME23 :

573000011500010

IT

F03

EKPO

The same for READ_TEXT but fails when try to extract text, i think that the problem isn't in the code but it is in the customizing.

Read only

0 Likes
1,526

Hi,

Can u post ur code?

In ME23N u might be looking english text. Just check whether parameters in ME23N and READ_TEXT are matching or not. Leading zeros also matters.

Thanks,

Vinod.

Read only

former_member302911
Active Participant
0 Likes
1,526


 VA_EBELN = '573000011500010'.
  CALL FUNCTION 'READ_TEXT_INLINE'
       EXPORTING
            ID              = 'F03'
           INLINE_COUNT    =  '1'
            LANGUAGE        = 'I'
            NAME            = VA_EBELN 
            OBJECT          = 'EKPO'
*    IMPORTING
*        HEADER          =
       TABLES
           INLINES         =   TB_LINE
            LINES           =  TB_LINE1
       EXCEPTIONS
            ID              = 1
            LANGUAGE        = 2
            NAME            = 3
            NOT_FOUND       = 4
            OBJECT          = 5
            REFERENCE_CHECK = 6
            OTHERS          = 7.
  IF SY-SUBRC EQ '0'.
    LOOP AT TB_LINE1.
      MOVE TB_LINE1-TDLINE TO TB_TESTO-TDLINE.
      MOVE TB_EKPO-EBELP  TO TB_TESTO-EBELP.
      APPEND TB_TESTO.
    ENDLOOP.
    FREE TB_LINE1.
    CLEAR TB_TESTO.
  ENDIF.

I've debugged the read text in ME23, and compare with this, the difference is that in ME23 make an IMPORT CATALOG FROM MEMORY ID 'SAPLSTXD' that not fails.

In the code above this import fails.

Read only

0 Likes
1,526

Hi,

Did u try the same in SE37???

I am thinking that some of the parameters u r passing must be wrong. Just try to compare ME23N=>Select texts tab for that item, Select script editor in drop down list(Option 3) (Bottom side).

Menu=>goto=>Header. Compare if there is any descripency.

I can see its working in my system.

Also instead of hard coding try to declare variables/constants of same type as FM interface.

Thanks,

Vinod.

Read only

0 Likes
1,526

The parameters is correct :

http://www.pchs.it/image-hosting/out.php/i5893_Immagine.JPG.

The variables are already declared like type of FM interfaces.

Is a strange problem 😕

Read only

0 Likes
1,526

Hi,

In text ID r u passing F03 or FO3?

It should be F03(F zero 3). Copy paste all parameters from ME23N into ur code.

Can you check it carefully? Also just remove hard coding and see. It really don't matter. But still u can give a try. Apart from this i dont see any descrepency.

Thanks,

Vinod.

Read only

Former Member
0 Likes
1,526

Angelo,

check the language key.

check if you have text maintained in the same langauage as you are passing it to FM.

Read only

0 Likes
1,526

For Vinod Reddy: Yes, F zero 3 is the same of function.

For santosh sarda: The language is Italian and the text work in italian language.

The unique difference that i've seen from another PO is this :

http://www.pchs.it/image-hosting/out.php/i5903_Immagine3.JPG

I don't know how to change this status ' * '. Another PO work fine with blank status.

Read only

0 Likes
1,526

Instead of FM read_text_inline , try using READ_TEXT only.

Read only

0 Likes
1,526

Is the same, i've tryed using READ_TEXT, however inside READ_TEXT_INLINE there is READ_TEXT .

Read only

0 Likes
1,526

what is the sy-subrc value you are getting after FM execution. try to map it with exception and see where the error is.

also test it with another PO so you will come to know if this the problem with that perticular PO only.

Read only

0 Likes
1,526

The sy-subrc exception is refered to NOT_FOUND. I don't know if there is a aparticular PO that have problem with the READ_TEXT, the problem is trange because when i set a breakpoint into READ_TEXT and when I run me23 in debug the READ_TEXT work fine because the CATALOG(Internal Structure) is FILLED from IMPORT CATALOG FROM MEMORY ID 'SAPLSTXD'.

In custom program this don't happen because this IMPORT fail.