Skip to Content
0
Former Member
Mar 24, 2010 at 06:45 PM

Using FM READ_TEXT in User Exit - passing value to NAME parameter

548 Views

Hi Gang,

I have data stored in Text Table STXL which I wish to append to a generic data source using the READ_TEXT fuction module.

I am storing this text in a CHAR 20 field ZZMC1. Howerver, the ZZMC1 is always blank. The point of failure seems to be passing the value from the user exit I_T_DATA-TDNAME to the NAME parameter of INIT_TEXT.

Unfortunately, I'm getting no errors - just blanks in the ZZMC1 fields. I am not an ABAPer, but I've pieced together the code below from samples. Any suggestions greatly appreciated.

John Hawk

___

___

REPORT ZBWI_ZDOC_NUMBER_ZMC1_ATTR.
*--- User exit program for datasource ZDOC_NUMBER_ZMC1_ATTR

TYPE-POOLS: sbiwa. "Mandatory for typecasting
*&---------------------------------------------------------------------*
*& Form start_user_exit
*&---------------------------------------------------------------------*
FORM execute_user_exit
TABLES I_T_SELECT TYPE SBIWA_T_SELECT
I_T_FIELDS TYPE SBIWA_T_FIELDS
I_T_DATA STRUCTURE ZOXOSD0124 " Datasource structure
C_T_MESSAGES STRUCTURE BALMI.
*-- table definition here (if any) ------------*
*-- local data definition here (if any) ------------*
  DATA: T_LINE_T LIKE TLINE OCCURS 0 WITH HEADER LINE.
  DATA: S_THEAD LIKE THEAD.
  DATA: T_LINE_H LIKE T_LINE_T OCCURS 0 WITH HEADER LINE.

  loop at I_T_DATA.
*--

    CALL FUNCTION 'INIT_TEXT'
      EXPORTING
*      CLIENT   = SY-MANDT
        ID       = 'ZMC1'
        LANGUAGE = 'E'
        *NAME     = I_T_DATA-TDNAME*
        OBJECT   = 'VBBK'
      TABLES
        LINES    = T_LINE_T
      EXCEPTIONS
        ID       = 1
        LANGUAGE = 2
        NAME     = 3
        OBJECT   = 4
        OTHERS   = 5.
    IF SY-SUBRC = 0.
      REFRESH T_LINE_T.

      CALL FUNCTION 'READ_TEXT'
      EXPORTING
      CLIENT = SY-MANDT
      ID = 'ZMC1' "Valid values for the text ID are defined in table TTXID.
      LANGUAGE = 'E'  " Hard code English
      *NAME = I_T_DATA-TDNAME*   "here i am passing Sales order no
      OBJECT = 'VBBK' "The text object is part of the text key and assigns the text module to a specific application object. Valid text objects are defined in table TTXOB.

* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
      IMPORTING
      HEADER = S_THEAD
      TABLES
      LINES = T_LINE_T
      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.
        READ TABLE T_LINE_T INTO T_LINE_H INDEX 1.
* Storing the value in the structure.
        I_T_DATA-ZZMC1 = T_Line_H-TDLINE.

      ENDIF.
      ENDIF.

    endloop.
  ENDFORM. " start_user_exit

Edited by: John Hawk on Mar 24, 2010 7:48 PM