*&---------------------------------------------------------------------*
*& Report : ZS_BAPI *
*&---------------------------------------------------------------------*
*& This Program is used to Find BAPI Function Module
* Depending upon Application type and description. *
*&---------------------------------------------------------------------*
*& Description text can be put as per requriment
*&---------------------------------------------------------------------*
REPORT zs_bapi NO STANDARD PAGE HEADING.
TYPES : BEGIN OF ty_tfdir,
funcname TYPE rs38l_fnam,
END OF ty_tfdir.
TYPES : BEGIN OF ty_tftit,
funcname TYPE rs38l_fnam,
stext TYPE rs38l_ftxt,
END OF ty_tftit.
DATA : it_tfdir TYPE STANDARD TABLE OF ty_tfdir,
wa_tfdir TYPE ty_tfdir,
it_tftit TYPE STANDARD TABLE OF ty_tftit,
wa_tftit TYPE ty_tftit.
DATA : ws_bapi TYPE char4,
chk TYPE char1,
field1(30).
DATA : ws_lines TYPE i.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: appl_typ TYPE rs38l_appl,
fmode TYPE fmode default 'R',
desc_txt TYPE char10 OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM select_fmname.
PERFORM process_table.
PERFORM no_of_records.
PERFORM top_of_page.
PERFORM write_fname.
AT LINE-SELECTION.
PERFORM call_function_module.
*&---------------------------------------------------------------------*
*& Form SELECT_FMNAME
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM select_fmname .
SELECT funcname
FROM tfdir INTO TABLE it_tfdir
WHERE ( appl = appl_typ
OR fmode = fmode ).
IF sy-subrc = 0.
SELECT funcname stext
FROM tftit INTO TABLE it_tftit
FOR ALL ENTRIES IN it_tfdir
WHERE funcname = it_tfdir-funcname
AND spras = sy-langu.
ENDIF.
ENDFORM. " SELECT_FMNAME
*&---------------------------------------------------------------------*
*& Form process_table
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM process_table .
LOOP AT it_tftit INTO wa_tftit.
ws_bapi = wa_tftit-funcname+0(4).
IF ws_bapi NE 'BAPI'.
DELETE TABLE it_tftit FROM wa_tftit.
CLEAR wa_tftit.
CLEAR ws_bapi.
CONTINUE.
ENDIF.
IF desc_txt IS NOT INITIAL.
SEARCH wa_tftit-stext FOR desc_txt.
IF sy-subrc NE 0.
DELETE TABLE it_tftit FROM wa_tftit.
CLEAR : wa_tftit.
CONTINUE.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " process_table
*&---------------------------------------------------------------------*
*& Form NO_OF_RECORDS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM no_of_records .
DESCRIBE TABLE it_tftit LINES ws_lines.
FORMAT COLOR COL_POSITIVE INTENSIFIED ON.
WRITE :/5 'No of BAPI Selected for Given Application type is-',ws_lines.
ENDFORM. " NO_OF_RECORDS
*&---------------------------------------------------------------------*
*& Form top_of_page
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM top_of_page .
WRITE :/1(125) sy-uline.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 '', 2(3) 'SNO',
6 '' , 7(35) 'BAPI FUNCTION MODULE',
43 '', 44(80) 'FUNCTION MODULE DESCRIPTION',
125 ''.
WRITE :/1(125) sy-uline.
ENDFORM. " top_of_page
*&---------------------------------------------------------------------*
*& Form WRITE_FNAME
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM write_fname .
DATA: loc_sl TYPE i VALUE '0'.
LOOP AT it_tftit INTO wa_tftit.
loc_sl = loc_sl + 1.
FORMAT COLOR COL_GROUP INTENSIFIED OFF.
WRITE :/1(125) sy-uline.
WRITE:/1 '', 2(3) loc_sl, "CHK AS CHECKBOX,
6 '' , 7(35) wa_tftit-funcname HOTSPOT ON,
43 '', 44(80) wa_tftit-stext,
125 ''.
ENDLOOP.
ENDFORM. " WRITE_FNAME
*&---------------------------------------------------------------------*
*& Form call_function_module
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM call_function_module .
DATA: ws_fname TYPE tfdir-funcname.
GET CURSOR FIELD field1.
CHECK field1(17) EQ 'WA_TFTIT-FUNCNAME'.
READ TABLE it_tftit INTO wa_tftit WITH KEY funcname = sy-lisel+6(30).
MOVE wa_tftit-funcname TO ws_fname.
SET PARAMETER ID 'LIB' FIELD ws_fname.
CALL TRANSACTION 'SE37' AND SKIP FIRST SCREEN.
ENDFORM. " call_function_module
***********************END*****************************************************
No comments:
Post a Comment