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

regarding selecting required data

Former Member
0 Likes
450

hi experts,

i am having first five records from the table by looping it , now the main problem is that i have combinations like

S1[ 93X 1]S2[415X 1]S3[249X 1]S4[230X 2]S5[215X 0]

S1[ 93X 1]S2[415X 0]S3[249X 1]S4[230X 1]

S1[ 93X 1]S2[415X 0]S3[249X 1]

these r the combinations drived from the system with the scrap being 0.

now what i want is how can i get the best combinations from the above combinations which is having more number of combinations from the above three

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
427

hopefully I understood your requirement. you need to find your which have more distinct combinations...


LOOP AT p_final_table ASSIGNING <fs_record>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <fs_record> TO <fs_comp>.
IF sy-subrc <> 0.
    EXIT.
ENDIF.
lf_buf = <fs_comp>.

CONCATENATE lf_buf lf_line INTO lf_line.
if sy-subrc eq 0.
     if lf_lines CS lf_buf.
       counter = counter + 1. " save this counter in one column in the table.
      endif.
endif.
"need some more code to append and all....
enddo.

sort p_final_table descending.

read table p_final_table into wa_final_table.
if sy-subrc eq 0.
write:/ 'Max combination row =' wa_final_table-field1.....
endif.

2 REPLIES 2
Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
427

I honestly can't understand your question... What "scrap", what "combinations"? Could you explain clearly what you're trying to do?

Read only

former_member156446
Active Contributor
0 Likes
428

hopefully I understood your requirement. you need to find your which have more distinct combinations...


LOOP AT p_final_table ASSIGNING <fs_record>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <fs_record> TO <fs_comp>.
IF sy-subrc <> 0.
    EXIT.
ENDIF.
lf_buf = <fs_comp>.

CONCATENATE lf_buf lf_line INTO lf_line.
if sy-subrc eq 0.
     if lf_lines CS lf_buf.
       counter = counter + 1. " save this counter in one column in the table.
      endif.
endif.
"need some more code to append and all....
enddo.

sort p_final_table descending.

read table p_final_table into wa_final_table.
if sy-subrc eq 0.
write:/ 'Max combination row =' wa_final_table-field1.....
endif.