Search For Standard or Customise Smartform

*&---------------------------------------------------------------------*
*&  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

Get help for your ABAP problems
Do you have a ABAP Question?

ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books

Smartforms Tips
SAP Smartforms Tips and Tricks

ABAP Programming Tips
ABAP and Samples Program Codes for Abapers

Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.