Sunday, December 19, 2010

Procedure to set PF status

  • When you set Pf status ZTEST, standard application tools will be removed.
  • Goto SE41 give program 'SAPLKKBL' and status 'STANDARD_FULLSCREEN'.
  • Copy the status from those to ZTEST of our program. Now you will see all standard functions.

REPORT ZTEST_NOTEPAD.
DATA:
      BEGIN OF IT_OUTPUT OCCURS 0,
        SELECT TYPE C,        "This variable stores the value when row selected.
        BUKRS  TYPE T001-BUKRS,
        BUTXT  TYPE T001-BUTXT,
      END OF IT_OUTPUT.
TYPE-POOLS:SLIS.
DATA:
      IT_EVENTS            TYPE STANDARD TABLE OF SLIS_ALV_EVENT,
      IT_FIELDCAT          TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV,
      WA_FIELDCAT          TYPE SLIS_FIELDCAT_ALV,
      WA_EVENTS            TYPE SLIS_ALV_EVENT,
      WA_LAYOUT            TYPE SLIS_LAYOUT_ALV.
DATA: G_PROGRAM            TYPE SY-REPID VALUE SY-REPID.

START-OF-SELECTION.
  SELECT * FROM T001 INTO CORRESPONDING FIELDS OF TABLE IT_OUTPUT UP TO 100 ROWS.
  DEFINE FIELDCATALOG.
    WA_FIELDCAT-FIELDNAME = &1.
    WA_FIELDCAT-TABNAME   = &2.
    WA_FIELDCAT-SELTEXT_L = &3.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR  WA_FIELDCAT.
  END-OF-DEFINITION.
  FIELDCATALOG: "Column table       col text
  'BUKRS' 'IT_OUTPUT' 'BUKRS',
  'BUTXT' 'IT_OUTPUT' 'BUTXT'.
  WA_LAYOUT-BOX_FIELDNAME     = 'SELECT'. "This has to be set to get selection
  WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

  WA_EVENTS-NAME              = 'PF_STATUS_SET'.
  WA_EVENTS-FORM              = 'PF_STATUS_SET'.
  APPEND WA_EVENTS TO IT_EVENTS.
  CLEAR WA_EVENTS.
  WA_EVENTS-NAME              = 'USER_COMMAND'.
  WA_EVENTS-FORM              = 'USER_COMMAND'.
  APPEND WA_EVENTS TO IT_EVENTS.
  CLEAR WA_EVENTS.

  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM = G_PROGRAM
      IS_LAYOUT          = WA_LAYOUT
      IT_FIELDCAT        = IT_FIELDCAT
      IT_EVENTS          = IT_EVENTS
    TABLES
      T_OUTTAB           = IT_OUTPUT.
*&---------------------------------------------------------------------*
*&      Form  PF_STATUS_SET
*&---------------------------------------------------------------------*
FORM PF_STATUS_SET USING RT_EXTAB TYPE SLIS_T_EXTAB.
  SET PF-STATUS 'ZTEST'.
ENDFORM.                    "PF_STATUS_SET

*------------------------------------------------------------------*
*       FORM USER_COMMAND                                          *
*------------------------------------------------------------------*
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD.
* Check function code
  CASE R_UCOMM.
    WHEN 'DISPLAY'.  "user presses SAVE
      LOOP AT IT_OUTPUT.
        IF IT_OUTPUT-SELECT EQ 'X'.
*       Process records that have been selected
          WRITE:/ IT_OUTPUT.
        ENDIF.
      ENDLOOP.
  ENDCASE.
ENDFORM.                    "user_command

0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.