Dear All,
I'm working on SAP NetWeaver BW 7.3 . I have successfully extracted data from FM READ_TEXT into Custom DataSource (Text DataSource) based on this FM and as we know this FM has decrypted the text stored in various objects of SAP stored in encrypted format in tables STXH and STXL.
When I check its "Extractor" in RSA3 it has been working fine and fetched about 17,408 in SAP ERP PRD. But when I replicated it into BW and create an InfoPackage it shows about 17,408 records and it got stuck on "Yellow" status and do not end with "Green" traffic light. I have asked my BASIS team to check different settings and also requested ABAPer to re-look into the logic/code of FM.
1. Following is the FM code:
FUNCTION YRSAX_BIW_GET_DATA_SIMPLE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_REQUNR) TYPE SRSC_S_IF_SIMPLE-REQUNR
*" VALUE(I_DSOURCE) TYPE SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
*" VALUE(I_MAXSIZE) TYPE SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL
*" VALUE(I_INITFLAG) TYPE SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
*" VALUE(I_READ_ONLY) TYPE SRSC_S_IF_SIMPLE-READONLY OPTIONAL
*" VALUE(I_REMOTE_CALL) TYPE SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF
*" TABLES
*" I_T_SELECT TYPE SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
*" E_T_DATA STRUCTURE ZQMLONG_TEXT OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
*"----------------------------------------------------------------------
* Example: DataSource for table SFLIGHT
* TABLES: SFLIGHT.
TABLES: ZQMLONG_TEXT.
*BREAK-POINT.
* Auxiliary Selection criteria structure
DATA: L_S_SELECT TYPE SRSC_S_SELECT,
I_T_DATA1 TYPe STANDARD TABLE OF ZQMLONG_TEXT,
wa LIKE LINE OF i_t_data1,
lt_text_lines TYPe STANDARD TABLE OF TLINE,
lr_text_lines TYPE TLINE.
FIELD-SYMBOLS: <FS_ZDS_TEXT_ORDER> TYPE ZQMLONG_TEXT.
* Maximum number of lines for DB table
STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE,
* counter
S_COUNTER_DATAPAKID LIKE SY-TABIX,
* cursor
S_CURSOR TYPE CURSOR.
* Select ranges
RANGES: SDNO FOR ZQMLONG_TEXT-VBELN.
RANGES: L_R_CARRID FOR SFLIGHT-CARRID,
L_R_CONNID FOR SFLIGHT-CONNID.
* Initialization mode (first call by SAPI) or data transfer mode
* (following calls) ?
IF I_INITFLAG = SBIWA_C_FLAG_ON.
************************************************************************
* Initialization: check input parameters
* buffer input parameters
* prepare data selection
************************************************************************
* Check DataSource validity
CASE I_DSOURCE.
* WHEN '0SAPI_SFLIGHT_SIMPLE'.
WHEN 'ZQM_UD_TEXT'.
WHEN OTHERS.
IF 1 = 2. MESSAGE E009(R3). ENDIF.
* this is a typical log call. Please write every error message like this
LOG_WRITE 'E' "message type
'R3' "message class
'009' "message number
I_DSOURCE "message variable 1
' '. "message variable 2
RAISE ERROR_PASSED_TO_MESS_HANDLER.
ENDCASE.
APPEND LINES OF I_T_SELECT TO S_S_IF-T_SELECT.
* Fill parameter buffer for data extraction calls
S_S_IF-REQUNR = I_REQUNR.
S_S_IF-DSOURCE = I_DSOURCE.
S_S_IF-MAXSIZE = I_MAXSIZE.
* Fill field list table for an optimized select statement
* (in case that there is no 1:1 relation between InfoSource fields
* and database table fields this may be far from beeing trivial)
APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS.
ELSE. "Initialization mode or data extraction ?
************************************************************************
* Data transfer: First Call OPEN CURSOR + FETCH
* Following Calls FETCH only
************************************************************************
* First data package -> OPEN CURSOR
IF S_COUNTER_DATAPAKID = 0.
* Fill range tables BW will only pass down simple selection criteria
* of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.
* LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CARRID'.
* MOVE-CORRESPONDING L_S_SELECT TO L_R_CARRID.
* APPEND L_R_CARRID.
* ENDLOOP.
*
* LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CONNID'.
* MOVE-CORRESPONDING L_S_SELECT TO L_R_CONNID.
* APPEND L_R_CONNID.
* ENDLOOP.
*BREAK-POINT.
LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'VBELN'.
MOVE-CORRESPONDING L_S_SELECT TO SDNO.
APPEND SDNO.
ENDLOOP.
* Determine number of database records to be read per FETCH statement
* from input parameter I_MAXSIZE. If there is a one to one relation
* between DataSource table lines and database entries, this is trivial.
* In other cases, it may be impossible and some estimated value has to
* be determined.
SELECT MANDT TDNAME TDSPRAS TDID
FROM STXL
into table I_T_DATA1
where TDOBJECT = 'QPRUEFLOS' and TDID = 'QAVE'.
LOOP AT I_T_DATA1 into wa.
wa-QPRUEFLOS = wa-VBELN+3(12).
modify i_t_data1 from wa.
endloop.
LOOP AT I_T_DATA1 ASSIGNING <FS_ZDS_TEXT_ORDER>.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = <FS_ZDS_TEXT_ORDER>-MANDT
*ID = 'QAVE'
ID = <FS_ZDS_TEXT_ORDER>-TDID
LANGUAGE = <FS_ZDS_TEXT_ORDER>-TDSPRAS
NAME = <FS_ZDS_TEXT_ORDER>-VBELN
OBJECT = 'QPRUEFLOS'
TABLES
LINES = lt_text_lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
READ TABLE lt_text_lines INTO lr_text_lines INDEX 1.
<FS_ZDS_TEXT_ORDER>-TXTLG = lr_text_lines-TDLINE(132).
ENDLOOP.
SORT I_T_DATA1.
E_T_DATA[] = I_T_DATA1[] .
* OPEN CURSOR WITH HOLD S_CURSOR FOR
* SELECT (S_S_IF-T_FIELDS) FROM SFLIGHT
* WHERE CARRID IN L_R_CARRID AND
* CONNID IN L_R_CONNID.
ENDIF. "First data package ?
* Fetch records into interface table.
* named E_T_'Name of extract structure'.
* FETCH NEXT CURSOR S_CURSOR
* APPENDING CORRESPONDING FIELDS
* OF TABLE E_T_DATA
* PACKAGE SIZE S_S_IF-MAXSIZE.
*
* IF SY-SUBRC <> 0.
* CLOSE CURSOR S_CURSOR.
* RAISE NO_MORE_DATA.
* ENDIF.
S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
ENDIF. "Initialization mode or data extraction ?
ENDFUNCTION.
2. Following is the InfoPackage "Monitor"
![FirstScreenShot.gif]()
3. Following is the Background Job Status in Source System:
![SecondScreenShot.gif]()
4. Following is the Background Job Log Overview:
![ThirdScreenShot.gif]()
1. What should I do to load the records successfully into BW from this DataSource based on FM?
2. Do I need to ask my BASIS team to check certain settings in SAP ERP or BW?
3. DO I need to ask my ABAPer to re-visit the code/logic?
4. Have I missed something that is causing an issue for job not being finished in source system?
I will appreciate your reply.
Many thanks!!!
Tariq Ashraf