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
Similar Messages
-
Passing selection table as parameter to function modules
i tried to pass a selection table as a parameter to a function module but there is a problem stating the eror the table length is different.
*& Report ZSFSELECT_OPTIONS_PGM
REPORT zsfselect_options_pgm.
TABLES zselect_options.
SELECT-OPTIONS sop FOR zselect_options-id.
DATA : fname(15) TYPE c.
*CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = fname
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME =
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
DATA lth(2) TYPE c.
DATA ty TYPE i.
DATA o TYPE i.
DATA l TYPE i.
DATA k TYPE c.
DESCRIBE FIELD sop-sign TYPE lth LENGTH ty IN CHARACTER MODE.
CALL FUNCTION fname
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
sf_sop =sop
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
in the smart form i have tried to pass the sp as the table.
i have created a program line node
:SELECT * FROM zselect_options INTO TABLE it_tab WHERE id IN sf_sop.Hi,
If i understand ur problem correctly u r trying to pass a select-option to Tables for a smartform function module. It gives an error & it correct.
If u understand the structure of a select option, it will have 4 fields in it & the structure will be
SIGN CHAR1
OPTION CHAR2
LOW Type Zfield
HIGH Type Zfield
But ur receiving Table paramter of the smnartform FM will be having only 1 field - Type Zfield
So this mismatch gives u an error.
Solution:
Case1:
Write code outsied th FM in ur program to get all the values & build an internal table & pass that to the FM.
Case2:
Define the Structure of table in the smartforms as tols earlier & then try passsig the Select option.
Thanks & Regards,
Bhargava -
Enabling Select-options in an RFC function module
Hi Abaper's,
I am using BAdi definition NOTIF_EVENT_SAVE for sending mail notification to user.
Under CHANGE_DATA_AT_SAVE method I have called an RFC enabled function module and written code here for mail notification.I used cl_bcs class for sending file.On executing this I am getting a mail box wherein we can enter user id and send mail.But I don't want to use cl_bcs for sending mail now.So I modified the code by including SO_NEW_DOCUMENT_SEND_API1 function.
My requirement is I want to enable select-options in this function module so that user can get a popup wherein he can select user name from master.On activating I am getting following error:
Local SELECT-OPTIONS are not allowed (FORM routine or GET event is active).
Can any one help me how to resolve this error?
I am using this customized function module for mail notification.If I hardcode mail id,notification is working properly.
Regards,
Samsam24 wrote:>
> My requirement is I want to enable select-options in this function module so that user can get a popup wherein he can select user name from master
Hi Sam,
in the function groups TOP include, you can define a selection-screen:
SELECTION-SCREEN BEGIN OF SCREEN 9786 [TITLE title].
select-options: s_uname for ...
SELECTION-SCREEN END OF SCREEN 9786.
and in the function use
CALL SELECTION-SCREEN dynnr
[STARTING AT col1 lin1
[ENDING AT col2 lin2]]
Everything declared in the function body source code is local.
But you must make sure that CHANGE_DATA_AT_SAVE is not processed in update task.
Regards,
Clemens
Edited by: Clemens Li on Jan 16, 2011 7:36 PM -
Pass select option and parameter with submit
Hello,
I have two programs and what i have to do is to use the selection screen information from program A and submit it to program B so that this second program will generate a report with this information.
After program B is executed it creates some files in a server, which i will have to use later in program A. I cannot modify the program B since its not part of the requirement.
But the thing is that i am having problems when submiting a select option and a parameter together.
It would be really useful if someone could give some examples of this.
Example of what i want to do:
SUBMIT PROGRAM_B
WITH S_MATNR EQ S_MATNR ->pass all the values from a select option.
WITH P_WERKS EQ P_WERKS ->pass a single value from a parameter.
AND RETURN
Regards,
RobertoHi,
Try this for select-options:
SUBMIT PROGRAM_B
WITH S_MATNR *IN* S_MATNR ->pass all the values from a select option.
WITH P_WERKS EQ P_WERKS ->pass a single value from a parameter.
AND RETURN
Hope it helps.
Regards,
Gilberto Li
Edited by: Gilberto Li on Feb 2, 2009 10:24 PM
Edited by: Gilberto Li on Feb 2, 2009 10:33 PM
Edited by: Gilberto Li on Feb 2, 2009 10:33 PM -
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 -
HOW TO PASS SELECT-OPTIONS PARAMETER TO A FUNCTION MODULE.
Hi friends.
HOW DO U PASS A SELECT-OPTIONS PARAMTER TO A FUNCTION MODULE AS ITS IMPORT PARAMETER(IN MY CASE rfc fM) .
Really urgent!!!
thanks to one and allHi,
If you are passing a single value, its better you take it from s_option-low or s_option-high (select options).
Else if you are passing values to the FM in a loop for all select option values, then better you declare an internal table with type <b>WSELKUNNR</b>.
get low & high fields from each row & pass them.
It will make you clear when you check out your select options in debug mode by entering different combinations of inputs. -
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 -
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 parameter in function module
hi friends,
I have created one function module in which i need to pass PO/SO number from standard EKKO/VBAK tables through the select option parameter S_POSONO. Inside the function module I have a select query which fetches the records from a Z-table which has a field called 'REFERENCE' which is 16-char long. Hence the length mismatches with PO/SO no which is 10-char long. the first 10-char from 'REFERENCE' is PO/SO number, next 3-char is line-item num, and the last three char is schedule item num. It is required to match only first 10-char with the parameter passed i.e, S_POSONO and display only those datas.
The function module is as follows.....
Function :
CALL FUNCTION 'YFIIN_RETRIEVE_SOURCE_DATA'
EXPORTING
LT_RANGE_BUKRS = S_BUKRS[]
LT_RANGE_DOCNO = S_POSONO[]
LT_RANGE_DOCDATE = S_DATUM[]
LT_RANGE_CURRENCY = S_FCURR[]
TABLES
IT_TEMEXPOSU = LT_TEMEXPOSU
EXCEPTIONS
INVALID_SELECTION = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Source code inside function module:
SELECT * FROM ZFIGL_TEMEXPOSU INTO TABLE IT_TEMEXPOSU
WHERE COMPANY_CODE IN LT_RANGE_BUKRS
AND currency in LT_RANGE_CURRENCY
and REFERENCE in LT_RANGE_DOCNO
and doc_date in LT_RANGE_docdate.
IF SY-SUBRC = 0.
SELECT COMPANY_CODE ATTRIBUTE_01 REFERENCE CREATION_DATE FOREIGN_CURR
FROM TEMT_RAWEXPOS APPENDING CORRESPONDING FIELDS OF
TABLE IT_TEMEXPOSU WHERE COMPANY_CODE IN LT_RANGE_BUKRS
AND REFERENCE in LT_RANGE_DOCNO
AND CREATION_DATE IN LT_RANGE_DOCDATE
AND FOREIGN_CURR IN LT_RANGE_CURRENCY.
ENDIF.
Import Parameter of Function Modules :
LT_RANGE_BUKRS - type - BUKRS
LT_RANGE_DOCNO - type - EBELN
LT_RANGE_DOCDATE - type - DOKDATS
LT_RANGE_CURRENCY - type - WAERS
please help me to solve this problem..Hi Ram Tej,
Try this.
First Read all the records without Checking REFERENCE field with LT_RANGE_DOCNO into an internal Tbale.
Then looping at that internal table delete records from the same internal table where REFERENCE(10) <> LT_RANGE_DOCNO.
Hope this may help ur requirement.
Award points if useful. -
How to pass select-option variable in function
hi ,
select-option : s_akont for KNB1-akont OBLIGATORY.
i have to pass s_akont in function without using
s_akont-low & s_akont-high.
rightnow i am passing like s_akont but it is giving me a error :
s_akont is followed by niether by an internal table nor by a value list.
what should i write.
regards
rajHello Raj
I assume that you want to import your select-options into your function module(s). Since select-options are, by default, itabs with header lines you have to pass your select-options as following:
CALL FUNCTION 'Z_...'
TABLES
it_selopt = s_akont[].
The TABLES parameter it_selopt could be of type ANY or better of type <b>TABLE</b>.
If you want to use generic select-option structure you can use <b>RSDSSELOPT</b> and the table type <b>TT_RSDSSELOPT</b>. In this case you would need to copy your select-options from s_akont to a generic type s_generic (of type RSDSSELOPT).
Regards
Uwe -
HOW TO PASS SELECT-OPTIONS AS IMPORT PARAMETER TO A CLASS
Hi experts,how to pass select options value as a export parameters to a zclass.
can give me some idea.
Thanks
saiAs Sachin already said, selection options are stored in an internal table. You can reconstruct the table type without the corresponding input fields using the type addition RANGE OF.
So - assuming you have the following in your program:
DATA: wa TYPE sflight.
SELECT-OPTIONS so_car FOR sflight-carrid.
you can create a publically-visible type in your class using direct type entry and the code
TYPES: my_selectoption TYPE RANGE OF sflight-carrid.
and use this to define the importing parameter of the method.
The only other thing you have to remember is that select-options generates an internal table with header line. Thereore, to pass the table to the method, you would use (in the above example) so_car[], and not just the name of the select-option.
Hope this helps.
Regards
Jon. -
How to Pass Select-options Single values as Parameter value to Method ?
Hi Friends,
I need to pass select-options values(single values) for s_arbpl to the method "process_percent_planned". Now all single values are in internal table s_arbpl-low field. I need to pass this internal table(s_arbpl-low) values to the method where i will run query based on these single values.In my below code i am passing value through variable w_arbpl. I have defined this parameter in the method.But here only one value is passed to method. I want multiple single values (in s_arbpl-low) should be passed. Please let me know how to correct code.
Tables: crhd.
Data: ktext type auftext,
w_arbpl type arbpl.
select-options: s_arbpl for crhd-arbpl.
ktext = 'Test'
create object obj_plan.
call method obj_plan->process_percent_planned
exporting
ktext = ktext
w_arbpl = s_arbpl-low.
Thankshi ,
when you want to pass S_ARBPL AS PARAMETER IN SELEC OPTION
ARBPL SUCH AS
WIN002
WIN003
WIN004
WIN005
WIN006
WIN007
IN MULTIPLE SELECTION S_ARBPL
THEN
USE
Tables: crhd.
Data: ktext type auftext,
w_arbpl type arbpl.
select-options: s_arbpl for crhd-arbpl.
ktext = 'Test'
LOOP AT S_ARBPL .
create object obj_plan.
call method obj_plan->process_percent_planned
exporting
ktext = ktext
w_arbpl = s_arbpl-low.
ENDLOOP.
REGARDS
dEEPAK .
THEN SELECT THAT
call method obj_plan->process_percent_planned
exporting
ktext = ktext
w_arbpl = s_arbpl-low. -
Select option as parameter in FM.
Ho to pass select options as a parameters in function module.
There are ways to do it...
In the Function module using the Table parameter you can do it.
Have a table parameter to hold the select option , Don't type refer to any DDIC structure or field.
In the implementation of the function module you can do some thing like this,.
"example you want to pass matnr select option
data: r_selopt type range of matnr.
data: wa_opt like line of r_selopt.
r_selopt = table_param[].
in the call function side you pass the select option directly to the table parameter directly.
call function 'ZTEST_FUNCTION_SLECTOPTION'
tables
table_param = s_matnr. -
Fetch data from table(ET_) which is exporting parameter of function module
Hi,
I m new to ABAP programming.
I have to develop a smartform that has to be filled in with fields from few tables.
These tables have the naming convention ET_<XXX> (i.e. exporting parameter of function module).
I m not able to directly view its contents in se11 or use select query for it.
I have a report program which i can execute to view these parameter names.
Now, how do i fetch data from these parameters/tables and pass it from my driver program to smartform??
Someone pls guide me...
Thank You.Hi,
I have done that using Field-Symbols.
Thanks,
Preetha -
Passing select-options value in method
How to pass select-options value in method ?
Example:
Select-options: carrid for spfli-carrid.
class cl_myclass implementation.
select carrid connid from
spfli where carrid in carrid.
endclass.
ThanksHello Anee
The coding of this functionality is quite simple:
REPORT zmy_report.
DATA: go_myclass TYPE REF TO zcl_myclass,
gd_repid TYPE syst-repid.
PARAMETERS:
p_bukrs ...
SELECT-OPTIONS:
o_kunnr ...
START-OF-SELECTION.
gd_repid = syst-repid.
CREATE OBJECT go_myclass
EXPORTING
id_calling_program = gd_repid.
And that's how your CONSTRUCTOR method should look like:
METHOD constructor. " IMPORTING parameter id_calling_program
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
CURR_REPORT = id_calling_report
TABLES
SELECTION_TABLE = me->mt_selopts.
" NOTE: define mt_selopts as instance attribute of table type RSPARAMS_TT
ENDMETHOD.
Finally you have to extract the parameter and select-options from MT_SELOPTS.
Regards
Uwe
Maybe you are looking for
-
IPhone 4S with iOS 6 can't connect to open Wi-Fi network on HP/H3C WX5004 controller
After upgrading from iOS 5.1.1 to iOS 6, iPhone 4S devices can no longer connect to an open wi-fi network on our campus. We have a controller based WLAN from HP/H3C managed by a WX5004 controller with AP models WA2620-AGN and WA2620E-AGN. Symptom: In
-
Hello CRM experts, I have one question in CRM Business Partner, This is regarding the BP address in the transaction BP. When I create a BP & enter a address, why the system is assigning it to standard address usage(type) automatically? Actually I do
-
Need suggestion to achieve this functionality
Hi, I was looking at cfgrid and cftree functionality. Is it possible to incorporate cftree within cfgrid. if I can create a tree like structure in cfgrid. I am looking for something like below: The hyphens would be replaced by checkboxes... - Folders
-
Writing multiple files using UTL_File package
Hi, I have an requirement where I need to read the flat file and based on the first 3 character in each line which will be compared with the FlagTable, I have to create and move data into different files. I'm using Oracle 11g in Windows xp platform.
-
Ok, so I want to use Lightroom to create a web gallery, which is easy enough, but I would like to use a different design other than the ones provided with the software. The included templates are fine, but are a little boring and look a bit dated. A