‎2009 Dec 01 11:22 AM
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.
‎2009 Dec 01 11:57 AM
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
‎2009 Dec 01 12:09 PM
i had already created the structure of the table as u have said.more thoughts plz
‎2009 Dec 01 12:31 PM
Passing Select-Options to Smart Forms
i have followed the same thing that is suggested in the link,
sap technical com
‎2009 Dec 01 12:38 PM
Hi,
as u said you have created a structure with the same type.....
you will have to create a table type for that structure and mention that table type name in the smartform parameter
Thanks,
Sid
‎2009 Dec 01 12:42 PM
Create a table type for structure SELOPT or RSPARAMS and use it.
‎2009 Dec 01 1:22 PM
i have created a data dictionary structure and used the same for the type of the sf_sop-(table parameter).
the fields of the structure are
sign,(1)
option,(2)
low(4)
high(4)
‎2009 Dec 01 1:27 PM
Hi infinity,
please select the ABAP code using the mouse, then click the above <_> code button. Then the code can be read.
For the SELECT-OPTIONS table you should create (or use an existing) appropriate table type. Im not on system now but I remember in DD06L you can find all table types and you may find the useful range table for your data element.
The pass the SELECT-OPTIONS range as s_xyz[] to a matching IMPORT parameter of this tabletype in the function.
Regards,
Clemens