Creating Function Module in Generic Extractor?
Hello All
DO anyone has steps how to create a Functional Module in Generic Extraction?
Pl let me know
Many Thanks
balaji
hi Balaji,
first create your function module (se37),
sample code see function module
RSAX_BIW_GET_DATA_SIMPLE.
then follow steps in create generic datasource
http://help.sap.com/saphelp_nw04/helpdata/en/3f/548c9ec754ee4d90188a4f108e0121/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/86/1c8c3e94243446e10000000a114084/frameset.htm
hope this helps.
Similar Messages
-
How to identify update mode in function module for generic extractor
Hi All,
I have created generic extractor using function module which supports delta load.
Delta logic is handeled in coding...by using ROOSGENDLM table.
Now problem is we need to identify the update mode, requested from infopackage in our function module in order to apply logic for Repair full.
I would like to know table or parameter in source system, which contain the update mode (Init , Delta , Full).
Thanks,
NirajHi Niraj
You can use the FM import parameter "i_updmode" (This is of type "SBIWA_S_INTERFACE-UPDMODE") to determine if infopackage triggerred in full or delta mode.
I_REQUNR TYPE SBIWA_S_INTERFACE-REQUNR
I_ISOURCE TYPE SBIWA_S_INTERFACE-ISOURCE InfoSource Name
I_MAXSIZE TYPE SBIWA_S_INTERFACE-MAXSIZE Data Packet size
I_INITFLAG TYPE SBIWA_S_INTERFACE-INITFLAG Initial Flag
I_UPDMODE TYPE SBIWA_S_INTERFACE-UPDMODE Update Mode
I_DATAPAKID TYPE SBIWA_S_INTERFACE-DATAPAKID Datapacket Id
I_PRIVATE_MODE
I_CALLMODE TYPE ROARCHD200-CALLMODE Single-Character Flag
I_REMOTE_CALL TYPE SBIWA_FLAG
Cheers
Vasu Sattenapalli -
Function Module for Generic Extractor
Hi, I have a generic extractor that uses a Function Module to extract the data. I have a change I need to make that only affects the code in the Function Module. Do I need to regenerate the DataSource or can I just change the function Module and transport the change to the function module?
Thanks for any details...As long as you are not changing the extract structure, you do not need to regenerate the datasource or replicate. Send FM only.
Regards,
Chad -
Function module based generic extractor - Problem with the selection
Hi all
The following is my code in the function module. I am able to get the entire data if i dont give any selections and the number of records is also correct. But when i select a MATNR value, it returns 0 records where as it needs to return 3 records. If i give selection based on bukrs, werks, lgort its working fine. But if i give selection based on MATNR, then it is not working.... I think there is a problem in the bold part of my code. If i debug, LS_MATNR is having the correct value which indicates that there is no problem with the value being passed to LS_MATNR from my selection screen of my datasource in RSA3. Even GT_WERKS is also having data. Please help.
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT MARA~MANDT
MARA~MATNR
MARC~WERKS
MARD~LGORT
MARA~MEINS
MARD~LABST
MARD~EINME
MARD~SPEME
MARD~RETME
MARD~INSME
MARD~UMLME
MARD~VMLAB
MARD~VMEIN
MARD~VMSPE
MARD~VMRET
MARD~VMINS
MARD~VMUML
MARC~XCHPF
MARD~KLABS
MARD~KEINM
MARD~KSPEM
MARD~KINSM
from MARA inner join MARC on
MARAMANDT = MARCMANDT AND
MARAMATNR = MARCMATNR
inner join MARD on
MARAMANDT = MARDMANDT AND
MARAMATNR = MARDMATNR
AND MARCWERKS = MARDWERKS
for all entries in gt_werks
where MARC~werks EQ gt_werks-werks
AND MARA~MATNR in LS_MATNR.
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.try this
select marc~matnr MARC~WERKS into t_marc for all entries in gt_werks
where werks EQ gt_werks-werks and lvorm = space.
if t_marc is not initial.
select MARD~LGORT MARD~WERKS MARA~MEINS MARD~LABST MARD~EINME
MARD~SPEME MARD~RETME MARD~INSME MARD~UMLME
MARD~VMLAB MARD~VMEIN MARD~VMSPE MARD~VMRET
MARD~VMINS MARD~VMUML MARC~XCHPF MARD~KLABS
MARD~KEINM MARD~KSPEM MARD~KINSM MARA~MEINS from
mard inner join MARA on mard~matnr = mara~matnr
for all entries in t_marc where mard~matnr = t_marc-matnr and mard-werks = t_marc-matnr
and mard~lvorm = space. -
When we go for Views and Function Modules for Generic Extraction
Hi Experts,
Can you please explain when we go for extracting the data using Views and when we got using Function Modules using Generic Extraction from R/3 system to BW with examples. And also can you explain when we go for delta for the above both scenarios.
Thanks for you help in advance
RohithHi,
Scenario for Extarction using FM
Imagine the scenario where you need to extract data from
tables having no common field between them and thereby preventing you from creating a view on top of those tables..
Or simply consider tables that are highly unrelatd in terms of fields, but you have a requiremnt to extract data from them.
Also Refer.
create generic extractor based on 2 tables
Generic Extraction via Function Module
/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
Steps.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33
http://help.sap.com/saphelp_nw04/helpdata/en/86/1c8c3e94243446e10000000a114084/frameset.htm
Scenario for Extraction using View
If there are more number of tables and data in those tables can be represented using joins then we can use this type of extraction
For more info Refer these links
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ecf9446011d189700000e8322d00/frameset.htm
Difference between "Help View" and "Search Help"
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed06446011d189700000e8322d00/frameset.htm
for more detailed info look on:
http://www.sap-img.com/abap/what-is-the-different-types-and-usage-of-views.htm
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/abap+dictionary&
For GEneric Delta refer these links
[generic with delta;
[https://forums.sdn.sap.com/click.jspa?searchID=11388803&messageID=5164737] -
How to convert a function module to BW extractor
Hi
I am Technical consultant. I have knowledge on BW.
We have one requirement in BW. It is to develop a report in BW.
The data has pickup in R/3 from 7 tables.
So i created one structure in R/3 side, and I created function module in SE37 using this structure display data as per the requirement.
Here my doubt is, How can i make it as a BW extractor.
Thnanks.Hi,
As mentioned above, you have to follow the steps to create a Datasource to be able extract data to BW, what is your doubt on this?
Hi Laxmi sri
Define your structure name on tables tab of your function madule then goto SBIW transaction in R/3 and goto Generic datasources and provide tech name and description for the extract structure.
Now provide App component the location where you want to save it
Now rpess extraction by FM and provide your function module name and extract structure name
Save and select fields to make selections on BW side
Save
Hope it helps.
Regards,
Chama.
Raj. -
Function Module in Generic DataSources in BI
Hi,
I appreciate your answer about the Function Module in Generic DataSources in BI.
These are the steps I followd on R/3 side.
1) Create a structure with the R/3 table fileds based on the requirement.
2) Create a function module by copying RSAX (Function Group) and RSAX_BIW_GET_DATA_SIMPLE (Functin Module) into our own function group & Function Module (name starting with Y /Z). And use the structure(ex: ZSPMT) created in the reference data of 'Tables' tab (ex: E_T_DATA LIKE ZSPMT).
3) Use the structure name & function module name in the Generic DataSource
Finally when I want to use the Generic DataSource, do i need to insert the records myself in the table (or structre) I created ZSPMT? (which is used in Function Module)
If I need to insert the data into table ZSPMT myself, what is use of function module?
Can't I use the view of this table (ZSPMT) directly in Generic DataSource?
Is the function module used to filter/restrict the data based on client need?
Thank you in advance for you answers
It will help undderstand the difference among View, InfoSet Query & Function Module
used in creating Generic DataSource.
Regards,
Lakshmihi,
why did you prefered function module?
if the table ZSPMT egts the data that you enter automatically then no need to use FM.
directly extract with tables/if more than one table then use views.
if you need especially the FM that could solve ur complex requirmnet.
http://help.sap.com/saphelp_nw04/helpdata/en/3f/548c9ec754ee4d90188a4f108e0121/content.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
Ramesh -
How to create function module step by step
hi experts,
i am new to ABAP.
can anybody tell me the step by step process on how to create a function module for adding two numbers without using editor screen.
ex: 2+3=5.Hi,
You can only create function modules and function groups using the Function Builder in the ABAP Workbench. For further information, refer to Creating New Function Modules. This section uses an example to illustrate how a function module is created from the point of view of ABAP programming.
Function Groups and Function Modules:
Firstly, we create a new function group DEMO_SPFLI to hold the function module. Then, we can create the new function module.
Parameter Interface:
You can specify the types of interface parameters in function modules in the
same way as the parameter interfaces of subroutines. Since function
modules can be used anywhere in the system, their interfaces can only contain
references to data types that are declared systemwide. These are the elementary
ABAP data types, the systemwide generic types, such as ANY TABLE, and types
defined in the ABAP Dictionary. You cannot use LIKE to refer to data types
declared in the main program.
Exceptions:
Our function module needs an exception that it can trigger if there are no entries
in table SPFLI that meet the selection criterion. The exception NOT_FOUND
serves this function.
Source Code:
Having defined the parameter interface and exceptions, we can now write the
source code of our function module. To do this, choose Source code in the
Function Builder. This opens the ABAP Editor for the include program
L<fgrp>U<xx> (see Function Groups). This is the include that will
hold the program code for the function module;
Data in Function Modules
You can use the TYPES and DATA statements to create local data types and
objects. The interface parameters also behave like local data objects. In
addition, you can access all of the global data of the main program. This data is
defined in the include program L<fgrp>TOP. To open this include, choose Goto
Global data. The global data behaves like the instance attributes of a class.
The first time you call a function module in a particular function group, the data is
loaded into memory. It can then be accessed and changed by all of the function
modules in the group. The system retains the values until the next time a function
module is called.
Calling Subroutines
You use subroutines for local modularization. Function modules can
also use this technique. The function module that they call are defined in the
corresponding main program.
If you only want to call a subroutine from a single function module, it is best to
define them in the same include program as the function module itself, directly
after the ENDFUNCTION statement. These subroutines can be called from all
function modules in the function group, but for clarity, they should only be called
from the function module that precedes them.
If you want to define a subroutine that will be called from several different function
modules, you can define a special include program for it with the name
L<fgrp>F<xx>.
Raising Exceptions
There are two ABAP statements for raising exceptions. They can only be used in
function modules:
RAISE <except>.
and
MESSAGE..... RAISING <except>.
The effect of these statements depends on whether the calling program handles
the exception or not. If the name <except> of the exception or OTHERS occurs
in the EXCEPTIONS addition of the CALL FUNCTION statement, the exception is
handled by the calling program.
If the calling program does not handle the exception
The RAISE statement terminates the program and switches to debugging mode.
The MESSAGE ..... RAISING statement display the specified message. How the
processing continues depends on the message type.
If the calling program handles the exception, both statements return control to the
program. No values are transferred. The MESSAGE ..... RAISING statement
does not display a message. Instead, it fills the system fields SY-MSGID, SYMSGTY,
SY-MSGNO, and SY-MSGV1 to SY-MSGV4.
Source Code of READ_SPFLI_INTO_TABLE
The entire source code of READ_SPFLI_INTO_TABLE looks like this:
FUNCTION READ_SPFLI_INTO_TABLE.
""Local interface:
*" IMPORTING
*" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
*" EXPORTING
*" VALUE(ITAB) TYPE SPFLI_TAB
*" EXCEPTIONS
*" NOT_FOUND
SELECT * FROM SPFLI INTO TABLE ITAB WHERE CARRID = ID.
IF SY-SUBRC NE 0.
MESSAGE E007(AT) RAISING NOT_FOUND.
ENDIF.
ENDFUNCTION.
The function module reads all of the data from the database table SPFLI where
the key field CARRID is equal to the import parameter ID and places the entries
that it finds into the internal table SPFLI_TAB. If it cannot find any entries, the
exception NOT_FOUND is triggered using MESSAGE...RAISING. Otherwise, the
table is passed to the caller as an exporting parameter.
Regards,
Chandru -
Doubt in export, import and table para when creating Function Module
Dear fellow ABAPers,
I have a doubt in defining export, import and table parameter while creating a function module.
I am calling a function module inside a user exit. Now in the user exit the SAP fills an internal table called i_lfa1 with all the data user has eneterd.
Now I want to pass this whole internal table to function module and the perform some checks on the values of internal table.
After that function module fills an error structure with values depending on some check.
1)
How do I pass this internal table to function module ?
When I am creating function module in se37 where do I define this iternal table type ? Is it in Import or Table parameter during function module creation?
2)
Where do I define error structure type (which is returned by function module to main program)? Is it in Export or table parameter during function module creation?
Please clear my doubt..
Relevant points will be awarded.
Regards,
Tushar.Hi Tushar,
1. How do I pass this internal table to function module ?
I assume u are creating your own Y/Z FM.
Pass it thru TABLES parameter.
2. When I am creating function module in se37 where do I define this iternal table type
Define this in TABLES interface.
What Type ?
THE SAME TYPE WHICH HAS BEEN DEFINED
WHILE PASSING IN THE USER-EXIT FUNCTION MODULE.
IF U SEE THE FM OF THE USER-EXIT,
U WILL COME TO KNOW.
3.
Where do I define error structure type (which is returned by function module to main program)? Is it in Export or table parameter during function module creation?
Define it in TABLES interace. (not in export, import)
(Since what u are going to return is an internal table)
U can take for eg. BDCMSGCOLL.
OR u can create your own Y/Z structure
for the same purpose.
(or u can use the structure type T100)
I hope it helps.
Regards,
Amit M. -
How to create function module for getting customer name
Hi Experts,
How to create function module? when in import parameter kunnr values to be passed it must give name1 details according to the customer number...
how to write the logic in source code....
Regards,
Thiru. R1. First of all create function group.
2. Create function module using this function group.
3. If only one kunnr is needed at a time, create import parameter for it. But if many kunnr to be entered at a time,use table.
4. Fetch name1 for each kunnr from KNA1 table.
"->> if many kunnr
if not t_kunnr[] is initial.
select kunnr as kunnr name1 as name1
into table t_kunnr_name1
from kna1
for all entried in table t_kunnr
where kunnr = t_kunnr-kunnr.
endif.
sort t_kunnr_name1 by kunnr name1.
delete adjacent duplicates from t_kunnr_name1 comparing kunnr name1.
table t_kunnr_name1 will contain kunnr and its name1.
I hope logic is clear for you now.
Regards,
Aparna -
How to create function module in real time
hi experts,
can somebody explain a real time requiremwnt , to create a function module.
its very urgent.
i want elaborately.
regards,
subhasis.hi,
In real time
1. as per my knowledge we create function modules to Inbound IDOC /outbound processing..
2.Interface between a program..
Example we need to take some data from a report say materials and plant and process some bapi and return logfiles to the report we can use FM here too.
To create a function module
First you need to create a function group (function group holds a number of function modules relevant)
SE37>goto>function groups-->create group ..click this create group..
Now in the pop up enter the function groupname Eg: ZW_FG1 plus short text and saveit
Now again goto SE37--> enter new Function module name eg:ZW_FM1
and press F5.
Now again a popup you need to enter
function group name : ZW_FG1
and short test and save it..
Now the Function module is created under the Function group ZW_FG1.
write your export import table parameters and you source code.
rewards if useful
regards,
nazeer
Message was edited by:
nazeer shaik -
How to create function module in abap for VirtualProvider in bi
how to create function module in abap for VirtualProvider in bi ???????????????
can any one help me with simple example ?????????????????
Moderator message : Duplicate post locked. Read forum rules before posting.
Edited by: Vinod Kumar on Jun 15, 2011 4:40 PMHi ,
Thanks for replies about my question??.
If i am using the exit in my char relation ship how can i debugg that exit???
if i am using BPS0 how to do it???If i am using BPS_WB how to do it??
Case1.Variable (type Exit) I known how to do debugg this one in BPS0 but i'm not sure in BPS_WB??
Case2:Char Relation Ship(Type Exit) how to do in BPS0 and BPS_WB??.
Thanks. -
How to extract data by using function module in generic extraction please
how to extract data by using function module in generic extraction please give me steps required
Dear Deba,
Generic Extraction via Function Module
/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
If the requirement is like extracting data from multiple tables with some complex logic then views cannot be used..so u cna go for FM is used where it can be achieved.
Chk these
/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33
check the following thread
generic extraction with function module
Generic Extraction with function module
Regards,
Ram. -
How to delete Thr created functional module dynamically
Hi All,
How to delete Thr created functional module dynamically
Regards,
Lisa
Message was edited by:
Lisa RoyHi,
You can use the function module RS_FUNCTION_DELETE to do that.
Make sure you are not deleting any standard FM's.
Example
call function 'RS_FUNCTION_DELETE'
exporting
funcname = 'ZFM_NAME" " Function modue name
suppress_popups = 'X' " TO suppress any pop-ups that come when you delete
exceptions
error_message = 1
cancelled = 2
function_released = 3
others = 4.
Regards,
Sesh -
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.
Maybe you are looking for
-
A warning box tells me that my login has to be 21 characters or less for iCloud ID. But the email address I use for my Apple ID has 26 characters. How do I get around this?
-
Mouse buttons not working correctly
For several days now, my mighty mouse (another does the same thing) is frequently acting with left button like I am holding down option key to select a group, when it should just select a single item (ie, it grabs a group). I can use escape button or
-
Anything equal to Cont+Alt+Del from windows?
I am having an issue where WoW will crash ( think its due to blizzards last update ) Once it locks up, I have to Power the iMac down and power back up. Is there a way, like control alt delete from windows to just shut the game down, so I don't have t
-
Restored Computer, can I save my applications?
I recently had to totally reinstall Snow Leopard, and was able to restore most of my files, but unfortunately my backup did not include several recently purchased applications that are present on my iPhone (I don't sync too often). Now that I've rest
-
How to enable Auto-complete in web dynpro abap? just like in sap gui, client side every inputfield entered value gets stored, as and when we press back button in the inputfields it lists previously entered values list. Abhi