<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Internal table permutations: for experts in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742989#M900628</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you explain your requirement further?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Apr 2008 16:28:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-04-25T16:28:57Z</dc:date>
    <item>
      <title>Internal table permutations: for experts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742986#M900625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have an internal table with 10 values. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to have all permutations. There are 10! possibilities.&lt;/P&gt;&lt;P&gt;How can i calculate this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2008 16:10:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742986#M900625</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-25T16:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table permutations: for experts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742987#M900626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi check this ...you will see all the permutations...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://service.sap.com/instguides" target="test_blank"&gt;http://service.sap.com/instguides&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;venkat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2008 16:15:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742987#M900626</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-25T16:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table permutations: for experts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742988#M900627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i can't follow you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you kidding me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2008 16:18:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742988#M900627</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-25T16:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table permutations: for experts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742989#M900628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you explain your requirement further?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2008 16:28:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742989#M900628</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-25T16:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table permutations: for experts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742990#M900629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure about what you need...It could something like this???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: BEGIN OF ty_table,
       value TYPE string,
       END OF ty_table.

DATA: t_table TYPE STANDARD TABLE OF ty_table
      WITH HEADER LINE.

DATA: counter TYPE sy-tabix,
      count TYPE sy-tabix,
      value TYPE string,
      perm TYPE string.

FIELD-SYMBOLS: &amp;lt;fs_table&amp;gt; LIKE LINE OF t_table.

DO 10 TIMES.
  counter = counter + 1.
  t_table-value = counter.
  APPEND t_table.
ENDDO.

LOOP AT t_table ASSIGNING &amp;lt;fs_table&amp;gt;.
  CLEAR count.
  value = &amp;lt;fs_table&amp;gt;-value.
  CONCATENATE perm value
  INTO perm SEPARATED BY '-'.
  DO 10 TIMES.
    count = count + 1.
    READ TABLE t_table INDEX count.
    IF value NE t_table-value.
      CONCATENATE perm t_table-value
      INTO perm SEPARATED BY '-'.
      CONDENSE perm NO-GAPS.
    ENDIF.
  ENDDO.
  SHIFT perm LEFT DELETING LEADING '-'.
  WRITE:/ perm.
  CLEAR perm.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
1-2-3-4-5-6-7-8-9-10 
2-1-3-4-5-6-7-8-9-10 
3-1-2-4-5-6-7-8-9-10 
4-1-2-3-5-6-7-8-9-10 
5-1-2-3-4-6-7-8-9-10 
6-1-2-3-4-5-7-8-9-10 
7-1-2-3-4-5-6-8-9-10 
8-1-2-3-4-5-6-7-9-10 
9-1-2-3-4-5-6-7-8-10 
10-1-2-3-4-5-6-7-8-9 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Blag.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2008 16:47:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742990#M900629</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-25T16:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table permutations: for experts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742991#M900630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes i need something like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have one value e. g. 5000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in the internal table i have sub values. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g. 500, 400, 350, 70, 80 ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to find the optimal combination of the sub values to fulfill the whole value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For that issue i want to build all permutations... to get the optimal combination....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2008 16:52:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742991#M900630</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-25T16:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table permutations: for experts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742992#M900631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It took me some time, but I made this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
types: begin of ty_tab,
text,
flag,
end of ty_tab.


data itab type table of ty_tab with header line.
data: result(200).
data: i_lines type p.
data: permutations type p.

data: curr_lenght type p value 0.
itab-text = 'a'.
append itab.
itab-text = 'b'.
append itab.
itab-text = 'c'.
append itab.
itab-text = 'd'.
append itab.


describe table itab lines i_lines.

perform loopear.
permutations = sy-linno - 2.
write: / 'number of permutations: ', permutations.

form loopear.
data: wa_itab type ty_tab.

do i_lines times.

read table itab into wa_itab index sy-index.
read table itab into wa_itab with key text = wa_itab-text flag = 'X'.
if sy-subrc ne 0.
wa_itab-flag = 'X'.
modify itab from wa_itab index sy-index.
result+curr_lenght(1) = wa_itab-text.
curr_lenght = curr_lenght + 1.
perform loopear.

if curr_lenght eq i_lines.
write / result.
endif.

wa_itab-flag = ''.
modify itab from wa_itab index sy-index.
curr_lenght = curr_lenght - 1.
endif.

enddo.


endform.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sadly it only works with unique values, it's working up to 7!.&lt;/P&gt;&lt;P&gt;It was something quick, maybe you can modify it to your requirements&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2008 21:50:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742992#M900631</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-25T21:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table permutations: for experts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742993#M900632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nice -:D&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Blag.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2008 21:56:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742993#M900632</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-25T21:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Internal table permutations: for experts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742994#M900633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, I made a bet with some colleagues that I could make it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's not exactly what he asks for, but I guess he can modify it now that the permutations are working. Saddly that's the best I can do while at work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I guess it can work with loops also, but I became frustrated with sy-tabix and decided to put that crazy do before noticing a little mistake I made. Didn't tried it with 10! I'm afraid it may take a lot of time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2008 22:26:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table-permutations-for-experts/m-p/3742994#M900633</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-25T22:26:22Z</dc:date>
    </item>
  </channel>
</rss>

