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

Checking an entry from an internal table.

walkerist79
Participant
0 Likes
1,707

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.
8 REPLIES 8
Read only

thkolz
Contributor
0 Likes
1,662
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.
Read only

1,662

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 ).



Read only

0 Likes
1,662

frdric.girod You're right. I'm more old-school...
Although this corresponding command looks useful 😉

Read only

0 Likes
1,662

But I follow you regarding some new command too much complex

Read only

Sandra_Rossi
Active Contributor
1,662

frdric.girod

Better use NEW NEW syntax 😄
t_tvarv_vkorg = VALUE #( name = 'VKORG' sign = 'I' opti = 'EQ' ( low = '0100' ) ( low = '0101' ) ).
Read only

0 Likes
1,662

Nice one sandra.rossi !

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,662

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.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,662

How is defined the table parameter (old school...)