‎2022 Oct 21 10:33 AM
I was encountering an error that T_TVARV_VKORG does not have the structure of a selection table. I was trying to check if my VKORG is present in T_TVARV_VKORG. Do I need to create a structure for that T_TVARV_VKORG?
CALL FUNCTION 'Z_GET_PARAMETERS_FROM_TVARVC'
EXPORTING
product = c_tvarv_vkorg
TABLES
t_parameter = t_tvarv_vkorg
EXCEPTIONS
VALUES_NOT_FOUND = 1
OTHERS = 2
.
IF sy-subrc = 0.
IF KOMK-VKORG IN T_TVARV_VKORG.
ENDIF.
ENDIF.
‎2022 Oct 21 10:59 AM
DATA:
t_tvarv_vkorg TYPE STANDARD TABLE OF tvarv,
lt_vkorg_r TYPE RANGE OF vkorg.
* Fill range table
LOOP AT t_tvarv_vkorg ASSIGNING FIELD-SYMBOL(<fs_tvarv_vkorg>).
APPEND INITIAL LINE TO lt_vkorg_r ASSIGNING FIELD-SYMBOL(<fs_vkorg_r>).
MOVE-CORRESPONDING <fs_tvarv_vkorg> TO <fs_vkorg_r>.
ENDLOOP.
IF komk-vkorg IN lt_vkorg_r.
* Do something
ENDIF.
‎2022 Oct 21 11:19 AM
c12b61ded10b4e18beae75c3b6218d2c definitively you don't like new syntax.
t_tvarv_vkorg = VALUE #( ( name = 'VKORG' sign = 'I' opti = 'EQ' low = '0100' )
( name = 'VKORG' sign = 'I' opti = 'EQ' low = '0101' ) ).
lt_vkorg_r = CORRESPONDING #( t_tvarv_vkorg mapping option = opti ).
cl_demo_output=>display_data( lt_vkorg_r ).‎2022 Oct 21 11:23 AM
frdric.girod You're right. I'm more old-school...
Although this corresponding command looks useful 😉
‎2022 Oct 21 11:26 AM
But I follow you regarding some new command too much complex
‎2022 Oct 21 1:16 PM
frdric.girod
Better use NEW NEW syntax 😄t_tvarv_vkorg = VALUE #( name = 'VKORG' sign = 'I' opti = 'EQ' ( low = '0100' ) ( low = '0101' ) ).
‎2022 Oct 21 1:18 PM
‎2022 Oct 21 1:14 PM
We don't know your custom "Z_GET..." function module, so can't answer.
About the error message, you must have your Actual parameter of the same type as the Formal parameter (although TABLES is a little bit flexible about the types).
I don't understand what it means to "create a structure for [an already-defined variable]".
Please provide information about the current types of Actual and Formal parameters.
‎2022 Oct 21 1:40 PM