‎2006 Jul 17 3:25 PM
Hi,
I have to down load the Financial Statement Version.
We can see it using T-Code 'FSE3'.
Requirement is to download the structure in CSV file.
File layout is:
PARENT,CHILD,DESCRIPTION OF CHILD
Is there any BAPI or Function module available that gives the structure or any other way to get it.
Will appreciate response.
Thanks
Rohit
‎2006 Jul 17 3:35 PM
See report bellow, execute and see content of internal table <b>node_tab</b> before "WRITE 'Hello'.":
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'.
*&---------------------------------------------------------------------*
* 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
*&---------------------------------------------------------------------*
*& Form LOAD_VERSN_TEXT
*&---------------------------------------------------------------------*
* 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 <> sy-langu.
MESSAGE s742 WITH maint_langu versn.
ENDIF.
ENDFORM. " LOAD_VERSN_TEXT
*&---------------------------------------------------------------------*
*& Form CREATE_NODE_TAB
*&---------------------------------------------------------------------*
* 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
*&---------------------------------------------------------------------*
*& Form ADD_NODE_WITH_SUBTREE
*&---------------------------------------------------------------------*
* 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