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 FM

Former Member
0 Kudos

Hi all,

what is the use of Read_Text Function Module. Pls provide me some sample examples.

Thanks & Regards,

praveena.

1 ACCEPTED SOLUTION

former_member588853
Active Contributor
0 Kudos

HI,

here is the sample program..

&----


*& Report YTEST12345 *

*& *

&----


*& *

*& *

&----


REPORT YTEST12345 .

data : head like THEAD.

constants : c_dnum like thead-tdname value '1000000146'.

data : it_line like tline occurs 0 with header line.

data : it_line1 like tline occurs 0 with header line.

perform sub_read_text using '0001' C_dnum 'VBBK'.

it_line1[] = it_line[].

perform sub_read_text using 'Z104' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using 'Z124' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using 'Z127' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using 'Z125' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using 'Z121' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using 'Z122' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using 'Z125' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using 'Z107' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using 'Z102' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using '0001' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using '0004' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z002' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z002' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z003' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z004' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z005' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z006' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z007' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z008' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z009' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z010' c_dnum 'VBBP'.

perform sub_save_text.

break-point.

form sub_read_text using id like THEAD-TDID

name like thEAD-Tdname

object like THEAD-TDobject.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = id

LANGUAGE = sy-langu

NAME = name

OBJECT = object

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

IMPORTING

HEADER = head

TABLES

LINES = it_line

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.

CALL FUNCTION 'INIT_TEXT'

EXPORTING

ID = id

LANGUAGE = sy-langu

NAME = name

OBJECT = object

IMPORTING

HEADER = head

TABLES

LINES = it_line

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • OBJECT = 4

  • OTHERS = 5

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDIF.

endform.

form sub_save_text.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

HEADER = head

  • INSERT = ' '

SAVEMODE_DIRECT = 'X'

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • FUNCTION =

  • NEWHEADER =

TABLES

LINES = it_Line1

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5

.

commit work.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endform.

reward points if helpful,

regards,

nazeer

10 REPLIES 10

Former Member
0 Kudos

Hi...

<b>READ_TEXT </b>

READ_TEXT provides a text for the application program in the specified work areas.

The function module reads the desired text from the text file, the text memory, or the archive. You must fully specify the text using OBJECT, NAME, ID, and LANGUAGE. An internal work area can hold only one text; therefore, generic specifications are not allowed with these options.

After successful reading, the system places header information and text lines into the work areas specified with HEADER and LINES.

If a reference text is used, SAPscript automatically processes the reference chain and provides the text lines found in the text at the end of the chain. If an error occurs, the system leaves the function module and triggers the exception REFERENCE_CHECK.

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

ARCHIVE_HANDLE

If you want to read the text from the archive, you must enter a handle here. The system uses it to access the archive. You can create the handle using the function module ACHIVE_OPEN_FOR_READ.

The value '0' indicates that you do not want to read the text from the archive.

Reference field: SY-TABIX

Default value: 0

Import parameters:

HEADER

If the system finds the desired text, it returns the text header in this parameter.

Structure: THEAD

Table parameters:

LINES

The table contains all text lines that belong to the text read.

Structure: TLINE

Exceptions:

ID

The text ID specified in the parameter ID does not exist in table TTXID. It must be defined there together with the object of the text module.

LANGUAGE

The parameter LANGUAGE contains a language key that does not exist in table T002.

NAME

The parameter NAME contains the name of a text module that does not correspond to the SAPscript conventions.

Possible errors:

The field contains only blanks.

The field contains the invalid characters ‘*’ or ‘,’.

OBJECT

The parameter OBJECT contains the name of a text object that does not exist in table TTXOB.

NOT_FOUND

The system did not find the specified text module.

REFERENCE_CHECK

The text module to be read has no text lines of its own but refers to the lines of another text module. This reference chain can include several levels. For the current text, the chain is interrupted, that is, one of the text modules referred to in the chain no longer exists.

WRONG_ACCESS_ TO_ARCHIVE

The exception WRONG_ACCESS_TO_ARCHIVE is triggered if an archive is accessed using an incorrect or non-existing archive handle or an incorrect mode (that is, read if the archive is open for writing or vice versa).

Former Member
0 Kudos

Hi,

read_text is a function module which can read the standard text by the object key,object id, Object name and language. IT would get the text in an internal table

Sample code:

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = business_partner

IMPORTING

output = business_partner.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = contract_account

IMPORTING

output = contract_account.

wa_thead-tdid = 'FKK'.

wa_thead-tdspras = sy-langu.

CONCATENATE contract_account business_partner INTO wa_thead-tdname.

wa_thead-tdobject = 'FKKVKP'.

CASE flag.

WHEN 'R'.

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = wa_thead-tdid

language = wa_thead-tdspras

name = wa_thead-tdname

object = wa_thead-tdobject

IMPORTING

header = wa_thead

TABLES

lines = notes

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

WHEN 'I'.

wa_thead-tdfuser = sy-uname.

wa_thead-tdfdate = sy-datum.

wa_thead-tdftime = sy-uzeit.

wa_thead-mandt = sy-mandt.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

header = wa_thead

insert = 'X'

savemode_direct = 'X'

IMPORTING

newheader = wa_thead

TABLES

lines = notes

EXCEPTIONS

id = 1

language = 2

name = 3

object = 4

OTHERS = 5.

WHEN 'D'.

REFRESH notes.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

header = wa_thead

savemode_direct = 'X'

IMPORTING

newheader = wa_thead

TABLES

lines = notes

EXCEPTIONS

id = 1

language = 2

name = 3

object = 4

OTHERS = 5.

WHEN 'M'.

wa_thead-tdluser = sy-uname.

wa_thead-tdldate = sy-datum.

wa_thead-tdltime = sy-uzeit.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

header = wa_thead

savemode_direct = 'X'

IMPORTING

newheader = wa_thead

TABLES

lines = notes

EXCEPTIONS

id = 1

language = 2

name = 3

object = 4

OTHERS = 5.

ENDCASE.

Former Member
0 Kudos

In order to process text modules in application programs, all

information about a text module must be transferred to internal work

areas.

A text is read from the text file or text memory with this function

module. It must be described fully by specifying OBJECT, NAME, ID, and

LANGUAGE. Generic entries in these parameters are not valid.

When header information and text lines have been read successfully, they

are transferred to the work areas HEADER and LINES.



  CALL FUNCTION 'READ_TEXT'
          EXPORTING
               ID                      = TDID
               LANGUAGE                = SY-LANGU
               NAME                    = TDNAME
               OBJECT                  = TDOBJECT
          TABLES
               LINES                   = XTLINES
          EXCEPTIONS
               ID                      = 1
               LANGUAGE                = 2
               NAME                    = 3
               NOT_FOUND               = 4
               OBJECT                  = 5
               REFERENCE_CHECK         = 6
               WRONG_ACCESS_TO_ARCHIVE = 7.

Former Member
0 Kudos

Hi,

It is used to fetch the Long texts from the application documents using OBJECT, ID,NAME and LANG fields.

see the doc

The usage of texts in SAP is very generic and it is used for all entities and documents . For example the texts exist for Vendor master / CUstomer master and in Sales as well as Purchase orders at item and header level .The long texts are used to maintain certain informative texts which the user wants to have and major benefit is that the additional long texts can be provided to the user through functional customising in IMG - SPRO you do not need any ABAP exit or enhancement for this.

Now you can maintain these texts programatically using the FM :

CREATE_TEXT

SAVE_TEXT

while you can read the existing texts using the FM ' READ_TEXT' .

For this purpose you can also go thru this blog /people/deepak.bhalla/blog/2005/01/24/storing-and-retreiving-of-texts .

I am giving extract from same below :

Please let me know if you need anything further on this .

********************************************************************

There are following ways of storing text in SAP.

1. Using Text Object and Text ID

2. Using Standard text with placeholders

1. Using Text Object and Text ID:

I am assuming that we already have a data in structure required by function module save_text for tables paramenter lines.

1. Use Transaction SE75 to create Text Object and Text ID.

2. Choose first radio button Text Object and ID's

3. Click at create. It will create Text Object.

4. Create Text ID for Text Object.

Now this created Text ID and Text Object can be used to Save and Retreive texts using following function module.

CALL FUNCTION 'ZSAVE_READ_TEXT'

EXPORTING

Save_read_indicator = 'X'

header = p_header

TABLES

lines = p_line.

Exporting parameter Save_read_inidcator type char1. default 'X' for Save.

Header should be of type thead

Tables parameter lines should be of type tline.

Header values should be populated as follows.

p_header-tdobject = name of the text object created.

p_header-tdname = It can be any Unique name.

p_header-tdid = name of text id created.

p_header-tdspras = sy-langu.

p_header-tdtitle = title of text.

Table P_lines will contain all data that is to be saved.It may be through Text control.

call function module save_text as follows to Save text.

If save_read_indicator = 'X'.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

client = sy-mandt

header = p_header

  • IMPORTING

  • FUNCTION =

  • NEWHEADER =

TABLES

lines = p_line

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • OBJECT = 4

  • OTHERS = 5.

ELSE.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = TEXT_ID

LANGUAGE = SY-LANGU

NAME = Same as TDNAME in Save_text

OBJECT = TEXT_OBJECT

TABLES

LINES = LI_LINE

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 8.

Endif.

2. Using Standard text with placeholders

Here I am assuming that for all placeholders we will have value availble.

1. Maintain standard text with place holder using transaction SO10.

for example :

Dear &1,

Your purchase requisition &2 was approved on &3 .

2. Use following following function module to read Standard text.

CALL FUNCTION 'READ_STDTEXT'

EXPORTING

id = 'ST'

language = sy-langu

name = name of standard text

  • USE_AUX_LANGUAGE = ' '

  • USE_THRUCLIENT = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

lines = p_std_text

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • REFERENCE_CHECK = 5

  • OTHERS = 6.

3. Use following code to replace Placeholders returned in table p_std_text.

Loop at p_std_text.

SEARCH p_std_text-tdline FOR '&1'.

IF sy-subrc = 0.

REPLACE '&1' WITH p_name INTO p_std_text-tdline.

ENDIF.

SEARCH p_std_text-tdline FOR '&2'.

IF sy-subrc = 0.

REPLACE '&2' WITH p_name INTO p_std_text-tdline.

ENDIF.

SEARCH p_std_text-tdline FOR '&3'.

IF sy-subrc = 0.

REPLACE '&3' WITH p_name INTO p_std_text-tdline.

ENDIF.

MODIFY p_std_text.

Endloop

reward if useful

regards,

ANJI

former_member588853
Active Contributor
0 Kudos

HI,

here is the sample program..

&----


*& Report YTEST12345 *

*& *

&----


*& *

*& *

&----


REPORT YTEST12345 .

data : head like THEAD.

constants : c_dnum like thead-tdname value '1000000146'.

data : it_line like tline occurs 0 with header line.

data : it_line1 like tline occurs 0 with header line.

perform sub_read_text using '0001' C_dnum 'VBBK'.

it_line1[] = it_line[].

perform sub_read_text using 'Z104' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using 'Z124' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using 'Z127' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using 'Z125' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using 'Z121' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using 'Z122' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using 'Z125' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using 'Z107' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using 'Z102' c_dnum 'VBBK'.

perform sub_save_text.

perform sub_read_text using '0001' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using '0004' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z002' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z002' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z003' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z004' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z005' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z006' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z007' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z008' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z009' c_dnum 'VBBP'.

perform sub_save_text.

perform sub_read_text using 'Z010' c_dnum 'VBBP'.

perform sub_save_text.

break-point.

form sub_read_text using id like THEAD-TDID

name like thEAD-Tdname

object like THEAD-TDobject.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = id

LANGUAGE = sy-langu

NAME = name

OBJECT = object

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

IMPORTING

HEADER = head

TABLES

LINES = it_line

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.

CALL FUNCTION 'INIT_TEXT'

EXPORTING

ID = id

LANGUAGE = sy-langu

NAME = name

OBJECT = object

IMPORTING

HEADER = head

TABLES

LINES = it_line

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • OBJECT = 4

  • OTHERS = 5

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDIF.

endform.

form sub_save_text.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

HEADER = head

  • INSERT = ' '

SAVEMODE_DIRECT = 'X'

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • FUNCTION =

  • NEWHEADER =

TABLES

LINES = it_Line1

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5

.

commit work.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endform.

reward points if helpful,

regards,

nazeer

Former Member
0 Kudos

Hi ...

Just see the following link....

http://help.sap.com/saphelp_nw04/helpdata/en/d6/0db8d5494511d182b70000e829fbfe/frameset.htm

Reward points if useful......

Suresh......

Former Member
0 Kudos

Hi

In order to process text modules in application programs, all information about a text module must be transferred to internal work areas.

A text is read from the text file or text memory with this function module. It must be described fully by specifying OBJECT, NAME, ID, and LANGUAGE. Generic entries in these parameters are not valid.

When header information and text lines have been read successfully, they are transferred to the work areas HEADER and LINES.

Regards

Haritha.

Former Member
0 Kudos

Hi Praveena,

Check this info.

READ_TEXT

READ_TEXT provides a text for the application program in the specified work areas.

The function module reads the desired text from the text file, the text memory, or the archive. You must fully specify the text using OBJECT, NAME, ID, and LANGUAGE. An internal work area can hold only one text; therefore, generic specifications are not allowed with these options.

After successful reading, the system places header information and text lines into the work areas specified with HEADER and LINES.

If a reference text is used, SAPscript automatically processes the reference chain and provides the text lines found in the text at the end of the chain. If an error occurs, the system leaves the function module and triggers the exception REFERENCE_CHECK.

tables: ekpo,MAKT.

TYPE-POOLS: slis.

DATA: thread LIKE thead.

  • data: P_MATNR1(15) type N.

DATA: BEGIN OF INT_MAKT OCCURS 0,

MATNR LIKE MAKT-MATNR,

MAKTX LIKE MAKT-MAKTX,

  • WERKS LIKE EKPO-WERKS,

END OF INT_MAKT.

DATA: BEGIN OF INT_EKPO OCCURS 0,

MATNR LIKE EKPO-MATNR,

WERKS LIKE EKPO-WERKS,

END OF INT_EKPO.

DATA: BEGIN OF INT_OUT OCCURS 0,

MATNR LIKE EKPO-MATNR,

MAKTX LIKE MAKT-MAKTX,

WERKS LIKE EKPO-WERKS,

TDLINE LIKE TLINE-TDLINE,

END OF INT_OUT.

DATA: it_tlines LIKE tline OCCURS 10 WITH HEADER LINE.

**************************

****ALV list definintion

*************************

DATA: ws_cat TYPE slis_fieldcat_alv ,

int_cat TYPE slis_t_fieldcat_alv WITH HEADER LINE.

DATA: g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',

g_custom_container TYPE REF TO cl_gui_custom_container.

*****************

*selection-screen

*****************

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECTION-SCREEN SKIP 2.

select-options: s_MATNR for EKPO-MATNR obligatory.

SELECT-OPTIONS: s_WERKS FOR EKPO-WERKS OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

PERFORM get_data.

PERFORM field_catalog.

PERFORM display_data.

END-OF-SELECTION.

FORM GET_DATA.

SELECT MATNR WERKS FROM EKPO

INTO CORRESPONDING FIELDS OF TABLE

INT_EKPO

WHERE

EKPO~WERKS in s_WERKS.

sort int_ekpo by werks.

delete adjacent duplicates from INT_EKPO .

SELECT * FROM MAKT INTO CORRESPONDING FIELDS OF TABLE

INT_MAKT

FOR ALL ENTRIES IN INT_EKPO

WHERE MAKT~MATNR = INT_EKPO-MATNR.

**" Read text

*

LOOP AT INT_EKPO.

thread-tdname = INT_EKPO-MATNR.

thread-tdid = 'BEST'.

thread-tdobject = 'MATERIAL'.

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

ID = thread-tdid

LANGUAGE = sy-langu

NAME = thread-tdname

OBJECT = thread-tdobject

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

LINES = it_tlines

*

.

loop at it_tlines.

read table int_MAKT with key matnr = INT_EKPO-MATNR.

int_OUT-MATNR = INT_EKPO-MATNR.

INT_OUT-MAKTX = INT_MAKT-MAKTX.

int_OUT-MAKTX = int_EKPO-WERKS.

int_OUT-TDLINE = it_tlines-tdline.

APPEND INT_OUT.

endloop.

ENDLOOP.

ENDFORM.

FORM field_catalog.

***MATERIAL NO no

int_cat-tabname = 'INT_OUT'.

int_cat-fieldname = 'MATNR'.

int_cat-reptext_ddic = 'MATERIAL NO'.

APPEND int_cat .

*vender name

int_cat-tabname = 'INT_OUT'.

int_cat-fieldname = 'MAKTX'.

int_cat-reptext_ddic = 'MATERIAL SHORT DESCRIPTION'.

APPEND int_cat .

    • PO No

int_cat-tabname = 'INT_OUT'.

int_cat-fieldname = 'TDLINE'.

int_cat-reptext_ddic = 'MATERIAL LONG DESCRIPTION'.

APPEND int_cat .

endform.

&----


*& Form display_data

&----


  • text

----


FORM display_data.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-repid

it_fieldcat = int_cat[]

TABLES

t_outtab = int_out

EXCEPTIONS

program_error = 1

OTHERS = 2.

ENDFORM. "display_data

Hope this resolves your query.

Reward all the helpful answers.

Regards

Former Member
0 Kudos

Hello,

'READ_TEXT' function is used to read text data at header or item level of a particular order.

e.g.

DATA:ls_head TYPE thead,

ls_text TYPE tline,

lt_text TYPE TABLE OF tline,

lv_ebeln TYPE tdobname,

lv_object TYPE THEAD-TDOBJECT VALUE 'EKKO',

lv_id TYPE THEAD-TDID VALUE 'F02',

lv_form TYPE TDFORM VALUE 'SYSTEM'.

CLEAR: ls_head,

ls_text.

WRITE ekko-ebeln TO lv_ebeln.

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = lv_id

language = ekko-spras

name = lv_ebeln

object = lv_object

IMPORTING

header = ls_head

TABLES

lines = lt_text

now lt_text will have the header text of that particular purchase order.

Former Member
0 Kudos

Hi sri,

Data: tid like thead-tdid,

tname like thead-tdid,

tobject like thead-tobject.

data: it_lines like tline occurs 0 with header line.

tid = 'F01'.

tobject = 'EKKO' (this we have to take that which this tid is there that we come to know from transaction).

tname = g_ebeln.

call functiion 'READ_TEXT'

EXPORTING

CLIENT = SY_MANDT

ID = TID

LANGUAGE = 'E'

NAME = TNAME

OBJECT = 'TOBJECT'

TABLE

LINES = IT_LINES

LOOP AT IT_LINES.

V_HT = IT_LINES-TDLINE.

IF V_HT <> ' '.

EXIT.

ENDIF.

ENDLOOP.

see here v_ht is the variable which is indicating to that text.