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

READ_TEXT

Former Member
0 Likes
1,060

I have declared

gt_itm_texts in Global Data.

and i have wrrite Routine in Form Routines

 CALL FUNCTION 'READ_TEXT'
      EXPORTING
        id                      = 'BEST'
        language                = 'E'
        name                    = ls_text-tdname
        object                  = 'MATERIAL'
        archive_handle          = 0
      TABLES
        lines                   = lt_texts
      EXCEPTIONS
        id                      = 1
        language                = 2
        name                    = 3
        not_found               = 4
        object                  = 5
        reference_check         = 6
        wrong_access_to_archive = 7
        OTHERS                  = 8.

    CLEAR : ls_text,ls_text-tdname.

    LOOP AT lt_texts INTO ls_text.
      APPEND ls_text TO gt_itm_texts.
    ENDLOOP.

it gives an error gt_itm_texts not declared ...

what can be the solution for this where i have declared it in Global Data.

12 REPLIES 12
Read only

former_member189629
Active Contributor
0 Likes
1,034

Abhishek,

does gt_itm_texts refer to THEAD? If not, change it accordingly to refer to THEAD.

Read only

former_member404244
Active Contributor
0 Likes
1,034

Hi,

try like this..

perform read_text using gt_itm_texts .

Regards,

Nagaraj

Read only

0 Likes
1,034

then how to use gt_itm_texts in read_text routine.

Read only

0 Likes
1,034

Hi

try like this

perform read_text using ls_text,ls_text-tdname

changing gt_itm_texts .

Regards,

Nagaraj

Read only

0 Likes
1,034
*&---------------------------------------------------------------------*
*&      Form  f_read_text
*&---------------------------------------------------------------------*
FORM f_read_text USING p_id p_name p_object
changing c_txt type ty_text.
  DATA : lt_texts  TYPE  TABLE OF ty_text.

  CALL FUNCTION 'READ_TEXT'
    EXPORTING
      id                      = p_id
      language                = 'E'
      name                    = p_name
      object                  = p_object
    TABLES
      lines                   = lt_texts
    EXCEPTIONS
      id                      = 1
      language                = 2
      name                    = 3
      not_found               = 4
      object                  = 5
      reference_check         = 6
      wrong_access_to_archive = 7
      OTHERS                  = 8.

  LOOP AT lt_texts INTO ls_text.
      APPEND ls_text TO c_txt.
    ENDLOOP.
ENDFORM.                    "f_read_text

i have used the above code but still giving error...

Read only

0 Likes
1,034

any clues ???

Read only

0 Likes
1,034

Change your form interface as follows and change the corresponding perform accordingly.

FORM f_read_text <b>TABLES</b> c_txt type ty_text USING p_id p_name p_object.

Read only

0 Likes
1,034

I have used but it throws error

<b>@8O@	Global Definitions	"C_TXT" is not an internal table - the "OCCURS n" specification is missing.</b>

*&---------------------------------------------------------------------*
*&      Form  f_read_text
*&---------------------------------------------------------------------*
FORM f_read_text USING p_id p_name p_object CHANGING c_flg
                TABLES c_txt TYPE ty_text.

  DATA : lt_texts  TYPE  TABLE OF ty_text,
         ls_text   TYPE  ty_text.

  CALL FUNCTION 'READ_TEXT'
    EXPORTING
      id                      = p_id
      language                = 'E'
      name                    = p_name
      object                  = p_object
    TABLES
      lines                   = lt_texts
    EXCEPTIONS
      id                      = 1
      language                = 2
      name                    = 3
      not_found               = 4
      object                  = 5
      reference_check         = 6
      wrong_access_to_archive = 7
      OTHERS                  = 8.

  LOOP AT lt_texts INTO ls_text.
    APPEND ls_text TO c_txt.
    c_flg = 'X' .
  ENDLOOP.
ENDFORM.                    "f_read_text

Read only

0 Likes
1,034

I have used but it throws error


<b>@8O@	Global Definitions	"C_TXT" is not an internal table - the "OCCURS n" specification is missing.</b>

*&---------------------------------------------------------------------*
*&      Form  f_read_text
*&---------------------------------------------------------------------*
FORM f_read_text USING p_id p_name p_object CHANGING c_flg
                TABLES c_txt TYPE ty_text.
 
  DATA : lt_texts  TYPE  TABLE OF ty_text,
         ls_text   TYPE  ty_text.
 
  CALL FUNCTION 'READ_TEXT'
    EXPORTING
      id                      = p_id
      language                = 'E'
      name                    = p_name
      object                  = p_object
    TABLES
      lines                   = lt_texts
    EXCEPTIONS
      id                      = 1
      language                = 2
      name                    = 3
      not_found               = 4
      object                  = 5
      reference_check         = 6
      wrong_access_to_archive = 7
      OTHERS                  = 8.
 
  LOOP AT lt_texts INTO ls_text.
    APPEND ls_text TO c_txt.
    c_flg = 'X' .
  ENDLOOP.
ENDFORM.                    "f_read_text

Read only

0 Likes
1,034

What is the definition of your "ty_text"? If it is not defined as table type, you can use TABLES c_txt TYPE ty_text OCCURS 0, or you can leave it untyped "TABLES c_txt".

TABLES is now obsolete, you can use USING, and CHANGING to achieve the same.

Read only

Former Member
0 Likes
1,034

hi

good

go through this code

The following code is a function that will return a customer comment.

form get_comment using cur_kunnr.

call function 'READ_TEXT'

exporting

id = '0002'

language = sy-langu

object = 'KNA1'

name = cur_kunnr

importing

header = thead

tables

lines = tlinetab

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.

loop at tlinetab.

write / tlinetab-tdline.

add 1 to line_cnt.

endloop.

endif.

endform.

The above subroutine is called with the following code:

if p_cmnt = 'X'.

tdname = cur_cust-kunnr.

perform get_comment using tdname.

endif.

These data elements are defined as:

data: begin of tlinetab occurs 100. "table to process comments

include structure tline.

data: end of tlinetab.

data: tdname like thead-tdname.

reward point if helpful.

thanks

mrutyun^

Read only

Former Member
0 Likes
1,034
TABLES: mara.                                                    
DATA: g_name   LIKE thead-tdname.                                
DATA: g_tline LIKE tline OCCURS 0 .                                                                 
PARAMETERS: p_matnr LIKE mara-matnr.                                                                      
CLEAR: g_name.                                                   
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'                      
     EXPORTING                                                   
          input        = p_matnr                                 
     IMPORTING                                                   
          output       = g_name                                  
     EXCEPTIONS                                                  
          length_error = 1                                       
          OTHERS       = 2.                                      
CALL FUNCTION 'READ_TEXT'                                        
     EXPORTING                                                   
*         CLIENT                  = SY-MANDT                     
          id                      = 'BEST'                       
          language                = 'D'                          
          name                    = g_name                       
          object                  = 'MATERIAL'                   
*         ARCHIVE_HANDLE          = 0                            
*    IMPORTING                                                   
*         HEADER                  =                              
     TABLES                                                      
          lines                   = g_tline                      
    EXCEPTIONS                                     
         id                      = 1               
         language                = 2               
         name                    = 3               
         not_found               = 4               
         object                  = 5               
         reference_check         = 6               
         wrong_access_to_archive = 7               
         OTHERS                  = 8               
          .                                        
     

you see the long text in IntTab: g_tline