Select options with function modules.
Hello People,
I found few threads on this topic already, I tried solving with the help of those clues but in vain.
I want to create a function module which accepts a date range like in ACC_T_RA_DATE, and output a list of materials.
The list of materials correspond to the purchase orders that were created in the given date range.
Please kindly observe, I am not using a program to pass any value - I will be using only the function module throughout the process.
Please advice me on this.
Thanks in advance,
Disha.
What is your exact requirement, FM should look like
FUNCTION z_mm_xxx.
*"*"Lokale Schnittstelle:
*" IMPORTING
*" REFERENCE(RANGE_DATE) TYPE ACC_T_RA_DATE
*" EXPORTING
*" REFERENCE(MATERIAL_LIST) TYPE /SAPXCQM/EKPO_TAB
*" EXCEPTIONS
*" INVALID_DATE_RANGE
*" NO_PURCHASE_ORDER
*" NO_ITEM_FOUND
DATA: lv_ebeln LIKE ekko-ebeln, "#EC NEEDED
lv_datum LIKE syst-datum.
FIELD-SYMBOLS <fs> TYPE acc_s_ra_date.
* Init
REFRESH material_list.
* Check date range
LOOP AT range_date ASSIGNING <fs>.
lv_datum = <fs>-low.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = lv_datum
EXCEPTIONS
plausibility_check_failed = 1.
IF sy-subrc NE 0.
RAISE invalid_date_range.
ENDIF.
IF <fs>-option EQ 'BT'
OR <fs>-option EQ 'NB'.
IF <fs>-high LT <fs>-low. "#EC PORTABLE
RAISE invalid_date_range.
ENDIF.
lv_datum = <fs>-high.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = lv_datum
EXCEPTIONS
plausibility_check_failed = 1.
IF sy-subrc NE 0.
RAISE invalid_date_range.
ENDIF.
ENDIF.
ENDLOOP.
* Check existence of PO
SELECT SINGLE ebeln INTO lv_ebeln
FROM ekko
WHERE aedat IN range_date.
IF sy-subrc NE 0.
RAISE no_purchase_order.
ENDIF.
* Read item
SELECT * INTO CORRESPONDING FIELDS OF TABLE material_list
FROM ekpo
JOIN ekko ON ekko~ebeln EQ ekpo~ebeln
WHERE ekko~aedat IN range_date.
IF sy-subrc NE 0.
RAISE no_item_found.
ENDIF.
ENDFUNCTION.
Regards,
Raymond
Similar Messages
-
Total funcnality of select options in function module
Dear ABAPers
i am using structure and ranges to meet the functionality of select-options in function module3
but unlike reports if i leave it blank rather than selecting all the data it comes blank.
how can i do that
coz my select query uses 8 selection criteria and user may enter one two or three as per his need.
in that case the output comes out to be blank.
how this can be resolved
Thanks and Regards
Luthra, Deep.You have to maintain conditions for all your possibilities.
Something like this.
IF ( post_dt_from IS INITIAL AND post_dt_to IS INITIAL AND
doc_dt_from IS INITIAL AND doc_dt_to IS INITIAL ) OR
( post_dt_from IS INITIAL AND post_dt_to IS NOT INITIAL AND
doc_dt_from IS NOT INITIAL AND doc_dt_to IS NOT INITIAL ) OR
( post_dt_from IS NOT INITIAL AND post_dt_to IS INITIAL AND
doc_dt_from IS NOT INITIAL AND doc_dt_to IS NOT INITIAL ) OR
( post_dt_from IS NOT INITIAL AND post_dt_to IS NOT INITIAL AND
doc_dt_from IS INITIAL AND doc_dt_to IS NOT INITIAL ) OR
( post_dt_from IS NOT INITIAL AND post_dt_to IS NOT INITIAL AND
doc_dt_from IS NOT INITIAL AND doc_dt_to IS INITIAL ) OR
( post_dt_from IS NOT INITIAL AND post_dt_to IS INITIAL AND
doc_dt_from IS INITIAL AND doc_dt_to IS INITIAL ) OR
( post_dt_from IS INITIAL AND post_dt_to IS NOT INITIAL AND
doc_dt_from IS INITIAL AND doc_dt_to IS INITIAL ) OR
( post_dt_from IS INITIAL AND post_dt_to IS INITIAL AND
doc_dt_from IS NOT INITIAL AND doc_dt_to IS INITIAL ) OR
( post_dt_from IS INITIAL AND post_dt_to IS INITIAL AND
doc_dt_from IS INITIAL AND doc_dt_to IS NOT INITIAL ) OR
( ( post_dt_from IS NOT INITIAL AND post_dt_to IS NOT INITIAL ) AND
( doc_dt_from IS NOT INITIAL AND doc_dt_to IS NOT INITIAL ) ). -
Using select option and function module in single view
Hi All,
I Have a requirment ,using service call i get a function module and bind to specified UI elements with low and high attributes to input fileds which i designed in my view . And i have to keep range for input values using select options for those input values and clicking on submit i have to display data in VC but it's going to dump
the bug is
Adapter error in INPUT_FIELD "SALEDOC_TXT" of view "ZSD_ORDERSTATUS.MAIN": Context binding of property VALUE cannot be resolved: Node COMPONENTCONTROLLER.1.ZSD_ORDER_STATUS.1.CHANGING.1.S_VBELN does not contain any elements
can any one get me out of this.
Thank U,
MadhanHi,
Call FM using CALL FUNCTION, if you want to pass selectoptions type values to FM..
Try like this...
DATA : delivery TYPE TABLE OF RVBELN,
wa_delivery TYPE RVBELN,
wa_delivery-sign = 'E'.
wa_delivery-option = 'BT'.
wa_delivery-low = lv_FROM_DELIVERYNO.
wa_delivery-high = lv_TO_DELIVERYNO.
APPEND wa_delivery to delivery.
CLEAR wa_delivery.
Pass Delivery to FM.
Cheers,
Kris. -
Passing Select-option to Function Module
Hi ,
I want to pass a select-option directly to the function Module tables parameter . Can anyone highlight on how i can declare the table in Function module side .
Thanks & Regards,
RajHi.
In the TABLES tab of the specific FM ,
give the parameter name ( which u have defined as Select options ). Since select options is like an Internal Table with values sign,option,low and high , u can give it here.
Also give the ref. type and type specification.
Pl try this.
Thanks,
Maheshwari.V -
Select options in function module
hi friends, pls help me reg my query.
I have wERKS select-options
on the selection screen.
(This same thing, i want to pass in FM)
2. So in FM, I have used the
TABLES parameter (Not import, nor export)
3. And the type given is
WERKS_RANG
i defined it like
plant type WERKS_RANG
(This WERKS_RANG has 4 fields,
just like a select option
SIGN
OPTION
LOW
HIGH
4. Then inside fm,
i used SELECT Query,
and use IN WERKS.
below is my code in FM.
select lgort labst
from mard
into table imard1
where PLANT in werks
and material1 = matnr.
but i am getting an error "field plant is unknown". i have defined it under tables parameter..pls help
how shud i get the values i enter in select option for main program in se38 to function module field 'plant'...Hi
You can define your TABLE parameter WERK without reference and define a range in your fm:
FUNCTION Z_PROVA_PROVA.
""Interfaccia locale:
*" IMPORTING
*" REFERENCE(MATNR) TYPE MATNR
*" TABLES
*" SEL_WERKS
RANGES R_WERKS FOR MARD-WERKS.
R_WERKS[] = SEL_WERKS[].
DATA: BEGIN OF IMARD1 OCCURS 0,
LGORT LIKE MARD-LGORT,
LABST LIKE MARD-LABST,
END OF IMARD1.
SELECT LGORT LABST FROM MARD INTO TABLE IMARD1
WHERE WERKS IN R_WERKS
AND MATNR = MATNR.
Max -
How to define select option in function module
Hi expert,
Actually in my program i am using two select options plant and project definition. i have to pass those two select options to my function module. What i did is i declared that two select options in tables tab using RSDSSELOPT structure. My function module is working correctly when i am testing in se37 but if i am calling my function module from my program its showing dump error 'TYPE CONFLICT WHEN CALLING A FUNCTION MODULE(field length)'. please tell me how to solve this problem.
Regards,
RathishProblem solved
-
Select option in function module
I have:
select-options: s_date for oijne-astdtt. in my screen.
I want to put my code in a function module, but as known that the s_date structure is
s_date-low
s_date-high
also in select statment,
select nomtk into table int_fnomtk from oijne where astdtf in s_date.
I want to pass the s_date value to the where condition in the select statment.
how i can u solve this problem.Hi Ali,
You can use ranges,
Kindly go through the sample code below:
RANGES : r_afaber FOR anlp-afaber, " for depreciation area
r_peraf FOR anlp-peraf. " for depreciation period
INITIALIZATION
TO INITIALIZE ALL THE VARIABLES TO BE USED
IN THE PROGRAM
INITIALIZATION.
r_afaber-sign = 'I'. " for inclusive
r_afaber-option = 'EQ'. " for equal operator
r_afaber-low = c_afaber_01. " depreciation area(low value)
APPEND r_afaber. " append values for depreciation area
r_afaber-sign = 'I'. " for inclusive
r_afaber-option = 'EQ'. " for equal operator
r_afaber-low = c_afaber_07. " depreciation area(low value)
APPEND r_afaber. " append values for depreciation area
r_peraf-sign = 'I'. " for inclusive
r_peraf-option = 'BT'. " for between operator
r_peraf-low = c_peraf_001. " depreciation period(low value)
r_peraf-high = c_peraf_012. " depreciation period(high value)
APPEND r_peraf. " append values for depreciation period
Hope it helps you
Regrds
Mansi -
Select options to Function Module parameter
Hello,
I have a select options parameter in my report and then I have a function module that have to select into a database table using this SO.
How can I pass the SO to the FM?
The code must be something like that:
REPORT ZXXXX.
SELECT-OPTIONS: so_werks FOR marc-werks.
CALL FUNCTION 'ZFUNCTION'
FUNCTION ZFUNCTION
SELECT matnr FROM marc INTO TABLE it
WHERE werks IN so_werks
The select options must be a TABLES parameter? I have to create a structure type for that SO?Hi,
In FM interface you can use
structure EFG_RANGES ( In Tables Parameter ) . This structure is same as select options.
Or in Importing parameters use EFG_TAB_RANGES . This is an internal table type .
In both ways you can pass your select option to FM diretcly.
Check the following link as well
https://forums.sdn.sap.com/click.jspa?searchID=11071891&messageID=4908310
Regards,
Raj. -
Updating Select Options via Function Module
I contrast to the previous posting, I would like to update the single values for a select option. I am attempting to use the DYNP_VALUES_UPDATE, but I can only update the value on the screen and not the underlying structure. I have also tried using the RD_SELECTIONSCREEN_UPDATE but with no success either. Has anyone tried this before?
I am using a bespoke screen (ALV with multiple row selection) as the F4 dropdown which works fine and I have my values but cannot then update the selection screen.
I am on 4.6C.
Thanks in advance
IanHello Ian,
The option of updating the select-options internal tabler seems right for the description of your requirement. However, I would like just give you a word of caution here - <i>Do that in your <b>initialization</b> event</i>.
Example:
tables mara.
select-options s_matnr for mara-matnr.
initialization.
s_matnr-sign = 'I'.
s_matnr-option = 'EQ'.
s_matnr-low = <Value1>.
append s_matnr.
s_matnr-low = <Value2>.
append s_matnr.
s_matnr-low = <ValueN>.
append s_matnr.
Hope this helps,
Regards,
Anand Mandalika. -
Place selection-option in function module
hai,
i want to place select-option for one field usinf functionmodule as import parameter.
plz tell me .Hi Suresh,
in se37 import parameters give the date range like this
erdat1 like vbak-erdat
erdat2 like vbak-erdat
SELECT erdat
vbeln
posnr
FROM vbak
INTO CORRESPONDING FIELDS OF TABLE it_final
WHERE erdat BETWEEN erdat1 AND erdat2. -
How to write select options with extension in module pool program
hi,
M having the following fields through screen painter.
1. sales offfice
2.sales district
3.customer no
for those three fields no extension is not provided and no search help is there.
i want write seletion options to get extension in that module pool
screen.
plese send coding for me , please let me know how to get that
select options with the above all three fields.
Thanks & Regards
RajiCheck it
In top include
DATA: number(4) TYPE n VALUE '9005',
PROCESS BEFORE OUTPUT.
MODULE status_9001.
CALL SUBSCREEN AREA1 INCLUDING SY-REPID number.
PROCESS AFTER INPUT.
MODULE user_command_9001.
CALL SUBSCREEN AREA1.
*& Module status_9001 OUTPUT
text
MODULE status_9001 OUTPUT.
SELECTION-SCREEN BEGIN OF SCREEN 9005 AS SUBSCREEN.
PARAMETER pa_bukrs TYPE t001-bukrs.
select-options matnr for wa_matnr.
SELECTION-SCREEN END OF SCREEN 9005.
ENDMODULE. " status_9001 OUTPUT -
Using selection options in functions..
Hi,
I have written abap program in which there are 3 selection options.. I want to pass these selection options to a function. so I want to know how to define or refer selection options in functions which is called by some other abap program ?
Regards,
SantoshThe select options are basically just tables with a specific structure. One option would be to specify them as TABLES parameters, e.g. check out function module BAPI_MATERIAL_GETLIST and you can see for example a call via function IAC_SHMA_MATERIALS_SELECT (or check dictionary table type SHP_MATNR_RANGE_T in SE11).
Cheers, harald -
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 -
VirtualProvider with Function module problem !
I implemented virtualprovider with function module. Unfortunately when I run query i get message error :
u201CFunction call of ZT0X failed; the obligatory parameter CHARACTERISTICS
An exception with the type CX_SY_DYN_CALL_PARAM_MISSING occurred, but was
I>> Row: 67 Inc: READ_DATA Prog: CL_RSDRV_VPROV_LOC_NOSIDu201D
Any suggestions ?
Below source code:
u201CFUNCTION ZT0X.
""Lokalny interfejs:
*" IMPORTING
*" VALUE(INFOCUBE) LIKE BAPI6200-INFOCUBE DEFAULT 'ZT03'
*" VALUE(KEYDATE) LIKE BAPI6200-KEYDATE OPTIONAL
*" EXPORTING
*" VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2
*" TABLES
*" SELECTION STRUCTURE BAPI6200SL
*" CHARACTERISTICS STRUCTURE BAPI6200FD
*" KEYFIGURES STRUCTURE BAPI6200FD
*" DATA STRUCTURE BAPI6100DA
DATA:
l_r_srv TYPE ref to CL_RSDRV_REMOTE_IPROV_SRV,
l_th_mapping TYPE CL_RSDRV_REMOTE_IPROV_SRV=>TN_TH_IOBJ_FLD_MAPPING.
* break-point ID ZRSDRV_RC1.
* break DEVELOPER.
perform build_mapping_table
changing l_th_mapping.
create object l_r_srv
exporting
i_tablnm = '/BIC/PZPRD_ID'
i_th_iobj_fld_mapping = l_th_mapping.
l_r_srv->open_cursor(
i_t_characteristics = characteristics[]
i_t_keyfigures = keyfigures[]
i_t_selection = selection[] ).
l_r_srv->fetch_pack_data(
importing
e_t_data = data[] ).
return-type = 'S'.
ENDFUNCTION.
&---- <
*& Form build_mapping_table
&---- <
Form build_mapping_table
changing
c_th_mapping TYPE CL_RSDRV_EXTERNAL_IPROV_SRV=>TN_TH_IOBJ_FLD_MAPPING.
DATA:
l_s_map TYPE CL_RSDRV_EXTERNAL_IPROV_SRV=>TN_S_IOBJ_FLD_MAPPING.
l_s_map-iobjnm = 'ZPRD_ID'.
l_s_map-fldnm = '/BIC/ZPRD_ID'.
insert l_s_map into table c_th_mapping.
l_s_map-iobjnm = 'ZWARTOSC'.
l_s_map-fldnm = '/BIC/Z_CEN_W'.
insert l_s_map into table c_th_mapping.
+endform.u201DHello
I experienced the same issue. Were u able to solve it? If yes , kindly ask you to make posting here so that others can benefit as well.
Huge thanks -
Problem in creating a Select-option im a module pool screen
I've been searching how to do a select option in a module pool screen, I've found this neat tutorial http://sample-code-abap.blogspot.com/2008/06/select-option-in-module-pool-screen.html
but I'm having trouble to replicate it...
I've created this conde in my TOP include
SELECTION-SCREEN BEGIN OF SCREEN 201 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
SELECT-OPTIONS: s_matnr FOR mara-matnr.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN END OF SCREEN 201.
and this is my screen flow code
PROCESS BEFORE OUTPUT.
MODULE status_0100.
MODULE pbo_200.
PROCESS AFTER INPUT.
MODULE pai.
MODULE user_command_0200.
in the screen 200 I have a subscreen area named subs
but when I do this:
MODULE pbo_200 OUTPUT.
CALL subscreen subs including sy-repid '0201'.
ENDMODULE. " pbo_200 OUTPUT
it doesn't "compile"
it gives me this error:
""." or "ID ... FIELD ..." expected after "SUBSCREEN"."
what am I missing? it seems its not recognising the "CALL SUBSCREEN" command...you can't use CALL SUBSCREEN... in any ABAP section. It is reserved to dynpro flow logic. Just add it after PROCESS BEFORE OUTPUT (and also after PROCESS AFTER INPUT).
Maybe you are looking for
-
How to send a mail attachment to group of users
i have a group ZTACT TEAM Which has 10 mail ID's. I want to send mails to those 10 ID's in ZTACT team . Plz tell me ..How to do this to send mails to the group..... Thanks Srinivas
-
Brightness shortcut keys not working in Windows 8 or 8.1
I'm no longer able to use the brightness shortcut keys after I've installed the Lenovo power management tool in Windows 8 on a Ideapad U300s. When the Lenovo power management tool is NOT installed on the system, pressing the shortcut keys brings up t
-
Hi all, While creating a user through portal(EP 7.0) I'm getting error as, "An error occurred in the persistence; contact your system administrator ". I checked the log, and got this exception: Error in the persistence [EXCEPTION] com.sap.security.co
-
Slightly different vertical line issue
Hey guys, I think I might be having the 'vertical line' problem. The screen suddenly goes to vertical lines and the computer is then unresponsive to inputs (actually there'd be no way to tell...), and the only solution being to restart it via the pow
-
Error message when try to access instruments in the library
xs24 instrument insert name of instrument.exs audio file insert file name.aif not found. This message is coming up with a fair number of instruments, and i was wondering how to remedy it. Thanks