<?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: bapi_costelementgrp_create and hierarchy nodes in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746900#M1582311</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Andrew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are very welcome.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apparently the &lt;STRONG&gt;less than sign, greater than sign&lt;/STRONG&gt; version of the not equal sign does not copy properly to this forum;  it is used as a formatting option for text.  Therefore, I needed to change the not equal sign from &lt;STRONG&gt;less than sign, greater than sign&lt;/STRONG&gt; to "ne" format.  That's what caused the confusion we were experiencing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a nice day!&lt;/P&gt;&lt;P&gt;Rae Ellen Woytowie&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rae Ellen Woytowiez on Apr 15, 2011 3:44 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Apr 2011 13:43:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-04-15T13:43:50Z</dc:date>
    <item>
      <title>bapi_costelementgrp_create and hierarchy nodes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746893#M1582304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi to all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need an algorythm in order to fill the internal table hierarchynodes (def. like bapiset_hier ) to pass to the bapi_costelementgrp_create.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The hierarchy nodes will be uploaded from a file with two fields: "father node" and "child node" like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TESTJR     TESTJR2 &lt;/P&gt;&lt;P&gt;TESTJR2   TESTJR3 &lt;/P&gt;&lt;P&gt;TESTJR     TESTJR4&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;in the internal table the hierlevel shoul be like the following schema:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; TESTJR is level &lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; TESTJR2 have to assigned to TESTJR (hierlevel 1)&lt;/P&gt;&lt;P&gt; TESTJR3 have to assigned to TESTJR2 (hierlevel 2)&lt;/P&gt;&lt;P&gt; TESTJR4 have to assigned to TESTJR (hierlevel 1) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas and suggestions? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Apr 2011 18:25:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746893#M1582304</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-14T18:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: bapi_costelementgrp_create and hierarchy nodes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746894#M1582305</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;you have to options. Go to SE37 and read documentaiton for BAPI_COSTELEMENTGRP_CREATE where it's described how to fill these tables. If you are lazy to read then you can create a sample hierarchy in standard SAP transaction and use BAPI BAPI_COSTELEMENTGRP_GETDETAIL to get example how you need to pass data. You can see that both BAPIs have similar interface.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Apr 2011 23:49:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746894#M1582305</guid>
      <dc:creator>mvoros</dc:creator>
      <dc:date>2011-04-14T23:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: bapi_costelementgrp_create and hierarchy nodes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746895#M1582306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Andrew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try the code below.  However, you should test it thoroughly.  WARNING:  Make sure first record in internal table pertains to the root node.  The internal table lt_hier is the internal table that you assign parameter "hierarchynodes" when calling BAPI_COSTELEMENTGRP_CREATE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Rae Ellen Woytowiez&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*
* Types, internal table, and structures for input file
TYPES:  BEGIN OF input,
          groupname1 TYPE bapiset_groupname,
          groupname2 TYPE bapiset_groupname,
        END OF input.
TYPES:  input_tt TYPE TABLE OF input.

DATA:  lt_input TYPE input_tt,
       ls_input TYPE input.

TYPES:  BEGIN OF input_numbered,
          groupname1 TYPE bapiset_groupname,
          groupname2 TYPE bapiset_groupname,
          rrn TYPE i,
        END OF input_numbered.
TYPES:  input_numbered_tt TYPE TABLE OF input_numbered.
DATA:  lt_input_numbered TYPE input_numbered_tt,
       ls_input_numbered TYPE input_numbered.
*
* Types, internal tables, structures used to help
* determine hierarchy level.
TYPES:  BEGIN OF group_level_numbered,
          level TYPE bapiset_level,
          rrn TYPE i,
          groupname TYPE bapiset_groupname,
        END OF group_level_numbered.
TYPES:  group_level_numbered_tt TYPE TABLE OF group_level_numbered.
DATA:  lt_group_level_numbered TYPE group_level_numbered_tt,
       ls_group_level_numbered TYPE group_level_numbered.
*
* Types, internal table, structures for function module.
TYPES:  bapiset_hier_tt TYPE TABLE OF bapiset_hier,
        bapi1113_values_tt TYPE TABLE OF bapi1113_values.
DATA:  lt_hier TYPE bapiset_hier_tt,
       lt_values TYPE bapi1113_values_tt,
       ls_hier TYPE bapiset_hier,
       ls_values TYPE bapi1113_values.

DATA:  count TYPE i.
DATA:  level TYPE i.

START-OF-SELECTION.

  count = 1.

  LOOP AT lt_input INTO ls_input.
    CLEAR:  ls_input_numbered.
    ls_input_numbered-groupname1 = ls_input-groupname1.
    ls_input_numbered-groupname2 = ls_input-groupname2.
    ls_input_numbered-rrn = count.
    APPEND ls_input_numbered TO lt_input_numbered.
    count = count + 1.
  ENDLOOP.

*
* Build hierarchy
  SORT lt_input_numbered BY groupname1 rrn.
  level = 0.
  LOOP AT lt_input_numbered INTO ls_input_numbered.
    PERFORM process_group
                USING
                   ls_input_numbered
                CHANGING
                   level.
  ENDLOOP.
*
* derive table to be used in FM
  SORT lt_group_level_numbered BY rrn.

  LOOP AT lt_group_level_numbered INTO ls_group_level_numbered.
    ls_hier-groupname = ls_group_level_numbered-groupname.
    ls_hier-hierlevel = ls_group_level_numbered-level.
    ls_hier-DESCRIPT = ls_group_level_numbered-groupname.
    APPEND ls_hier TO lt_hier.
  ENDLOOP.
FORM process_group USING value(ps_input_numbered) TYPE input_numbered
                   CHANGING value(pv_level) TYPE bapiset_level.


  DATA:  groupname1_subrc TYPE sysubrc,
         groupname1_tabix TYPE sytabix.
  DATA:  groupname2_subrc TYPE sysubrc,
         groupname2_tabix TYPE sytabix.

*
* Check and if necessary add groupname1.
  CLEAR ls_group_level_numbered.
  READ TABLE lt_group_level_numbered INTO ls_group_level_numbered
             WITH KEY groupname = ps_input_numbered-groupname1
             BINARY SEARCH.
  groupname1_subrc = sy-subrc.
  groupname1_tabix = sy-tabix.

  IF groupname1_subrc &amp;lt;&amp;gt; 0.
    ls_group_level_numbered-groupname = ps_input_numbered-groupname1.
    ls_group_level_numbered-level = pv_level.
    ls_group_level_numbered-rrn = ps_input_numbered-rrn.
    INSERT ls_group_level_numbered INTO lt_group_level_numbered
           INDEX groupname1_tabix.
  ELSE.
    pv_level = ls_group_level_numbered-level.
  ENDIF.

*
* Check and if necessary add groupname2.
  CLEAR ls_group_level_numbered.
  READ TABLE lt_group_level_numbered INTO ls_group_level_numbered
             WITH KEY groupname = ps_input_numbered-groupname2
             BINARY SEARCH.
  groupname2_subrc = sy-subrc.
  groupname2_tabix = sy-tabix.
  IF groupname2_subrc &amp;lt;&amp;gt; 0.
    ls_group_level_numbered-groupname = ps_input_numbered-groupname2.
    ls_group_level_numbered-level = pv_level + 1.
    ls_group_level_numbered-rrn = ps_input_numbered-rrn.
    INSERT ls_group_level_numbered INTO lt_group_level_numbered
           INDEX groupname2_tabix.
  ENDIF.


*
* Check for childs for groupname2.
  pv_level = pv_level + 1.
  LOOP AT lt_input_numbered INTO ls_input_numbered
                     WHERE groupname1 = ps_input_numbered-groupname2.

    PERFORM process_group
                USING
                   ls_input_numbered
                CHANGING
                   level.

  ENDLOOP.
ENDFORM.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rae Ellen Woytowiez on Apr 15, 2011 7:24 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rae Ellen Woytowiez on Apr 15, 2011 7:26 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rae Ellen Woytowiez on Apr 15, 2011 7:26 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Apr 2011 05:07:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746895#M1582306</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-15T05:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: bapi_costelementgrp_create and hierarchy nodes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746896#M1582307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It doesn't work. Why table  lt_group_level_numbered  is empty ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE lt_group_level_numbered INTO ls_group_level_numbered&lt;/P&gt;&lt;P&gt;             WITH KEY groupname = ps_input_numbered-groupname1&lt;/P&gt;&lt;P&gt;             BINARY SEARCH.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Apr 2011 08:45:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746896#M1582307</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-15T08:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: bapi_costelementgrp_create and hierarchy nodes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746897#M1582308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Andrew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I see a syntax error in my code.  In the subroutine "process_group" you need to change code as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 
if groupname1_subrc 0. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;to &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 
if groupname1_subrc ne 0. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 
if groupname2_subrc 0. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;to &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 
if groupname2_subrc ne 0. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Rae Ellen Woytowiez&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rae Ellen Woytowiez on Apr 15, 2011 3:31 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Apr 2011 13:20:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746897#M1582308</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-15T13:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: bapi_costelementgrp_create and hierarchy nodes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746898#M1582309</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;But the table lt_group_level_numbered (last table befor insert into lt_hier table) remains empty (after perform process_group) .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;????&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Apr 2011 13:33:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746898#M1582309</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-15T13:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: bapi_costelementgrp_create and hierarchy nodes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746899#M1582310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok ... modifying "sy-subrc NE 0" it works....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Apr 2011 13:35:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746899#M1582310</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-15T13:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: bapi_costelementgrp_create and hierarchy nodes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746900#M1582311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Andrew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are very welcome.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apparently the &lt;STRONG&gt;less than sign, greater than sign&lt;/STRONG&gt; version of the not equal sign does not copy properly to this forum;  it is used as a formatting option for text.  Therefore, I needed to change the not equal sign from &lt;STRONG&gt;less than sign, greater than sign&lt;/STRONG&gt; to "ne" format.  That's what caused the confusion we were experiencing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a nice day!&lt;/P&gt;&lt;P&gt;Rae Ellen Woytowie&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rae Ellen Woytowiez on Apr 15, 2011 3:44 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Apr 2011 13:43:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-costelementgrp-create-and-hierarchy-nodes/m-p/7746900#M1582311</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-15T13:43:50Z</dc:date>
    </item>
  </channel>
</rss>

