Routine based on Function Module
Hello All,
i have to write code for a routine using a custom function module that is created previously.
the function has input parameter IN_YEAR_WEEK and output parameter EN_WEEK_1 , EN_WEEK_2.
this routine is in the transformation between cube and open hub between the 0calweek of the cube and a custom field znum_week in the open hub.
the input parameter of the function like 201005 (the fifth week in 2010 year) is the same value that i will have in the 0calweek of my cube and give in output 2 parameters between 0 and 5 that's mean the number of week in the month.
the value between 0 and 5 should be puted in the znum_week field
if the function return value between 1 and 5 i should have duplicate records in the open hub file.
can you give me please some advice how should be my abap coding for this routine.
should i use start routine? or routine of the single field?
thanks
Bilal
Hi ALL,
i have created this code for start routine to duplicate records in my open hub, can you tell me please if the logic is correct?
data: v_week_1 like n.
data : v_week_2 like n.
DATA: vn_tabix LIKE sy-tabix.
data: wa_temp LIKE SOURCE_PACKAGE.
LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.
CALL FUNCTION ' ZIV_DP_FUNC_NUM_WEEK_LA '
EXPORTING
IN_YEAR_WEEK = <SOURCE_FIELDS>-/bic/0calweek
IMPORTING
EN_WEEK_1 = v_week_1
EN_WEEK_2 = v_week_2.
If v_week_1 between 1 and 5 and v_week_2 = 0
<SOURCE_FIELDS>-/bic/0calweek = v_week_1.
MODIFY SOURCE_PACKAGE INDEX vn_tabix FROM < SOURCE_FIELDS>.
Endif.
Else
If v_week_1 between 1 and 5 and v_week_2 between 1 and 5
<SOURCE_FIELDS>-/bic/0calweek = v_week_1.
MODIFY SOURCE_PACKAGE INDEX vn_tabix FROM < SOURCE_FIELDS>.
MOVE <SOURCE_FIELDS> to wa_temp.
wa_temp-/bic/0calweek = v_week_2.
APPEND wa_temp TO SOURCE_PACKAGE.
Endif.
REFRESH: wa_temp.
thanks a lot
Bilal
Similar Messages
-
Problem with R/3 Data Source based on Function module in SAP BI
Hi,
We have a data source based on functional module. When we load data from R/3 to BI we face the following error.
" No end-confirmation arrived in the Warehouse from the source system."
We are getting data but due to no end confirmation from the source system, the load become timed-out and status becomes "RED". When we change the status to be "GREEN" and proceed tha load further, load is fine.
Please suggest us a suitable solution.
Thanks in Advance,
GeethaHi Geetha Devi Ramalingam.
I faced the same problem since yesterday. I just resolve the issue.
So here is my solution :
try this code :
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.
if you add your
bold
IF sy-subrc <> 0.
CLOSE CURSOR s_cursor.
RAISE no_more_data.
ENDIF.
bold
than the sy-subrc may be equal and than your CLOSE CURSOR s_cursor. will have no effect
it work for me hope it will for u
Hard luck!
Salah
Edited by: idrissi salaheddine on Jan 19, 2012 12:24 PM -
Generic Data Source Based On Function Module (Delta capable)
Hi,
My requirement is to develop a Generic Extractor based on Function Module (Delta capable). As I already found many threads explaining this concept, but most of them discussing FM RSAX_BIW_GET_DATA_SIMPLE with Extraction Method F2. There is another FM RSAX_BIW_GET_DATA which, one can use to build delta enabled extractor.
Although I do have some doubts:
what is the E_T_SOURCE_STRUCTURE_NAME ?
read table i_t_select into l_s_select with key fieldnm = 'PGMID'. Use of this code ?
Templet only showing
case i_updmode.
when 'F'.
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.
i.upmode as F, D(delta) is not included, do i need to include this?
Can someone help to solve this. Appropriate points will be allotted to helpful suggestions.
Edited by: Debjit_Singha_86 on Jul 23, 2011 8:35 AMTry using following piece of code;
READ TABLE g_t_select INTO l_s_select
WITH KEY fieldnm = 'Date Field for Delta'.
IF sy-subrc EQ 0.
SELECT SINGLE *
FROM ROOSGENDLM
WHERE oltpsource EQ 'DataSource Nameu2019
AND slogsys EQ lw_slogsys.
IF sy-subrc EQ 0.
lw_date = roosgendlm-deltaid+0(8).
lw_time = roosgendlm-deltaid+8(6).
ENDIF. " IF SY-SUBRC EQ 0.
ENDIF.
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT * FROM TABLE
WHERE CPUDT GE lw_date AND
CPUTIME GE lw_time.
ENDIF.
Table R00SGEMDLM stores the date and time data was last extracted from a data source.
Alternatively, you can also try using the i_updmode.
When 'F'.
SELECT * FROM TABLE (without any where clause on last change date)
When 'D'
SELECT * FROM TABLE
WHERE CPUDT GE lw_date AND
CPUTIME GE lw_time.
These are just suggestions. Try these out, I hope it helps.
Regards,
Gaurav -
Error while creating a extractor based on Functional Module
Hi,
I am building an extactor based on afunction module.I created a DS and created a structure in Se11.When i am trying to put the extract structure in the Tables tab of the function module it gives me an error saying Tables parameters are obselete and doesnt allow me to activate or go back and front to other tabs.Can anyone please tell me what might be the reason?
Thanks,Hi,
Just try to reactivate the structure once again. And when you open the function module, if the problem still persists just try to press Return key several times. The message you are getting is just a warning message.
PS: I am not sure whether this is the correct way, but i personally resolved this by pressing the ENTER key 4 or 5 times. So just give a try.
Regards
Sunil -
Extractor based on function module
I have create an extractor based on
A function module: ZSALESTEXT_EXTRACT
Extract structure: ZOXDT20030
When I execute this extractor on debug mode, as the function module ZSALESTEXT_EXTRACT is called I have a short dump with the following message:
Since the caller of the procedure could not have expected this exception
to occur, the running program was terminated.
The reason for the exception is:
When calling the function module "ZSALESTEXT_EXTRACT", one of the parameters
needed according to the interface description was not specified.
This parameter was "E_T_DATA".
Do you know what's happen ?
Many thanks
Annexe Function module code :
FUNCTION ZSALESTEXT_EXTRACT.
""Local interface:
*" TABLES
*" E_T_DATA STRUCTURE ZOXDT20030
*" SELECTION STRUCTURE RSSELECT
Data: D_NAME LIKE THEAD-TDNAME,
d_vbeln like vbap-vbeln,
d_posnr like vbap-posnr,
d_date1 like vbap-aedat,
d_date2 like vbap-aedat,
TRESULT LIKE TLINE occurs 1 with header line.
*internal table
Types: BEGIN OF SalesTextTable,
VBELN Like VBAP-VBELN,
POSNR Like VBAP-POSNR,
TextMST Like TLINE-TDLINE,
TextKPI Like TLINE-TDLINE,
END OF SalesTextTable.
*Tables: Like SalesTextTable with header line.
DATA: ITAB TYPE TABLE OF SalesTextTable with header line
WITH KEY VBELN
POSNR,
WA_ITAB LIKE LINE OF ITAB.
LOOP AT SELECTION WHERE FIELDNM EQ 'DATE1'.
d_date1 = SELECTION-LOW.
ENDLOOP.
LOOP AT SELECTION WHERE FIELDNM EQ 'DATE2'.
d_date2 = SELECTION-LOW.
ENDLOOP.
Select VBELN POSNR
into corresponding fields of table ITAB
from VBAP
where AEDAT between d_date1 and d_date2.
Loop at ITAB into WA_ITAB.
Concatenate WA_ITAB-VBELN WA_ITAB-POSNR into d_name.
* Material Sales Text
CALL FUNCTION 'ZSALES_ORDER_TEXT_BW'
EXPORTING
CLIENT = SY-MANDT
ID = '0001'
LANGUAGE = 'E'
NAME = d_name
OBJECT = 'VBBP'
TABLES
LINES = TRESULT.
If sy-subrc = 0.
Read table TRESULT index 1.
E_T_DATA-TextMST = TRESULT-TDLINE.
refresh TRESULT.
clear TRESULT.
endif.
* KPI Comment
CALL FUNCTION 'ZSALES_ORDER_TEXT_BW'
EXPORTING
CLIENT = SY-MANDT
ID = 'Z004'
LANGUAGE = 'E'
NAME = d_name
OBJECT = 'VBBP'
TABLES
LINES = TRESULT.
If sy-subrc = 0.
Read table TRESULT index 1.
E_T_DATA-TextKPIC = TRESULT-TDLINE.
clear TRESULT.
endif.
E_T_DATA-SALES_ORDER = WA_ITAB-VBELN.
E_T_DATA-SALES_ITEM = WA_ITAB-POSNR.
Append E_T_DATA.
endloop.
ENDFUNCTION.This FM does not have the correct import parameters. Have a look at RSAX_BIW_GET_DATA_SIMPLE.
FUNCTION RSAX_BIW_GET_DATA_SIMPLE.
""Lokale Schnittstelle:
*" 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 SFLIGHT OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
Your FM will be called from the service API and must have the same parameters as this same FM.
Cheers
Aneesh -
Runtime Error while extracting data by datasource based on function module
Hi all,
I am facing an issue while extracting data from a customised data source based on a new function module.
The datasource is extracting data successfully for only 15000 records but after that the runtime error is displayed.
I am not able to extract whole data from R/3 system.
Please take a look into the details and tell me what should I have to do.
Details of Issue:
Runtime Error : GETWA_NOT_ASSIGNED
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLZ_99Z_BW_SD_PRICING"had to be terminated because it has come across a statement that unfortunately cannot be executed.
Error analysis
You attempted to access an unassigned field symbol
(data segment 32790).
This error may occur if
- You address a typed field symbol before it has been set with
ASSIGN
- You address a field symbol that pointed to the line of an
internal table that was deleted
- You address a field symbol that was previously reset using
UNASSIGN or that pointed to a local field that no
longer exists
- You address a global function interface, although the
respective function module is not active - that is, is
not in the list of active calls. The list of active calls
can be taken from this short dump.
Edited by: anshu13 on Apr 27, 2010 10:28 AMThe code is displayed here:
error is in line no. 625
Source Code Extract
Line SourceCde
595 <fs_fldval> = l_fieldval.
596 APPEND <fs_dyntable> TO <it_dyntable>.
597 CLEAR :l_fieldval, wa_fldcat.
598 CLEAR l_totlength.
599 CLEAR <fs_dyntable>.
600 ENDIF.
601 ENDIF.
602 MOVE-CORRESPONDING <dd03l_fields> TO wa_dd03l.
603 IF <dd03l_fields>-datatype EQ 'DATS'.
604 l_fieldval = 'X'.
605 ELSE.
606 SHIFT <dd03l_fields>-intlen LEFT DELETING LEADING '0'.
607 IF l_totlength IS INITIAL.
608 SHIFT l_totlength LEFT DELETING LEADING '0'.
609 l_totlength = '0'.
610 ENDIF.
611 l_currlength = <dd03l_fields>-intlen.
612 CONCATENATE l_totlength '(' l_currlength ') ' INTO l_fieldval .
613 l_totlength = l_totlength + l_currlength.
614 ENDIF.
615*** Consider both field name and domian name for checking in range list:
616 IF <dd03l_fields>-fieldname IN s_fieldlist.
617 wa_fldcat-fieldname = <dd03l_fields>-fieldname.
618 ELSEIF <dd03l_fields>-domname IN s_fieldlist.
619 wa_fldcat-fieldname = <dd03l_fields>-domname.
620 ELSE.
621 wa_fldcat-fieldname = <dd03l_fields>-fieldname.
622 ENDIF.
623 ASSIGN COMPONENT wa_fldcat-fieldname
624 OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
>>>>| <fsfldval> = l_fieldval._
626 CLEAR l_fieldval.
627 CLEAR l_currlength.
628 ELSE.
629 IF <dd03l_fields>-datatype EQ 'DATS'.
630 l_fieldval = 'X'.
631 ELSE.
632 SHIFT <dd03l_fields>-intlen LEFT DELETING LEADING '0'.
633 IF l_totlength IS INITIAL.
634 SHIFT l_totlength LEFT DELETING LEADING '0'.
635 l_totlength = '0'.
636 ENDIF.
637 l_currlength = <dd03l_fields>-intlen.
638 CONCATENATE l_totlength '(' l_currlength ') ' INTO l_fieldval .
639 l_totlength = l_totlength + l_currlength.
640 ENDIF.
641*** Consider both field name and domian name for checking in range list:
642 IF <dd03l_fields>-fieldname IN s_fieldlist.
643 wa_fldcat-fieldname = <dd03l_fields>-fieldname.
644 ELSEIF <dd03l_fields>-domname IN s_fieldlist.
Edited by: anshu13 on Apr 27, 2010 11:33 AM -
Handling Init/Full/Delta-Loading for a generic DS based on function-module
Hi Experts,
we need to build a generic datasource based on a function-module; and we would like to
implement a slightly different logic in the function-module depending on the data-staging-mode that was selected in the InfoPackage.
What we're missing is a possibility to distinguish (in the ds-function-module) if an init/delta/full-load was requested.
Could you please provide some information/hints about that topic?
Thanks in advance,
MarcoHi Anjum,
we found an alternative that seems to be closer to SAPs idea of how it should work:
We check the status of the Init-Table (RSA7) - depending on the result
a) Init exists ---> Delta or Full
b) Init does not exist --> Init or Full
we check if the system itself passes a timestamp together with the data-request.
1) If it does so --> Delta/Init
2) If it doesn't provide a timestamp --> Full.
Summary:
a1 --> Delta
a2 --> Full
b1 --> Init
b2 --> Full -
How to create a generic data extractor using standard function module
Hi,
I have to generate report based on Function module(standard FM),client know only Fm Name n they have given FM Name n asked reports based on that, so can any one give me steps to create DS based on that.
Thanks,
Swapnacheck this blog
/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
and this pdf:
Generik extraction: https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33
Generic delta:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
Edited by: Aduri on Dec 17, 2007 4:04 PM -
Need code for a function module- Urgent
Hi friends,
I have a requirement where I am giving material description as an import parameter in the function module. ( Material description could be a wild search -- say - Mat* ) I want a sub routine in the function module which should get all the materials from the database ( mara or makt..not sure ) for the user entered Material description.
I want this particular code to be written using a sub-routine using formal parameters inside this fm . Could any one send me the code for this.
Thanks in advance,
Vishnu.Hi Vishvanath,,
Please find the below code.
DATA : BEGIN OF itab OCCURS 0,
matnr LIKE makt-MATNR,
MAKTX LIKE makt-MAKTX,
END OF itab.
DATA : BEGIN OF itab1 OCCURS 0,
matnr LIKE makt-MATNR,
MAKTX LIKE makt-MAKTX,
END OF itab1.
data : a(5) type c value 'TEST'.
perform mat_no using a.
form mat_no using p_a.
data : lv_temp(4) type c.
select matnr maktx from makt into table itab.
loop at itab.
lv_temp = itab-maktx+0(4).
if lv_temp = p_a.
move itab to itab1.
APPEND ITAB1.
endif.
endloop.
loop at itab1.
write :/ itab1.
endloop.
endform. " mat_no
Thanks.
Amjad. -
Function module in BW for Balance Sheet
Dear all,
i have a request to create a FM for BW module.I'm new at abap in BW so i want kindly to ask you to help me with some material or knowledge that you have.
The specific request is for Balance Sheet. It is done in BW with routine but i have to add this routines in one functional modul.The misunderstanding for me is that this routine use some standard form (like compute_data_field which is call dynamically ) for input parameter and i'm not sure in my FM how to take the same input parameter.
If someone have some expirience with this i will rewards with points
Thank you.In the BeX, when you are creating the query, you need to create a variable to the object by doing the following:
1 Select the object in the leftside
2 create new variable
3 in the variable select the eleboration with customer exit
4 after creating the variable, go into transaction CMOD
5 Select the project for BW, if you don't have one, just create it. (You need to include it into the data packet for BW, if you don't have you must create it otherwise you'll get the data packet tmp and you cannot transport it)and select the Henancement Assignment RSAP0001.
3 In the components area you'll get 4 functional exit:
EXIT_SAPLRSAP_001
EXIT_SAPLRSAP_002
EXIT_SAPLRSAP_003
EXIT_SAPLRSAP_004
click on the first exit and than click on INCLUDE ZXRSAU01
in this include you go in the change mode and input this kind of code:
WHEN 'name of the variable'.
PERFORM and input your code.
Rgs
Antonino -
Fund center derivation based on functional location cost center
Hi,
can anybody share the process to derive fund center based on cost center assigned to functional location/equipment of a plant maintenance order
ThanksHi Eli,
Thanks for your response.
Scenario is as follows:
Cost is booked to PM order & settles to cost centers. I don't have budget at PM order level. But will have budget in fund management for cost center. So whenever I book cost to PM order it should check budget available in fund center. Fund center should be derived from cost center assigned to functional location of PM Order
I have not used function module before for derivation. I have created a derivation rule based on functional module but there is no place to assign fund center in derivation rule. Please explain the process to derived fund center through PM order in above scenario.
Thanks -
Function module for Remote cube
Hi all
I just want to know, does the remote cube works for the datasource which is based on function module.
Regards
PreetiPreeti,
the Remote cube works on any type of datasource .as this datasource is already replicated into BI system then it is a BI datasource only.
but at the time of extraction of data,the datasource fetch the data from the respective tables specified in the Function module.by applying the logic to the data.not to the fields.
so the logic applies only to data not to fields. -
How to - customize datasource by means of 'Function module' via 'RSO2' ?
Wilson, the topic of Function Module extractors is well documented in the forums - please search the forums before posting
+__Hi,Expert:__+
+__Could you please kindly advise me how to customize datasource by 'Function module',__+
+__and which aspects I should pay more attention?__+
+__Or provide me valuable documentation.__+
+__Thanks very much !__+
Edited by: Arun Varadarajan on Feb 11, 2009 9:58 AMHi Wilson,
Check here..........
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d3219af2-0c01-0010-71ac-dbb4356cf4bf
Generic extractor based on function module RSAX_BIW_GET_DATA_SIMPLE
Thanks,
Vijay. -
Datasource using Function Module
Hi Guys,
I have two ODS objects...the first ODS has 5 fields and it gets data from flat file.
I created a custom Datasource based on Function module and i'm extracting data from first ODS based on one of the field 'DATE'. This datasource extracts correct number of records as per my logic in RSA3.
So i think there is no problem with Datasource.
Now, i created Infosource and i'm trying to load data from Custom Datasource to second ODS. But when i start the infopackage, the records are not extracted completely...i can see 3 records sent( 0 records received) '0 from 3' records in the monitor...it's a yellow request...
In status i get following message -
No request Idoc generated in BW
Diagnosis
No request IDoc has been created in BW. A short dump has most probably been logged in BW.
Procedure
Look for the short dump belonging to your data request in the short dump overview in BW. Pay attention to the correct date and time in the selection screen.
You can get the short dump list using the Wizard or from the monitor detail screen via the menu path "Environment -> Short dump -> Data Warehouse".
Removing errors:
Follow the instructions in the short dump.
Please let me know if anyone of you have faced similar problem...
Thanks,Hi,
There are no short dumps in the system. Only the message in Bold in my first post is the help i can get and provide.
Strange thing is, RSA3 works correctly but it's not successful in actual extraction.
Thanks, -
3 generic data sources or only one function module
Hi all,
I have 3 custom tables
1. ZCOUNTRY (giving the link between code entity and country)
1. ZCURR (giving the link between code entity and currency)
1. ZYTPE (giving the link between code entity and type entity)
I shall fill an info object which has as fields code entity, country,currency and type entity.
I have 2 solutions i suppose:
1. Create 3 generic data sources based on the 3 tables.
2. Create a generic data source by using the function module.The function module will populate an extract extracture from data from these 3 tables.
What is the best solution?What is the advantage of the chosen solution?
Thks a lot.Hi,
Generic Extractors are based on View/Table or Fn Module or Infoset Query i.e all the extractors created via RSO2. The extractors you create for the customers would generally be generic extractors only. SAP has some other extractors like your LIS, LO Cockpit which are based on different extraction method.
Generic extractors are of 3 types:
1. Based on table/view
2. Based on Infoset Query
3. Based on Function module
The first 2 are straight forward extraction where you would either use a standard SAP or custom table/view or Infoset query to extract data.
However if you have to get data from more than 1 table and also incorporate some logic then you would use a fn module extractor. It is like a program where you would code using ABAP and have all your logic incorporated.
Check this blog for more info on fn module extractor:
/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
Raj
Maybe you are looking for
-
Pie Chart displaying percentages
Good Morning, I'm hoping someone has had experience creating a pie chart with percentage values and is wiling to offer some assistance because I've tried many ways and still came up short. The data table I'm using contains two columns: type (A, B, C,
-
OSX Yosemite 10.10 MacBook Pro 17", 2009 Mail 8.0 Whe I attach in Mail a jpg file the recipient (windows) see the file as a bits map and he can not open and edit. I were sure to mark the attachment like a windows compatible file What to do? Thanks
-
Setting file system size on install
Well im about to reinstall Solaris 10 (hate that i just complted the 100+ patches just yesterday) because apparently the file system slice / is too small by default (why?) and im not sure where to make the currection because I actually thought I had
-
How can I get rfc822 format using Groupwise Object API(C++)?
I am newbie to Groupwise Object API, I want to get email in it's rfc822 form. How can I achieve this?
-
Dell XPS 600 XFi Soundcard (D) veri
I have the Dell XPS 600 with the XFi Extreme Music D. Am not getting DTs option. I bourght XFi ExtremeMusic to install in my other computer How can I install the full verison in XPS 600. Do I have two un-install the (D) Verison first Thanks Johnny