10-07-2008 2:38 PM
Hi,
I want to get the Financial statement Version in (FSE2 Tcode)
Kindly give some idea if there is any functional module is there
Thanks & Regards,
John Victor
10-07-2008 2:41 PM
Hi,
Try this program.
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
Thanks,
Sree.
10-07-2008 2:40 PM
10-07-2008 2:41 PM
Hi,
Try this program.
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
Thanks,
Sree.
10-13-2008 4:20 PM
Hi Sree,
Thanks for your information it was very helpful to solve this issue
Thanks a lot
Regards,
John Victor
06-23-2023 5:05 PM
Thank you for this information! It was very useful to also solve my recent problem!
11-03-2022 1:11 AM
in my case this information is stored in fagl_011pc table so I did a form that fills an structure where I can have the relationship between children and parents for further operations
*obtiene las estructuras de balance que se van a sumar para cos1
TYPES: BEGIN OF gty_con_hijos,
padre TYPE ERGSL,DATA:
tb_hijos type gty_ts_hijos,
wa_hijos type gty_con_hijos,
"Those are due to business logic (COS. ING. EGR. ) so I dont carry unwanted parents into my final table
IF nodo-ergsl(4) EQ 'COS.' OR nodo-ergsl(4) EQ 'ING.' OR nodo-ergsl(4) EQ 'EGR.'.