cancel
Showing results for 
Search instead for 
Did you mean: 

sample program how to read lines using read_text

Former Member
0 Kudos

a sample program of how to read the lines. The table i am using is AUFK, the feild is OBJNR, Clearly specify how to read the lines from the function READ_TEXT.

This is the question to use the function module 'Read-Text' with the id (prepared with order object number), concatenate the lines into one string separated by ' '.

Accepted Solutions (1)

Accepted Solutions (1)

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Here is a sample. There are many ids under the AUFK object. You must find the one that fits your needs.




report zrich_0001
       no standard page heading.



data: begin of ttab occurs 0.
        include structure tline.
data: end of ttab.

data: name like thead-tdname.

parameters: p_aufnr type aufk-aufnr.


concatenate sy-mandt p_aufnr into name.

perform read_text tables ttab
                  using  'KOPF'
                         'AUFK'
                         name.

loop at ttab.
  write:/ ttab.
endloop.


************************************************************************
* READ_TEXT.
************************************************************************
form read_text tables tab
               using  id
                      object
                      name.

  data: begin of header.
          include structure thead.
  data: end of header.

  clear tab.  refresh tab.

  call function 'READ_TEXT'
       exporting
            client                  = sy-mandt
            id                      = id
            language                = sy-langu
            name                    = name
            object                  = object
       importing
            header                  = header
       tables
            lines                   = tab
       exceptions
            id                      = 1
            language                = 2
            name                    = 3
            not_found               = 4
            object                  = 5
            reference_check         = 6
            wrong_access_to_archive = 7
            others                  = 8.


endform.

Object AUFK.

IDs......



AFFV     Proc.instruction charact.text
AVOT     Transaction text             
FHMT     PRT text                     
KOPF     Order header text            
LTXT     Order text                   
MATK     Component text               
MKMT     Text for characteristic      
MSTT     Milestone text               
POSN     Order item text              
RMEL     Order confirmation text      
SEQU     Order sequence text          
SUBM                                  
VSAV     Transaction text (versions)  
VSKO     Order header text (versions) 
VSMA     Component text (versions)    
VSMS     Milestone text (versions)    


Regards,

Rich Heilman

Answers (4)

Answers (4)

Former Member
0 Kudos

hi ,

If you want to read the status of the production order/Service order the Read_Text doesn't help you.

In this case please use.

*--CHECK ORDER STATUS

I_PROD-OBJNR = OBJENR at Order level

CALL FUNCTION 'STATUS_TEXT_EDIT'

EXPORTING

FLG_USER_STAT = 'X'

OBJNR = I_PROD-OBJNR

SPRAS = 'E'

IMPORTING

LINE = V_SY_TXT

  • USER_LINE = V_ST_TXT

EXCEPTIONS

OBJECT_NOT_FOUND = 1

OTHERS = 2.

*--CHECK USER STATUS AT OPERATION LEVEL

I_PROD-OBJNR1 = ONJNR at operation level

CALL FUNCTION 'STATUS_TEXT_EDIT'

EXPORTING

FLG_USER_STAT = 'X'

OBJNR = I_PROD-OBJNR1

SPRAS = 'E'

IMPORTING

LINE = V_ST_TXT

USER_LINE = V_SS_TXT

E_STSMA = ZSTSMA

EXCEPTIONS

OBJECT_NOT_FOUND = 1

OTHERS = 2.

Former Member
0 Kudos

Hi,

Please find the below code.

call function 'READ_TEXT'

exporting

client = sy-mandt

id = c_grun "ID OF text

language = p_spras

name = lv_name

object = c_material

tables

lines = it_lines

exceptions

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

others = 8.

lv_name is the material number in this case.

Hope this will help.

Thanks,

Vamsi.

Former Member
0 Kudos

data: stxh type stxh,

thead type thead.

data: tline like standard table of tline.

DATA: STRING TYPE STRING.

select single * into stxt from stxh

where tdobject = <YOUR OBJECT>

and tdname = AUFK-OBJNR

and tdid = <YOUR ID>

and tdspras = <YOUR LANGUAGE>.

check sy-subrc = 0.

move-corresponding text to thead.

call function 'READ_TEXT'

exporting

id = thead-tdid

language = thead-tdspras

name = thead-tdname

object = thead-tdobject

importing

header = thead

tables

lines = tline.

LOOP AT TLINE-LINES.

V_LEN = STRLEN( TLINE-LINES ).

CONCATENATE TLINE-LINES(V_LEN) STRING INTO STRING

SEPARATED BY SPACE.

ENDLOOP.

Max

Former Member
0 Kudos

Hi,

Please use the following code.

Change the values wherever required

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

ID = P_C_ID

LANGUAGE = SY-LANGU

NAME = P_G_OBJ_NAME

OBJECT = P_C_OBJECT

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

LINES = it_TLINE

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

.

data : l_str(132) type c,

l_str1(1000) type c.

LOOP AT IT_TLINE.

CLEAR L_STR.

move IT_TLINE-TDLINE TO L_STR.

concatenate l_str1 l_str into l_str1.

endloop.

Hope this helps.

Lokesh

Pls. rewards appropriate points.