ALV - Buttons handling

Hi gurus,
My ALV(reuse_alv) report has 4 buttons(custom buttons, like category wise view, plant wise view etc) created by me and iam using my own GUI status. Now when i view my report and navigate between the four buttons the functionality is not working properly. data is safe.
my problem is:
on the report after navigation btwn the buttons created by me,
the 3 buttons:
back - is going to the previous screen of alv
exit - is functioning same as back button
cancel - going to selection screen with the same selection screen values
*My functionality is: Back seems to be ok,
exit should be out of t/code (at the moment selection screen comes),
cancel (back to selection screen).*
so can u please suggest me what can i give in user_command to handle the above events
points will be rewarded.
urs,  Chaitu
Edited by: chaitanya on Jun 23, 2008 12:10 PM

Hi,
If the caller wants to use a self-defined user interface (for example, in order to provide additional list functions or use existing functions), I recommend that you copy standard status STANDARD_FULLSCREEN from function group SLVC_FULLSCREEN and modify it accordingly. ALV standard function codes always start with '&'.
Add your Fcodes at the apllication toolbar it will come as button .
I am givng you a sample code of ALV which has a button on application toolbar which calls a smartform on press.
REPORT  ZMSTR0022.
CONSTANTS: C_FORM_NAME TYPE TDSFNAME VALUE 'ZMST_PER_APPL'.
TABLES :ZMST_PERMIT.
TYPE-POOLS: SLIS.
TYPE-POOLS :VRM.                           "Value Request Manager
TYPES:BEGIN OF STRU_ZMST_PERMIT,
     CHECKBOX(1) TYPE C,                    " Checkbox
     ZPIDNUM TYPE ZMST_PERMIT-ZPIDNUM,   " Permit ID No.
     ZARBDSC TYPE ZMST_PERMIT-ZARBDSC,   " Arabic description
     ZENGDSC TYPE ZMST_PERMIT-ZENGDSC,   " English description
     ZENQUAN TYPE ZMST_PERMIT-ZENQUAN,   " Qty in English
     ZARQUAN TYPE ZMST_PERMIT-ZARQUAN,   " Qty in Arabic
     ZENUOM  TYPE ZMST_PERMIT-ZENUOM,    " UoM
     ZTARIFF TYPE  ZMST_PERMIT-ZTARIFF,  " Tariff No
     ZARRPRT TYPE ZMST_PERMIT-ZARRPRT,   " Port code
     ZPRT_NAME(60) TYPE C,               " Port name in Arabic
     ZPERNUM TYPE ZMST_PERMIT-ZPERNUM,   " Reference No
     ZEFFDT  TYPE ZMST_PERMIT-ZEFFDT,    " Valid from
     ZEXPDT  TYPE ZMST_PERMIT-ZEXPDT,    " Valid to
     ZARB_DT(15) TYPE C,                 " Arabic Date of letter
     ZNAME_AUTH(50) TYPE C,              " Name of Authority
     ZPERM_MIN(50) TYPE C,               " Permit Ministry
     END OF STRU_ZMST_PERMIT.
TYPES:BEGIN OF STRU_PERMIT,
      ZPIDNUM TYPE ZMST_PERMIT-ZPIDNUM,  " Permit ID No.
      ZENGDSC TYPE ZMST_PERMIT-ZENGDSC,  " English description
      ZARBDSC TYPE ZMST_PERMIT-ZARBDSC,  " Arabic description
      ZTARIFF TYPE  ZMST_PERMIT-ZTARIFF, " Tariff No
      ZPERNUM TYPE ZMST_PERMIT-ZPERNUM,  " Reference No
      ZARRPRT TYPE ZMST_PERMIT-ZARRPRT,  " Port code
      ZEFFDT  TYPE ZMST_PERMIT-ZEFFDT,   " Valid from
      ZEXPDT  TYPE ZMST_PERMIT-ZEXPDT,   " Valid to
      END OF STRU_PERMIT.
TYPES: BEGIN OF STRU_FORM_PERMIT,
       ZARBDSC TYPE ZMST_PERMIT-ZARBDSC,   " Arabic description
       ZENGDSC TYPE ZMST_PERMIT-ZENGDSC,   " English description
       ZENQUAN TYPE ZMST_PERMIT-ZENQUAN,   " Qty in English
       ZARQUAN TYPE ZMST_PERMIT-ZARQUAN,   " Qty in Arabic
       ZENUOM  TYPE ZMST_PERMIT-ZENUOM,    " UoM
       ZTARIFF TYPE  ZMST_PERMIT-ZTARIFF,  " Tariff No
       ZPRT_NAME(60) TYPE C,               " Port name in Arabic
       END OF STRU_FORM_PERMIT.
DATA: IT_PERMIT TYPE TABLE OF STRU_PERMIT.
DATA: IT_ZMST_PERMIT TYPE TABLE OF STRU_ZMST_PERMIT,
      WA_ZMST_PERMIT LIKE LINE OF IT_ZMST_PERMIT,
      IT_FORM_PERMIT TYPE TABLE OF STRU_FORM_PERMIT,
      WA_FORM_PERMIT LIKE LINE OF IT_FORM_PERMIT.
DATA: WA_LAYOUT   TYPE SLIS_LAYOUT_ALV,
      WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
      IT_FIELDCAT TYPE TABLE OF SLIS_FIELDCAT_ALV.
DATA: W_FORM TYPE RS38L_FNAM.
DATA: W_NAME_AUTH(50),
      W_ZARBDT(15),
      W_ZENGDT(10),
     W_ZPRT_NAME(70).
DATA: W_PARAM TYPE SSFCTRLOP.
DATA:W_NAME1 TYPE DFIES-FIELDNAME,
      W_NAME2 TYPE HELP_INFO-DYNPROFLD .
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-023.
SELECT-OPTIONS:S_PIDNUM FOR ZMST_PERMIT-ZPIDNUM ,
               S_ENGDSC FOR ZMST_PERMIT-ZENGDSC NO INTERVALS LOWER CASE,
               S_ARBDSC FOR ZMST_PERMIT-ZARBDSC NO INTERVALS LOWER CASE,
               S_TARIFF FOR ZMST_PERMIT-ZTARIFF NO INTERVALS,
               S_PERNUM FOR ZMST_PERMIT-ZPERNUM NO INTERVALS,
               S_ARRPRT FOR ZMST_PERMIT-ZARRPRT NO INTERVALS MATCHCODE OBJECT ZMST_PORTS.
PARAMETER:P_PERTYP(2) TYPE C AS LISTBOX VISIBLE LENGTH 20.
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_PIDNUM-LOW.
  W_NAME2 = 'S_PIDNUM-LOW'.
  W_NAME1 = 'ZPIDNUM'.
  PERFORM F4_HELP USING W_NAME1 W_NAME2 .         "calling subroutine to provide desired F4 help
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_PIDNUM-HIGH.
  W_NAME2 = 'S_PIDNUM-HIGH'.
  W_NAME1 = 'ZPIDNUM'.
  PERFORM F4_HELP USING W_NAME1 W_NAME2 .         "calling subroutine to provide desired F4 help
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_ENGDSC-LOW.
  W_NAME2 = 'S_ENGDSC'.
  W_NAME1 = 'ZENGDSC'.
  PERFORM F4_HELP USING W_NAME1 W_NAME2 .         "calling subroutine to provide desired F4 help
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_ARBDSC-LOW.
  W_NAME2 = 'S_ARBDSC'.
  W_NAME1 = 'ZARBDSC'.
  PERFORM F4_HELP USING W_NAME1 W_NAME2 .         "calling subroutine to provide desired F4 help
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_TARIFF-LOW.
  W_NAME2 = 'S_TARIFF'.
  W_NAME1 = 'ZTARIFF'.
  PERFORM F4_HELP USING W_NAME1 W_NAME2 .         "calling subroutine to provide desired F4 help
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_PERNUM-LOW.
  W_NAME2 = 'S_PERNUM'.
  W_NAME1 = 'ZPERNUM'.
  PERFORM F4_HELP USING W_NAME1 W_NAME2 .         "calling subroutine to provide desired F4 help
AT SELECTION-SCREEN.
  IF SY-UCOMM = 'ONLI'.
    PERFORM CHECK_INPUT.                            "calling subroutine to check inputs on selection screen
  ENDIF.
INITIALIZATION.
  PERFORM VAL_PERTYP.
START-OF-SELECTION.
  PERFORM FILL_FIELDCAT.                          "calling subroutine for filling fieldcatalog
If Permit ministry is blank then fetch data from ZMST_PERMIT otherwise from ZMST_PERMITHI--
  IF P_PERTYP IS INITIAL.
    PERFORM FETCH_PERMIT.                         "calling subroutine to fetch data from ZMST_PERMIT
  ELSE.
    PERFORM FETCH_PERMITHI.                       "calling subroutine to fetch data from ZMST_PERMITHI
  ENDIF.
END-OF-SELECTION.
*&      Form  fill_fieldcat
      text
-->  p1        text
<--  p2        text
FORM FILL_FIELDCAT .
-passing the parameters of layout--
  WA_LAYOUT-ZEBRA = 'X'.
  WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
  WA_LAYOUT-BOX_FIELDNAME = 'CHECKBOX'.
  WA_LAYOUT-BOX_TABNAME = 'IT_ZMST_PERMIT'.
-Passing the parameters of fieldcatalog--
  WA_FIELDCAT-FIELDNAME = 'ZPIDNUM'.
  WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
  WA_FIELDCAT-SELTEXT_M = TEXT-001.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-FIELDNAME = 'ZARBDSC'.
  WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
  WA_FIELDCAT-SELTEXT_M = TEXT-002.
  WA_FIELDCAT-EDIT = 'X'.
  WA_FIELDCAT-LOWERCASE = 'X'.
  WA_FIELDCAT-OUTPUTLEN = 120.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-FIELDNAME = 'ZENGDSC'.
  WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
  WA_FIELDCAT-SELTEXT_M = TEXT-003.
  WA_FIELDCAT-EDIT = 'X'.
  WA_FIELDCAT-LOWERCASE = 'X'.
  WA_FIELDCAT-OUTPUTLEN = 120.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-FIELDNAME = 'ZENQUAN'.
  WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
  WA_FIELDCAT-SELTEXT_M = TEXT-004.
  WA_FIELDCAT-EDIT = 'X'.
  WA_FIELDCAT-LOWERCASE = 'X'.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-FIELDNAME = 'ZARQUAN'.
  WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
  WA_FIELDCAT-SELTEXT_M = TEXT-005.
  WA_FIELDCAT-EDIT = 'X'.
  WA_FIELDCAT-LOWERCASE = 'X'.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-FIELDNAME = 'ZENUOM'.
  WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
  WA_FIELDCAT-SELTEXT_M = TEXT-006.
  WA_FIELDCAT-EDIT = 'X'.
  WA_FIELDCAT-LOWERCASE = 'X'.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-FIELDNAME = 'ZTARIFF'.
  WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
  WA_FIELDCAT-SELTEXT_M = TEXT-007.
  WA_FIELDCAT-EDIT = 'X'.
  WA_FIELDCAT-OUTPUTLEN = 15.
  WA_FIELDCAT-LOWERCASE = 'X'.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-FIELDNAME = 'ZARB_DT'.
  WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
  WA_FIELDCAT-SELTEXT_L = TEXT-013.
  WA_FIELDCAT-EDIT = 'X'.
  WA_FIELDCAT-LOWERCASE = 'X'.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-FIELDNAME = 'ZNAME_AUTH'.
  WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
  WA_FIELDCAT-SELTEXT_M = TEXT-014.
  WA_FIELDCAT-EDIT = 'X'.
  WA_FIELDCAT-OUTPUTLEN = 50.
  WA_FIELDCAT-LOWERCASE = 'X'.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-FIELDNAME = 'ZPRT_NAME'.
  WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
  WA_FIELDCAT-SELTEXT_M = TEXT-009.
  WA_FIELDCAT-EDIT = 'X'.
  WA_FIELDCAT-OUTPUTLEN = 60.
  WA_FIELDCAT-LOWERCASE = 'X'.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-FIELDNAME = 'ZARRPRT'.
  WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
  WA_FIELDCAT-SELTEXT_M = TEXT-008.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-FIELDNAME = 'ZPERNUM'.
  WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
  WA_FIELDCAT-SELTEXT_M = TEXT-010.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-FIELDNAME = 'ZEFFDT'.
  WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
  WA_FIELDCAT-SELTEXT_M = TEXT-011.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-FIELDNAME = 'ZEXPDT'.
  WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
  WA_FIELDCAT-SELTEXT_M = TEXT-012.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
  WA_FIELDCAT-FIELDNAME = 'ZPERM_MIN'.
  WA_FIELDCAT-TABNAME = 'IT_ZMST_PERMIT'.
  WA_FIELDCAT-SELTEXT_M = TEXT-019.
  WA_FIELDCAT-OUTPUTLEN = 50.
  WA_FIELDCAT-LOWERCASE = 'X'.
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.
ENDFORM.                    " fill_fieldcat
*&      Form  alv_disp
      text
-->  p1        text
<--  p2        text
FORM ALV_DISP .
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM       = 'ZMSTR0022'
      I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
      I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
      I_GRID_TITLE             = TEXT-015
      IS_LAYOUT                = WA_LAYOUT
      IT_FIELDCAT              = IT_FIELDCAT
      I_SAVE                   = 'A'
    TABLES
      T_OUTTAB                 = IT_ZMST_PERMIT
    EXCEPTIONS
      PROGRAM_ERROR            = 1
      OTHERS                   = 2.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " alv_disp
*&      Form  PF_STATUS
      text
  This subroutine sets the GUI status
FORM PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
  SET PF-STATUS 'ZSTANDARD_FULLSCREEN'.
ENDFORM.                    "PF_STATUS
*&      Form  USER_COMMAND
FORM USER_COMMAND USING R_UCOMM TYPE SY-UCOMM  RS_SELFIELD TYPE SLIS_SELFIELD.
*For Printing Smartform
  IF R_UCOMM = 'PRT'.
    CLEAR WA_FORM_PERMIT.
    REFRESH IT_FORM_PERMIT.
    LOOP AT IT_ZMST_PERMIT INTO WA_ZMST_PERMIT WHERE CHECKBOX = 'X'.
      MOVE-CORRESPONDING WA_ZMST_PERMIT TO WA_FORM_PERMIT.
      APPEND WA_FORM_PERMIT TO IT_FORM_PERMIT .
*Check for First occurence of Name of authority
      IF WA_ZMST_PERMIT-ZNAME_AUTH NE SPACE.
        IF W_NAME_AUTH = ' '.
          W_NAME_AUTH = WA_ZMST_PERMIT-ZNAME_AUTH.
        ENDIF.
      ENDIF.
*Check for First occurence of Arabic date
      IF WA_ZMST_PERMIT-ZARB_DT NE SPACE.
        IF W_ZARBDT = ' '.
          W_ZARBDT = WA_ZMST_PERMIT-ZARB_DT.
        ENDIF.
      ENDIF.
      IF WA_ZMST_PERMIT-ZPRT_NAME NE SPACE.
        IF W_ZPRT_NAME = ' '.
          MOVE WA_ZMST_PERMIT-ZPRT_NAME TO W_ZPRT_NAME.
          CONDENSE W_ZPRT_NAME.
        ENDIF.
      ENDIF.
      CLEAR : WA_FORM_PERMIT, WA_ZMST_PERMIT.
    ENDLOOP.
    CONCATENATE SY-DATUM0(4) '/' SY-DATUM4(2) '/' SY-DATUM+6(2) INTO W_ZENGDT.
*Printing    Subroutine
    IF NOT IT_FORM_PERMIT[] IS INITIAL.
      PERFORM PRINT_FORM.
    ELSE.
      MESSAGE TEXT-018 TYPE 'I'.
    ENDIF.
  ENDIF.
ENDFORM.                    "user_command
*&      Form  F4_HELP
      text
-->  p1        text
<--  p2        text
FORM F4_HELP USING: W_VAR TYPE DFIES-FIELDNAME
                    W_VAR1 TYPE HELP_INFO-DYNPROFLD .
Fetching data from zmst_permit for F4 help on PERMIT ID No.--
  IF IT_PERMIT[] IS INITIAL.
    SELECT ZPIDNUM
           ZENGDSC
           ZARBDSC
           ZTARIFF
           ZPERNUM
           ZARRPRT
           ZEFFDT
           ZEXPDT
           FROM ZMST_PERMIT INTO CORRESPONDING FIELDS OF TABLE IT_PERMIT.
  ENDIF.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      RETFIELD        = W_NAME1 " 'ZPIDNUM'
      DYNPPROG        = 'ZMSTR0022'
      DYNPNR          = SY-DYNNR
      DYNPROFIELD     = W_NAME2 "'S_PIDNUM'
      VALUE_ORG       = 'S'
    TABLES
      VALUE_TAB       = IT_PERMIT
    EXCEPTIONS
      PARAMETER_ERROR = 1
      NO_VALUES_FOUND = 2
      OTHERS          = 3.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                                                    " F4_HELP
*&      Form  check_input
      text
-->  p1        text
<--  p2        text
FORM CHECK_INPUT .
  IF S_PIDNUM[] IS INITIAL AND
     S_ENGDSC[] IS INITIAL AND
     S_ARBDSC[] IS INITIAL AND
     S_TARIFF[] IS INITIAL AND
     S_PERNUM[] IS INITIAL AND
     S_ARRPRT[] IS INITIAL .
    MESSAGE TEXT-016 TYPE 'E'.
    LEAVE TO TRANSACTION 'ZMSTR022'.
  ENDIF.
ENDFORM.                    " check_input
*&      Form  print_form
      text
-->  p1        text
<--  p2        text
FORM PRINT_FORM .
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      FORMNAME           = C_FORM_NAME
    IMPORTING
      FM_NAME            = W_FORM
    EXCEPTIONS
      NO_FORM            = 1
      NO_FUNCTION_MODULE = 2
      OTHERS             = 3.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  W_PARAM-LANGU ='AR'.
  CALL FUNCTION W_FORM
    EXPORTING
      CONTROL_PARAMETERS = W_PARAM
      W_NAME_AUTH        = W_NAME_AUTH
      W_ZARBDT           = W_ZARBDT
      W_ZENGDT           = W_ZENGDT
      W_ZPRT_NAME        = W_ZPRT_NAME
    TABLES
      IT_FORM_PERMIT     = IT_FORM_PERMIT
    EXCEPTIONS
      FORMATTING_ERROR   = 1
      INTERNAL_ERROR     = 2
      SEND_ERROR         = 3
      USER_CANCELED      = 4
      OTHERS             = 5.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " print_form
*&      Form  fetch_Permit
      text
-->  p1        text
<--  p2        text
FORM FETCH_PERMIT .
-Fetching data from zmst_permit based on the inputs on selection screen--
  SELECT
       ZPIDNUM
       ZARBDSC
       ZENGDSC
       ZENQUAN
       ZARQUAN
       ZENUOM
       ZTARIFF
       ZARRPRT
       ZPERNUM
       ZEFFDT
       ZEXPDT
       FROM ZMST_PERMIT INTO CORRESPONDING FIELDS OF TABLE IT_ZMST_PERMIT
       WHERE ZPIDNUM IN S_PIDNUM
       AND   ZENGDSC IN S_ENGDSC
       AND   ZARBDSC IN S_ARBDSC
       AND   ZTARIFF IN S_TARIFF
       AND   ZPERNUM IN S_PERNUM
       AND   ZARRPRT IN S_ARRPRT.
  IF SY-SUBRC <> 0.
    MESSAGE TEXT-017 TYPE 'I'.
    LEAVE TO TRANSACTION 'ZMSTR022'.
  ELSE.
    LOOP AT IT_ZMST_PERMIT INTO WA_ZMST_PERMIT.
      WA_ZMST_PERMIT-ZPERM_MIN = TEXT-020.
      MODIFY IT_ZMST_PERMIT INDEX SY-TABIX FROM WA_ZMST_PERMIT TRANSPORTING ZPERM_MIN .
    ENDLOOP.
    PERFORM ALV_DISP.        " calling subroutine for ALV display
  ENDIF.
ENDFORM.                    " fetch_Permit
*&      Form  fetch_permithi
      text
-->  p1        text
<--  p2        text
FORM FETCH_PERMITHI .
-Fetching data from zmst_permit based on the inputs on selection screen--
  SELECT
       ZPIDNUM
       ZARBDSC
       ZENGDSC
       ZENQUAN
       ZARQUAN
       ZENUOM
       ZTARIFF
       ZARRPRT
       ZPERNUM
       ZEFFDT
       ZEXPDT
       FROM ZMST_PERMITHI INTO CORRESPONDING FIELDS OF TABLE IT_ZMST_PERMIT
       WHERE ZPIDNUM IN S_PIDNUM
       AND   ZENGDSC IN S_ENGDSC
       AND   ZARBDSC IN S_ARBDSC
       AND   ZTARIFF IN S_TARIFF
       AND   ZPERNUM IN S_PERNUM
       AND   ZARRPRT IN S_ARRPRT
       AND  ZPERTYP  = P_PERTYP.
  IF SY-SUBRC <> 0.
    MESSAGE TEXT-017 TYPE 'I'.
    LEAVE TO TRANSACTION 'ZMSTR022'.
  ELSE.
    LOOP AT IT_ZMST_PERMIT INTO WA_ZMST_PERMIT.
      CASE P_PERTYP.
        WHEN 'I'.
          WA_ZMST_PERMIT-ZPERM_MIN = TEXT-021.
          MODIFY IT_ZMST_PERMIT INDEX SY-TABIX FROM WA_ZMST_PERMIT TRANSPORTING ZPERM_MIN .
        WHEN 'H'.
          WA_ZMST_PERMIT-ZPERM_MIN = TEXT-022.
          MODIFY IT_ZMST_PERMIT INDEX SY-TABIX FROM WA_ZMST_PERMIT TRANSPORTING ZPERM_MIN .
      ENDCASE.
    ENDLOOP.
    PERFORM ALV_DISP.        " calling subroutine for ALV display
  ENDIF.
ENDFORM.                    " fetch_permithi
*&      Form  val_PERTYP
      text
-->  p1        text
<--  p2        text
FORM VAL_PERTYP .
  DATA: W_NAME TYPE VRM_ID,
        IT_LIST TYPE VRM_VALUES,
        WA_VALUE LIKE LINE OF IT_LIST.
  WA_VALUE-KEY = ' '.
  WA_VALUE-TEXT = TEXT-020.
  APPEND WA_VALUE TO IT_LIST.
  CLEAR WA_VALUE.
  WA_VALUE-KEY = 'I'.
  WA_VALUE-TEXT = TEXT-021.
  APPEND WA_VALUE TO IT_LIST.
  CLEAR WA_VALUE.
  WA_VALUE-KEY = 'H'.
  WA_VALUE-TEXT = TEXT-022.
  APPEND WA_VALUE TO IT_LIST.
  CLEAR WA_VALUE.
  W_NAME = 'P_PERTYP'.
  P_PERTYP = ' '.
  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      ID              = W_NAME
      VALUES          = IT_LIST
    EXCEPTIONS
      ID_ILLEGAL_NAME = 1
      OTHERS          = 2.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " val_PERTYP
I hope this will help you.
Help children of U.N World Food Program by rewarding  points and encourage others to answer your queries.

Similar Messages

  • RE: [iPlanet-JATO] image button handling

    Hi Todd,
    from what I have seen so far on the Project they are just buttons on
    the page.
    In the interim, I modified RequestHandlingViewBase.acceptsRequest() to
    handle the matching of parameter and command child names.
    from
    if (request.getParameter(commands)!=null)
    return getCommandChildNames()[i];
    to
    if (request.getParameter(commands[i])!=null ||
    (request.getParameter(commands[i]+ ".x")!=null ))
    return getCommandChildNames()[i];
    This fixed the problem with the image buttons in our cases.
    Kostas
    -----Original Message-----
    From: Todd Fast
    Sent: 10/27/00 6:21 AM
    Subject: Re: [iPlanet-JATO] image button handling
    Hi Kostas--
    I wanted to get some feedback on the known issue of the
    handleXXXXRequest method not being fired for buttons which have
    images, due to the the browser submitting
    the pixel coordinates back to the server like this:
    Page1.ImageButton1.x=...
    Page1.ImageButton1.y=...
    As the ND conversion project we are currently working on heavily uses
    image buttons we would like to get and indication if and when a patch
    is planned for this.
    Our current work around is to remove the src attribute from the JATO
    tags in the JSPs.We are currently working on getting this fixed. One question--what is
    the
    relative type of usage of image buttons in your project? Are they just
    buttons on the page (view bean), or do they appear in tiled views as
    well?
    Todd
    [email protected]
    [Non-text portions of this message have been removed]

    OK, here's what I'm trying to do: We have, like you said, a menu
    page. The pages that it goes to and the number of links are all
    variable and read from the database. In NetD we were able to create
    URLs in the form
    pgXYZ?SPIDERSESSION=abcd
    so this is what I'm trying to replicate here. So the URL that works
    is
    pgContactUs?GXHC_GX_jst=fc7b7e61662d6164&GXHC_gx_session_id_=cc9c6dfa5
    601afa7
    which I interpreted to be the equivalent of the old Netd way. Our
    javascript also loads other frames of the page in the same manner.
    And I believe the URL-rewritten frame sources of a frameset look like
    this too.
    This all worked except for the timeout problem. In theory we could
    rewrite all URLs to go to a handler, but that would be...
    inconvenient.

  • How to disable generic alv buttons in CL_SALV_TABLE?

    I am needing to disable individually the generic alv buttons in CL_SALV_TABLE. 
    I see how to disable buttons by group.  eg-
         lr_functions->set_group_export( abap_false ).
         lr_functions->set_group_filter( abap_false ).
         lr_functions->set_group_sort( abap_false ).
         etc....
    However, I cannot find source  codes to disable individual buttons.  Is it possible to do this?...   and if so would appreciate an example coding.
    Best Regards,
    Dean Atteberry.

    There are method available in the class CL_SALV_FUNCTIONS_LIST which can be helpful to active / deactive certain button.
    Like: To remove the SORT Ascending button:
      data: lr_functions type ref to cl_salv_functions_list.
      lr_functions = gr_table->get_functions( ).
      lr_functions->SET_SORT_ASC( ).
    Regards,
    Naimesh Patel

  • How to remove all ALV buttons?

    Hello all.
    Does anyone know how to remove all the ALV buttons?
    I now the IT_EXCLUDING option, but is there a different and
    faster way?
    (I'm using ALV classes).
    Thanks!

    hii..
    All the ALV Toolbar Buttons can be removed in Single Shot.
    There is a method in CL_GUI_ALV_GRID->SET_TOOLBAR_VISIBLE.
    it is protected method create class that is inheriting from CL_GUI_ALV_GRID.
    CALL METHOD ME->set_toolbar_visible
             EXPORTING
               visible = '0'
    *        EXCEPTIONS
    *          error   = 1
    *          others  = 2
           IF sy-subrc <> 0.
    *       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
           ENDIF.
    Set visible to '0' will disable all the buttons.
    Example Program:
    *DATA DECALRATIONS
    TYPES : BEGIN OF ty_sflight,
           carrid TYPE sflight-carrid,
           connid TYPE sflight-connid,
           Fldate TYPE sflight-fldate,
           price TYPE sflight-price,
           currency TYPE sflight-currency,
      END OF ty_sflight.
    DATA : IT_SFLIGHT TYPE TABLE OF TY_SFLIGHT,
            WA_SFLIGHT TYPE TY_SFLIGHT.
    DATA : IT_FCAT TYPE LVC_T_FCAT ,
            WA_FCAT TYPE LVC_S_FCAT.
    data : o_cont type REF TO cl_gui_custom_container ,
            o_grid type REF TO cl_gui_alv_grid.
    CLASS LCL_ALV DEFINITION INHERITING FROM CL_GUI_ALV_GRID.
       PUBLIC SECTION.
         METHODS : M1.
       ENDCLASS.
       CLASS LCL_ALV IMPLEMENTATION.
         METHOD M1.
           CALL METHOD ME->set_toolbar_visible
             EXPORTING
               visible = '0'
    *        EXCEPTIONS
    *          error   = 1
    *          others  = 2
           IF sy-subrc <> 0.
    *       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
           ENDIF.
         ENDMETHOD.
         ENDCLASS.
       START-OF-SELECTION.
         CALL SCREEN 200.
    *&      Module  STATUS_0200  OUTPUT
    module STATUS_0200 output.
       SET PF-STATUS 'ZDC'.
    *  SET TITLEBAR 'xxx'.
    endmodule.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
    module USER_COMMAND_0200 input.
    CASE SY-UCOMM.
       WHEN 'BACK'.
         LEAVE TO SCREEN 0.
         ENDCASE.
    endmodule.                 " USER_COMMAND_0200  INPUT
    *&      Module  GET_DATA  OUTPUT
    module GET_DATA output.
    SELECT * FROM SFLIGHT INTO CORRESPONDING FIELDS OF TABLE IT_SFLIGHT
                                                              UP TO 50 ROWS.
    CLEAR WA_FCAT.
    WA_FCAT-col_pos = '01'.
    WA_FCAT-fieldname = 'CARRID'.
    WA_FCAT-tabname = 'SFLIGHT'.
    WA_FCAT-ref_table = 'SFLIGHT'.
    APPEND WA_FCAT TO IT_FCAT.
    CLEAR WA_FCAT.
    WA_FCAT-col_pos = '02'.
    WA_FCAT-fieldname = 'CONNID'.
    WA_FCAT-tabname = 'SFLIGHT'.
    WA_FCAT-ref_table = 'SFLIGHT'.
    APPEND WA_FCAT TO IT_FCAT.
    CLEAR WA_FCAT.
    WA_FCAT-col_pos = '03'.
    WA_FCAT-fieldname = 'FLDATE'.
    WA_FCAT-tabname = 'SFLIGHT'.
    WA_FCAT-ref_table = 'SFLIGHT'.
    APPEND WA_FCAT TO IT_FCAT.
    CLEAR WA_FCAT.
    WA_FCAT-col_pos = '04'.
    WA_FCAT-fieldname = 'PRICE'.
    WA_FCAT-tabname = 'SFLIGHT'.
    WA_FCAT-ref_table = 'SFLIGHT'.
    APPEND WA_FCAT TO IT_FCAT.
    CLEAR WA_FCAT.
    WA_FCAT-col_pos = '05'.
    WA_FCAT-fieldname = 'CURRENCY'.
    WA_FCAT-tabname = 'SFLIGHT'.
    WA_FCAT-ref_table = 'SFLIGHT'.
    APPEND WA_FCAT TO IT_FCAT.
    CREATE OBJECT o_cont
       EXPORTING
    *    parent                      =
         container_name              = 'C1'
    .DATA O_ALV TYPE REF TO LCL_ALV.
       CREATE OBJECT O_ALV
       EXPORTING
         I_PARENT = O_CONT.
    CALL METHOD o_ALV->set_table_for_first_display
       CHANGING
         it_outtab                     = IT_SFLIGHT
         it_fieldcatalog               = IT_FCAT
    CALL METHOD O_ALV->M1.  "method called to remove all the toolbar buttons
    endmodule.

  • Hotkeys for ALV Buttons?

    Hi experts (from SAP),
    I read the documentation about HOTKEYS (http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/b951297a6d2d65e10000000a42189c/frameset.htm) and I'm wondering why the HOTKEYS are not supported for ALVs respectively for Buttons which trigger ALV-Functions.
    In my mind i thought, that the implementing class of a button should be the same (which obviously is not), not dependig in which UI Element it is used?
    So my question is, is there a work-around for enabling Hot-Keys for ALV-Buttons and/or is SAP going to support HOTKEYS for ALVs in a later on release?
    Best regards.
    Volker

    Hello,
    I'm using this code in my program but still I'm getting error I get a null pointer exception. Is it that I forgot to reference any object or what. can you please help me
    wPanel is my JPanel
    hotKeyAction is my class where I have extended Abstract action
    JRootPane rootPane = wPanel.getRootPane();
    ActionMap parentActionMap = rootPane.getActionMap();
    ActionMap am = new ActionMap();
    am.setParent(parentActionMap);
    am.put("openClFrame",new hotKeyAction());
    rootPane.setActionMap(am);
    InputMap parentInputMap = rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    ComponentInputMap im = new ComponentInputMap(wPanel.getRootPane());
    im.setParent(parentInputMap);
    im.put(KeyStroke.getKeyStroke("F1"), "openClFrame");
    rootPane.setInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, im);
    Best Regards,
    Sreedhar

  • Default Button Handling

    i want to know about Default Button Handling.
    Default Button means "Auto Focused Submit Button when i click page and press enter key ".
    i want to know how can i set some submit button to Default Submit Button.
    Message was edited by:
    Redsky21
    Message was edited by:
    Redsky21

    The description is still quite not understandable. Please put it in more detail with a sample scenario if possible.
    --Shiv                                                                                                                                                                                                                                                           

  • Hide customised alv button

    hi,
    how should i go about hiding the customised alv button i created?
    thanks.

    Hi,
    You can get the reference to your user defined function by calling the method get_function and passing the ID or the function code that you have specified. The simply call the set_visible method to make it invisible. Sample code would be like this:
    data: lr_function               TYPE REF TO cl_salv_wd_function.
    lr_function = l_alv_model->if_salv_wd_function_settings~get_function( 'ID' ).
    lr_function->set_visible( CL_WD_UIELEMENT=>e_visible-NONE ).
    Hope this helps.
    Regards
    Nithya

  • Random numbers, whithin a button handler class

    For my last project I need to create a program that opens a window with 10 text boxes, all displaying "0" at first and a button labled New Numbers. When this button is pushed it needs to generate random numbers within all of the text fields. I have been able to create one that has the text boxes and the button, but in the button handler class the random numbers will not generate properly.I figured that if I could get the button handler class to at least change just the first text field then I would be able to get the rest, but I can't even seem to get that far. Below is what I have so far, any help or guidence would really be appreciated.. Thanks
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Program6
         public static void main(String [] args)
              MyFrame frame = new MyFrame("Alan Jackson - Program 6");
              frame.pack();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setVisible(true);
    class MyFrame extends JFrame
         JTextField [] txt = new JTextField[10];
         JButton btnNewNumbers;
         public MyFrame(String S)
              super(S);
              setLayout(new FlowLayout());
              btnNewNumbers = new JButton("New Numbers");
              int i = 0;
              while(i<10)
                   txt[i] = new JTextField("0",12);
                   add(txt);
                   i++;
              add (btnNewNumbers);     
              btnNewNumbers.addActionListener(new ButtonHandler());
              class ButtonHandler implements ActionListener
                   public void actionPerformed(ActionEvent random)
                        txt[0].setText((int) (Math.random() * 100 +1));                    

    Next time, please use CODE tags, to post your code.
    class MyFrame extends JFrame{
         JTextField [] txt = new JTextField[10];
         JButton btnNewNumbers;
         public MyFrame(String S){
              super(S);
              setLayout(new FlowLayout());
              btnNewNumbers = new JButton("New Numbers");
              int i=0;
              while(i<10){
                   txt[i] = new JTextField("0",12); //<<<<< changed
                   add(txt);
                   i++;
              add (btnNewNumbers);
              btnNewNumbers.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent random){
                        for(int i = 0; i< 10; i++){
                             txt[i].setText(Integer.toString((int) (Math.random() * 100 +1)));

  • Button handler never runs

    I currently have a new button that seems okay (over behavior
    shows correctly), but the .onRelease handler never hits a
    breakpoint on the first statement. I tried the following experiment
    on an old working button and I can't understand what I observed.
    The working button is defined on the whole timeline, i.e., it
    appears on frame 1 in a layer that has keyframes only on frame 1
    and the last frame. The button handler is in Active Script on frame
    1 in a separate actions layer. The script applies for the whole
    timeline too. Now if I take frame 1 of the buttons layer and move
    it to frame 5 so the button does not appear until frame 5, geez,
    the button handler never runs. What is happening?
    I tried the above experiment cuz the new button I can't get
    to work does not appear at frame 1, even though its handler is in
    that script that is on frame 1 (like the documentation tells you to
    do - gather up all your code into a single program on frame 1 in an
    actions layer.) However, making this new button start on frame 1
    (by moving its starting frame back to 1) did not make it work.
    Another property of my non-working button is that it is in a
    layer folder. Moving this layer out of the folder made it work. Is
    there some restriction that buttons can't be in a layer folder -
    I'm using Action Script 2?

    If the button script is not on a keyframe in frame 5, it is
    "not there".
    Enter an empty keyframe in frame 5, put the button script on
    that
    keyframe. Now the button (in frame 5) should work, too, if
    you did not
    mess anything else up. :)
    Just because the script from frame 1 is shown in the AS
    window when you
    click somewhere in the timeline after frame 1, does not mean
    that it
    works the way you think it should.
    Christian Scholz-Flöter

  • Standard ALV Buttons

    can anyone explain, how to get standard ALV buttons when we are using customized buttons using
    SET PF-STATUS 'zxxx'.

    Hi Sripriya,
    Write like SET PF-STATUS 'ZXXXX'. Then double click on the name. then it will take you into SE41 (Menu painter). Now select menu path EXRAS>ADJUST TEMPLETE. Then a popu up window will be displayed. Now select List viewer radio button and enter. Now all the standard buttons will be copied into your own pf status. Now change as per your requirement.
    Hope this helps you. Reply for queries, shall post the updates.
    Regards. 
    Kumar.

  • ALV button Call Up Report OK_CODE &EB9

    What does ALV button Call Up Report OK_CODE &EB9 do? I can find no documentation on it and I have no clue what it does. Any information on this would be great thank you

    seems that the icon is ICON_TABLE_SETTINGS. dont think that has any relevance to its functionality

  • ALV Button event handling

    I have added a custom button on ALV toolbar of my web dynpro view. Now when user click that button, i want to implement the functionality...like onAction...How to do that...where do i need to write the code and how can i capture the button event...
    pls suggest

    Hi ,
    write following to create button:
    DATA: ui_btn1                     TYPE REF TO cl_salv_wd_fe_button.
      DATA: ui_sepa1                    TYPE REF TO cl_salv_wd_fe_separator.
      DATA: sepa1                       TYPE REF TO cl_salv_wd_function.
      DATA: btn1                        TYPE REF TO cl_salv_wd_function.
      data: lr_disp_button type ref to cl_salv_wd_fe_button.
      data: lv_button_text type string.
      CREATE OBJECT ui_btn1.
      CREATE OBJECT ui_sepa1.
      create object lr_disp_button.
    /to create new buttons...
      lv_button_text = 'Refresh Selection'.
      lr_disp_button->set_text( lv_button_text ).
    lr_disp_button->SET_IMAGE_SOURCE( 'ICON_DISPLAY' ).
      btn1 = l_value->if_salv_wd_function_settings~create_function( id = 'LSBUTTON' ).
      btn1->set_editor( lr_disp_button ).
    IN methods tab of view declare:
    ON_REFRESH     Event Handler     On refresh function pf ALV     ON_FUNCTION     INTERFACECONTROLLER     ALV
    in method ON_REFRESH write below code:
      DATA: temp TYPE string.
      temp = r_param->id.
      IF temp = 'LSBUTTON'.
    custom functional;ity
      endif.
    where :
    R_PARAM      Importing     1     IF_SALV_WD_TABLE_FUNCTION     
    This woudl solve ur purpose.
    Regards,
    Vishal.

  • How to add ALV button using OO in module pool program using ALV grid

    Hello Gurus!!!
                  Want some tips related how to add button using ALV Grid(OO).
    I want to display the button for search, sort ....
                 Please suggest the step -by-step procedure for implementation of these button.
                 I am designing the code for transaction FB03. Header data has been displayed but want to display the line items.
                 Kindly suggest your answers.
    Thanks,
    Sachin

    Hi,
    CLASS SELSCR_APPLICATION DEFINITION DEFERRED.
    CLASS SELSCR_APPLICATION DEFINITION.
      PUBLIC SECTION.
       METHODS:
            HANDLE_TOOLBAR
            FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
                IMPORTING E_OBJECT  E_INTERACTIVE,
            HANDLE_USER_COMMAND
            FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
                IMPORTING E_UCOMM.
    ENDCLASS.        "SELSCR_APPLICATION DEFINITION
    CLASS SELSCR_APPLICATION IMPLEMENTATION.
      METHOD HANDLE_TOOLBAR.
        DATA: LS_TOOLBAR  TYPE STB_BUTTON.
    append SAVE icon
        CLEAR LS_TOOLBAR.
        MOVE 'SAVE' TO LS_TOOLBAR-FUNCTION.
        MOVE ICON_SYSTEM_SAVE TO LS_TOOLBAR-ICON.
        MOVE 'Save' TO LS_TOOLBAR-QUICKINFO.
        MOVE ' '  TO LS_TOOLBAR-DISABLED.
        APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
        CLEAR LS_TOOLBAR.
      ENDMETHOD.                    "handle_toolbar
      METHOD HANDLE_USER_COMMAND.
        CASE E_UCOMM.
          WHEN 'SAVE'.
              PERFORM UPDATE_FIELDS.
        ENDCASE.
      ENDMETHOD.
    ENDCLASS.                 "SELSCR_APPLICATION IMPLEMENTATION
    these lines should be after calling method SET_TABLE_FOR_FIRST_DISPLAY
    SET HANDLER G_APPLICATION1->HANDLE_TOOLBAR FOR GRID1.
            CALL METHOD grid1->set_toolbar_interactive.
    rgds,
    bharat.

  • ALV buttons

    Hi all
    I need to add a button/icon at the end of each row of an ALV. When the user clicks on a button it will send a mail.
    Can you help me? Specially on the first issue.
    Many thanks.

    hi check this code this is also works as same except the mail part,this will trigger a workflow log .plz go trought he code below and revert back to me for any clarifications.
    *& Report yi_amra_yiamraber                                            *
    report yi_amra_yiamraber no standard page heading.
    tables: yiamra_ber,SWW_WI2OBJ.
    include <icon>.
    include <symbol>.
    type-pools: slis.
    class cl_gui_resources definition load.
    constants: con_true     type char1 value 'X',
               con_on       type char1 value '1',
               con_off      type char1 value '0',
               con_exit like sy-ucomm value 'EXIT',
               con_back like sy-ucomm value 'BACK',
               con_canc like sy-ucomm value 'CANC'.
    data: g_okcode                 type sy-ucomm,
          g_container_d0100        type ref to cl_gui_custom_container,
          g_container_name_d0100   type scrfname value 'D0100_CONTAINER',
          g_grid_d0100             type ref to cl_gui_alv_grid.
    DATA: objkey LIKE sweinstcou-objkey.
    DATA: ls_ibfobject TYPE  sibflporb.
    data : v_WI_ID type SWW_WI2OBJ-WI_ID.
    DATA BEGIN OF GT_yiamra_ber OCCURS 0 .
            INCLUDE STRUCTURE yiamra_ber .
    DATA cellstyles TYPE lvc_t_styl.
    DATA text(28) TYPE c.
    DATA printer(10)   TYPE c.
    DATA workflow(13)  TYPE c.
    DATA END OF GT_yiamra_ber .
    DATA  ls_style     TYPE lvc_s_styl.
    DATA:  X_FIELDCAT  TYPE LVC_S_FCAT.
    DATA:L_POS TYPE I VALUE 1.
    data: gs_layout TYPE lvc_s_layo.
    SELECT-OPTIONS LFDNR FOR yiamra_ber-LFDNR.
    SELECT-OPTIONS POSNR FOR yiamra_ber-POSNR.
    SELECT-OPTIONS UNAME FOR yiamra_ber-UNAME.
    SELECT-OPTIONS ROLLE FOR yiamra_ber-ROLLE.
    SELECT-OPTIONS PRCTR FOR yiamra_ber-PRCTR.
    SELECT-OPTIONS PRCTRGRP FOR yiamra_ber-PRCTRGRP.
    SELECT-OPTIONS KOSTL FOR yiamra_ber-KOSTL.
    SELECT-OPTIONS KOSTLGRP FOR yiamra_ber-KOSTLGRP.
    SELECT-OPTIONS ABREC FOR yiamra_ber-ABRECHNST.
    SELECT-OPTIONS ANFORD FOR yiamra_ber-ANFORDERER.
    SELECT-OPTIONS DATUMU FOR yiamra_ber-DATUMNEU.
    SELECT-OPTIONS DATUMA FOR yiamra_ber-DATUMANF.
    SELECT-OPTIONS STATUS FOR yiamra_ber-STATUS.
    SELECT-OPTIONS DATUM FOR yiamra_ber-DATUMADM.
    SELECT-OPTIONS DATUMB FOR yiamra_ber-DATUMBEG.
    SELECT-OPTIONS DATUME FOR yiamra_ber-DATUMEND.
    class Definition.
    CLASS lcl_event_handler DEFINITION .
      PUBLIC SECTION .
        METHODS:
    *To control button clicks
        handle_button_click
        FOR EVENT button_click OF cl_gui_alv_grid
        IMPORTING es_col_id
                  es_row_no.
    *PRIVATE SECTION.
       METHODS:
         perform_copy_checks
            IMPORTING
               er_data_changed TYPE REF TO cl_alv_changed_data_protocol.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    *&       Class (Implementation)  lcl_event_handler
           Text
    CLASS lcl_event_handler IMPLEMENTATION.
    METHOD handle_button_click .
        PERFORM handle_button_click USING es_col_id
                                          es_row_no.
      ENDMETHOD.
    ENDCLASS.               "lcl_event_handler
    Display Data
    start-of-selection.
    end-of-selection.
    call screen 0100.
    *&      Module  d0100_set_status  OUTPUT
          text
    module d0100_set_status output.
      perform d0100_set_status.
    endmodule.                             " d0100_set_status  OUTPUT
    *&      Module  d0100_prepare_container  OUTPUT
          text
    module d0100_prepare_container output.
      perform d0100_prepare_container.
    endmodule.                             " d0100_prepare_container  OUTPUT
    *&      Module  d0100_exit  INPUT
          text
    module d0100_exit input.
      perform d0100_exit changing g_okcode.
    endmodule.                             " d0100_exit  INPUT
    *&      Module  d0100_fcode  INPUT
          text
    module d0100_fcode input.
      perform d0100_fcode changing g_okcode.
    endmodule.                             " d0100_fcode  INPUT
    *&      Form  d0100_set_status
          text
    form d0100_set_status.
      set pf-status 'D0100' .
      set titlebar 'D0100'.
      SELECT * FROM yiamra_ber
      INTO corresponding fields of TABLE GT_yiamra_ber
      WHERE  LFDNR IN LFDNR
      AND POSNR   IN POSNR
      AND UNAME  IN UNAME
      AND ROLLE In ROLLE
      AND PRCTR IN PRCTR
      AND PRCTRGRP IN PRCTRGRP
      AND KOSTL IN KOSTL
      AND KOSTLGRP IN KOSTLGRP
      AND ABRECHNST  IN ABREC
      AND  ANFORDERER IN  ANFORD
      AND   DATUMNEU  IN DATUMU
      AND  DATUMANF IN  DATUMA
      AND  STATUS IN  STATUS
      AND   DATUMADM IN DATUM
      AND   DATUMBEG IN  DATUMB
      AND   DATUMEND IN  DATUME.
      loop at gt_yiamra_ber.
      CONCATENATE GT_yiamra_ber-lfdnr GT_yiamra_ber-posnr INTO objkey.
            ls_ibfobject-catid = 'BO'.
            ls_ibfobject-typeid = 'YIAMRAROLL'.
            ls_ibfobject-instid = objkey.
    clear v_WI_ID.
    select single WI_ID from SWW_WI2OBJ into v_WI_ID where INSTID = objkey.
           IF sy-subrc = 0.
        ls_style-fieldname = 'WORKFLOW'.
        ls_style-style = cl_gui_alv_grid=>mc_style_button.
        INSERT ls_style INTO TABLE GT_yiamra_ber-cellstyles.
    GT_yiamra_ber-anfordern = icon_workflow_event_producer.
    GT_yiamra_ber-printer = icon_print.
        GT_yiamra_ber-workflow = ICON_HISTORY.
        endif.
         ls_style-fieldname = 'TEXT' .
        ls_style-style = cl_gui_alv_grid=>mc_style_button .
        INSERT ls_style INTO TABLE gt_yiamra_ber-cellstyles.
        GT_yiamra_ber-text = ICON_DISPLAY_TEXT.
        MODIFY GT_yiamra_ber
          INDEX sy-tabix
          TRANSPORTING cellstyles Text workflow.
    endloop.
    endform.                               " d0100_set_status
    *&      Form  d0100_prepare_container
          text
    form d0100_prepare_container.
      data: ls_vari type disvariant,
            lt_fcat type lvc_t_fcat.
      DATA gr_event_handler TYPE REF TO lcl_event_handler .
    DATA IT_UI_FUNCTIONS TYPE UI_FUNCTIONS.
    APPEND '&DETAIL' TO IT_UI_FUNCTIONS.
      if g_container_d0100 is initial.
        create object g_container_d0100
                      exporting container_name = g_container_name_d0100.
        create object g_grid_d0100
                      exporting i_parent = g_container_d0100.
        CREATE OBJECT gr_event_handler .
        SET HANDLER gr_event_handler->handle_button_click FOR g_grid_d0100 .
        perform d0100_set_grid_vari changing ls_vari.
        perform d0100_set_grid_fcat changing lt_fcat.
       perform d0100_set_grid_fcat1 changing lt_fcat.
      call method g_grid_d0100->INIT_TOOLBAR
        EXPORTING
          IT_TOOLBAR_EXCLUDING = IT_UI_FUNCTIONS.
        call method g_grid_d0100->set_table_for_first_display
          EXPORTING
            is_layout       = gs_layout
            IT_TOOLBAR_EXCLUDING = IT_UI_FUNCTIONS
          CHANGING
            it_outtab       = gt_yiamra_ber[]
            it_fieldcatalog = lt_fcat.
        call method cl_gui_control=>set_focus
          EXPORTING
            control = g_grid_d0100.
      endif.
    endform.                               " d0100_prepare_container
    *&      Form  d0100_exit
          text
    form d0100_exit changing c_okcode type sy-ucomm.
      data: l_okcode like sy-ucomm.
      l_okcode = c_okcode.
      clear c_okcode.
      case l_okcode.
        when con_exit or con_back or con_canc.
          call method g_grid_d0100->free.
          call method g_container_d0100->free.
          call method cl_gui_cfw=>flush.
          clear g_container_d0100.
          clear g_grid_d0100.
          set screen 0.
          leave screen.
      endcase.
    endform.                               " d0100_exit
    *&      Form  d0100_fcode
          text
    form d0100_fcode changing c_okcode type sy-ucomm.
      data: l_okcode like sy-ucomm.
      l_okcode = c_okcode.
      clear c_okcode.
      call method cl_gui_cfw=>dispatch.
      case l_okcode.
        when con_exit or con_back or con_canc.
          call method g_container_d0100->free.
          call method cl_gui_cfw=>flush.
          clear g_container_d0100.
          clear g_grid_d0100.
          set screen 0.
          leave screen.
      endcase.
    endform.                               " d0100_fcode
    *&      Form  d0100_set_grid_fcat
          text
    form d0100_set_grid_fcat changing ct_fcat type lvc_t_fcat.
      data: ls_fcat type lvc_s_fcat.
      gs_layout-stylefname = 'CELLSTYLES'.
    *+++ STEP 1: retrieve the fieldcatalog
    call function 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
         i_structure_name       = 'YIAMRA_BER'
       CHANGING
         ct_fieldcat            = ct_fcat[]
       EXCEPTIONS
         inconsistent_interface = 1
         program_error          = 2
         others                 = 3.
    if sy-subrc eq 0.
    *+++ STEP 2: modify the fieldcatalog.
       loop at ct_fcat into ls_fcat.
      clear ls_fcat.
      ls_fcat-fieldname = 'LFDNR' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'LFDNR' .
      APPEND LS_FCAT TO CT_FCAT.
    clear ls_fcat.
      ls_fcat-fieldname = 'POSNR' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'POSNR' .
      APPEND LS_FCAT TO CT_FCAT.
       clear ls_fcat.
      ls_fcat-fieldname = 'UNAME' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'UNAME' .
      APPEND LS_FCAT TO CT_FCAT.
        clear ls_fcat.
      ls_fcat-fieldname = 'ROLLE' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'ROLLE' .
      APPEND LS_FCAT TO CT_FCAT.
          clear ls_fcat.
      ls_fcat-fieldname = 'PRCTR' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'PRCTR' .
      APPEND LS_FCAT TO CT_FCAT.
            clear ls_fcat.
      ls_fcat-fieldname = 'PRCTRGRP' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'PRCTRGRP' .
      APPEND LS_FCAT TO CT_FCAT.
              clear ls_fcat.
      ls_fcat-fieldname = 'KOSTL' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'KOSTL' .
      APPEND LS_FCAT TO CT_FCAT.
                clear ls_fcat.
      ls_fcat-fieldname = 'KOSTLGRP' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'KOSTLGRP' .
      APPEND LS_FCAT TO CT_FCAT.
              clear ls_fcat.
      ls_fcat-fieldname = 'ABRECHNST' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'ABRECHNST' .
      APPEND LS_FCAT TO CT_FCAT.
              clear ls_fcat.
      ls_fcat-fieldname = 'ANFORDERER' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'ANFORDERER' .
      APPEND LS_FCAT TO CT_FCAT.
              clear ls_fcat.
      ls_fcat-fieldname = 'DATUMNEU' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'DATUMNEU' .
      APPEND LS_FCAT TO CT_FCAT.
              clear ls_fcat.
      ls_fcat-fieldname = 'DATUMANF' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'DATUMANF' .
      APPEND LS_FCAT TO CT_FCAT.
              clear ls_fcat.
      ls_fcat-fieldname = 'STATUS' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'STATUS' .
      APPEND LS_FCAT TO CT_FCAT.
              clear ls_fcat.
      ls_fcat-fieldname = 'DATUMADM' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'DATUMADM' .
      APPEND LS_FCAT TO CT_FCAT.
              clear ls_fcat.
      ls_fcat-fieldname = 'DATUMBEG' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'DATUMBEG' .
      APPEND LS_FCAT TO CT_FCAT.
                clear ls_fcat.
      ls_fcat-fieldname = 'DATUMEND' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'DATUMEND' .
      APPEND LS_FCAT TO CT_FCAT.
      clear ls_fcat.
      ls_fcat-fieldname = 'WORKFLOW' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'WORKFLOW'.
      ls_fcat-icon = 'X'.
      APPEND LS_FCAT TO CT_FCAT.
        clear ls_fcat.
      ls_fcat-fieldname = 'TEXT' .
      ls_fcat-outputlen = '10' .
      ls_fcat-coltext = 'TEXT' .
      ls_fcat-icon = 'X'.
      APPEND LS_FCAT TO CT_FCAT.
         modify ct_fcat from ls_fcat.
       endloop.
    endif.
    endform.                               " d0100_set_grid_fcat
    *&      Form  d0100_set_grid_vari
          text
    form d0100_set_grid_vari changing cs_vari type disvariant.
    *+++ allow layout maintenance
    *+++ note report is compelling
    cs_vari-report      = .
    cs_vari-handle      = .
    cs_vari-log_group   = .
    cs_vari-username    = .
    cs_vari-variant     = .
    cs_vari-text        = .
    cs_vari-dependvars  = .
    endform.                               " d0100_set_grid_vari
    *&      Form  handle_button_click
          text
         -->P_ES_COL_ID  text
         -->P_ES_ROW_NO  text
    FORM handle_button_click  USING    P_ES_COL_ID TYPE lvc_s_col
                                       P_ES_ROW_NO TYPE lvc_s_roid.
    DATA: objkey LIKE sweinstcou-objkey.
      DATA: ls_ibfobject TYPE  sibflporb.
      DATA:  BEGIN OF ls_output OCCURS 0 .
            INCLUDE STRUCTURE yiamra_ber .
    DATA cellstyles TYPE lvc_t_styl.
    DATA text(28) TYPE c.
    DATA printer(10)   TYPE c.
    DATA workflow(13)  TYPE c.
    DATA END OF ls_output.
      READ TABLE GT_yiamra_ber INDEX p_es_row_no-row_id INTO ls_output.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
      case  P_ES_COL_ID-fieldname.
        when 'TEXT'.
          IF GT_yiamra_ber-rolle IS NOT INITIAL.
            CALL FUNCTION 'Y_I_AMRA_ROLLE_TEXT'
              EXPORTING
                i_rolle = GT_yiamra_ber-rolle.
          endif.
        when 'WORKFLOW'.
          clear: objkey.
          IF sy-subrc = 0 AND p_es_col_id-fieldname = 'WORKFLOW'.
            CONCATENATE ls_output-lfdnr ls_output-posnr INTO objkey.
            ls_ibfobject-catid = 'BO'.
            ls_ibfobject-typeid = 'YIAMRAROLL'.
            ls_ibfobject-instid = objkey.
            CALL FUNCTION 'SWI_WF_CONNECTIONS_DISPLAY'
              EXPORTING
                ibf_object         = ls_ibfobject
              EXCEPTIONS
                not_found          = 1
                no_authority       = 2
                no_workflows_found = 3
                OTHERS             = 4.
            IF sy-subrc <> 0.
              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            ENDIF.
          endif.
      endcase.
    ENDFORM.                    " handle_button_click

  • Change the funcionality y a ALV button

    Hi, I need to change the funcionality of the buttons "+" and "-" in an ALV.
    I need to throw a function when I push the button "+" or "-" (add line, delete line).
    What events do I have to use ?
    Thanks

    REUSE_ALV_GRID_DISPLAY
    The important parameters are :
    I. Export :
    i. I_callback_program : report id
    ii.<b> I_callback_pf_status_set</b> : routine where a user can set his own pf status or <b>change the functionality of the existing pf status</b>
    iii. I_callback_user_command : routine where the function codes are handled
    iv. I_structure name : name of the dictionary table
    v. Is_layout : structure to set the layout of the report
    vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE
    vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
    II. Tables :
    i. t_outtab : internal table with the data to be output
    Regards
    vasu

Maybe you are looking for

  • Csv no data found when using bind variables

    Hi, I have created a report, that uses 2 date variables to limit the query and rows display as they should. But clicking the csv link opens csv having one row stating 'No data found...'. If I set static values in place of variables, I get the right r

  • Passing data from a ListView to a TextBlock

    On my Windows Phone 8.1 RT project, I have a two-page setup, Page1.xaml and Page2.xaml. Page1.xaml has a Textblock, called p1tbl whose tapped event, p1tbl_Tapped, takes you to Page2.xaml. It has a list of countries (in a listview, and everything on t

  • [ReWire] How to use Logic's MIDI channels only

    Sorry for the rather vague subject title, but I can't come up with a better one. Let me explain the situation: I'm working on a project with several audio and MIDI tracks and also two ReWired Reason4 instruments, all routed to their corresponding Rea

  • Problem with the right and left Channel

    Hey Guys, i bought a few days ago the X-Fi Titanium PCIe Card. Now my problem:? After i installed the drivers i noticed that i can hear the sounds of the left speaker also in the right speaker of my Headphone (Sennheiser PC60). I made a channel test

  • Xi-Fi Xtreme Music and Windows Vista 32 bit driv

    I have a lot of problems with Vista driver. There is only one driver and it doesn't work correctly. Sometimes I have very bad noise, the sound skips, and it often has disturbance. When I connect the integrated sound card there are no problems. But I