cancel
Showing results for 
Search instead for 
Did you mean: 

Blank fields for data extracted using Functional Module

Former Member
0 Kudos

Could some please help with this

i have written a Function Module based on RSAX_BIW_GET_DATA_SIMPLE

While testing using RSA3 the test extractor completes successfully stating 1000 record selected but all the fields are blank

I have checked the code several times but i cannot see what i am doing wrong

Any suggestions PLEASE

Thanks

Pushpa

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Post your code

Regards

Former Member
0 Kudos

hi Oscar

As requested the code is supplied below

i know very little about ABAP and this FM is written using the the FM stated in the earlier thread

Currently just trying to get this working but eventually want to use this FM to select records from three different tables with an outer join.

FUNCTION ZFM_SMARTLINK.

*"----


""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(IREAD_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 ZSLINKTABLE OPTIONAL

*" EXCEPTIONS

*" NO_MORE_DATA

*" ERROR_PASSED_TO_MESS_HANDLER

*"----


  • Example: DataSource for table SFLIGHT

TABLES: /MCSL/MTRANS.

  • Auxiliary Selection criteria structure

DATA: L_S_SELECT TYPE SRSC_S_SELECT.

  • 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: L_R_ACCTNO FOR /MCSL/MTRANS-ACCT_NO.

  • L_R_AQ_REFNO FOR /MCSL/MTRANS-AQ_REFNO.

  • 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 'ZSMARTLINK'.

WHEN OTHERS.

IF 1 = 2. MESSAGE E009(R3). ENDIF.

  • this is a typical log call. Please write every error message like this

  • 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 = 'ACCT_NO'.

*AND fieldnm = 'AQ_REFNO'.

MOVE-CORRESPONDING L_S_SELECT TO L_R_ACCTNO.

APPEND L_R_ACCTNO.

ENDLOOP.

  • LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM =

*'AQ_REFNO'.

    • AND fieldnm = 'AQ_REFNO'.

  • MOVE-CORRESPONDING L_S_SELECT TO L_R_AQ_REFNO.

  • APPEND L_R_AQ_REFNO.

  • 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.

OPEN CURSOR WITH HOLD S_CURSOR FOR

  • SELECT ACCT_NO AQ_REFNO FROM /MCSL/MTRANS

SELECT ACCT_NO FROM /MCSL/MTRANS

WHERE ACCT_NO IN L_R_ACCTNO. "AND

  • AQ_REFNO IN L_R_AQ_REFNO.

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.

Former Member
0 Kudos

I extracted data from the Function Module earlier if you tell me clearly which structure u are using and have you created the generic datasource or not.

have you created the generic data source zsmartlink

i think u r coding went some thing wrong may be i guess u r not reading the records in the internal table.

i am having a document which will help you to achieve your task.

give me u r mail id

Message was edited by:

shahid syed

Message was edited by:

shahid syed

Former Member
0 Kudos

Hi,

first of all you should replace the statement 'appending corresponding fields...' by 'into corresponding fields...'. Then, make sure that a field named ACCT_NO exists in STRUCTURE ZSLINKTABLE.

regards

siggi

Answers (2)

Answers (2)

Former Member
0 Kudos

Try to do a load in BW using PSA and check if the data comes in the same way taht in R3...

Regards

Former Member
0 Kudos

Hi Oscar

Tried that

Picks correct no of records BUT they are Blank!

Thanks

Former Member
0 Kudos

It seems ok for me...did you check your DB table in order to see if there are records that match your selection...

Check if your structure ZSLINKTABLE match the fields of the database table...

Regards

Former Member
0 Kudos

Hi Oscar

Already did that

all fields appear

Mandt has 200 in it but acct_no and aq_refno are BLANK

Thanks

Pushpa