‎2008 Oct 10 9:46 AM
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
‎2008 Oct 11 12:29 AM
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.
‎2008 Oct 10 9:44 PM
I honestly can't understand your question... What "scrap", what "combinations"? Could you explain clearly what you're trying to do?
‎2008 Oct 11 12:29 AM
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.