Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

passing selection table as parameter to function modules

Former Member
0 Likes
1,025

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.

7 REPLIES 7
Read only

Former Member
0 Likes
863

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

Read only

0 Likes
863

i had already created the structure of the table as u have said.more thoughts plz

Read only

Former Member
0 Likes
863

Passing Select-Options to Smart Forms

i have followed the same thing that is suggested in the link,

sap technical com

Read only

0 Likes
863

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

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
863

Create a table type for structure SELOPT or RSPARAMS and use it.

Read only

Former Member
0 Likes
863

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)

Read only

Clemenss
Active Contributor
0 Likes
863

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