Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Function Module to get Financial Statement Version

Former Member

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

1 ACCEPTED SOLUTION

Former Member

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.

5 REPLIES 5

Former Member
0 Kudos

Hi

Go through the link given below :

With Regards

Nikunj Shah

Former Member

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.

0 Kudos

Hi Sree,

Thanks for your information it was very helpful to solve this issue

Thanks a lot

Regards,

John Victor

0 Kudos

Thank you for this information! It was very useful to also solve my recent problem!

0 Kudos

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,
hijo TYPE ERGSL,
profundidad type i,
END OF gty_con_hijos,
gty_ts_hijos TYPE STANDARD TABLE OF gty_con_hijos.

DATA:
tb_hijos type gty_ts_hijos,
wa_hijos type gty_con_hijos,

FORM obtiene_familias.
DATA tb_temp TYPE TABLE OF fagl_011pc. "ALMACENA NODOS
DATA pivote LIKE tb_temp. "ALMACENA EL QUERY DENTRO DEL WHILE.
DATA nodo TYPE fagl_011pc.
DATA profundidad TYPE i VALUE 1.

SELECT * FROM fagl_011pc
INTO TABLE tb_temp
WHERE versn = 'ZML2'.
pivote = tb_temp.
WHILE tb_temp IS NOT INITIAL.

READ TABLE tb_temp INTO nodo INDEX 1.

"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.'.
clear wa_hijos.
loop at pivote ASSIGNING FIELD-SYMBOL(<piv>) where parent = nodo-id.
wa_hijos-padre = nodo-ergsl.
wa_hijos-hijo = <piv>-ergsl.
wa_hijos-profundidad = nodo-STUFE.

append wa_hijos to tb_hijos.
endloop.
delete tb_temp WHERE id eq nodo-id.
else.
delete tb_temp index 1.
ENDIF.

ENDWHILE.

ENDFORM.