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

Increase The Counter inside Value Constructor

RachamallaKiran
Participant
0 Likes
1,314

Hi all,

Just not able to write counter increase Logic inside Value Constructor

Want to increase the Counter i mean want to increase i inside loop but how to increase the i value in the above code not understanding can some one help me out.

Regards,

kiran rachamalla.

1 ACCEPTED SOLUTION
Read only

FredericGirod
Active Contributor
1,158

If you need the index of the line, why didn't you use INDEX statement ?

DATA(lt_setopt) = VALUE tbl_mat_range( ( sign       = 'I'
                                        option     = 'EQ'
                                        matnr_low  = '123'
                                        matnr_high = '456' )
                                      ( sign       = 'I'
                                        option     = 'EQ'
                                        matnr_low  = '123'
                                        matnr_high = '456' ) ).


DATA(lt_result) = VALUE tbl_mat_range(  FOR my_temp_line
                                        IN lt_setopt
                                        INDEX INTO my_index (
                                          sign      = my_temp_line-sign
                                          option    = my_temp_line-option
                                          matnr_low = my_temp_line-matnr_low
                                          matnr_high =  my_index + 1 ) ) .




cl_demo_output=>write_data( lt_setopt ).
cl_demo_output=>write_data( lt_result ).
cl_demo_output=>display( ).
2 REPLIES 2
Read only

FredericGirod
Active Contributor
1,159

If you need the index of the line, why didn't you use INDEX statement ?

DATA(lt_setopt) = VALUE tbl_mat_range( ( sign       = 'I'
                                        option     = 'EQ'
                                        matnr_low  = '123'
                                        matnr_high = '456' )
                                      ( sign       = 'I'
                                        option     = 'EQ'
                                        matnr_low  = '123'
                                        matnr_high = '456' ) ).


DATA(lt_result) = VALUE tbl_mat_range(  FOR my_temp_line
                                        IN lt_setopt
                                        INDEX INTO my_index (
                                          sign      = my_temp_line-sign
                                          option    = my_temp_line-option
                                          matnr_low = my_temp_line-matnr_low
                                          matnr_high =  my_index + 1 ) ) .




cl_demo_output=>write_data( lt_setopt ).
cl_demo_output=>write_data( lt_result ).
cl_demo_output=>display( ).
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,158

Please don't post code as image, copy/paste it and use CODE button to add the colors. Hopefully some people accept to not be paid to type your code again...