Application Development and Automation 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: 
Read only

How do i get all Function-Groups + their Function-Modules of a Package ?

Former Member
0 Likes
4,100

Hi experts,

i need a report which gets all function-groups from a given package and then all function-modules of each function group.

i have a package <b>/MSG/R_VERTRAG</b> , i need all function groups which begin with

<b>/MSG/R_VPLAUSI</b> and <b>/MSG/R_VPRUEF</b> and then a table with all their function-modules.

how can i do that?

Hope you can help.

Regards,

Basti

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,972

Hi,

The select works for me...

INstead of your function group name..I tried with XM06..It is working fine..

Manually check if there is any data in SE16...in the table TADIR & TFDIR..For the corrresponding function group..

THanks,

Naren

11 REPLIES 11
Read only

Former Member
0 Likes
2,972

Goto SE80 and you would find all the FMs under Function Group.

Thanks,

Santosh

Read only

Former Member
0 Likes
2,972

Hi,

Go to table TADIR and pass DEVCLASS = ackage name.

All the objects that are returned belong to that pacjage.

You can further filter them based on the Object = 'FUGR' for function group.

Regards,

Ravi

Read only

Former Member
0 Likes
2,972

Hi,

GO to the table TADIR..Give the development class name..in the field DEVCLASS.

Then In the object give FUGR..which is for function group..

Then in the object name give the function group name with *..

You can also get Function modules for the function group..use the table TFDIR..

Give the function group name in the field PNAME ...Ex..if the function group name is XM06..you have to give SAPLXM06 in the field PNAME to get the FMs..

Thanks,

Naren

Read only

Former Member
0 Likes
2,972

Hi

you can select table ENLFDIR to get the FM from each FG.

Regards,

Read only

Former Member
0 Likes
2,972

ok, i made a little report with "TADIR". ( sorry that comments are in german )



* Lokale Datendeklaration
*----------------------------------------
TYPES: BEGIN OF typ_fugr,
          fugr TYPE sobj_name,
          fugr_t TYPE areat,
       END OF typ_fugr.

DATA: lt_fugr   TYPE TABLE OF typ_fugr,
      ls_fugr   LIKE LINE OF lt_fugr.


* Auswahl des Paketes

PARAMETERS: paket TYPE devclass DEFAULT '/MSG/'.

*----------------------------------------

[REFRESH lt_fugr.

* Überschriftsspalten aufnehmen
*----------------------------------------

ls_fugr-fugr   = 'Functionsbaustein'.
ls_fugr-fugr_t = 'Text'.
APPEND ls_fugr TO lt_fugr.

*----------------------------------------

* Funktionsgruppen und Text auslesen
*--------------------------------------------

SELECT obj_name
   FROM tadir
   INTO ls_fugr-fugr
   WHERE devclass = paket
     AND object   = 'FUGR'
  AND obj_name LIKE '/MSG/R_VPLAUSI%' OR obj_name LIKE '/MSG/R_VPRUEF%'.
  IF ( sy-subrc = 0 ).

    APPEND ls_fugr TO lt_fugr.
endif.
ENDSELECT.

in 'lt_fugr' there are my functiongroups. i m too stupid to get the modules for it fg.

can you try to help again?

other problem is, i don t know who i should give those post points lemme think..

regards again

Basti

Read only

0 Likes
2,972

Hi Naren, I modified my report as you mentioned above but the last select doesn t work 😞



REPORT  z_kohl_fuba2.

* local data declaration

TYPES: BEGIN OF typ_fugr,
          fugr TYPE sobj_name,
          fugr_t TYPE areat,
       END OF typ_fugr.

DATA: lt_fugr   TYPE TABLE OF typ_fugr,
      ls_fugr   LIKE LINE OF lt_fugr,
      lt_fm TYPE TABLE OF tfdir,
      lt_fm_lcl TYPE TABLE OF tfdir,
      wa TYPE tfdir.

*----------------------------------------

* Choice of package
PARAMETERS: paket TYPE devclass DEFAULT '/MSG/'.

*----------------------------------------

REFRESH lt_fugr.

* Überschriftsspalten aufnehmen
ls_fugr-fugr   = 'Functiongroup'.
ls_fugr-fugr_t = 'Text'.
APPEND ls_fugr TO lt_fugr.

*----------------------------------------

* get functiongroups and texts

SELECT obj_name
   FROM tadir
   INTO ls_fugr-fugr
   WHERE devclass = paket
     AND object   = 'FUGR'
  AND obj_name LIKE '/MSG/R_VPLAUSI%' OR obj_name LIKE '/MSG/R_VPRUEF%'.
  IF ( sy-subrc = 0 ).
    SELECT SINGLE areat
      FROM tlibt
      INTO ls_fugr-fugr_t
      WHERE spras = sy-langu
        AND area  = ls_fugr-fugr.
    APPEND ls_fugr TO lt_fugr.
  ENDIF.
ENDSELECT.

LOOP AT lt_fugr INTO ls_fugr.
  CONCATENATE 'SAPL' ls_fugr-fugr INTO wa-pname.
  APPEND wa TO lt_fm_lcl.
ENDLOOP.

*checken if lt_fm_lcl has content ( works till here )
*LOOP AT lt_fm_lcl INTO wa.
*  WRITE: / wa-pname.
*ENDLOOP.


* Get the Function modules..

IF NOT lt_fm_lcl[] IS INITIAL.

  SELECT * FROM tfdir
    INTO TABLE lt_fm
    FOR ALL ENTRIES IN lt_fm_lcl
    WHERE pname = lt_fm_lcl-pname.
ENDIF.



*the select above doesn t give anything
LOOP AT lt_fm INTO wa.
  WRITE: / 'Bausteinname: ', wa-pname.
  WRITE: / 'Funktionsname: ', wa-funcname.
ENDLOOP.

can you help a last time?

Read only

0 Likes
2,972

Hi

I believe you don't need a own your custom report but u can use the trx SE84

Programming->Function Builder->Function Modules

Max

Read only

Former Member
0 Likes
2,972

Hi,

DATA: T_FM TYPE TABLE OF TFDIR.

DATA: T_FM_LCL TYPE TABLE OF TFDIR.

DATA: WA TYPE TFDIR.

  • Get the correct program name..

LOOP AT LT_FUGR INTO LS_FUGR.

CONCANTENATE 'SAPL' LS_FUGR-FUGR INTO WA-PNAME.

APPEND WA TO T_FM_LCL.

ENDLOOP.

  • Get the Function modules..

IF NOT T_FM_LCL[] IS INITIAL.

SELECT * FROM TFDIR

INTO TABLE T_FM

FOR ALL ENTRIES IN T_FM_LCL

WHERE PNAME = T_FM_LCL-PNAME.

ENDIF.

THanks,

Naren

Read only

Former Member
0 Likes
2,973

Hi,

The select works for me...

INstead of your function group name..I tried with XM06..It is working fine..

Manually check if there is any data in SE16...in the table TADIR & TFDIR..For the corrresponding function group..

THanks,

Naren

Read only

0 Likes
2,972

hey naren, thx i found the mistake now.. :X You got the points 😉

if s.o. is interested in the code .. here you are..

*&---------------------------------------------------------------------*
*& Report  Z_KOHL_FUBAALV
*&
*&---------------------------------------------------------------------*
*& Report für Verwendungsnachweis ausgewählter Funktionsgruppen
*&
*& erstellt:         01.03.07 von Bastian Kohl
*& letzte Änderung:  06.03.07 von Bastian Kohl
*&
*&---------------------------------------------------------------------*

report  z_kohl_fubaalv no standard page heading.

* local data declaration

types: begin of typ_fugr,
          fugr type sobj_name,
          fugr_t type areat,
       end of typ_fugr.

data: lt_fugr   type table of typ_fugr,
      ls_fugr   like line of lt_fugr,
      lt_fm type table of tfdir,
      lt_fm_lcl type table of tfdir,
      wa type tfdir,
      lt_findstring type table of rsfind,
      ls_findstring type rsfind,
      lt_func type standard table of funcname,
      wa2 like tfdir-funcname,
      lv_devclass type tdevc-devclass,
      lt_scope_object_cls type standard table of seu_obj,
      ls_scope_object_cls type seu_obj,
      ls_scope_devclass type range_dev,
      lt_scope_devclass type table of range_dev,
      lt_founds type table of rsfindlst,
      lt_founds2 type table of rsfindlst,
      ls_founds like rsfindlst,
      v_lsd1 type c value 'I',
      v_lsd2(2) type c value 'EQ',
      lt_sa like table of zzsa,
      ls_sa like line of lt_sa,
      nix(50) type c value 'Baustein wird noch nicht verwendet',
      container_r type ref to cl_gui_custom_container,
      grid_r type ref to cl_gui_alv_grid,
      ok_code like sy-ucomm,
      save_ok like sy-ucomm.

field-symbols: <ls_func> type funcname.

*----------------------------------------

* Choice of package
selection-screen begin of screen 100
                  as window title text-010.
selection-screen: skip,
               begin of block b1
               with frame title text-020.

parameters: paket type tdevc-devclass default '/MSG/'.

selection-screen: end of block b1,
                  skip,
                  begin of block b2
                  with frame title text-030.

parameters: fugrn1(50) type c default '/MSG/R_VPRUEF%'.
parameters: fugrn2(50) type c default '/MSG/R_VPLAUSI%'.

selection-screen: end of block b2,
                  skip,
                  begin of block b3
                  with frame title text-040.

parameters: such_p as checkbox,
            such_o as checkbox,
            such_wo as checkbox,
            such_ff as checkbox,
            such_ps as checkbox,
            such_dd as checkbox.
selection-screen: end of block b3,
                  skip,
                  end of screen 100.

start-of-selection.

  call selection-screen 100.

*----------------------------------------

  refresh lt_fugr.

*----------------------------------------

* get functiongroups
  if fugrn2 is not initial.
    select obj_name
       from tadir
       into ls_fugr-fugr
       where devclass = paket
         and object   = 'FUGR'
      and obj_name like fugrn1 or obj_name like fugrn2.
      if ( sy-subrc = 0 ).
        append ls_fugr to lt_fugr.
      endif.
    endselect.
  else.
*IF fugrn2 = ''.
    select obj_name
     from tadir
     into ls_fugr-fugr
     where devclass = paket
       and object   = 'FUGR'
    and obj_name like fugrn1.
      if ( sy-subrc = 0 ).
        append ls_fugr to lt_fugr.
      endif.
    endselect.
  endif.

* add 'SAPL' into right position of ls_fugr-fugr
* to get pname of tfdir

  loop at lt_fugr into ls_fugr.
    replace '/MSG/' with '/MSG/SAPL' into ls_fugr-fugr.
    move ls_fugr-fugr to wa-pname.
    append wa to lt_fm_lcl.
  endloop.

  if not lt_fm_lcl[] is initial.
    select * from tfdir
      into table lt_fm
      for all entries in lt_fm_lcl
      where pname = lt_fm_lcl-pname.
  endif.
  sort lt_fm.

* parsing of lt_fm in lt_func
  loop at lt_fm into wa.
    append wa to lt_func.
  endloop.

* add locations where to search for the fuba's
  if such_p = 'X'.
    ls_scope_object_cls = 'P'.  "Programmen
    append ls_scope_object_cls to lt_scope_object_cls.
  elseif such_o = 'X'.
    ls_scope_object_cls = 'O'.  "Klassen/Interfaces
    append ls_scope_object_cls to lt_scope_object_cls.
  elseif such_wo = 'X'.
    ls_scope_object_cls = 'WO'. "BSP-Applikationen
    append ls_scope_object_cls to lt_scope_object_cls.
  elseif such_ff = 'X'.
    ls_scope_object_cls = 'FF'. "Funktionsbausteinschnittstellen
    append ls_scope_object_cls to lt_scope_object_cls.
  elseif such_ps = 'X'.
    ls_scope_object_cls = 'PS'. "Dynpros
    append ls_scope_object_cls to lt_scope_object_cls.
  elseif such_dd = 'X'.
    ls_scope_object_cls = 'DD'. "Domänen
    append ls_scope_object_cls to lt_scope_object_cls.
  endif.
*  casting of paket to type tdevc-devclass
  lv_devclass = paket.

* append paket in lt_scope_devclass for crossref check
* add values in fields of lt_scope_devclass
  if lv_devclass is not initial.
    move v_lsd1 to ls_scope_devclass-sign.
    move v_lsd2 to ls_scope_devclass-option.
    move lv_devclass to ls_scope_devclass-low.
    append ls_scope_devclass to lt_scope_devclass.
  endif.


* where-used check for all lines of lt_func

  loop at lt_func assigning <ls_func>.

    refresh lt_findstring.
    refresh lt_founds.


    ls_findstring-object = <ls_func>.
    append ls_findstring to lt_findstring.



* call where-used function
    call function 'RS_EU_CROSSREF'
      exporting
        i_find_obj_cls           = 'FF'
        no_dialog                = 'X'
      tables
        i_findstrings            = lt_findstring
        o_founds                 = lt_founds
        i_scope_devclass         = lt_scope_devclass
      exceptions
        not_executed             = 1
        not_found                = 2
        illegal_object           = 3
        no_cross_for_this_object = 4
        batch                    = 5
        batchjob_error           = 6
        wrong_type               = 7
        object_not_exist         = 8
        others                   = 9.
    if sy-subrc <> 0.
      if sy-subrc = 2.
      else.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    endif.


    concatenate 'Funktionsbaustein :' ls_findstring into ls_sa.
    append ls_sa to lt_sa.
    clear ls_sa.
    append ls_sa to lt_sa.


    loop at lt_founds into ls_sa.
      append ls_sa-sa1 to lt_sa.
    endloop.
    if lt_founds is initial.
      append nix to lt_sa.
    endif.
    clear ls_sa.
    append ls_sa to lt_sa.
  endloop.

  call screen '200'.


  include z_kohl_fubaalv_status_0200.

  include z_kohl_fubaalv_user_200.

Read only

0 Likes
2,972
*&---------------------------------------------------------------------*
*& Report ZP_GET_FM_FRM_PKG
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZP_GET_FM_FRM_PKG.


PARAMETERS: P_PACKG TYPE DEVCLASS. " Parameter for Package Name

TYPES: BEGIN OF TY_FM_DTLS,
         PACKAGE  TYPE DEVCLASS,
         F_GROUP  TYPE AREA,
         F_MODULE TYPE FUNCNAME,
         FM_TEXT  TYPE STEXT,
       END OF TY_FM_DTLS.


DATA: LT_FM_DTLS TYPE TABLE OF TY_FM_DTLS,
      LS_FM_DTLS TYPE TY_FM_DTLS.

"Fetch Function Group name from Package
SELECT OBJ_NAME
  FROM TADIR
  INTO TABLE @DATA(LT_FG)
  WHERE OBJECT = 'FUGR'
  AND DEVCLASS = @P_PACKG.

IF LT_FG IS NOT INITIAL.

"Fetch Function module name from Function Group
  SELECT FUNCNAME,
         AREA
    FROM ENLFDIR
    INTO TABLE @DATA(LT_FM_FG)
    FOR ALL ENTRIES IN @LT_FG
    WHERE AREA = @LT_FG-OBJ_NAME+0(26).


ENDIF.

IF LT_FM_FG IS NOT INITIAL.

"Fetch Function module Short Text Using Function module name
  SELECT FUNCNAME,
         STEXT
    FROM TFTIT
    INTO TABLE @DATA(LT_FM_TXT)
    FOR ALL ENTRIES IN @LT_FM_FG
    WHERE SPRAS = 'E'
    AND FUNCNAME = @LT_FM_FG-FUNCNAME.
ENDIF.


"Filling all data into one internal table

LOOP AT LT_FM_TXT INTO DATA(LS_FM_TXT).
  LS_FM_DTLS-F_MODULE = LS_FM_TXT-FUNCNAME.
  LS_FM_DTLS-FM_TEXT = LS_FM_TXT-STEXT.

  READ TABLE LT_FM_FG
  INTO DATA(LS_FM_FG)
  WITH KEY FUNCNAME = LS_FM_TXT-FUNCNAME.

  IF SY-SUBRC = 0.
    LS_FM_DTLS-F_GROUP = LS_FM_FG-AREA.
  ENDIF.


  LS_FM_DTLS-PACKAGE = P_PACKG.


  APPEND LS_FM_DTLS TO LT_FM_DTLS.
  CLEAR LS_FM_DTLS.


ENDLOOP.


SORT LT_FM_DTLS BY F_GROUP F_MODULE ASCENDING.

" Export internal table data into excel file

CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
  EXPORTING
*   I_FIELD_SEPERATOR          =
*   I_LINE_HEADER              =
    I_FILENAME                 = 'F:\Abc.xls' " File Path and Name
*   I_APPL_KEEP                = ' '
  TABLES
    I_TAB_SAP_DATA             = LT_FM_DTLS
* CHANGING
*   I_TAB_CONVERTED_DATA       =
* EXCEPTIONS
*   CONVERSION_FAILED          = 1
*   OTHERS                     = 2
          .
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.


WRITE: 'FM_NAME'.