Google Search - Blog...........

ABAP - Sample Program To Search For Standard or Customised Smartforms.

*&---------------------------------------------------------------------*
*& Report : ZTEST_SEARCH_FORMNAME
*
*& Created by : SHYAM BABU SAH.
*& date : 17.01 2007.
*
*&---------------------------------------------------------------------*
*& This program will help you to search the SMARTFORM either Standard
* Or Customer created in your compatiable language.
* *
*&---------------------------------------------------------------------*
REPORT ZTEST_SEARCH_FORMNAME .
TYPE-POOLS: SLIS.
TABLES: STXFADM, STXFADMT.
DATA: BEGIN OF ITAB OCCURS 0,
FORMNAME LIKE STXFADM-FORMNAME,
MASTERLANG LIKE STXFADM-MASTERLANG,
DEVCLASS LIKE STXFADM-DEVCLASS,
VERSION LIKE STXFADM-VERSION,
FIRSTUSER LIKE STXFADM-FIRSTUSER,
FIRSTDATE LIKE STXFADM-FIRSTDATE,
FIRSTTIME LIKE STXFADM-FIRSTTIME,
LASTUSER LIKE STXFADM-LASTUSER,
LASTDATE LIKE STXFADM-LASTDATE,
FORMTYPE LIKE STXFADM-FORMTYPE,
CAPTION LIKE STXFADMT-CAPTION,
END OF ITAB.

DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_DEV FOR STXFADM-DEVCLASS NO INTERVALS.
SELECT-OPTIONS: S_FORM FOR STXFADM-FORMNAME NO INTERVALS.
SELECTION-SCREEN SKIP 1.
PARAMETERS: P_LANG LIKE T002-SPRAS DEFAULT 'EN'.
SELECTION-SCREEN END OF BLOCK B1.

PERFORM F_SELECT_DATA.
PERFORM F_LAYOUT.
PERFORM F_FIELDCAT.
PERFORM DISPLAY.
*&---------------------------------------------------------------------*
*& Form f_select_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM F_SELECT_DATA . SELECT A~FORMNAME A~MASTERLANG A~DEVCLASS A~VERSION A~FIRSTUSER A~FIRSTDATE A~FIRSTTIME A~LASTUSER A~LASTDATE A~FORMTYPE B~CAPTION FROM STXFADM AS A INNER JOIN STXFADMT AS B ON A~FORMNAME = B~FORMNAME INTO TABLE ITAB WHERE A~DEVCLASS IN S_DEV AND A~FORMNAME IN S_FORM AND B~LANGU = P_LANG. IF SY-SUBRC = 0. SORT ITAB BY FORMNAME. ELSE. MESSAGE I398(00) WITH 'No Form Exits for this selection criteria'. LEAVE LIST-PROCESSING. ENDIF. ENDFORM. " f_select_data *&---------------------------------------------------------------------* *& Form display *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM DISPLAY . CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING I_CALLBACK_PROGRAM = SYST-CPROG IS_LAYOUT = WA_LAYOUT IT_FIELDCAT = IT_FIELDCAT TABLES T_OUTTAB = ITAB. IF SY-SUBRC <> 0.
ENDIF.

ENDFORM. " display
*&---------------------------------------------------------------------*
*& Form f_fieldcat
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM F_FIELDCAT . DATA: WA_COL TYPE I VALUE 1. WA_FIELDCAT-COL_POS = WA_COL + 1. WA_FIELDCAT-SELTEXT_L = TEXT-003. " Form Name WA_FIELDCAT-FIELDNAME = 'FORMNAME'. WA_FIELDCAT-TABNAME = 'ITAB'. APPEND WA_FIELDCAT TO IT_FIELDCAT. CLEAR WA_FIELDCAT. WA_FIELDCAT-COL_POS = WA_COL + 1. WA_FIELDCAT-SELTEXT_L = TEXT-004. " Smart form Text WA_FIELDCAT-FIELDNAME = 'CAPTION'. WA_FIELDCAT-TABNAME = 'ITAB'. APPEND WA_FIELDCAT TO IT_FIELDCAT. CLEAR WA_FIELDCAT. WA_FIELDCAT-COL_POS = WA_COL + 1. WA_FIELDCAT-SELTEXT_L = TEXT-005. "Package WA_FIELDCAT-FIELDNAME = 'DEVCLASS'. WA_FIELDCAT-TABNAME = 'ITAB'. APPEND WA_FIELDCAT TO IT_FIELDCAT. CLEAR WA_FIELDCAT. WA_FIELDCAT-COL_POS = WA_COL + 1. WA_FIELDCAT-SELTEXT_L = TEXT-006. "First User WA_FIELDCAT-FIELDNAME = 'FIRSTUSER'. WA_FIELDCAT-TABNAME = 'ITAB'. APPEND WA_FIELDCAT TO IT_FIELDCAT. CLEAR WA_FIELDCAT. WA_FIELDCAT-COL_POS = WA_COL + 1. WA_FIELDCAT-SELTEXT_L = TEXT-007. "First Date WA_FIELDCAT-FIELDNAME = 'FIRSTDATE'. WA_FIELDCAT-TABNAME = 'ITAB'. APPEND WA_FIELDCAT TO IT_FIELDCAT. CLEAR WA_FIELDCAT. WA_FIELDCAT-COL_POS = WA_COL + 1. WA_FIELDCAT-SELTEXT_L = TEXT-008. "Version WA_FIELDCAT-FIELDNAME = 'VERSION'. WA_FIELDCAT-TABNAME = 'ITAB'. APPEND WA_FIELDCAT TO IT_FIELDCAT. CLEAR WA_FIELDCAT. WA_FIELDCAT-COL_POS = WA_COL + 1. WA_FIELDCAT-SELTEXT_L = TEXT-009. "Master Language WA_FIELDCAT-FIELDNAME = 'MASTERLANG'. WA_FIELDCAT-TABNAME = 'ITAB'. APPEND WA_FIELDCAT TO IT_FIELDCAT. CLEAR WA_FIELDCAT. WA_FIELDCAT-COL_POS = WA_COL + 1. WA_FIELDCAT-SELTEXT_L = TEXT-010. "Last User WA_FIELDCAT-FIELDNAME = 'LASTUSER'. WA_FIELDCAT-TABNAME = 'ITAB'. APPEND WA_FIELDCAT TO IT_FIELDCAT. CLEAR WA_FIELDCAT. ENDFORM. " f_fieldcat *&---------------------------------------------------------------------* *& Form f_layout *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM F_LAYOUT .

WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

ENDFORM. " f_layout

1 comment:

  1. Hello,
    Is there a way to search for a text string in all the Smartforms ?

    For Example: the user (or programer) will enter a text for search and the program will return all the smartforms which include this text.
    Best Regards,
    Eran

    ReplyDelete