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,
Raj
Hi.
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
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 ) ). -
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. -
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. -
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 -
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. -
Passing Select-options as parameter to function module
I need to pass a select-option as a parameter to a function module. Is this possible?
There is an option of passing all the values of the select-option to an internal table, passing that internal table as parameter to the function module, and then adding it manually again to a select-option in the function module.
But is there any direct way to do this?Hi,
I have a similar problem: I have RFC function module to which I want to pass select options. Therefore I defined table parameters as follows:
IT_RUNID TYPE EFG_TAB_RANGES
IT_PERNR TYPE EFG_TAB_RANGES
IT_REINR TYPE EFG_TAB_RANGES
I can successfully pass my values to the module, but if I try to check these parameters
using
CHECK IT_TRIPS-RUNID IN IT_RUNID.
CHECK IT_TRIPS-PERNR IN IT_PERNR.
CHECK IT_TRIPS-REINR IN IT_REINR.
the check always fails, I guess because there are leading zeros in the ranges. Is there a way to solve this problem?
Thanks and regards,
Martin -
How to pass select-option filed to Function Module Exporting Parameter
Hi,
How to pass select-option filed to Function Module Exporting Parameter.
ThanksHi,
DATA: BEGIN OF ITAB5_WRK OCCURS 0,
KUNNR TYPE KNKK-KUNNR, "CUSTOMER #
SBGRP TYPE KNKK-SBGRP, "CREDIT REP
KLIMK TYPE KNKK-KLIMK, "CREDIT LIMIT
NAME1 TYPE KNA1-NAME1, "CUSTOMER NAME
SKFOR TYPE KNKK-SKFOR, "TOTAL A/R
AMT1 TYPE KNKK-SKFOR, "CURRENT
AMT2 TYPE KNKK-SKFOR, "01-30
AMT3 TYPE KNKK-SKFOR, "31-60
AMT4 TYPE KNKK-SKFOR, "61-90
AMT5 TYPE KNKK-SKFOR, "91-120
AMT6 TYPE KNKK-SKFOR, "OVR 120
BZIRK TYPE KNVV-BZIRK,
END OF ITAB5_WRK.
SELECT-OPTIONS P_COMP FOR T001-BUKRS
SELECT KUNNR SBGRP FROM KNKK
INTO TABLE ITAB5_WRK
WHERE SBGRP IN P_REP
AND KUNNR GE '0001000000'
AND SKFOR NE 0.
LOOP AT ITAB5_WRK.
DELETE ADJACENT DUPLICATES FROM ITAB5_WRK COMPARING KUNNR.
ENDLOOP.
PERFORM GET_CREDIT_LIMITS.
*=======================================================================
IF P_DIST NE SPACE.
LOOP AT ITAB5_WRK.
SELECT SINGLE * FROM KNVV WHERE KUNNR EQ ITAB5_WRK-KUNNR
AND VKORG EQ P_COMP
AND VTWEG EQ '20'
AND SPART EQ '10'
AND BZIRK IN P_DIST.
IF SY-SUBRC EQ 0.
MOVE KNVV-BZIRK TO ITAB5_WRK-BZIRK.
MODIFY ITAB5_WRK.
ELSE.
DELETE ITAB5_WRK.
ENDIF.
ENDLOOP.
ENDIF.
*==============================================================
LOOP AT ITAB5_WRK.
MOVE: 'F/S' TO WRK-KKBER,
ITAB5_WRK-KUNNR TO WRK-KUNNR.
PERFORM AGING.
ADD: W_SNFAE TO ITAB5_WRK-AMT1,
W_SFAE1 TO ITAB5_WRK-AMT2,
W_SFAE2 TO ITAB5_WRK-AMT3,
W_SFAE3 TO ITAB5_WRK-AMT4,
W_SFAE4 TO ITAB5_WRK-AMT5,
W_SFAE5 TO ITAB5_WRK-AMT6,
W_SFAEL TO ITAB5_WRK-SKFOR,
W_SNFAE TO ITAB5_WRK-SKFOR.
MOVE: 'SPEC' TO WRK-KKBER,
ITAB5_WRK-KUNNR TO WRK-KUNNR.
*PERFORM AGING.*
ADD: W_SNFAE TO ITAB5_WRK-AMT1,
W_SFAE1 TO ITAB5_WRK-AMT2,
W_SFAE2 TO ITAB5_WRK-AMT3,
W_SFAE3 TO ITAB5_WRK-AMT4,
W_SFAE4 TO ITAB5_WRK-AMT5,
W_SFAE5 TO ITAB5_WRK-AMT6,
W_SFAEL TO ITAB5_WRK-SKFOR,
W_SNFAE TO ITAB5_WRK-SKFOR.
MODIFY ITAB5_WRK.
ENDLOOP.
FORM AGING.
*CALL FUNCTION 'CUSTOMER_DUE_DATE_ANALYSIS'*
EXPORTING
BUKRS = P_COMP
KKBER = WRK-KKBER
KUNNR = WRK-KUNNR
RASID = 'FEND'
KLIMP = 'X'
IMPORTING
SFAE1 = W_SFAE1
SFAE2 = W_SFAE2
SFAE3 = W_SFAE3
SFAE4 = W_SFAE4
SFAE5 = W_SFAE5
SFAE6 = W_SFAE6
SFAEL = W_SFAEL
SNFA1 = W_SNFA1
SNFA2 = W_SNFA2
SNFA3 = W_SNFA3
SNFA4 = W_SNFA4
SNFA5 = W_SNFA5
SNFA6 = W_SNFA6
SNFAE = W_SNFAE
EXCEPTIONS
NO-AGING_SCHEDULE = 1
NO_TABLE_INPUT = 2.
CASE SY-SUBRC.
WHEN 1.
MESSAGE E999 WITH 'PLEASE ENTER AGING SCHEDULE'.
WHEN 2.
MESSAGE E999 WITH 'DO NOTHING ??'.
ENDCASE.
ENDFORM. "AGING
Thanks -
Passing SELECT-OPTIONS value to Function Module
Hi,
I need to pass select-options value to a function module.
Code is like the following:
SELECT-OPTIONS seltab FOR object-type.
CALL FUNCTION 'Z_MY_FM'
EXPORTING
sel_tab = seltab
IMPORTING
result_tab = it_result
I have found a similar problem in the SDN forum: How to pass select-options parameter to FM?
However, that could not help me much in solving my problem.
So far I have tried to created a structure in DDIC with the following components for the select-options:
SIGN - BAPISIGN
OPTION - BAPIOPTION
LOW - ZBWOBJECTTYPE (my type)
HIGH - ZBWOBJECTTYPE (my type)
and subsequently a table type for this structure which is specified in the "Import" tab of my function module.
Unfortunately, when I ran the program a runtime exception occured (CALL_FUNCTION_CONFLICT_TYPE).
Could anyone please help me on this issue?
Thanks in advance.
Regards,
Joon MengHello Joon,
CALL FUNCTION 'Z_MY_FM'
EXPORTING
sel_tab = seltab
IMPORTING
result_tab = it_result
You have defined SELTAB as a SELECT-OPTION.
So when you pass only SELTAB, the header line is transferred to the FM. When you pass SELTAB[] the whole table(range) is passed.
It is similar to the concept of an internal table with header line.
Hope i am clear.
Anyways how have you defined result_tab and sel_tab ?
BR,
Suhas -
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 -
Regarding select option in a module pool prog .
hello .. i need some help regarding select options in a module pool program .. i hav tried putting a select options in a module pool prog but i am not able 2 ... can any one tel me why select options r not aloowed in a module pool prog ?? and i read that we hav 2 use ranges 2 fulfil the needs of the select options . is there any way i cal get all the functionality of select options ( eg including , excludig , equal to , not equal to , .... .) using a range ??
Hi
Select-options won't work if you declare the program as Module POOL.
if you wants to use select-options like utility in module pool programming
use ranges
declare and develop ranges and use that in select statement where condition.
ranges: r_vbeln for vbak-vbeln.
r_vbeln-low = '0018900678'.
r_vbeln-sign = 'I'.
r_vbeln-option = 'EQ'.
append r_vbeln.
r_vbeln-low = '0018900456'.
r_vbeln-sign = 'I'.
r_vbeln-option = 'EQ'.
append r_vbeln.
reward if useful
regards
Anji
Maybe you are looking for
-
The dropdown list "Store Files" in the "Import Settings" section of Aperture 3.3.2 displays the history of the entries previously added to the list. Some of the entries are no longer valid and I'm trying to delete them but I can't find a way to do th
-
Praoblems in creating a variable using JSP - el
Posting this again : Please help How to create a variable using <c:set> whose value is specified within the tag body . I want to use this variable created as one of the parameters in a javascript method call . But my problem is when I run my applicat
-
Hey, I have a big Poblem with my iPhone 3gs, 16gb. The Screen was broken and I sent it for repair. After I got it back, it works without problems but then I tried to send a SMS and nothing happened! When I press "send" it goes to my homescreen/menu.
-
Deleting in coverflow - out of step?
Hi Folks. I am in the habit of browsing through my pictures in folders using Coverflow (Command-4 in the Finder) HOWEVER, when I delete a picture, using Command-Delete, I find that the file number in the list below gets out of step with the image
-
Which has more demand in the current job market ? - Peoplesoft or SAP - HR ? I am planning to take up one of these two and do a complete course/certification on it . Pls advice