How to create delta extraction through function module?
Hi all,
So far i have created the data source through full load. But currently i would like to convert the couple of function module generic extraction converted through delta.
Can anyone let me know how to convert from full load to delta using generic extraction
thanks
Hi,
Try these Links, helps u in getting an idea.
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30aefb04-7043-2c10-8e92-941536eebc79?QuickLink=index&overridelayout=true
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30f1a423-02ae-2e10-bd85-bde64e61fe7b?QuickLink=index&overridelayout=true&51947629650864
Regards,
Aravind.
Similar Messages
-
How to create material(mm01) through function module or bapi
Hi,
this is kiran iam sap fresher.Hi,
try this
*& Report ZKAR_MATMAS_BAPI
*& This program demonstrates how easy it is to create Material master
*& data using BAPI_MATERIAL_SAVEDATA
*& The program also generates a report post-execution displaying errors
*& as well as successful uploads
REPORT ZKAR_MATMAS_BAPI.
* TABLES
* FLAGS *
DATA: F_STOP. " Flag used to stop processing
* DATA DECLARATIONS *
DATA : V_EMPTY TYPE I, " No. of empty records
V_TOTAL TYPE I. " Total no. of records.
* STRUCTURES & INTERNAL TABLES
*BAPI structures
DATA: BAPI_HEAD LIKE BAPIMATHEAD, " Header Segment with Control Information
BAPI_MAKT LIKE BAPI_MAKT, " Material Description
BAPI_MARA1 LIKE BAPI_MARA, " Client Data
BAPI_MARAX LIKE BAPI_MARAX, " Checkbox Structure for BAPI_MARA
BAPI_MARC1 LIKE BAPI_MARC, " Plant View
BAPI_MARCX LIKE BAPI_MARCX, " Checkbox Structure for BAPI_MARC
BAPI_MBEW1 LIKE BAPI_MBEW, " Accounting View
BAPI_MBEWX LIKE BAPI_MBEWX, " Checkbox Structure for BAPI_MBEW
BAPI_RETURN LIKE BAPIRET2. " Return Parameter
*--- Internal table to hold excel file data
DATA: IT_INTERN TYPE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
*--- Internal table to hold Matetrial descriptions
DATA: BEGIN OF IT_MAKT OCCURS 100.
INCLUDE STRUCTURE BAPI_MAKT.
DATA: END OF IT_MAKT.
*--- Internal to hold the records in the text file
DATA : BEGIN OF IT_DATA OCCURS 100,
WERKS(4), " Plant
MTART(4), " Material type
MATNR(18), " Material number
MATKL(9) , " Material group
MBRSH(1), " Industry sector
MEINS(3), " Base unit of measure
GEWEI(3), " Weight Unit
SPART(2), " Division
EKGRP(3), " Purchasing group
VPRSV(1), " Price control indicator
STPRS(12), " Standard price
PEINH(3), " Price unit
SPRAS(2), " Language key
MAKTX(40), " Material description
END OF IT_DATA.
* SELECTION SCREEN. *
SELECTION-SCREEN BEGIN OF BLOCK SCR1 WITH FRAME TITLE TEXT-111.
PARAMETER : P_FILE TYPE RLGRAP-FILENAME OBLIGATORY DEFAULT " Input File
'C:\Material_master.XLS'.
PARAMETER : P_MAX(4) OBLIGATORY DEFAULT '100'. " no.of recs in a session
PARAMETERS: P_HEADER TYPE I DEFAULT 0. " Header Lines
PARAMETERS: P_BEGCOL TYPE I DEFAULT 1 NO-DISPLAY,
P_BEGROW TYPE I DEFAULT 1 NO-DISPLAY,
P_ENDCOL TYPE I DEFAULT 100 NO-DISPLAY,
P_ENDROW TYPE I DEFAULT 32000 NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK SCR1.
* AT SELECTION-SCREEN *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
*--- Validating file
PERFORM VALIDATE_FILE USING P_FILE.
* START-OF-SELECTION
START-OF-SELECTION.
*--- Perform to convert the Excel data into an internal table
PERFORM CONVERT_XLS_ITAB.
IF NOT IT_DATA[] IS INITIAL.
*--- Perform to delete Header lines
PERFORM DELETE_HEADER_EMPTY_RECS.
ENDIF.
* END OF SELECTION. *
END-OF-SELECTION.
*--- Perform to upload Material Master data
PERFORM UPLOAD_MATMAS.
* Form : validate_input_file
* Description : To provide F4 help for file if read from PC
FORM VALIDATE_FILE USING F_FILE TYPE RLGRAP-FILENAME.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
FILE_NAME = F_FILE
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE S010(ZLKPL_MSGCLASS). " 'Error in getting filename'.
ENDIF.
ENDFORM. " validate_input_file
*& Form CONVER_XLS_ITAB
* text
FORM CONVERT_XLS_ITAB.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = P_BEGCOL
I_BEGIN_ROW = P_BEGROW
I_END_COL = P_ENDCOL
I_END_ROW = P_ENDROW
TABLES
INTERN = IT_INTERN.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*--- Perform to move the data into an internal data
PERFORM MOVE_DATA.
ENDFORM. " CONVERT_XLS_ITAB
*& Form MOVE_DATA
* text
FORM MOVE_DATA.
DATA : LV_INDEX TYPE I.
FIELD-SYMBOLS <FS>.
*--- Sorting the internal table
SORT IT_INTERN BY ROW COL.
CLEAR IT_INTERN.
LOOP AT IT_INTERN.
MOVE IT_INTERN-COL TO LV_INDEX.
*--- Assigning the each record to an internal table row
ASSIGN COMPONENT LV_INDEX OF STRUCTURE IT_DATA TO <FS>.
*--- Asigning the field value to a field symbol
MOVE IT_INTERN-VALUE TO <FS>.
AT END OF ROW.
APPEND IT_DATA.
CLEAR IT_DATA.
ENDAT.
ENDLOOP.
ENDFORM. " MOVE_DATA
*& Form DELETE_HEADER_EMPTY_RECS
* To delete the Header and empty records
FORM DELETE_HEADER_EMPTY_RECS.
DATA: LV_TABIX LIKE SY-TABIX.
IF NOT P_HEADER IS INITIAL.
LOOP AT IT_DATA.
IF P_HEADER > 0 AND NOT IT_DATA IS INITIAL.
DELETE IT_DATA FROM 1 TO P_HEADER.
* P_HEADER = 0.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
CLEAR IT_DATA.
*--- To delete the empty lines from internal table
LOOP AT IT_DATA.
LV_TABIX = SY-TABIX.
IF IT_DATA IS INITIAL.
V_EMPTY = V_EMPTY + 1.
DELETE IT_DATA INDEX LV_TABIX..
ENDIF.
ENDLOOP.
CLEAR IT_DATA.
*--- Total no of recs in file
DESCRIBE TABLE IT_DATA LINES V_TOTAL.
IF V_TOTAL = 0.
MESSAGE I013(ZLKPL_MSGCLASS). " No records in the file
F_STOP = 'X'.
STOP.
ENDIF.
ENDFORM. " DELETE_HEADER_EMPTY_RECS
*& Form UPLOAD_MATMAS
* to upload Material Master data
FORM UPLOAD_MATMAS .
LOOP AT IT_DATA.
* Header
UNPACK IT_DATA-MATNR TO IT_DATA-MATNR.
BAPI_HEAD-MATERIAL = IT_DATA-MATNR.
BAPI_HEAD-IND_SECTOR = IT_DATA-MBRSH.
BAPI_HEAD-MATL_TYPE = IT_DATA-MTART.
BAPI_HEAD-BASIC_VIEW = 'X'.
BAPI_HEAD-PURCHASE_VIEW = 'X'.
BAPI_HEAD-ACCOUNT_VIEW = 'X'.
* Material Description
REFRESH IT_MAKT.
IT_MAKT-LANGU = IT_DATA-SPRAS.
IT_MAKT-MATL_DESC = IT_DATA-MAKTX.
APPEND IT_MAKT.
* Client Data - Basic
BAPI_MARA1-MATL_GROUP = IT_DATA-MATKL.
BAPI_MARA1-BASE_UOM = IT_DATA-MEINS.
BAPI_MARA1-UNIT_OF_WT = IT_DATA-GEWEI.
BAPI_MARA1-DIVISION = IT_DATA-SPART.
BAPI_MARAX-MATL_GROUP = 'X'.
BAPI_MARAX-BASE_UOM = 'X'.
BAPI_MARAX-UNIT_OF_WT = 'X'.
BAPI_MARAX-DIVISION = 'X'.
* Plant - Purchasing
BAPI_MARC1-PLANT = IT_DATA-WERKS.
BAPI_MARC1-PUR_GROUP = IT_DATA-EKGRP.
BAPI_MARCX-PLANT = IT_DATA-WERKS.
BAPI_MARCX-PUR_GROUP = 'X'.
* Accounting
BAPI_MBEW1-VAL_AREA = IT_DATA-WERKS.
BAPI_MBEW1-PRICE_CTRL = IT_DATA-VPRSV.
BAPI_MBEW1-STD_PRICE = IT_DATA-STPRS.
BAPI_MBEW1-PRICE_UNIT = IT_DATA-PEINH.
BAPI_MBEWX-VAL_AREA = IT_DATA-WERKS.
BAPI_MBEWX-PRICE_CTRL = 'X'.
BAPI_MBEWX-STD_PRICE = 'X'.
BAPI_MBEWX-PRICE_UNIT = 'X'.
*--- BAPI to create material
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
HEADDATA = BAPI_HEAD
CLIENTDATA = BAPI_MARA1
CLIENTDATAX = BAPI_MARAX
PLANTDATA = BAPI_MARC1
PLANTDATAX = BAPI_MARCX
* FORECASTPARAMETERS =
* FORECASTPARAMETERSX =
* PLANNINGDATA =
* PLANNINGDATAX =
* STORAGELOCATIONDATA =
* STORAGELOCATIONDATAX =
* VALUATIONDATA = BAPI_MBEW1
* VALUATIONDATAX = BAPI_MBEWX
* WAREHOUSENUMBERDATA =
* WAREHOUSENUMBERDATAX =
* SALESDATA = BAPI_MVKE1
* SALESDATAX = BAPI_MVKEX
* STORAGETYPEDATA =
* STORAGETYPEDATAX =
IMPORTING
RETURN = BAPI_RETURN
TABLES
MATERIALDESCRIPTION = IT_MAKT
* UNITSOFMEASURE =
* UNITSOFMEASUREX =
* INTERNATIONALARTNOS =
* MATERIALLONGTEXT =
* TAXCLASSIFICATIONS =
* RETURNMESSAGES =
* PRTDATA =
* PRTDATAX =
* EXTENSIONIN =
* EXTENSIONINX =
IF BAPI_RETURN-TYPE = 'E'.
WRITE:/ 'Error:' ,BAPI_RETURN-MESSAGE ,'for material:' ,IT_DATA-MATNR.
ELSEIF BAPI_RETURN-TYPE = 'S'.
WRITE: 'Successfully created material' ,IT_DATA-MATNR.
ENDIF.
ENDLOOP.
ENDFORM. " UPLOAD_MATMAS -
Generic Delta extraction by Function module issue
Hello Experts,
Please help !!!
I have problem for delta extraction by Function module. For the full load, I wrote function module based on RSAX_BIW_GET_DATA_SIMPLE. It works fine.
But I would like to have the delta load enabled. Therefore, I modified the datasource, add a delta specific field u2018ztimestampu2019, which type is calendar day.
Then I create a function module based on template u2018RSAX_BIW_GET_DATAu2019, as this support the upload mode. But when I test this datasource in RSA3, no matter itu2019s full load or initial delta load, it always send me an error, u201CErrors occurred during the extractionu201D.
I had some debug, and found that there is no value for i_isource when my function module is called. Therefore it raised the exception.
But I do not have the chance to debug my code for the delta logic, can somebody help to check?
I also check the entries in ROOSOURCE,
For my datasource ZTRNREC_FM_DELTA, The DELTA value is u2018AIEu2019, and extraction method is u2018F2u2019, should I change them to DELTA= u2018Du2019 and extraction method to u2018F1u2019? Where to change?
FUNCTION ZRSAX_TRAININGREC_DELTA.
""Local Interface:
*" IMPORTING
*" VALUE(I_REQUNR) TYPE SBIWA_S_INTERFACE-REQUNR
*" VALUE(I_ISOURCE) TYPE SBIWA_S_INTERFACE-ISOURCE OPTIONAL
*" VALUE(I_MAXSIZE) TYPE SBIWA_S_INTERFACE-MAXSIZE OPTIONAL
*" VALUE(I_INITFLAG) TYPE SBIWA_S_INTERFACE-INITFLAG OPTIONAL
*" VALUE(I_UPDMODE) TYPE SBIWA_S_INTERFACE-UPDMODE OPTIONAL
*" VALUE(I_DATAPAKID) TYPE SBIWA_S_INTERFACE-DATAPAKID OPTIONAL
*" VALUE(I_PRIVATE_MODE) OPTIONAL
*" VALUE(I_CALLMODE) LIKE ROARCHD200-CALLMODE OPTIONAL
*" VALUE(I_REMOTE_CALL) TYPE SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF
*" TABLES
*" I_T_SELECT TYPE SBIWA_T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SBIWA_T_FIELDS OPTIONAL
*" E_T_DATA STRUCTURE ZTRN_REC_TIME OPTIONAL
*" E_T_SOURCE_STRUCTURE_NAME OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
The input parameter I_DATAPAKID is not supported yet !
Example: InfoSource containing TADIR objects
Auxiliary Selection criteria structure
DATA: l_s_select TYPE sbiwa_s_select.
Maximum number of lines for DB table
STATICS: l_maxsize TYPE sbiwa_s_interface-maxsize,
S_S_IF TYPE SRSC_S_IF_SIMPLE,
S_COUNTER_DATAPAKID LIKE SY-TABIX.
Parameter I_PRIVATE_MODE:
Some applications might want to use this function module for other
purposes as well (e.g. data supply for OLTP reporting tools). If the
processing logic has to be different in this case, use the optional
parameter I_PRIVATE_MODE (not supplied by BIW !) to distinguish
between BIW calls (I_PRIVATE_MODE = SPACE) and other calls
(I_PRIVATE_MODE = X).
If the message handling has to be different as well, define Your own
messaging macro which interprets parameter I_PRIVATE_MODE. When
called by BIW, it should use the LOG_WRITE macro, otherwise do what
You want.
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
The input parameter I_DATAPAKID is not supported yet !
Invalid second initialization call -> error exit
IF NOT g_flag_interface_initialized IS INITIAL.
IF 1 = 2. MESSAGE e008(r3). ENDIF.
log_write 'E' "message type
'R3' "message class
'008' "message number
' ' "message variable 1
' '. "message variable 2
RAISE error_passed_to_mess_handler.
ENDIF.
Check InfoSource validity
CASE i_isource.
WHEN 'ZTRNREC_FM_DELTA'.
WHEN OTHERS.
IF 1 = 2. MESSAGE e009(r3). ENDIF.
log_write 'E' "message type
'R3' "message class
'009' "message number
i_isource "message variable 1
' '. "message variable 2
RAISE error_passed_to_mess_handler.
ENDCASE.
Check for supported update mode
CASE i_updmode.
WHEN 'F'.
WHEN 'D'.
WHEN 'R'.
WHEN OTHERS.
IF 1 = 2. MESSAGE e011(r3). ENDIF.
log_write 'E' "message type
'R3' "message class
'011' "message number
i_updmode "message variable 1
' '. "message variable 2
RAISE error_passed_to_mess_handler.
ENDCASE.
Check for obligatory selection criteria
APPEND LINES OF i_t_select TO g_t_select.
Fill parameter buffer for data extraction calls
g_s_interface-requnr = i_requnr.
g_s_interface-isource = i_isource.
g_s_interface-maxsize = i_maxsize.
g_s_interface-initflag = i_initflag.
g_s_interface-updmode = i_updmode.
g_s_interface-datapakid = i_datapakid.
g_flag_interface_initialized = sbiwa_c_flag_on.
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 g_t_segfields.
ELSE. "Initialization mode or data extraction ?
Data transfer: First Call OPEN CURSOR + FETCH
Following Calls FETCH only
LOOP AT G_T_SELECT INTO L_S_SELECT
WHERE FIELDNM = 'ZTIMESTAMP'.
ENDLOOP.
IF G_COUNTER_DATAPAKID = 0.
IF L_S_SELECT-LOW = '' AND L_S_SELECT-HIGH = ''.
OPEN CURSOR WITH HOLD G_CURSOR FOR
SELECT (g_t_fields)
FROM ZTRN_REC_TIME.
ELSE.
OPEN CURSOR WITH HOLD G_CURSOR FOR
SELECT (g_t_fields)
FROM ZTRN_REC_TIME
WHERE ZTIMESTAMP >= L_S_SELECT-LOW
AND ZTIMESTAMP <= L_S_SELECT-HIGH.
ENDIF.
ENDIF.
FETCH NEXT CURSOR G_CURSOR
APPENDING CORRESPONDING FIELDS
OF TABLE E_T_DATA
PACKAGE SIZE S_S_IF-MAXSIZE.
IF SY-SUBRC <> 0.
CLOSE CURSOR G_CURSOR.
RAISE NO_MORE_DATA.
ENDIF.
S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
ENDIF.
ENDFUNCTION.
I found some similar issue in this forum by link
Generic Extractor Delta Function Module code, but still I could not get clear answer.
Can you please help me:
1) why there is no value for i_source , how to fix it?
2) For the delta logic for ztimestemp, is it correct?
3) Need I modify the entries in ROOSOURCE ?
Thanks a lot !!!Hello Andre,
Thanks a lot for your help. I did some change , but still does not work. Could you please help check.
Now the source code are the following, It's based on the RSAX_BIW_GET_DATA_SIMPLE, as you confirm that this also supply the update mode (full, initial delta, delta).
FUNCTION RSAX_BIW_GET_DATA_TRAININGREC1.
""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 ZTRN_REC_TIME OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
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_ZTIMESTAMP FOR ZTRN_REC_TIME-ZTIMESTAMP.
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 'ZTRNREC_FM'.
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.
LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'ZTIMESTAMP'.
MOVE-CORRESPONDING L_S_SELECT TO L_R_ZTIMESTAMP.
APPEND L_R_ZTIMESTAMP.
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.
IF L_S_SELECT-LOW = '' AND L_S_SELECT-HIGH = ''.
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT (S_S_IF-T_FIELDS)
FROM ZTRN_REC_TIME.
ELSE.
OPEN CURSOR WITH HOLD G_CURSOR FOR
SELECT (S_S_IF-T_FIELDS)
FROM ZTRN_REC_TIME
WHERE ZTIMESTAMP >= L_S_SELECT-LOW
AND ZTIMESTAMP <= L_S_SELECT-HIGH.
ENDIF.
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.
I think it already includes the important statements you suggested.
I test this FM in RSA3, for the Full load mode, it works fine. Also if I checked the debug mode in execution , it will stop in the code and let me debug.
But when I choose other mode, like 'initializion of the delta transfer' or simulation of initial delta, I always get error 'error occurs during the extraction' .. even I choose debug mode, but it could not enter the code for debug..
Till now I did not see any parameter or value for the upload mode..
Another questions is that, in RSO2, I define Ztimestamp as my delta field.. But , can I add other field as selection condition in the datasource definition, and has its range table in this function module ?
Should I change the entries in ROOSOURCE for this datasource ??
Please let me know your feedback, do you have some concret example for generic delta extraction ?
Thanks a lot ! -
Code For Delta Extraction Using Function Module
Dear Experts,
I want a sample code for Delta Extraction using Function Module ( If it is customized already working code very helpful ), I have already created Function Module but Full update is happening. If I give delta update again it is retrieving all records. It is very urgent, if you have please send me to the following mail ID.
[email protected]
Best Regards,
SGK.Dear KJ,
Thank for your response. I saw the code that you sent, you have used some ztables like ZSC_DELTA_IP, ZSC_SAFETY_DELTA, ZSC_SET_EXT_TIME
What are the fields that you have created in these tables , what is use of these tables, can you send the fields that you have used in these tables.
Thanks & Regards,
SGK -
Delta Extraction Using Function Module ( Customization )
Dear Experts,
I want a sample code for Delta Extraction using Function Module ( If it is customized already working code very helpful ), I have already created Function Module but Full update is happening. If I give delta update again it is retrieving all records. It is very urgent, if you have please send me to the following mail ID.
[email protected]
Best Regards,
SGK.Hi SGK,
I've done this for a delta based on a timestamp and it's actually pretty easy. The basic steps are:
1) Create an extract structure in SE11. Make sure the structure has a date or timestamp field in it that you can use for delta. You'll need to include the field twice if you also want to extract it to BW/BI since once it's chosen as the delta field then it will be hidden in the interface.
2) Create the extractor function module in SE37. You can use RSAX_BIW_GET_DATA_SIMPLE as a template. Make sure your logic restricts the data it retrieves according to the selections that are passed in I_T_SELECT, including restrictions on the delta field.
3) Create a generic DataSource in RSO2. Click Extraction by FM then fill in your extract structure and function module. Click Generic Delta and pick your delta field and the appropriate radio button (time stamp or calendar day). If your delta field is a timestamp field then be sure to set the upper and lower safety limits to -86400 and 86400 respectively. This might not be necessary on your version of SAPI but on mine there is a bug where it doesn't translate between system time and UTC (GMT) correctly so this was necessary.
You don't need to program any special delta handling logic in your function module as long as you restrict the data you retrieve based on the delta field (I_T_SELECT). This is because the SAPI takes care of catching the init, delta and repeat requests, translating them to the appropriate delta field values, and then passing them to your function module as if it was a full extraction for a specific date or timestamp range.
Hope this helps!
Jason -
Save EAN11 field while creating POrder creation through Function module
Hi All,
I want to update EAN11 field in material master while creating Purchase Order through function module. I am using function module BAPI_PO_CREATE1 for creating purchase order. There are no structures in the PO creation FM in which EAN11 field is there. I have also tried using function module MEPO_DOC_ITEM_PROCESS for updating EAN11 field. It is not working. Please suggest some method to do that.
Note: I am receiving EAN11 through an external system by proxy.
Thanks,
ChinmayHi,
Use BAPI_MATERIAL_SAVEDATA to updat ean numbers for materials.
tables INTERNATIONALARTNOS is used to update EAN.
Regards,
Shanmugavel Chandrasekaran -
How to Create a Remotely Enabled Function Module
Hi All,
How to Create a Remotely Enabled Function Module.
I Want to Create a FM Using Sample Data , This for Practice
What Fields can i give in the Import and Export Parameters.
Please Give me one Example
Can Any one Give me the Steps to do this.
Regards
VamsiHi Vamsi,
Lets do simple example where you will first create a RFC in one server (say A) and create normal program in othere server (say B). Finally you will call the RFC in A from B.
Do the following steps for creating RFC in server A.
1. log on to server A
2. go to se37
3. Edit -> function groups-> create function group and give the function group name (say ZGRP).
4. create a FM ( say Z_TEST_RFC) in se37 providing the function group which is created just now.
5. go to attribute tab -> choose remote-enabled module from processing type.
so that your FM will become RFC.
6. provide the import parameter in import tab.
we will provide only two import parameters.
- parameter name : P_NUM1, typing: TYPE, associated type : I & <b>check the pass value</b> (all the parameters of RFC must pass by value).
- parameter name : P_NUM2, typing: TYPE, associated type : I & <b>check the pass value</b>
7. provide the export parameter in export tab.
parameter name : P_SUM, typing: TYPE, associated type : I & <b>check the pass value</b>
8. write the given simple code in source code tab.
FUNCTION Z_TEST_RFC.
P_TOT = P_NUM1 + P_NUM2.
ENDFUNCTION.
Do the following steps for creating ABAP program which will call the RFC in server B.
1. se38 - > creat a program.
2. write the given simple code.
data tot type i.
call function 'Z_TEST_RFC' destination '<b>XXXXXX</b>'
exporting
p_num1 = 10
p_num2 = 15
importing
p_tot = tot.
write tot.
please note that <b>XXXXXX</b> is RFC connection which is avialable in <b>sm59</b> transaction in server A.
-go to sm59 - > abap connection (list of RFC connection configurations are avialable). choose server B connection and replace it of <b>XXXXXX</b> in the code.
finally you can execute the normal abap program that will call the RFC and display the result.
Regards,
Sukhee -
Generic Delta Extraction via Function Module
Hello,
i need a help for a generic delta extraction based on a Function Module. As an example i take the function module RSVD_BW_GET_DELTA_DATA.
My generic delta extractor based on the field AEDAT - Change Date and i will extract purchase service orders and entry sheets.
In the sample function module the select for the extraction worked with the table ROBWQTSTAT, but this table ist empty after the initialization.
OPEN CURSOR WITH HOLD G_CURSOR FOR
SELECT * FROM ROVERCUBE1
WHERE COUNTRY IN L_R_COUNTRY AND
REGION IN L_R_REGION AND
KUNNR IN L_R_KUNNR AND
TYPE IN L_R_TYPE AND
GJAHR IN L_R_GJAHR AND
Here the timerange calculated in form GET_TIME_INTERVAL is evaluated.
TSTMP IN S_R_TSTMP AND
OBJVERS = 'A'.
I found the table ROOSGENDLM. In this table i found the field DELTAID with the last date of the extraction and the field REPEATID with the date for the repead-Update.
My Questions:
Is this the right way to build an generic delta extraction with an function module or must i install a coding in my function module for an update of the table ROBWQTSTAT?
Which settings are needed in the table ROOSOURCE for a generic delta extraction via function module?
Best regards
UweHi Uwe,
please have a look at https://weblogs.sdn.sap.com/pub/wlg/2415. [original link is broken] [original link is broken] [original link is broken] It might help
kind regards
Siggi
PS: We already had almost the same question here today. -
Generic delta extraction using function module
Hi.
I have a generic datasource , extraction being performed by a function module. The extraction works fine in full update mode. The extract structure has a timestamp field.
I have enabled generic delta using this field(i.e., marked this field in RSO2). I understand that with this setting, I should be able to get delta data when I do a delta request. But it does not seem to happen.
I checked the ROOSPRMSC table for the last(local) timestamp stored there. Now when I do the delta upload I expect to see only those records which are younger than the stored timestamp of last upload.
But I still get the entire set of records.
Questions are :
1. Do I need to explicitly code for fetching the delta in the extractor ?
2. If not, what could be the reason why generic delta is not working ?
Thanks and regards,
AnuradhaHi GFV,
I read-up all the forum entries on this topic but could not find anything specifically dealing with my problem. I have browsed through the how-to paper on generic delta as well.
I am quite sure that we don't need any special coding in the extrator for generating delta generically. Even the how-to paper does not mention that.
I have used the FM RSAX_BIW_GET_DATA_SIMPLE as a template
for my extractor(as suggested by F1 help in RSO2). This FM does not even have the i_updmode flag in its interface.
Thus this function module always does full extraction and I expect the system to take care of delta using the timestamp field.
Are these assumptions incorrect ?
Regards,
Anuradha -
How to create Drop-Down with Function Module REUSE_ALV_GRID_DISPLAY
Hi Experts,
I have used Reuse_alv_grid_display function module in my report for ALV output. I have a requirement to add drop down in one cell of my output. I have searched but all are suggesting through OOPS programing that I can not use.
If it is possible with the given scenerion , please help me how to write the code for it?
Thanks a bunch in advance.Hi,
You can check demo programs:
BCALV_EDIT_06
BCALV_EDIT_07
Hope it helps
Regards
Mansi -
EXtraction through function module
Hello
I have craeted generic extractor which is using function module for pulling sales document data..
Here is the code
UNCTION ZRSAX_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
*" 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 ZBWPRICING OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
Example: DataSource for table SFLIGHT
tables: vbak, vbap, konv.
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,
ls_s_if type srsc_s_if_simple,
counter
s_counter_datapakid like sy-tabix,
cursor
s_cursor type cursor.
Select ranges
ranges: l_r_vbeln for vbak-vbeln,
l_r_erdat for vbak-erdat,
l_r_kschl for konv-kschl,
l_r_posnr for vbap-posnr.
break-point.
data:
gv_tabix type sytabix,
gs_order type gts_order,
gs_konv_hold type gts_konv,
gs_konv type gts_konv,
gt_konv type gtt_konv.
statics: gt_order type gtt_order.
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 'ZPRICING'.
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.
clear: gt_order, gt_order[].
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 = 'VBELN'.
move-corresponding l_s_select to l_r_vbeln.
append l_r_vbeln.
endloop.
loop at s_s_if-t_select into l_s_select where fieldnm = 'ERDAT'.
move-corresponding l_s_select to l_r_erdat.
append l_r_erdat.
endloop.
loop at s_s_if-t_select into l_s_select where fieldnm = 'POSNR'.
move-corresponding l_s_select to l_r_posnr.
append l_r_posnr.
endloop.
loop at s_s_if-t_select into l_s_select where fieldnm = 'KSCHL'.
move-corresponding l_s_select to l_r_KSCHL.
append l_r_KSCHL.
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 avbeln bposnr aerdat aknumv aauart avkorg
from vbak as a
inner join vbap as b on bvbeln eq avbeln
appending table gt_order
where a~vbeln in l_r_vbeln and
a~erdat in l_r_erdat and
b~posnr in l_r_posnr.
Delete Extra fields.
move: s_s_if-t_fields to ls_s_if-t_fields.
delete ls_s_if-t_fields
where fieldnm eq 'VBELN' or
fieldnm eq 'POSNR' or
fieldnm eq 'ERDAT' or
fieldnm eq 'AUART' or
fieldnm eq 'VKORG'.
open cursor with hold s_cursor for
select (ls_s_if-t_fields) from konv
for all entries in gt_order
where knumv eq gt_order-knumv and
kposn eq gt_order-posnr. "jlm
kposn eq gt_order-posnr and "jlm
kschl in l_r_kschl. "jlm
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.
loop at e_t_data.
move: sy-tabix to gv_tabix.
read table gt_order into gs_order
with key knumv = e_t_data-knumv
posnr = e_t_data-kposn.
check sy-subrc is initial.
move: gs_order-vbeln to e_t_data-vbeln,
gs_order-posnr to e_t_data-posnr,
gs_order-erdat to e_t_data-erdat,
gs_order-auart to e_t_data-auart,
gs_order-vkorg to e_t_data-vkorg .
modify e_t_data index gv_tabix.
clear: gs_order, gv_tabix.
endloop.
raise no_more_data.
endif.
s_counter_datapakid = s_counter_datapakid + 1.
loop at e_t_data.
move: sy-tabix to gv_tabix.
read table gt_order into gs_order
with key knumv = e_t_data-knumv
posnr = e_t_data-kposn.
check sy-subrc is initial.
move: gs_order-vbeln to e_t_data-vbeln,
gs_order-posnr to e_t_data-posnr,
gs_order-erdat to e_t_data-erdat ,
gs_order-auart to e_t_data-auart,
gs_order-vkorg to e_t_data-vkorg .
modify e_t_data index gv_tabix.
clear: gs_order, gv_tabix.
endloop.
endif. "Initialization mode or data extraction ?
loop at e_t_data.
move: sy-tabix to gv_tabix.
read table gt_order into gs_order
with key knumv = e_t_data-knumv
posnr = e_t_data-kposn.
check sy-subrc is initial.
move: gs_order-vbeln to e_t_data-vbeln,
gs_order-posnr to e_t_data-posnr,
gs_order-erdat to e_t_data-erdat ,
gs_order-auart to e_t_data-auart,
gs_order-vkorg to e_t_data-vkorg .
modify e_t_data index gv_tabix.
clear: gs_order, gv_tabix.
endloop.
It works ok if I give selection ERDAT or KSCHL but when I enter ERDAT & KSCHL value it only filters data based on ERDAT.
I debugged but everything looks OK..
can anyone Pls tell me whats is missing here in above code
Thanks for help
Regards
DougHi Nishu,
For this u have to write user exit in enhancement RSAP0001.
A sampe code for that is:
WHEN '2LIS_11_VAITM'.
SELECT * FROM vbak INTO CORRESPONDING FIELDS OF TABLE c_t_data .
TABLES : vbak.
*DATA : I_AUDAT LIKE VBAK-AUDAT,
I_VBELN LIKE VBAK-VBELN occurs 0 with header line.
*DATA : I_EXT LIKE MC11VA0ITM OCCURS 0 WITH HEADER LINE.
DATA : i_t_tab LIKE mc11va0itm OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF it_vbak OCCURS 0,
vbeln TYPE vbak-vbeln,
audat TYPE vbak-audat,
END OF it_vbak.
i_t_tab[] = c_t_data[].
BREAK-POINT.
SELECT vbeln
audat
INTO TABLE it_vbak
FROM vbak
FOR ALL ENTRIES IN i_t_tab
WHERE vbeln = i_t_tab-vbeln.
LOOP AT i_t_tab.
READ TABLE it_vbak WITH KEY
vbeln = i_t_tab-vbeln.
IF sy-subrc = 0.
i_t_tab-zzaudat = it_vbak-audat.
MODIFY i_t_tab.
CLEAR : i_t_tab,it_vbak.
ENDIF.
ENDLOOP.
c_t_data[] = i_t_tab[].
REFRESH : i_t_tab,it_vbak.
I think u know where to write this.
Vinod.
Assign points if helpful. -
How to calculate system date through function module date
Hi friends!!
i declare a variable "date like sy-datum".
now i want to add 15 days to the system date,
please give me the function module name which can do it.
xample.
date = sytem date. -> date= 13/08/2010
i want date= 28/08/2010.
please help.
Edited by: sandeep08 on Aug 13, 2010 1:53 PM
Moderator message: date calculation questions = FAQ, please search before posting.
locked by: Thomas Zloch on Aug 13, 2010 2:03 PMHi,
You can directly add 15 to the date. It will give you appropriate results.
Regards,
Aparna Alashe. -
Generic Extraction - Using Function Modules
Hi Friends,
Can you pl let me know the step by step process for creating generic extraction using function module?
Thanks in Advance.
Regards,
Ari.
Please search the forum before posting a thread
Edited by: Pravender on Aug 5, 2010 7:31 PMHi,
Plz find this doc.
http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33.
And go this link...
http://www.sdn.sap.com/irj/scn/advancedsearch?query=genericextractionwithfunctionmadule
Regards.....KP
Edited by: kundan.sap on Aug 5, 2010 4:35 PM -
Generic Extraction business Requirement, through function module,
Generic Extraction business Requirement, specifically through function module and source code in function module.
Dear Karthik,
Go to transaction SBIW -> Generic Datasource -> Maintain Generic Datasources -> Choose Master/Transaction Data -> Maintain proper entries (Application Component, Descriptions) -> Extraction by FM if you want to extract using FM.
Maintaining Generic DataSources - Independently of application, you can create and maintain generic DataSources for transaction data, master data attributes or texts from any kinds of transparent tables, database views, InfoSets of the SAP query or using a function module. As a result, you can make use of the generic extraction of data.
Creating a Generic DataSource
1. Select the DataSource type and give it a technical name.
2. Choose Create. The creating a generic DataSource screen appears.
3. Choose an application component to which the DataSource is to be assigned.
4. Enter the descriptive texts. You can choose any text.
5. Choose from which datasets the generic DataSource is to be filled.
a. Choose Extraction from View, if you want to extract data from a transparent table or a database view. Enter the name of the table or the database view.
After generation, you get a DataSource whose extract structure is congruent with the database view or the transparent table view.
For more information about creating and maintaining database views and tables, see the ABAP Dictionary Documentation.
b. Choose Extraction from Query, if you want to use a SAP query InfoSet as the data source. Select the required InfoSet from the InfoSet catalog.
After generation, you now have a DataSource whose extract structure matches the InfoSet.
For more information about maintaining the InfoSet, see the System Administration documentation.
c. Choose Extraction using FM, if you want to extract data using a function module. Enter the function module and extract structure.
The data must be transferred by the function module in an interface table E_T_DATA.
For information about the function library, see the ABAP Workbench: Tools documentation.
d. With texts, you also have the option of extraction from domain fixed values.
Maintain the settings for delta transfer where appropriate.
7. Choose Save.
Note when extracting from a transparent table or view:
If the extract structure contains a key figure field, that references to a unit of measure or currency unit field, this unit field must appear in the same extract structure as the key figure field.
A screen appears in which you can edit the fields of the extract structure.
8. Editing the DataSource:
Selection
When scheduling a data request in the BW Scheduler, you can enter the selection criteria for the data transfer. For example, you may want to determine that data requests are only to apply to data from the previous month.
If you set the Selection indicator for a field within the extract structure, the data for this field is transferred in correspondence with the selection criteria in the scheduler.
Hide field
You should set this indicator to exclude an extract structure field from the data transfer. As a result of your action, the field is no longer made available in BW when setting the transfer rules and generating the transfer structure.
Inversion
Reverse postings are possible for customer-defined key figures. For this reason, inversion is only possible for certain transaction data DataSources. These include DataSources that have a field that is indicated as an inversion field, for example, the field update mode in the DataSource 0FI_AP_3. If this field has a value, then the data records are interpreted as reverse records in BW.
Set the Inversion indicator if you want to carry out a reverse posting for a customer-defined field (key figure). The value of the key figure is then transferred in inverted form (multiplied by 1) into BW.
Field only known in exit
You can enhance data by extending the extract structure for a DataSource using fields in append structures.
The indicator Field only known in Exit is set for fields of an append structure. In other words, by default these fields are not passed onto the extractor from the field list and selection table.
Deselect the indicator Field Only Known in Exit to enable the Service API to pass on the append structure field to the extractor together with the fields of the delivered extract structures in the field list as well as in the selection table.
9. Choose DataSource -> Generate.
The DataSource is now saved in the source system.
Maintaining Generic DataSources
· Change the DataSource
To change a generic DataSource, in the initial screen of DataSource maintenance, enter the name of the DataSource and choose Change.
You can change the assignment of a DataSource to an application component as well as the texts of a DataSource. Double-clicking on the name of the table, view, InfoSet or extract structure takes you to the appropriate maintenance screen. Here you can make changes required to add new fields. You can fully swap transparent tables and database views, but not InfoSets. If you return to the DataSource maintenance and choose Create, the screen for editing a DataSource appears. To save the DataSource in the SAP source system, choose DataSource -> Generate.
If you want to test extraction in the source system independently of a BW system, choose DataSource -> Test Extraction.
· Delta DataSource
In the Change Generic DataSource screen, you can delete any DataSources that are no longer relevant. If you are extracting data from an InfoSet, delete the associated query. If you want to delete a DataSource, this must not be connected to a BW system.
Also visit :[Data Extraction from SAP Source System | http://help.sap.com/saphelp_nw04/helpdata/en/28/4c553c42360a40e10000000a114084/content.htm]
Regards,
Naveen. -
Creating BW Function module to extract R3 Function module data.
Could you tell me how to create a BW Function Module to Extract data from R/3 Function module?.
Also, the BW function module needs to pass a date/time filter to R/3 function module basis which the R/3 function module passes the date/time restricted data to BW function module.
Thanks,
GautamYou will have to create a function module in R/3 and then call the same in BW using the RFC call function option.
Please do not raise separate threads for each question - you have asked the same question in another post of yours..
bw extraction using function module
http://tinyurl.com/lwhtk8
this will give you an idea on how you can achieve this.
Maybe you are looking for
-
Anyone have list of issues fixed in 8.01? thanx...
Hi all (happy holidays) Anyone have list of issues fixed in 8.01? thanx... ps: I'm on a G5 and was hoping that 8.01 runs noticeably better now.... SvK Message was edited by: S v K
-
Garritan personal orchestra and Logic
Hi all, I just bought the Garritan personal orchestra and installed it but when I open Logic it keeps crashing validation in the AU manager and if I tick it anyway Logic just crashes. What to do? Any ideas please. JBlen
-
MI7.1 Re-Commit data before synchronization
Hi, I am newbie in Netweaver CE Mobile development. I have a problem during synchronization between Mobile to R/3 server. The data that uploaded to R/3 server is only first committed data "OcaRoot.getInstance().commit();". The data after first commit
-
Splitting of catalogue and data tables in their core BO management database
Hi All, Could you please suggest your ideas on the below recommendation suggested by our DBA's:- It is recommendable to split catalogue tables from data table and other data objects (e.g. indexes) using storage. splitting of catalogue and data tables
-
SCOM 2012 - Getting List of Objects in Maintenance Mode
Hi, I want to create a group of all the objects that are in Maintenance / Unmonitored Mode at that particular moment. Whether it is possible to have it? Regards, Sajid