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: 

Reading Header Text from PO

Former Member
0 Kudos

Hi,

I want to use READ_TEXT and retrieve the Header Text in the PO. Can anyone Provide me a sample code? i want to display this in a script. and pls tell the structure of the internal table too.

6 REPLIES 6

Former Member
0 Kudos

Function call:

CALL FUNCTION 'READ_TEXT'

EXPORTING CLIENT = SY-MANDT

OBJECT = ?...

NAME = ?...

ID = ?...

LANGUAGE = ?...

ARCHIVE_HANDLE = 0

IMPORTING HEADER =

TABLES LINES = ?...

EXCEPTIONS ID =

LANGUAGE =

NAME =

NOT_FOUND =

OBJECT =

REFERENCE_CHECK =

WRONG_ACCESS_TO_ARCHIVE =

Export parameters:

CLIENT

Specify the client under which the text is stored. If you omit this parameter, the system uses the current client as default.

Reference field: SY-MANDT

Default value: SY-MANDT

OBJECT

Enter the name of the text object to which the text is allocated. Table TTXOB contains the valid objects.

Reference field: THEAD-TDOBJECT

NAME

Enter the name of the text module. The name may be up to 70 characters long. Its internal structure depends on the text object used.

Reference field: THEAD-TDNAME

ID

Enter the text ID of the text module. Table TTXID contains the valid text IDs, depending on the text object.

Reference field: THEAD-TDID

LANGUAGE

Enter the language key of the text module. The system accepts only languages that are defined in table T002.

Reference field: THEAD-TDSPRAS

Reward points for useful Answers

Regards

Anji

Former Member
0 Kudos

<b>Reward points if helpfull.</b>

First find the header values for the text. To find it go to the required PO text and double click to go to the editor. Then on the menu Goto-> Header

Pick the below values (I've provided some junk values)

Text Name : 4500000525

Text ID : F01

Text object : EKKO

After finding the values call FM READ_TEXT with required parameters


data i_TLINE type standard table of TLINE with header line.

CALL FUNCTION 'READ_TEXT'
  EXPORTING
    id                            = 'F01'
    language                      = sy-langu
    name                          = '4500000525'
    object                        = 'EKKO'
  tables
    lines                         = i_tline
 EXCEPTIONS
   ID                            = 1
   LANGUAGE                      = 2
   NAME                          = 3
   NOT_FOUND                     = 4
   OBJECT                        = 5
   REFERENCE_CHECK               = 6
   WRONG_ACCESS_TO_ARCHIVE       = 7
   OTHERS                        = 8.

Former Member
0 Kudos

Hi Naveen,

may be helpful this,

data: lv_id type thead-tdid value 'F01',

lv_language type thead-tdspras value 'E',

lv_name type thead-tdname,

lv_object type thead-tdobject value 'EKKO'.

data : tline type standard table of tline initial size 0,

wa_tline type tline.

parameters : p_ebeln type ekpo-ebeln.

start-of-selection.

CALL FUNCTION 'READ_TEXT'

EXPORTING

ID = lv_id

LANGUAGE = lv_language

NAME = p_ebeln

OBJECT = lv_object

TABLES

LINES = tline.

  • IF SY-SUBRC eq 0.

  • else.

  • Message 'No Text Exits' Type 'E'.

  • ENDIF.

loop at tline into wa_tline.

write:/10 wa_tline-tdline color 1.

endloop.

endloop.

Regards,

Vishvesh

if answers helpful, please rewards it.

Former Member
0 Kudos

Hi Krishnan,

Do the following steps to get the header text.

1. go to Tcode 'ME23N'. There press the texts tab in header block.

2. select which text u want and double click on the editor.

3. Now text editor will open. in that from menu bar > goto>header.

4. note the following details.

example. text name = 0040010566

textid = 'F01'

textobject = 'EKKO'

Language = 'EN'

Now in driver program write the following code.

DATA: BEGIN OF tlines OCCURS 10.
        INCLUDE STRUCTURE tline.
DATA: END OF tlines.
Data  entries  LIKE sy-tfill.

CALL FUNCTION 'READ_TEXT'
       EXPORTING
            id          = text_id
            language  = lang
            name      = text_name
            object    = text_obj
       IMPORTING
            entries   = entries
       TABLES
            lines     = lines
       EXCEPTIONS
            id        = 1
            language  = 2
            name      = 3
            not_found = 4.

read table lines index 1.
v_text = lines-tdline.

  • for this code u will read first line text. if u want all lines means use table tlines and pass this table for tables parameter of scripts.

reward points if helpful.

Thanks,

Suma.

Former Member
0 Kudos

upto FM in the previous code will get all lines of text in <b>lines</b> table. u can use that table directly instead of reading first line like that.

0 Kudos

hi,,

I tried as above but it is goin to dump...

TYPE CONFLICT WHEN CALLING A FUNCTION MODULE.

pls help