/scripts/ahub.form.attachments.js
0

Calling Method with Importing-Parameter "SelectOptions Range-Table" as TYPE any table???

Apr 06, 2017 at 02:42 PM

103

avatar image

Hi at all,

i have a Dynpro with a Select-Options "S_VBELN" and "S_DATE" and iam trying to call a Method "CONVERT_RANGE" with Importing-Parameter IT_TABLE = S_VBELN and IT_SELOPT_DATE = S_DATE, but it doesnt work.

When iam calling the "dynamic Method" with "S_VBELN" than i got always a Error-Message from Syntax-Check: S_VBELN is not Type-compatible to "IT_TABLE"!!!

I hope anyone can help me with this dynamic Importing-Parameters!
Thanks in forward.

Kind Regards
ETN

---------------------------------------------REPORT--------------------------------------------------

DATA: lt_selopt TYPE RSDSSELOPT_T.

SELECT-OPTIONS: s_vbeln TYPE vbeln,
s_date TYPE sy-datum.

lt_selopt_vbeln = convert_range( it_table = s_vbeln ).

lt_selopt_date = convert_range( it_table = s_date ).

----------------------------------------------METHOD-------------------------------------------------
*// IT_TABLE TYPE ANY TABLE
*// RT_SELOPT TYPE RSDSSELOPT_T

*& data declaration
DATA: ls_selopt TYPE rsdsselopt,
lo_dynamic_line TYPE REF TO data,
lo_dynamic_table TYPE REF TO data,
lo_struct TYPE REF TO cl_abap_structdescr.

FIELD-SYMBOLS: <lt_table> TYPE table,
<ls_table> TYPE any,
<fs_comp> TYPE abap_compdescr,
<lv_value> TYPE any,
<lv_selopt> TYPE any.

CREATE DATA lo_dynamic_table LIKE it_table.
ASSIGN lo_dynamic_table->* TO <lt_table>.

CREATE DATA lo_dynamic_line LIKE LINE OF <lt_table>.
ASSIGN lo_dynamic_line->* TO <ls_table>.

APPEND LINES OF it_table TO <lt_table>.

* Populate the fields of wa_pc_model_data2
lo_struct ?= cl_abap_typedescr=>describe_by_data( <ls_table> ).

IF lo_struct IS BOUND AND lo_struct IS NOT INITIAL.
LOOP AT <lt_table> INTO <ls_table>.
CLEAR ls_selopt.

LOOP AT lo_struct->components INTO <fs_comp>
WHERE name EQ 'SIGN'
OR name EQ 'OPTION'
OR name EQ 'LOW'
OR name EQ 'HIGH'.

ASSIGN COMPONENT <fs_comp>-name OF STRUCTURE <ls_table> TO <lv_value>.
ASSIGN COMPONENT <fs_comp>-name OF STRUCTURE ls_selopt TO <lv_selopt>.
<lv_selopt> = <lv_value>.
ENDLOOP.

IF ls_selopt IS NOT INITIAL.
APPEND ls_selopt TO rt_selopt.
ENDIF.
ENDLOOP.
ENDIF.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Horst Keller
Apr 06, 2017 at 04:13 PM
3

Is it as simple as follows?

Selection tables have infamous header lines. You pass the header lines and not the table body. Append [] to the names and it should be fine!

Show 1 Share
10 |10000 characters needed characters left characters exceeded

It is as simple as that.

1
Evgeniy Astafev Apr 07, 2017 at 05:00 AM
1

It's a bit offtopic but if I correctly understand your logic you can replace all your code with just one line of code:

lt_selopt_vbeln = corresponding #( s_vbeln[] ).

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hello Evgeniy,

thanks you too, your Answer is also correct.
My Solution is a bit offtopic, but the Problem was, that i forgot, that Select-Options has "Header-Lines"!!!

Kind Regards
ETN

0
Skip to Content