<?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: Financial Statement Version Extract in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/financial-statement-version-extract/m-p/1377956#M185052</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See report bellow, execute and see content of internal table &amp;lt;b&amp;gt;node_tab&amp;lt;/b&amp;gt; before "WRITE 'Hello'.":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT ztemp_estructura_balance MESSAGE-ID fe.
TYPE-POOLS:
  fibs.


TABLES: t011, rfgbst.

TYPES:
  t_flag TYPE c,
  t_bs_node_id TYPE fibs_bs_node_id,
  t_bs_node_tab TYPE t_bs_node_id OCCURS 50,
  t_bs_type TYPE i.

TYPES:
  BEGIN OF t_bs_info,
*   info about BS given out to clients
    ktopl LIKE t011-ktopl,
    xauto LIKE t011-xauto,
    type TYPE t_bs_type,
  END OF t_bs_info.

CONSTANTS:
  true TYPE t_flag VALUE 'X',
  false TYPE t_flag VALUE ' '.

DATA: versn LIKE t011-versn VALUE 'CTIY'.
DATA: node_tab LIKE snodetext OCCURS 0 WITH HEADER LINE.
DATA: bs_info TYPE t_bs_info.


SELECT SINGLE * FROM t011
       WHERE versn = versn.


*   Load the structure from DB
PERFORM load_versn
        USING versn.

*   Create the node table for the function module displaying the tree
PERFORM create_node_tab
        TABLES node_tab.

WRITE 'Hello'.


*&amp;amp;---------------------------------------------------------------------*
*  Load the version (again)                                            *
*----------------------------------------------------------------------*
FORM load_versn
     USING  versn.

* Load the version
  CALL FUNCTION 'FI_BS_LOAD'
       EXPORTING
            version = versn
       IMPORTING
            bs_info = bs_info.

* Load the texts
  PERFORM load_versn_text.
ENDFORM.                               " LOAD_VERSN
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  LOAD_VERSN_TEXT
*&amp;amp;---------------------------------------------------------------------*
* Load the texts of the version                                        *
*----------------------------------------------------------------------*
FORM load_versn_text.

  DATA:
    flg_langu_maint TYPE t_flag VALUE false,
    flg_sylangu_not_found TYPE t_flag,
    maint_langu LIKE sy-langu.

  CALL FUNCTION 'FI_BS_LOAD_LANGU'
       EXPORTING
            flg_langu_maint       = flg_langu_maint
       IMPORTING
            flg_sylangu_not_found = flg_sylangu_not_found
            maint_langu           = maint_langu
       EXCEPTIONS
            OTHERS                = 1.
* if maintenance language was loaded, because sy-langu was not found
  IF flg_sylangu_not_found = true.
    MESSAGE s741 WITH sy-langu maint_langu.
  ENDIF.

* if maintenance language is wanted, but is different from SY-LANGU
* tell him
  IF flg_langu_maint = true AND
    maint_langu &amp;lt;&amp;gt; sy-langu.
    MESSAGE s742 WITH maint_langu versn.
  ENDIF.
ENDFORM.                               " LOAD_VERSN_TEXT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  CREATE_NODE_TAB
*&amp;amp;---------------------------------------------------------------------*
*       text                                                           *
*----------------------------------------------------------------------*
FORM create_node_tab
     TABLES node_tab STRUCTURE node_tab.

  REFRESH node_tab.
  DATA:
    root_id TYPE t_bs_node_id.

* Get the root
  CALL FUNCTION 'FI_BS_GET_ROOT'
       IMPORTING
            root_id   = root_id
       EXCEPTIONS
            not_found = 01.

* Recursively add nodes
  PERFORM add_node_with_subtree
          TABLES node_tab
          USING 1
                root_id.

ENDFORM.                               " CREATE_NODE_TAB
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  ADD_NODE_WITH_SUBTREE
*&amp;amp;---------------------------------------------------------------------*
* Recursively add a node with its subtree                              *
*----------------------------------------------------------------------*
FORM add_node_with_subtree
     TABLES node_tab STRUCTURE node_tab
     USING value(level) TYPE i
           value(node_id) TYPE t_bs_node_id.
  DATA:
    children_node_tab TYPE t_bs_node_tab WITH HEADER LINE.


* Get the display info
  CALL FUNCTION 'FI_BS_NODE_GET_SNODETEXT'
       EXPORTING
            node_id          = node_id
            with_gl_accounts = rfgbst-glac_on
       IMPORTING
            attr             = node_tab
       EXCEPTIONS
            node_not_found   = 01.
  node_tab-tlevel = level.
  APPEND node_tab.

* And do the same for its children
  level = level + 1.
  CALL FUNCTION 'FI_BS_NODE_GET_CHILDREN'
       EXPORTING
            node              = node_id
            with_gl_accounts  = rfgbst-glac_on
       TABLES
            children_node_tab = children_node_tab
       EXCEPTIONS
            node_not_found    = 01.
  LOOP AT children_node_tab.
    PERFORM add_node_with_subtree
            TABLES node_tab
            USING  level
                   children_node_tab.
  ENDLOOP.
ENDFORM.                               " ADD_NODE_WITH_SUBTREE
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Jul 2006 14:35:13 GMT</pubDate>
    <dc:creator>LucianoBentiveg</dc:creator>
    <dc:date>2006-07-17T14:35:13Z</dc:date>
    <item>
      <title>Financial Statement Version Extract</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/financial-statement-version-extract/m-p/1377955#M185051</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 have to down load the Financial Statement Version.&lt;/P&gt;&lt;P&gt;We can see it using T-Code 'FSE3'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Requirement is to download the structure in CSV file. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;File layout is:&lt;/P&gt;&lt;P&gt;PARENT,CHILD,DESCRIPTION OF CHILD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any BAPI or Function module available that gives the structure or any other way to get it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Will appreciate response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Rohit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jul 2006 14:25:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/financial-statement-version-extract/m-p/1377955#M185051</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-17T14:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Financial Statement Version Extract</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/financial-statement-version-extract/m-p/1377956#M185052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See report bellow, execute and see content of internal table &amp;lt;b&amp;gt;node_tab&amp;lt;/b&amp;gt; before "WRITE 'Hello'.":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT ztemp_estructura_balance MESSAGE-ID fe.
TYPE-POOLS:
  fibs.


TABLES: t011, rfgbst.

TYPES:
  t_flag TYPE c,
  t_bs_node_id TYPE fibs_bs_node_id,
  t_bs_node_tab TYPE t_bs_node_id OCCURS 50,
  t_bs_type TYPE i.

TYPES:
  BEGIN OF t_bs_info,
*   info about BS given out to clients
    ktopl LIKE t011-ktopl,
    xauto LIKE t011-xauto,
    type TYPE t_bs_type,
  END OF t_bs_info.

CONSTANTS:
  true TYPE t_flag VALUE 'X',
  false TYPE t_flag VALUE ' '.

DATA: versn LIKE t011-versn VALUE 'CTIY'.
DATA: node_tab LIKE snodetext OCCURS 0 WITH HEADER LINE.
DATA: bs_info TYPE t_bs_info.


SELECT SINGLE * FROM t011
       WHERE versn = versn.


*   Load the structure from DB
PERFORM load_versn
        USING versn.

*   Create the node table for the function module displaying the tree
PERFORM create_node_tab
        TABLES node_tab.

WRITE 'Hello'.


*&amp;amp;---------------------------------------------------------------------*
*  Load the version (again)                                            *
*----------------------------------------------------------------------*
FORM load_versn
     USING  versn.

* Load the version
  CALL FUNCTION 'FI_BS_LOAD'
       EXPORTING
            version = versn
       IMPORTING
            bs_info = bs_info.

* Load the texts
  PERFORM load_versn_text.
ENDFORM.                               " LOAD_VERSN
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  LOAD_VERSN_TEXT
*&amp;amp;---------------------------------------------------------------------*
* Load the texts of the version                                        *
*----------------------------------------------------------------------*
FORM load_versn_text.

  DATA:
    flg_langu_maint TYPE t_flag VALUE false,
    flg_sylangu_not_found TYPE t_flag,
    maint_langu LIKE sy-langu.

  CALL FUNCTION 'FI_BS_LOAD_LANGU'
       EXPORTING
            flg_langu_maint       = flg_langu_maint
       IMPORTING
            flg_sylangu_not_found = flg_sylangu_not_found
            maint_langu           = maint_langu
       EXCEPTIONS
            OTHERS                = 1.
* if maintenance language was loaded, because sy-langu was not found
  IF flg_sylangu_not_found = true.
    MESSAGE s741 WITH sy-langu maint_langu.
  ENDIF.

* if maintenance language is wanted, but is different from SY-LANGU
* tell him
  IF flg_langu_maint = true AND
    maint_langu &amp;lt;&amp;gt; sy-langu.
    MESSAGE s742 WITH maint_langu versn.
  ENDIF.
ENDFORM.                               " LOAD_VERSN_TEXT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  CREATE_NODE_TAB
*&amp;amp;---------------------------------------------------------------------*
*       text                                                           *
*----------------------------------------------------------------------*
FORM create_node_tab
     TABLES node_tab STRUCTURE node_tab.

  REFRESH node_tab.
  DATA:
    root_id TYPE t_bs_node_id.

* Get the root
  CALL FUNCTION 'FI_BS_GET_ROOT'
       IMPORTING
            root_id   = root_id
       EXCEPTIONS
            not_found = 01.

* Recursively add nodes
  PERFORM add_node_with_subtree
          TABLES node_tab
          USING 1
                root_id.

ENDFORM.                               " CREATE_NODE_TAB
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  ADD_NODE_WITH_SUBTREE
*&amp;amp;---------------------------------------------------------------------*
* Recursively add a node with its subtree                              *
*----------------------------------------------------------------------*
FORM add_node_with_subtree
     TABLES node_tab STRUCTURE node_tab
     USING value(level) TYPE i
           value(node_id) TYPE t_bs_node_id.
  DATA:
    children_node_tab TYPE t_bs_node_tab WITH HEADER LINE.


* Get the display info
  CALL FUNCTION 'FI_BS_NODE_GET_SNODETEXT'
       EXPORTING
            node_id          = node_id
            with_gl_accounts = rfgbst-glac_on
       IMPORTING
            attr             = node_tab
       EXCEPTIONS
            node_not_found   = 01.
  node_tab-tlevel = level.
  APPEND node_tab.

* And do the same for its children
  level = level + 1.
  CALL FUNCTION 'FI_BS_NODE_GET_CHILDREN'
       EXPORTING
            node              = node_id
            with_gl_accounts  = rfgbst-glac_on
       TABLES
            children_node_tab = children_node_tab
       EXCEPTIONS
            node_not_found    = 01.
  LOOP AT children_node_tab.
    PERFORM add_node_with_subtree
            TABLES node_tab
            USING  level
                   children_node_tab.
  ENDLOOP.
ENDFORM.                               " ADD_NODE_WITH_SUBTREE
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jul 2006 14:35:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/financial-statement-version-extract/m-p/1377956#M185052</guid>
      <dc:creator>LucianoBentiveg</dc:creator>
      <dc:date>2006-07-17T14:35:13Z</dc:date>
    </item>
  </channel>
</rss>

