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
Similar Messages
-
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 -
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 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 declare Dynamic table in Tables Parameters of a Function Module...
Hi Gurus,
I would like to Know how to declare a Dynamic table in Tables parameters of a Function Module.
so that it should be able to hold any table data ....
I have tried all possible ways of trying to assign fields-symbol like declarations which doesnt allow here ...
plz Dont reply with the basics of creating dynamic internal tables, coz my case is not an Internal table it is FM table parameter declaration.....Hi,
If you are requirement is to create a function module with tables parameter having a generic line type i.e. no specific line type
just declare it with a name under Parameter name with out specifying the type.
A reference function module with such parameter, i would quote is the standard GUI_UPLOAD/ GUI_DOWNLOAD where the parameters specified under TABLES are generic.
If you want to process the values passed to these parameters in the source code of function module, field symbols would be a preferable option.
Regards,
Sharath Panuganti -
Doubt in export, import and table para when creating Function Module
Dear fellow ABAPers,
I have a doubt in defining export, import and table parameter while creating a function module.
I am calling a function module inside a user exit. Now in the user exit the SAP fills an internal table called i_lfa1 with all the data user has eneterd.
Now I want to pass this whole internal table to function module and the perform some checks on the values of internal table.
After that function module fills an error structure with values depending on some check.
1)
How do I pass this internal table to function module ?
When I am creating function module in se37 where do I define this iternal table type ? Is it in Import or Table parameter during function module creation?
2)
Where do I define error structure type (which is returned by function module to main program)? Is it in Export or table parameter during function module creation?
Please clear my doubt..
Relevant points will be awarded.
Regards,
Tushar.Hi Tushar,
1. How do I pass this internal table to function module ?
I assume u are creating your own Y/Z FM.
Pass it thru TABLES parameter.
2. When I am creating function module in se37 where do I define this iternal table type
Define this in TABLES interface.
What Type ?
THE SAME TYPE WHICH HAS BEEN DEFINED
WHILE PASSING IN THE USER-EXIT FUNCTION MODULE.
IF U SEE THE FM OF THE USER-EXIT,
U WILL COME TO KNOW.
3.
Where do I define error structure type (which is returned by function module to main program)? Is it in Export or table parameter during function module creation?
Define it in TABLES interace. (not in export, import)
(Since what u are going to return is an internal table)
U can take for eg. BDCMSGCOLL.
OR u can create your own Y/Z structure
for the same purpose.
(or u can use the structure type T100)
I hope it helps.
Regards,
Amit M. -
Checkbox as import parameter in function module
Hi all,
how to create a checkbox as import parameter in function module,
thnx in advance?? Function modules don't have screens...they do have import, export parameters.
If you look at how "checkboxes" are stored in db tables, you'll see that the previous replies are precisely correct. A check box is a char1 field...it is on when 'X' (ABAP_TRUE) and off when blank (initial)....you would call your FM with an import field of type char1 set to 'X' or set to space, and handle accordingly in your FM code.
If you have a checkbox on a selection screen, then the value of that parameter is either 'X' or space, depending upon whether or not the user checked the box. -
Add parameter in Function Module
hi all,
I'm trying to add a parameter to function module HRGPBS_HER_GET_SURNAME_NINO.
However, the system is telling me to carry out modification comparison first.
Can someone guide me on using SPAU or SE95, as I don't understand what to enter in the selection area?
thanksIf you go to transaction code: SPAU, you can find the item (program, function module, screen, etc) in question, open the tree to the lower levels. On the lower item, you can choose to save your changes or revert back to original.
The developers should be able to tell what has been changed. In most cases, we wanted to keep our changes with the exception of when a change was made and later a note was released to produce the same result or if new functionality is released related to the item in question.
Hope this helps. -
How to get tables used by a Function Module
Hi,
How to know the tables used by a function module dynamically.
Cuurently im using BAPI_MATERIAL_SAVEDATA in my report program.
I tried FM GET_TABLES to know the tables, but could see only tables used in the report.
Main issue in my case is when im running this update program, could observe different tables being displayed as updated in SM50(Process Overview).Want to clarify as why these tables which are not being used in my report are being displayed in SM50.
So was doubtin weather this FM is using these displayed tables.
Thanks in advance for u r replys.
Regards,
DedeepyaHi Dedeepya,
you could use a SQL Trace (tx. ST05) to list all tables affected and operations that realize. Just active the trace, execute FM, and Deactive trace. Then click in "Display trace" and check it.
Best regards,
Pablo -
Update TVARV table entries using a Function Module or Program
Hi Gurus,
My requirement is that I have a entry in TVARV table which has a 'low'. We would like to change this value whenever we desire. We are unable to do it via sm30 and se16 as table maintenance access is not permitted in Production environment.
Can you please provide any Function module or program code to do it?
Requirement - User can enter a value into TVARV table by executing a function module or program
Thank you all, will award points,
PriyanshHi Priyansh,
Please refer to SAP Help for more information on variant maintenance and more specifically variable values in variants. You can use t/code STVARV for maintaining the variant variables in table TVARVC (Client-Specific Variant Variables).
Note: I suggest to use the TVARVC table instead of TVARV.
If you are looking for Function Modules in the area of Variant Maintenance, then please have a look at Function Group SVAR (t/code SE80).
If you are looking for Function Modules in the area of User Variables in Variants, then please have a look at Function Group SVUV (t/code SE80).
Furthermore, if you are looking for a program to update table TVARVC, please have a look at ABAP: Dynamic Variant Processing with STVARV.
Best eregards,
Sander -
CRM Tables , Tables Mappings , T-codes , Function modules
Hi All,
I am new to CRM , I want to know the tables , table mappings transaction
codes , functional modules used . Can any one mention the link / list down all which i have mentioned above .
I will be very helpful if i get this information.
cheers,
Chandra.hi,
CRM tables:
https://forums.sdn.sap.com/click.jspa?searchID=2400935&messageID=3134573
https://forums.sdn.sap.com/click.jspa?searchID=2400935&messageID=3128631
https://forums.sdn.sap.com/click.jspa?searchID=2400935&messageID=3269744
CRM FM:
https://forums.sdn.sap.com/click.jspa?searchID=2400963&messageID=3239545
Reward points if useful..
Regards
Nilesh -
(internal) Tables obsolete as parameter in function modules,
Hi
As you probably can see by the question, my ABAP Knowledge isn't exactly overwhelming !
<i>anyway:</i>
I'm trying to create a function module in NW2004s, This functionmodule should take an internal table, based on a structure as (import) parameter.
In the earlier version, I've done this by defining it under the TAB 'Tables' in the function builder - But know its telling me that "<i>Tables Parameters are obsolete</i>", and that I should define it under "Changing" instead.
I have tried that, but I'm only allowed to pass a single line, and if I try to do a Loop, in the function module, it tells me that ity isn't created as an internal table.
So please - what is the "best practice" here ?
Regards
Morten NielsenHi All,
I followed Steps 1 and 2 but when I use the following select statement I get a dump with the error enclosed.
Step1. Created a structure ZDFKKCOHI which is a replica of DFKKCOHI.
Step2. Created a table type ZDFKKCOHITABLE with line type as ZDFKKCOHI.
Step3. In my function module I have a changing parameter ZDFKKCOHIPARAM of type ZDFKKCOHITABLE.
Step 4. When I use the following select clause I am getting a dump.
DATA: wa_zdfkkcohi LIKE LINE OF zdfkkcohiparam.
SELECT *
FROM dfkkcohi
INTO CORRESPONDING FIELDS OF TABLE zdfkkcohiparam
WHERE cotyp EQ zcotyp
AND gpart EQ zgpart
AND corr_status EQ zcorr_status.
LOOP AT zdfkkcohiparam INTO wa_zdfkkcohi.
*Move IT_ZDFKKCOHI to ZDFKKCOHIOUT.
*Append ZDFKKCOHIOUT.
*Clear IT_ZDFKKCOHI.
ENDLOOP.
What could be wrong?
Thanks for all your help in advance.
Regards,
Divya -
(internal) Tables obsolete as parameter in function modules in ECC 6.0
Hi All,
I followed Steps 1 and 2 in the thread but when I use the following select statement I get a dump with the error enclosed.
Step1. Created a structure ZDFKKCOHI which is a replica of DFKKCOHI.
Step2. Created a table type ZDFKKCOHITABLE with line type as ZDFKKCOHI.
Step3. In my function module I have a changing parameter ZDFKKCOHIPARAM of type ZDFKKCOHITABLE.
Step 4. When I use the following select clause I am getting a dump.
DATA: wa_zdfkkcohi LIKE LINE OF zdfkkcohiparam.
SELECT *
FROM dfkkcohi
INTO CORRESPONDING FIELDS OF TABLE zdfkkcohiparam
WHERE cotyp EQ zcotyp
AND gpart EQ zgpart
AND corr_status EQ zcorr_status.
LOOP AT zdfkkcohiparam INTO wa_zdfkkcohi.
*Move IT_ZDFKKCOHI to ZDFKKCOHIOUT.
*Append ZDFKKCOHIOUT.
*Clear IT_ZDFKKCOHI.
ENDLOOP.
Error: Das laufende ABAP-Programm wollte eine Open SQL-Anweisung ausführen,
bei der die Treffermenge mit 'INTO CORRESPONDING FIELDS' in
namensgleiche Felder der Zielbereichs gestellt werden soll. Hierbei
müssen die namensgleichen Felder des Zielbereichs einen flachen Typ
haben, oder vom Typ STRING oder XSTRING sein.
Im vorliegenden Fall enthält der Zielbereich " " aber ein
namensgleiches Feld "MANDT " mit dem verbotenen internen Typ "l".
What could be wrong?
Thanks for all your help in advance.
Regards,
DivyaTranslating the error message -;)
The running ABAP-program wanted to carry out an opus SQL-direction, with which the hit quantity with 'INTO
CORRESPONDING FIELDS' is supposed to be placed into name same fields the goal area. Herewith the name same
fields of the goal area must have be a flat type, or of the type STRING or XSTRING.
In the existing case, the goal area "" contains however a name same field "MANDT" with the forbidden internal type "l".
You should check you structures and assign the correct TYPE to the fields -:)
Greetings,
Blag. -
TABLE parameter in FUnction module
Hi Experts
Iam modifying a FM, i have 10 fileds in export parameters,
filed1
filed2
filed3
filed 10.
as per the requirement i need to display the same parameters in table form
suppose the rows of table is like
filed1filed2filed3
filed4filed5filed6
filed7filed8filed9filed10
so iam planing to create internal table and pass it TABLE parameter option in FM
please tell me is it make sense and how to define TABLE parameter in FM, and how to pass data to it
thanks
vasaviinside the fm you can declare some thing like this.. have a table parameter name some thing don't reference to any data type.
and also you have 10 importing parameters.
function ztest_function.
data: begin of itab occurs 0,
field1 type <datatype>,
field2..
field10,
end of itab.
"passing importing parameters
itab-field1 = i_field1. "these are importing parameters
itab-field2 = i_field2.
itab-field10 = i_field10.
append itab.
table_parameter[] = itab[].
endfunction. -
Tables-Parameter in Function module
Hello together,
i created a new function module in CRM with one "Tables"-Parameter. The parameter will be filled in debugging but if i call the fm in SAPRFC test script the table is empty. Do have any idea how i could solve this?
Best regards
SaschaChanging parameters can be used as work areas as well as tables, tables can not be used as work areas.
Reference Difference between changing and table parameters in Function Modules SAP ABAP - Modularization techniques in SAP ABAP | at SAPNuts.com
Maybe you are looking for
-
Seeking library with industrial HMI drawings
Hello, I am Developing a nice HMI that communicates with PLC;s an d DCS's automation and control systems using visual studio 2008 and NModbus.dll lilbrary. The only thing I am still missing are the libraries for the HMI drawings, What I am looking
-
Not able to scroll up in BDC for J1IJ
Hi, I am trying to create a BDC for J1IJ transaction.The problem comes if there are multiple excise invoices for a delivery document (program SAPMJ1IJ screen 400). For the first line item ,the scroll is initialized automatically to the first record i
-
Event Keeps Reappearing After Delete, Event Keeps Reappearing After Delete
I created an event and noticed subsequently that, in addition to this, the same event appeared again on a different date. I left the original and deleted the spurious event/date but, as soon as I touch any other date to make a new entry, it reappears
-
Hi Freinds, I got the following error while doing customization for Non-valuated sale order. In the Requirement class i selected the 40 and went in to details and have not selected any thing in the field Valuation which means i want to have "Non valu
-
Can I change email report name?
Hi everyone, This question has gone unanswered in the forums so I must ask... Can I change the name of the report from report.pdf to something more meaningful when using DESTYPE = MAIL? I'm using Forms 6. Thanks. Lesley