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

Issue with Read_Text FM

Former Member
0 Likes
3,865

Hi All,

I am using the FM Read_Text for reading text from S010 but its behaving strangely. With the same data if i execute the FM in SE37 transaction, i am getting proper results but while executing in ABAP , its not returning any data as well as no exception. Below is the code written, please suggest if i am lacking something.

   DATA BEGIN OF TEXTHEADER.
        INCLUDE STRUCTURE THEAD.
DATA END OF TEXTHEADER.

DATA BEGIN OF LINES OCCURS 10.
        INCLUDE STRUCTURE TLINE.
DATA END OF LINES.

   DATA: name like THEAD-TDNAME,
      object LIKE THEAD-TDOBJECT,
      ID like THEAD-TDID.

CLEAR TEXTHEADER.

   ID = '0001'.
name = GS_HD_REF-ORDER_NUMB.
object = 'VBBK'.

   CALL FUNCTION 'READ_TEXT'
  EXPORTING
   CLIENT                        = SY-MANDT
    id                            = ID
    language                      = sy-langu
    name                          = name
    object                        = object
*   ARCHIVE_HANDLE                = 0
*   LOCAL_CAT                     = ' '
IMPORTING
   HEADER                        = TEXTHEADER
  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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

I checked the values while debugging & executed the FM with same values in SE37 which displays the correct results but in the program i am not getting any results.

regards

Sumit

12 REPLIES 12
Read only

RaymondGiuseppi
Active Contributor
0 Likes
3,415

If the FM performs fine in SE37, execute it in debug mode and check the exact format of received parameters, SE37 will perform conversion-exit between your input and actual exported parameters, and not your report.

Check GS_HD_REF-ORDER_NUMB format/length vs THEAD-NAME? I suppose something like a wrong right justify padded with 0 ?

Regards,

Raymond

Read only

guilherme_frisoni
Contributor
0 Likes
3,415

Hi Sumit,

First you said you want to read a text from SO10, but in your code you are using:

id = '0001'.

object = 'VBBK'.

This object are not related to SO10, it is a standard text from Sales Order Header.

In this scenario you should use VBAK-VBELN in your "name" variable.

Regards,

Frisoni

Read only

0 Likes
3,415

Hi Frisoni,

I want to read the Sales Order Header only & i am getting it correct in SE37. Problem is with the program, i am still checking that.

regards

Sumit

Read only

0 Likes
3,415

Well, possible errors are missing leading zeros at left in VBELN number, or wrong language. Are you logging in SAP in the same language that text was written?

Frisoni

Read only

Former Member
0 Likes
3,414

Hi Sumit,

Try to pass the same value as you input in the FM READ_TEXT.

Get the exact values from TEXT HEADER as given in the sample screenshot.

Most probably it's should be because of leading zeros issue.

Regards,

Amit

Read only

0 Likes
3,414

Hi Amit,

I checked the transaction SE37 & header data, its same as while debugging. Screenshots are attached but still not getting the data in abap program.

regards

Sumit

Read only

0 Likes
3,414

Dear Sumit,

I tested your program code and it's working fine.

If you are passing the correct values then there should not be any issue.

Please check again.

Regards,

Amit

Read only

0 Likes
3,414

Language should be EN May be there is conversion exit.

Read only

0 Likes
3,414

Sy-langu is single character hence 'E' is fine.

Sumit,

there is nothing wrong with your code.  try with different test cases.

Regards,

Amit

Read only

Former Member
0 Likes
3,414

I have used this function module but declared my table differently.

data: lines type table of tline.

That's the only difference I notice between your code and mine.

Read only

Former Member
0 Likes
3,414

hello sumit,

follow this code:

   DATA BEGIN OF TEXTHEADER.
         INCLUDE STRUCTURE THEAD.
DATA END OF TEXTHEADER.

DATA BEGIN OF LINES OCCURS 10.
         INCLUDE STRUCTURE TLINE.
DATA END OF LINES.

    DATA: name like THEAD-TDNAME,
       object LIKE THEAD-TDOBJECT,
       ID like THEAD-TDID.



CLEAR TEXTHEADER.



    ID = 'ST'.
name = 'ZSABYA'.
object = 'TEXT'.



    CALL FUNCTION 'READ_TEXT'
   EXPORTING
    CLIENT                        = SY-MANDT
     id                            = ID
     language                      = sy-langu
     name                          = name
     object                        = object
*   ARCHIVE_HANDLE                = 0
*   LOCAL_CAT                     = ' '
IMPORTING
    HEADER                        = TEXTHEADER
   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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

LOOP AT LINES.
   WRITE😕 LINES-TDLINE.
   ENDLOOP.

Hope it will be helpfull......

Thanks

Sabyasachi

Read only

Former Member
0 Likes
3,414

hello,

follow this below link.....

http://scn.sap.com/thread/1391513

helpfull for you,

Thanks

Sabyasachi