Application Development 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_Text - Not Working

Former Member
0 Kudos

Hi All,

I am not understanding why this FM : Read_Text is not working in my report.Tell me the solution for this issue.

REPORT ZTEST_PRO_DU1.

DATA: BEGIN OF T_TEXT OCCURS 0.

INCLUDE STRUCTURE tline. " Text Lines

DATA: END OF T_TEXT.

DATA: TDNAME type THEAD-TDNAME,

TDID type THEAD-TDID,

TDOBJECT type THEAD-TDOBJECT.

TDID = 'PROC'.

TDNAME = '0000400009'.

TDOBJECT = 'J1IF'.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = TDID

language = sy-langu

name = TDNAME

object = TDOBJECT

TABLES

lines = t_text

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 ne 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF. " IF sy-subrc

Here table t_text doesn't have any values.

Thankx in advance,,,,,

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Declare the parameters which you are transferring to function module exactly of same type as they are declared in function module.

Compare your program with this sample code.


REPORT  z_test1.
 
TABLES:
  thead.
 
PARAMETERS:
  p_vbeln TYPE vbak-vbeln.
 
PARAMETERS:
  p_textid TYPE thead-tdid.
 
DATA:
  BEGIN OF t_thead OCCURS 0.
        INCLUDE STRUCTURE thead.
DATA:
END OF t_thead.
DATA:
  w_line TYPE i,
  w_idx TYPE i,
  w_flag TYPE i.
DATA:
  BEGIN OF t_tline OCCURS 0.
        INCLUDE STRUCTURE tline.
DATA:
END OF t_tline.
 
DATA:
  w_test TYPE thead-tdname.

 
START-OF-SELECTION.
  w_test = p_vbeln.
 
  CALL FUNCTION 'READ_TEXT'
    EXPORTING
      client                  = sy-mandt
      id                      = p_textid
      language                = sy-langu
      name                    = w_test
      object                  = 'VBBK'
    TABLES
      lines                   = t_tline
    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 NE 0.
  MESSAGE 'NO TEXT EXITS FOR THIS TEXT ID' TYPE 'I'. 
ENDIF.
 
END-OF-SELECTION.
 
  LOOP AT t_tline.
    WRITE: / t_tline-tdline.
  ENDLOOP.

Regards

Abhijeet

4 REPLIES 4

Former Member
0 Kudos

Hi,

Declare the parameters which you are transferring to function module exactly of same type as they are declared in function module.

Compare your program with this sample code.


REPORT  z_test1.
 
TABLES:
  thead.
 
PARAMETERS:
  p_vbeln TYPE vbak-vbeln.
 
PARAMETERS:
  p_textid TYPE thead-tdid.
 
DATA:
  BEGIN OF t_thead OCCURS 0.
        INCLUDE STRUCTURE thead.
DATA:
END OF t_thead.
DATA:
  w_line TYPE i,
  w_idx TYPE i,
  w_flag TYPE i.
DATA:
  BEGIN OF t_tline OCCURS 0.
        INCLUDE STRUCTURE tline.
DATA:
END OF t_tline.
 
DATA:
  w_test TYPE thead-tdname.

 
START-OF-SELECTION.
  w_test = p_vbeln.
 
  CALL FUNCTION 'READ_TEXT'
    EXPORTING
      client                  = sy-mandt
      id                      = p_textid
      language                = sy-langu
      name                    = w_test
      object                  = 'VBBK'
    TABLES
      lines                   = t_tline
    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 NE 0.
  MESSAGE 'NO TEXT EXITS FOR THIS TEXT ID' TYPE 'I'. 
ENDIF.
 
END-OF-SELECTION.
 
  LOOP AT t_tline.
    WRITE: / t_tline-tdline.
  ENDLOOP.

Regards

Abhijeet

Former Member
0 Kudos

Hi,

TDID = 'PROC'.

TDNAME = '0000400009'.

TDOBJECT = 'J1IF'.

check if the text id you provided is available or not in the login language..

regards

padma

Former Member
0 Kudos

Hi,

Run the function module READ_TEXT in SE37 , enter ur id,object,name,language . check whether any records are exists in the server or not.

Thnaks,

Former Member
0 Kudos

hi.

whenever you use the function module read_text.you need to create a text object through transacton so10.here you have to fill in the lines whoch you need to display after calling this function module.

you need to pass these lines in the table t_text.

since you havnt passed anything in t_text,its not displaying anything..

just check the text object and lemme know...