Generic extractor based on specific function module with delta update
Hi everybody,
I'm trying to create a specific extractor using a specific function module and a specific structure of record.
In my F.M i merge record from standard table MKPF and MSEg and return the result trhu the structure.
In initialisation mode, there's no problem . But now i'm must be able to use the DELTA mode but i don't know how to do it.
Can somebody help me?
Here is the code of my function module , i know it's not a standard one because i'm not using cursor but i got everything i need. The delta mode must be on creattion time of record in mkpf .
FUNCTION z_bw_extract_mvt_sortant.
""Interface locale :
*" IMPORTING
*" VALUE(I_REQUNR) TYPE SBIWA_S_INTERFACE-REQUNR
*" VALUE(I_ISOURCE) TYPE SBIWA_S_INTERFACE-ISOURCE OPTIONAL
*" VALUE(I_DSOURCE) TYPE SBIWA_S_INTERFACE-ISOURCE OPTIONAL
*" VALUE(I_MAXSIZE) TYPE SBIWA_S_INTERFACE-MAXSIZE OPTIONAL
*" VALUE(I_INITFLAG) TYPE SBIWA_S_INTERFACE-INITFLAG OPTIONAL
*" TABLES
*" E_T_DATA STRUCTURE ZBW_MVTSORTANT OPTIONAL
*" I_T_SELECT TYPE SBIWA_T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SBIWA_T_FIELDS OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*récupération des données.
CASE i_initflag.
WHEN space.
transfert_record it_mvtsor e_t_data i_maxsize.
DESCRIBE TABLE it_mvtsor LINES sy-tfill.
IF sy-tfill GT i_maxsize.
APPEND LINES OF it_mvtsor FROM 1 TO i_maxsize TO e_t_data.
DELETE it_mvtsor FROM 1 TO i_maxsize.
ELSEIF sy-tfill GT 0.
APPEND LINES OF it_mvtsor FROM 1 TO sy-tfill TO e_t_data.
FREE it_mvtsor.
ELSE.
RAISE no_more_data.
ENDIF.
WHEN OTHERS.
raffraichissement des variables de travails.
FREE : r_werks , r_bwart , it_mkpf , it_mseg , it_mvtsor .
CLEAR : r_werks , r_bwart , it_mkpf , it_mseg , it_mvtsor .
récupération des paramètres.
PERFORM set_selection_criteria TABLES i_t_select.
PERFORM init_code_mouvement.
SELECT * FROM mkpf
APPENDING CORRESPONDING FIELDS OF TABLE it_mkpf.
WHERE cpudt = sy-datum.
CHECK NOT it_mkpf IS INITIAL.
SELECT * FROM mseg
APPENDING CORRESPONDING FIELDS OF TABLE it_mseg
FOR ALL ENTRIES IN it_mkpf
WHERE mblnr = it_mkpf-mblnr
AND mjahr = it_mkpf-mjahr
AND werks IN r_werks
AND bwart IN r_bwart.
LOOP AT it_mkpf ASSIGNING .
ENDLOOP.
ENDLOOP.
ENDCASE.
ENDFUNCTION.
Thanks in advance.
Hi,
first of all: The use of delta in a generic Datasource by FM is not supported by SAP standard. You need to change the extraction method in table ROOSOURCE from F2 to F1. There is no standard transaction to do this, you have to do a hard table update. Be careful not to change any standard datasource by error, otherwise you can get serious problems.
The interface for the FM will change with the new extraction method. You will need a new parameter I_UPDMODE of type SBIWA_S_INTERFACE-UPDMODE to distinguish between Init, Delta and Full Load.
For an example coding please refer to FM RSVD_BW_GET_DELTA_DATA.
Hope that helps
Stephan
Message was edited by: Stephan Müller
Similar Messages
-
Generic Extractor using Function module with Complex Interface
Hi,
Has anyone created Generic extractor using Function module with Complex Interface?
What is the difference between Complex and Simple interface in Function module?
Pls explain.
Thanks,
GopalHi,
Go through this link.....
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d3219af2-0c01-0010-71ac-dbb4356cf4bf
GTR -
Create generic extractor based on 2 tables
hey BI gurus,
I have to create a generic extractor based on these 3 tables:
eban - i need all fields
vttk - i need only 4 fields i.e
route,
tknum,
datbg,
daten
ekbe - budat.
now the problem is thr is no common field between vttk & eban AND vttk & ekbe. but thr is a common field between eban & ekbe.so i can create a view only on these 2 tables but i want 3 tables
how do i proceed???Hi,
Sometimes, if your application or requirement makes it necessary, you have to create your own function module to extract the data from whatever sap system to bw.
Therefore you normally make a copy of the standard fm 'RSAX_BIW_GET_DATA_SIMPLE'. To make this new function work for you, you have to realize the following.
1.) the fm gets called by the extraction api for at least 2 times. First time is for initialization and from the 2nd time on it is for data extraction.
2.) right after the last data package (somehow you need to make sure that it is the last one) you have to raise the exception no_more_data.
Refer this links for more Info
SAP BI Generic Extraction Using a Function Module
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33
SAP Network Blog: Generic Extraction via Function Module
/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
Take the help of an ABAPer if your are new to this process
Regards
Karthik
Assigning points is the way to say thanks -
Generic function module for delta - which FM ?
Hi all,
I want to create a custom generic datasource in R3 which uses a function module for delta extraction. This is straight forward for full extract (copy FM RSAX_BIW_GET_DATA_SIMPLE - I already did this and have a full extraction working to BW). However I need to extract delta - and the above function module does not have example code for that (I have seen some forum posts that it 'can' be used - but this looks like a pseudo get around where the delta field name is passed in I_T_SELECT).
FM RSVD_BW_GET_DELTA_DATA seems to be an example code of a FM which can allow delta (i.e. manually codes how to fill date/time stamp information). However when I code this and try test in RSA3 it seems to try to populate the delta selection field before calling my function module! I need it to call my function and allow the function to specifiy the date criteria.
Can anyone help with an example of how this should best be done ?
Or can it only be done in a pseudo form using 'RSAX_BIW_GET_DATA_SIMPLE' example FM.
Note: I have setup the RSO2 datasource to allow delta.
Also - I have spent several hours searching the forum - but please answer with a link if you think it does answer exactly this problem.
Thanks for any help
MartinHi again,
Have had a few requests for the code I used - I created a new custom function copied from 'RSAX_BIW_GET_DATA_SIMPLE'. AEDAT has been set as the delta date for this data source in transaction RSO2.
Main sample code is -
1. Code to receive selection criteria and store in internal ranges -
FUNCTION zbw_sodetail_get_detail.
""Global interface:
*" IMPORTING
*" VALUE(I_REQUNR) TYPE SRSC_S_IF_SIMPLE-REQUNR
*" VALUE(I_DSOURCE) TYPE SRSC_S_IF_SIMPLE-DSOURCE
*" VALUE(I_MAXSIZE) TYPE SRSC_S_IF_SIMPLE-MAXSIZE
*" VALUE(I_INITFLAG) TYPE SRSC_S_IF_SIMPLE-INITFLAG
*" VALUE(I_READ_ONLY) TYPE SRSC_S_IF_SIMPLE-READONLY
*" 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 ZBW_SODETAIL OPTIONAL
*--- Sales order item create date
LOOP AT i_t_select INTO l_s_select WHERE fieldnm = 'ERDAT'.
MOVE-CORRESPONDING l_s_select TO r_erdat.
APPEND r_erdat.
ENDLOOP.
*--- Sales order item change date - DELTA only - auto filled before
this function is called.
C (Initialise Delta) - Low = blank, High = today - safety limit
D (Delta) - low = , High = . *from roosgendlm
LOOP AT i_t_select INTO l_s_select WHERE fieldnm = 'AEDAT'.
MOVE-CORRESPONDING l_s_select TO r_aedat.
APPEND r_aedat.
ENDLOOP.
2. Code to use selection criteria to get initial or delta. Note that for delta the delta date field to be used is automatically populated with the date of the last delta run (from table roosgendlm) -
SELECT VBAK~KNUMV
VBAPVBELN VBAPPOSNR VBAPMATNR VBAPARKTX VBAP~SPART
VBAPWERKS VBAPERDAT VBAPAEDAT VBAPNETWR VBAP~WAERK
VBAPABGRU VBAPZPROMISE VBAP~CUOBJ
VBEP~EDATU
INTO CORRESPONDING FIELDS OF TABLE ZBW_SODETAIL_ITAB
FROM VBAK JOIN VBAP ON VBAKVBELN = VBAPVBELN
JOIN VBEP ON VBAPVBELN = VBEPVBELN
AND VBAPPOSNR = VBEPPOSNR
WHERE VBAP~VBELN IN R_VBELN "Order number
AND VBAP~POSNR IN R_POSNR "Order item number
AND VBAP~ERDAT IN R_ERDAT "Order item date created
AND ( VBAP~ERDAT IN R_AEDAT OR "Created date in Delta range
VBAP~AEDAT IN R_AEDAT OR "Order item change Delta range
VBAK~AEDAT IN R_AEDAT ). "Order header change Delta range
Note that if the data source is called in initial or full extract mode the delta change date (aedat) will automatically be blank.
I have been using this successfully.
I hope this helps
Martin. -
Creating function modules with step by step
Hi,
plz provide me the material for creating function modules with step by step.Hi Nagaraju,
Step 1.
GO to transaction SE80.In the drop box list select function group enter your Z Function group name.Press enter it will ask for creating the function group.Create your function group.
OR
In SE37 transaction,in the menu bar Goto - > Function Group - > Create Group.Your Function Group will be created.
Step 2.
Go to transaction SE37.Enter your Z Function module name,your recently created function group name and the description.Press Enter.Now your FM is created.
Step 3.
Enter Export,Import parameters.In the source code tab write the code what you want to write.If any exception write in the exception tab.
Method 2)
First u have to create Function Group.
1.se37->Goto->Function Group--->Create.
2.Create FM.
3.maintain import /export parameters and tables , exceptions.
4.based on the ur requirement u have to bulid ur logic in Source Code by using there Import parameters and u can pass the results by using Export or table.
5.u can raise error by using exception.
Reward if useful.
Thanks
Aneesh. -
How to check for a function module with its description and functionality
Hi all,
How to check for a function module,with its description and its functionality,in detail how can I know the purpose of a particular function module,how to search for a function module which suits my requirement .Hi,
You can search a FM of your requirement by putting in the Key words and searching for a FM. Like * KEYWORD * and then pressing F4.
Say for example you need to search something regarding converstion.
Search for * CONVERT * and press F4.
If there is something specfic like converting date to something you can give
DATE * CONVERT *
OR
CONVERT * DATE * and press F4.
Once you narrow down your search you will have a Function module documentation inside the Function module. Please note that all the FMs willl not have documentation.
Regards,
Pramod -
How to create a custom function module with the records in SAP R/3?
Hi All,
How to create a custom function module with the records in SAP R/3? Using RFC Adapter I have to fetch the custom function module records.
Regards
SaraHi
goto se37...here u need to create a function group... then u need to create a function module. inside assign import/export parameters. assign tables/exceptions. activate the same. now write ur code within the function module
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm
Look at the below SAP HELP links, These links will show you the way to create a Function Module
http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm -
RFC Function module-With Only Request message
Hi
i need a RFC with only Request message and Response message is not required.
please help me, how to create a RFC function module with out Response message, and it should contain only Request message.
i have created RFC in this way:
RFC doesn't contain neither import nor export parameters. and i have defined one table in TABLE tab which refers to a ztable created already.
when i imported RFC into XI i came to know that RFC has both Request and Response messages, but i don't need Response message.
Thanks in advance..help would be appreciated
Regards,
RajeshThankx Michal,
I have written ZRFC this way:
insert ZMM_AUTO_GR from INPUT_TABLE .
if sy-subrc = 0.
commit work.
else.
rollback work.
im not using neither import nor export parameters..but using only tables parameters. but when imported in XI im getting same table structure in both request an response.
please suggest what changes required in above code to invoke my ZRFC in async way.
you will not get any response in XI- what chages required in my code to dnt get .reponse in XI.
appreciate your help.
Regards,
Rajesh. -
How to assign function module with process code in IDOC ?
how to assign function module with process code in IDOC ? and what code i have to write in that function module for custom IDOC ?
helpful answer will be rewarded?Hi,
First goto transaction we42 -->editing mode --> new entries -->give name of your process code and description --> processing with alv service and function module -->then press enter -->after that enter the name of the function module you want to associate from the drop down and save it.
Thats the way to assign function module with process code.
In that process code we will have the Function modules and Bapi's which will take the data which we are sending through IDOC and then process it.
for example: i am triggering the IDOC for every purchase order created then this process code in the receiver system will take the data which i have enetered in the sender system to create the purchase order and process it and creates the same purchase order in the receiver's system.
Reward if helpful.
with regards,
Syed -
Find Userexit name based on Exit function module
Hi All,
Is there any way to find the userexit name based on the function module.
My exit function module is EXIT_SAPLATPC_001. I want to find the exit name.
Appreciate your help.
Thanks,
Jaffer Ali.SHi
This is the Exit Name: ATP00001 for the Exit FM you have given. I took the package name this exit FM is stored in the Attributes of FM in SE37. In the search criteria of SMOD,after hitting f4..and selecting Information System, I gave the package name...and it gave me the exit name.
P.S: The above method may sometimes lead to giving in more than one exit as result.
Vishwa. -
Log on into the function module with different user name.
hi,
i log on into the system with my user id suppose 'mukka' and i have to check the authorization of another user say 'you' using the function module "authority_check_tcode". but here i am getting the problem that when i assigned sy-uname to 'you' and execute the function module it is entering into the function module with 'mukka' user name only.
sample code:-
sy-uname = p_uname.
CALL FUNCTION 'AUTHORITY_CHECK_TCODE' "#EC"
EXPORTING
tcode = v_tcode
EXCEPTIONS
ok = 1
not_ok = 2.
when i am changing the sy-uname with p_uname the sy-uname is changed but when i entered into the function module authority_check_tcode in the debugging mode at the below the sy-uname variable is showing as 'mukka' only. but i need to check the authorizations of user 'you' pls give me solution to my problem.Hi,
Why would you want to check the authorisation of another user and not the one currently logged in? The idea of authorisations is to check the current user is able to perform a certain activity. The majority of fields on SYST are constantly updated to have the correct values (partly so you can't fiddel authorisation checks like this
Maybe if you explain to us what you are trying to do we can offer some other help.
Gareth. -
RFC enabled function module to insert , update and delete data in a ZTABLE
friends..
Is there any standatd RFC enabled function module to insert , update and delete data in a custom database-table (Ztable)?
if not how can we create it? plz give me the details steps..
what are the import, export parameters and how to code and process it.. (for example: suppose fields in the table is Emp_Id, Name, Address. I need to develop a RFM which does the 3 tasks, insert update delete in the same RFM)
Thanks and Regardscreate a f.n mod in se37 and make it rfc enabled. ur import parameters are Emp_Id, Name, Address and TASK and u can have an export parameter like result which gives the status of the update. based on task u can insert using keyword INSERT....and update using UPDATE or MODIFY and delete using DELETE. these keyword are not compelte with syntax but need to refer the SAP documentation.
-
RFC enabled function module for insert update and delete in a Ztable..
friends..
Is there any standatd RFC enabled function module to insert , update and delete data in a custom database-table (Ztable)? if not how can we create it? plz give me the details steps..
what are the import, export parameters and how to develop and process it.. (for example: suppose fields in the table is Emp_Id, Name, Address)
Thanks and RegardsHi,
Try this code.
REPORT ZMMC071Z_RMV.
TYPE-POOLS : ABAP.
FIELD-SYMBOLS: <DYN_TABLE> TYPE STANDARD TABLE,
<DYN_WA>,
<DYN_FIELD>,
<LV_CONDI>.
DATA: DY_TABLE TYPE REF TO DATA,
DY_LINE TYPE REF TO DATA,
XFC TYPE LVC_S_FCAT,
IFC TYPE LVC_T_FCAT.
SELECTION-SCREEN BEGIN OF BLOCK F1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_TABLE LIKE DD02L-TABNAME OBLIGATORY.
SELECTION-SCREEN END OF BLOCK F1.
Evento: At Selection Screen *
START-OF-SELECTION.
PERFORM GET_STRUCTURE.
PERFORM CREATE_DYNAMIC_ITAB.
PERFORM GET_DATA.
END-OF-SELECTION.
*& Form get_structure
text
FORM GET_STRUCTURE.
DATA : IDETAILS TYPE ABAP_COMPDESCR_TAB,
XDETAILS TYPE ABAP_COMPDESCR.
DATA : REF_TABLE_DES TYPE REF TO CL_ABAP_STRUCTDESCR.
DATA VL_LENGHT(30).
Get the structure of the table.
REF_TABLE_DES ?=
CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( P_TABLE ).
IDETAILS[] = REF_TABLE_DES->COMPONENTS[].
LOOP AT IDETAILS INTO XDETAILS.
CLEAR XFC.
XFC-FIELDNAME = XDETAILS-NAME .
XFC-DATATYPE = XDETAILS-TYPE_KIND.
XFC-INTTYPE = XDETAILS-TYPE_KIND.
XFC-INTLEN = XDETAILS-LENGTH.
XFC-DECIMALS = XDETAILS-DECIMALS.
APPEND XFC TO IFC.
ENDLOOP.
ENDFORM. "get_structure
*& Form create_dynamic_itab
text
FORM CREATE_DYNAMIC_ITAB.
Create dynamic internal table and assign to FS
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = IFC
IMPORTING
EP_TABLE = DY_TABLE.
ASSIGN DY_TABLE->* TO <DYN_TABLE>.
Create dynamic work area and assign to FS
CREATE DATA DY_LINE LIKE LINE OF <DYN_TABLE>.
ASSIGN DY_LINE->* TO <DYN_WA>.
ENDFORM. "create_dynamic_itab
*& Form get_data
text
--> p1 text
<-- p2 text
FORM GET_DATA .
*Get data from p_table into internal table <DYN_TABLE>
SELECT * INTO TABLE <DYN_TABLE>
FROM (P_TABLE)
Here you can implemente function DELETE, INSERT.
ENDFORM. " De_para -
Function Module 'Save_text' in update task of Vl01n
Hi Friends,
My requirement is, when i save a delivery document, the 'Material Sales text' in delivery has to be updated with custom details.
It is good that we can code the function module 'Save_text' in update task in the exit provided for VL01n - Delivery creation right.
At saving of delivery, we can use the set, get parameters to get the delivery document no and pass it to the Function module 'Save_text' in update task. Hope this will work.
Correct me if i am wrong.
Highly appreciate your valuable responses.
Thanks,
Jaffer Ali.SHi,
You are going in a correct method proceed. Its been good to know whether you are going correct or wrong.
Cheers!!
VEnk@ -
Function Module to Change / Update BOM Line Items
Hi,
I need a Function Module to Change / Update BOM Line Items.
Please help.
Thanks.Try this FM - CSAP_MAT_BOM_MAINTAIN
Maybe you are looking for
-
as many of you do, I use time capsule as airport, too... It worked fine for 6 months or so after I bought the new time capsule. (I bought it in September 2012.) Since the beginning of this year, I had to reset, and power off and plug it in almost eve
-
IPhone 4 locks up while updating to iOS 4.3.2
My iPhone 4 (GSM; AT&T) just had the first major problem that I have ever encountered with my iPhone. While updating my phone to iOS 4.3.2 from an iMac (early 2006; Snow Leopard 10.6.7/iTunes 10.2.1), it hung on the update screen for 30 minutes, lock
-
Select only non-numeric characters
A $ ^ (78^*)5$#7 )!@#$0-99 _454*(&--0 +@#$%564 =123 How select only non-numeric characters from above table?
-
How to download pc version from a mac?
Is there a setting? I can't find how to do.. Thanks
-
Where is messages in the app store
The application 'messages' that allows you to text via your mac is nowhere to be found on my app store. I just downloaded the new mavericks onto my computer. Has anyone else had this same issue or found a solution. Please let me know.