- SAP Community
- Groups
- Interest Groups
- Application Development
- Discussions
- Function Module for Permutation Combination of 123...

Application Development Discussions

Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Function Module for Permutation Combination of 1234

Former Member

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

10-10-2006 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

- SAP Managed Tags:
- ABAP Development

3 REPLIES 3

Former Member

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

10-10-2006 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>

- SAP Managed Tags:
- ABAP Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

10-10-2006 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.

- SAP Managed Tags:
- ABAP Development

Former Member

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

10-10-2006 9:20 AM

Hello,

Please check this function module

RSEC_GENERATE_PASSWORD

Best Regards,

Krishnakumar

- SAP Managed Tags:
- ABAP Development