2006 Oct 10 8:38 AM
Dear ALL,
I have a string suppose for example 1234 and i have to make permutation combination for the given string.
1 ) By taking all four word
2 ) By taking any three of them,
3 ) By taking any two of them,
is there any function module to provide permutation combination of the given string or please provide any logic related to calculate permutation & combination .
Thanks in advance,
With Regards
Shantanu
Dear ALL,
I have a string suppose for example 1234 and i have to make permutation combination for the given string.
1 ) By taking all four word
2 ) By taking any three of them,
3 ) By taking any two of them,
is there any function module to provide permutation combination of the given string or please provide any logic related to calculate permutation & combination .
Thanks in advance,
With Regards
Shantanu
2006 Oct 10 9:01 AM
i could not find such fm.
logic is---
suppose u have 4 digit string.
u can find out the length of string using <b>strln( str)</b>
now if u want to number of possible combination be.
<b>total no = 4c4 + 4c3 + 4c2 + 4c1 = 2(pow,n) - 1.
where n = lenth of string.</b>
2006 Oct 10 9:01 AM
Hi shantanu,
no function AFAIK.
The logic should be recursive as follows:
(set are all members like example 1234, N is size of resulting set like all four, three, two; sets are the resulting variations - only all of them is called permutation)
get_variations importing set N exporting sets;
check N > 0.
for <all members of set> do:
remove member from set;
put member to result set;
get_variations exporting set N importing partsets;
put member to all partsets;
put partsets to resulting sets
This is the recursive logic. You can use internal tables for the sets. The internal table may have fields that are internal table as well.
Hope you get it! - it is recursive
Regards,
Clemens
BTW: Post once.
2006 Oct 10 9:20 AM
Hello,
Please check this function module
RSEC_GENERATE_PASSWORD
Best Regards,
Krishnakumar