Date range in function module
Hi guys,
i have a selection screen where i need to give range of date.
say from 01.01.1998 to 01.02.2007.
i need to pass this date range to 'Z' funtion module how can i do it.
do i need to define it in tables declaration. if yes what will be the reference type of this field.
I want this range of dates in function module.
Please explain.
Hi ahmed
Let us assume s_date is the select option for the date range defined like
DATA: s_date for p0001-begda.
Now while calling the FM pass the s_date-low and s_date-high as 2 parameters for the FM.In the FM create 2 parameters begda and endda of type begda. Use the low value and high value in the FM to populate the range table and u can use this range table for further processing of the dates in the FM.The range table can be forwarded as follows:
r_date-low = begda.
r_date-high = endda.
also provide the sign and options for the ranges table.
Similar Messages
-
Export RANGES to function module
Can anyone tell, how to pass RANGES to function module.
i have report program in ,
DATA : BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
END OF ITAB.
SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
I want all the values in S_MATNR in ITAB.
Note that S_MATNR has any value( Include, Exclude,Between, Equal etc.)Hi,
Define a type in the global data declaration of the function module as follows :
TYPES : BEGIN OF t_range_matnr,
sign(1) TYPE c,
option(2) TYPE c,
low TYPE mara-matnr,
high TYPE mara-matnr,
END OF t_range_werk.
" Define a table type
types matnr_tab type t_range_matnr occurs 0.
Once done, define the importing parameter of t_matnr in the function modules signature, lets call it matnr
In your program where you would call the function, lets say you have the select option as follows
SELECT-OPTIONS matnr FOR ekpo-matnr.
" In the call function simply pass matnr[]
call function 'select_mara'
exporting
matnr = matnr[].
Done.
P.S. Do not forget the square brackets.
regards,
Advait
Edited by: Advait Gode on Apr 16, 2009 10:05 AM -
Hi gurus,
How do we get evtcreation_date and evtcreation_time data into check function module or implementation of object type? I am using cdhdr and cdpos and able to write my own logic.
Thanks in advance!!!
Xevi G.I think check FM's contain these value in any paramters.
Otherwise check CDHDR/CDPOS with appropriate OBJECT number etc.
This question can more appropriately answered in WORKFLOW forum.
Try [this|http://www.*******************/2007/09/work-flow-2.html] link also. -
HI All,
how can we use ranges in function module.
please send sample code for this.
regards,
amit.Hi,
If you have range, you can convert the contents of ranges into internal table.
And then Pass the internal table to FM.
Thanks,
Sriram Ponna. -
How to add Test data for a function module
Hi experts,
i want to add test data for a function module . i don't know how to proceed on it . please help me...
with regards,
James...
Valuable answers will be rewarded...Hi,
- Go to SE37 and execute your FM
- Enter the data you want to pass to FM
- Hit 'Save' button. Enter the meaningful name for your test scenario and save. That's it you have saved the test data.
You can also enter some other test data and save that also. In short, you can save multiple test scenario. Also, you can give multiple test scenario a same name and they do not overwrite each other ( but normally you give different name to differentiate them)
Next time you come to execute the FM again, hit the "test data" button and it will show you all the test scenario you have stored before. Select the one you want to use and it will load the data in FM parameters.
Let me know if you need any other information.
Regards,
RS -
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. -
Generic Data Source with Function Module data mismatch in BI
Hi All,
I'm using Generic Data Source with Function Module, When I execute the Function Module (Which I have Created), I'm getting 16000 records and when run extractor(in RSA3) im getting different no.of records(infact they are more no.).
when I run the InfoPackage in BI im Getting more no. of records than what i got executing the function module..
and single record is divided into 2 records in BI side(not all the records), how can it be possible???
is there anything Im missing to explain you my issue???
if understood please help me out.
Thanks n Regards,
ravi.the datasource frame work starts the function module several times.
1. the initialization
2. the serval times, until you "raise no_more_data".
check you coding: have you refreshed necessary internal tables.
Sven -
Generic Data Source with Function Module data mismatch
Hi All,
I'm using Generic Data Source with Function Module, When I execute the Function Module (Which I have Created), I'm getting 16000 records and when run extractor(in RSA3) im getting different no.of records(infact they are more no.).
when I run the InfoPackage in BI im Getting more no. of records than what i got executing the function module..
and single record is divided into 2 records in BI side(not all the records), how can it be possible???
is there anything Im missing to explain you my issue???
if understood please help me out.
Thanks n Regards,
ravi.HI rkiranbi,
1. FIrst you excute function module according to your paramers, you will get some records. then goto tcode RSA3 --> excute
Provide your Data source name and under setting we have options like Data records/calls, Display extractor calls and selections --> fields .
in that options you have to increase the values. and then you have to pass paramers in RSA3 according to your function module
selections in SE37. Now you will get equal values in both functin module selection and RSA3 Selection. if it fail means you need to
check coding logic in function module.
2. if your are getting wrong values in BI System then check with
1. compare with PSA data and data target data (here you need to check with characterstic as well as keyfigures)
if you find any mistake you need change the coding in function module according to client requirement.
2. compare data with RSA3 and bi report data or data target data.
check it properly above steps, you will get solution.
thanks and regards,
malli -
Delta Problem while extracting the data by using function module
Hi Experts,
I have extracted the data by using Function module, for delta loads I have given Calday and additive delta in Generic delta settings, in BW side I have initialized the data after that I have given delta update option in infopackage and I made process chain also, every day process chain is running successfully but it is showing zero records, but there is a data in Data source (RSA3), means delta is not working.
What is the problem,
Is there any another settings for delta loads,
Please help me to do this,
Helpful answer will be appreciated with points,
Regards,
VenkatHi,
Try this delta type :NEW STATUS FOR CHANGED RECORDS.
More information from Nagesh, this information may help
1. New status for changed Records.
2. Additive delta.
New status for changed records means
New Order
order no quantity
1000 10
order changed to quntity 8. then 2 records will posted 2 BW in first case.
1000 -10
1000 8
if you come to Additve delta.
for the same case it will send the same record as
1000 10
changed records
1000 -2
this is the difference. New status with changed records should be used only in association with ODS not cube becoz we don't have overwrite option.
Additive delta we can use for ODS and Cubes with update mode Addition.
Regards,
Satya -
How to import a range in Function module?
I am using a Function module in which material is getting imported.
In the import tab we have
Parameter Name Typing Associated Type optional pass value
IM_MATERIAL TYPE MATNR <checked> <checked>
So when the Function module is execute we can enter only one value into the IM_MATERIAL.
But now it has to be enhanced for entering multiple values. How to import the material as a range?
Please throw light.
Thanks.Hi
If you are using a select-options you can use this approach.
TABLES: MARA.
DATA: RANGE TYPE WRF_MATNR_RANG_TTY.
SELECT-OPTIONS: SO_MATNR FOR MARA-MATNR.
START-OF-SELECTION.
RANGE[] = SO_MATNR[].
CALL FUNCTION 'ZTEST'
EXPORTING
I_RANGE = RANGE.
Where I_RANGE is defined using this table type WRF_MATNR_RANG_TTY
Parameter Name Typing Associated Type optional pass value
I_RANGE TYPE WRF_MATNR_RANG_TTY <checked> <checked> -
R/3 Master Data Extraction Using Function Module
Hi Experts,
Could you please let me know why & How (Detail procedure) to extract R/3 master data using function module.
My team manager asked me to extract master data from R/3 for 3 more attributes of info object '0material' which is already defined as data target.
I would like to know why they are extracting data using function module
ThanksThe steps for creating extractor using Function Module. I
1. Create new Function group (if you have already not done so) in Se80
2. Copy Function module "RSAX_BIW_GET_DATA_SIMPLE" with suitable name.
3. Change the code that populate data.
Following table may give you the guideline for parameters.
Parameter Description
I_REQUNR (import) BW provides this request identifier. It is a system-generated identifier in the form REQU_XXXXXX. BW uses this same identifier in all function module calls that relate to a single load.
I_DSOURCE (import) The name of the generic extractor
I_MAXSIZE (import) The maximum number of records that BW expects to be in each data packet
I_INITFLAG (import) A Boolean flag that indicates if this is the initialization (first) call to the function module
I_READ_ONLY (import) A test flag not needed in most extraction scenarios
I_T_SELECT (table) This table holds any selections from the BW InfoPackage. The function module should examine these selections and only return data that matches the selections.
I_T_FIELD (table) This table holds the fields that BW requests
E_T_DATA (table) The function module fills this table with data records. These records then return to BW as data packets. This table has the same structure as the extract structure defined in the generic DataSource.
NO_MORE_DATA (exception) The function module raises this exception when no more data is available
ERROR_PASSED_TO_MESS_HANDLER (exception) The function module raises this exception if an error occurred during the extraction. It alerts BW to check for error logs.
Change following code to put the selection fields
Select ranges
RANGES: L_R_CARRID FOR SFLIGHT-CARRID,
L_R_CONNID FOR SFLIGHT-CONNID.
Change following to populate data
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT (S_S_IF-T_FIELDS) FROM SFLIGHT
WHERE CARRID IN L_R_CARRID AND
CONNID IN L_R_CONNID.
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.
below links
Re: functionmodule
Re: FM for G. extractor
***Assign points if it helps.**
Regards
CSM Reddy -
Hi,
We have a requirement to create a BI report based on plant maintenance report. The plant maintenance report is based on a ABAP program with complex logic. My question is i want create a Generic Datasource using Function module and can I include the logic(Abap Program) that is used for plant maintenance report in the function module? Please share your thoughts.
Thanks,
RaviHi,
Step1-Create a table structure which you need to create same as the fields you require in you data source.
Step 2-create a custom abap program and inside that call the Client abap program with the selections as required and save the result data in some table
Step 3-create infoset query.In the infoset query give your table structure name and program name which you developed.
Step4-create data source on top of that query -
How to retrieve data from a function module and use it in sap script??
I have a report program, which calls a function module. This function module internally calls an include program. In this program, I have a variable which is to be used in the sap script. How can I send this variable to the sap script
Hi,
In your case, Include prog is part of FM, no need to treat it as an Entity.
Now, Your Answer -
In SCRIPT - IN Page Window -->
PERFORM GET_MVAT_TIN IN PROGRAM Z_SCRIPT_PERFORMS_ABAPDB3
USING &VBDKR-KUNRE&
CHANGING &STCD1&
CHANGING &STCD2&
ENDPERFORM
IF &STCD1& <> ' '
<B>MVAT Number :</> &STCD1&
ENDIF
Then go to SE38 --> Creat prog with type - Subroutine pool
In that Write FORM statement for this PERFORM.
FORM get_mvat_tin TABLES inttab STRUCTURE itcsy
outtab STRUCTURE itcsy.
DATA : v_kunre TYPE kna1-kunnr,
v_stcd1 TYPE kna1-stcd1,
v_stcd2 TYPE kna1-stcd2.
LOOP AT outtab.
CLEAR outtab-value.
MODIFY outtab.
ENDLOOP.
READ TABLE inttab INDEX 1.
v_kunre = inttab-value.
IF v_kunre CA sy-abcde.
ELSE.
UNPACK v_kunre TO v_kunre.
ENDIF.
" Here You can take your Funcion module ***************************
SELECT SINGLE stcd1 stcd2 FROM kna1 INTO (v_stcd1, v_stcd2)
WHERE kunnr = v_kunre.
IF sy-subrc = 0.
READ TABLE outtab INDEX 1.
WRITE v_stcd1 TO outtab-value.
MODIFY outtab INDEX 1.
READ TABLE outtab INDEX 2.
WRITE v_stcd2 TO outtab-value.
MODIFY outtab INDEX 2.
ENDIF.
ENDFORM. -
Get purchase order doc date using BAPI function module
Hi,
I have a .net windows application that uses BAPI_PO_GETDETAIL function module to get particular details of a PO in SAP. But i am not able to get the "Doc Date" for a particular PO. I am able to get all the details of items from the table "PO_ITEMS ". I used only 1 input parameter "PURCHASEORDER".
Please help me to get this thing done
.netframework : 4.0
Language: C#
Visual Studio: vs 2010
Regards,
Manosh JacobAbsolutely hynek petrak..
Manosh Jacob You can go with the above technique. -
Error with data transfer in functional module
Hi all,
I need to upload file to the employee through BDS. (oaor transcation). i am using functional module
function zin_bds_dms_upload.
""Local Interface:
*" IMPORTING
*" VALUE(P_CLASS) TYPE BDN_CON-CLASSNAME
*" VALUE(P_OBJCT) TYPE BDN_CON-OBJKEY
*" VALUE(P_DESCR) TYPE BDN_CON-DESCRIPT
*" REFERENCE(P_PATH) TYPE SAPB-SAPFILES
data: begin of i_bds_conn occurs 10, " ITAB for the actual
bdn_tab_i type num08,
client type mandt,
classname type seoclsname,
classtype type bds_clstyp,
objkey type bds_typeid,
log_system type swo_typeid,
loio_id type char42,
doc_ver_no type num08,
doc_var_id type num08,
doc_var_tg type bds_var_tg,
descript type sdok_descr,
langu type spras,
comp_id type bds_compid,
mimetype type bds_mimetp,
crea_user type sdok_crusr,
crea_time type sdok_crtst,
chng_user type sdok_chusr,
chng_time type sdok_chtst,
contrep type bds_conrep,
docuclass type sdok_prv_m,
doc_type type sdok_prv_s,
expirytime type sdok_prv_m,
bds_docid type sdok_prv_l,
loio_id_to type sdok_loid,
rela_id type bds_relaid,
state type sdok_phsta,
bds_status type bds_state,
stor_tab type saearstat,
bdn_tab_d type bar_keep,
note_type type bds_state,
objecttext type toasp-objecttext,
objecttext2 type toasd-objecttext,
objecttext3 type toasr-objecttext,
ntext type tojtt-ntext,
end of i_bds_conn.
data: begin of bds_doctype_list occurs 10,
mandt type mandt,
classname type bapibds01-classname,
contrep type bapibds01-contrep,
docuclass type bapibds01-doc_class,
docuclass_text type toasd-objecttext,
doc_type type bapibds01-doc_type,
doc_type_text type toasp-objecttext,
appl_type type toadd-appl_type,
appl_type_text(50) type c,
standard type toadv-standard,
check_box type toadv-standard,
end of bds_doctype_list.
data: file_extension type toadd-doc_type, " file-extension
i_files type bapifiles occurs 1 with header line,
i_signature type bapisignat occurs 1 with header line,
logical_system type bds_conn00-log_system.
data: classname_select type bdn_con-classname,
classtype_select type bdn_con-classtype,
objkey_select type bdn_con-objkey,
mask(20) type c,
answer type c,
mimetype type toadd-mimetype,
i_toadd type toadd,
file_path type sapb-sapfiles,
filename_all type sapb-sapfiles,
file_path_memory(250) type c, " path für SAP memory
file_path_length type i, " length of the file_path
file_name type sapb-sapfiles.
classname_select = p_class.
classtype_select = 'BO'.
objkey_select = p_objct.
filename_all = p_path.
get parameter id 'OAP' field file_path.
if sy-subrc <> 0. " no file_path found.
file_path = space.
endif.
concatenate ',.' '' ',.' '' '.' into mask.
-- split filename -- *
perform split_path(oaall) using filename_all file_path file_name.
-- set new file_path to SAP memory -- *
file_path_length = strlen( file_path ).
if file_path <> space and file_path_length < 250.
file_path_memory = file_path.
set parameter id 'OAP' field file_path_memory.
else.
file_path_memory = space.
set parameter id 'OAP' field file_path_memory.
endif.
-- check documentclass -- *
perform get_file_extension using file_name
file_extension.
-- check file extension -- *
if file_extension = space.
-> if no docuclass is found from the document
-> default docuclass from the doctype!
file_extension = bds_doctype_list-docuclass.
endif.
-- get the mimetype of the docuclass -- *
perform mimetype_get(oaall) using file_extension
changing i_toadd.
move i_toadd-mimetype to mimetype.
-- fill file and signature structure -- *
clear: i_files, i_signature.
refresh : i_files, i_signature.
i_files-doc_count = 1.
i_files-directory = file_path.
i_files-filename = file_name.
i_files-mimetype = mimetype.
append i_files.
i_signature-doc_count = 1.
i_signature-prop_name = 'BDS_DOCUMENTCLASS'.
i_signature-prop_value = file_extension.
append i_signature.
i_signature-prop_name = 'BDS_CONTREP'.
if bds_doctype_list-contrep = space.
i_signature-prop_value = ' '. "#EC NOTEXT
else.
i_signature-prop_value = bds_doctype_list-contrep.
endif.
append i_signature.
i_signature-prop_name = 'BDS_DOCUMENTTYPE'.
i_signature-prop_value = bds_doctype_list-doc_type.
append i_signature.
i_signature-prop_name = 'DESCRIPTION'.
i_signature-prop_value = p_descr.
append i_signature.
i_signature-prop_name = 'LANGUAGE'.
i_signature-prop_value = sy-langu.
append i_signature.
-- create new document via KPro -- *
call function 'BDS_BUSINESSDOCUMENT_CREATEF'
exporting
logical_system = logical_system
classname = classname_select
classtype = classtype_select
client = sy-mandt
object_key = objkey_select
tables
files = i_files
signature = i_signature
exceptions
internal_error = 1
others = 2.
endfunction.
*& Form GET_FILE_EXTENSION
try to get the extension of the uploaded file
form get_file_extension using file_name file_extension.
-- data declaration ------------------------------------------------ *
data: length type i,
single_c type c.
data: begin of bds_doctype_list occurs 10,
mandt type mandt,
classname type bapibds01-classname,
contrep type bapibds01-contrep,
docuclass type bapibds01-doc_class,
docuclass_text type toasd-objecttext,
doc_type type bapibds01-doc_type,
doc_type_text type toasp-objecttext,
appl_type type toadd-appl_type,
appl_type_text(50) type c,
standard type toadv-standard,
check_box type toadv-standard,
end of bds_doctype_list.
clear: single_c.
length = strlen( file_name ).
if length > 0.
while length > 0.
single_c = file_name+length(1).
if single_c co '.'.
length = length + 1.
exit.
else.
length = length - 1.
endif.
endwhile.
if length > 0.
file_extension = file_name+length.
else.
file_extension = space.
endif.
else.
file_extension = space.
endif.
if file_extension <> space.
set locale language sy-langu.
translate file_extension to upper case. "#EC TRANSLANG
set locale language space.
endif.
endform. "get_file_extension
example : class = PREL
object = pernr_no
desc = 'leav application'
p_path = file_path
I used this in abap program then it is uploading fine but when used in the web dynpro file is not uploading. On debugging it is showing error in function module SDOK_PHIOS_CHECKIN
error key 5 ie error in transfer.
So please suggest how to upload in web dynpro abap.
Edited by: Bhavya belagal on Dec 22, 2010 11:55 AM
Edited by: Bhavya belagal on Dec 22, 2010 12:09 PMHallo Bhavya,
Please do not post like this as it is not readable . Mostly when you describe it in a simple manner you would get more response.
See this thread for answers from Thomas Jung [Re: Approach content repository other way then URL approach|Re: Approach content repository other way then URL approach]
Wiki [http://wiki.sdn.sap.com/wiki/display/WDABAP/File%2bUpload%2busing%2bcl_fitv_gos%2bclass|http://wiki.sdn.sap.com/wiki/display/WDABAP/File%2bUpload%2busing%2bcl_fitv_gos%2bclass]
Edited by: Baskaran Senthivel on Dec 22, 2010 2:42 PM
Maybe you are looking for
-
How to use Opera with Tor?
My fav browser is Opera and Opera-next. When I try to use it with Tor, it doesn't work. I tried also "torify" and changing proxy settings to 127.0.0.1:9050 However when I run firefox with "torify" it works flawlessly without any configuration.
-
Drag & Drop on singleCell in Advanced Datagrid
Hi There Is it posible to make a "Exel" like flex app where you drag from one cell to another cell to organise you data ? Regards T
-
Spaces and Exposé with Mavericks
I've lost Spaces and Exposé after a startup disk full error - any ideas?
-
I purchased both FCS 1 and upgraded to FCS2 in Australia. I want to upgrade to FCS (3) purchased in the US. does anyone know if the US version is compatible with Aus version. Ie will it recognize that I have FCS installed and instal the upgrade. I pr
-
I iphone 3g(s) is stuck on recovery mode.
Recently my iphone 3g(s) has been shutting off randomly and cant turn back on untill i recharge it even though it was at 100%. Two days ago its shut off and is stuck on recovery mode. I tried restoring it but i got an error. I try to restart the ipho