cancel
Showing results for 
Search instead for 
Did you mean: 

function module read_text

Former Member
0 Kudos

hi all,

can anybody tell me how to use functional module read_text.

it would be great if somebody can explain its functionality through some example.

i want to know its usage

thanks

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi..,

Check this example .. it retrieves the materials and their short texts from database tables..

and Long texts from Text modules .. by using READ_TEXT function module..

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

regards,

sai ramesh

former_member181962
Active Contributor
0 Kudos

It is a very well documented FM. What elese do you require?

Go to se37.

Give the name of the FM. Press Display.

Click on the Function MOdule Documentation button on the application toobar.

For sampe usage , you can do a where used list on the FM name.

Regards,

Ravi

Former Member
0 Kudos

hi Kunal,

Refer

http://www.sap-basis-abap.com/sapac002.htm

Regards,

Santosh

Former Member
0 Kudos