Listbox in alv grid output -Possible?

Can List box or drop down box can be placed in ALV Grid(Using FM) Ouput for a field .
please clarify

Check thse two examples.
BCALV_EDIT_06
BCALV_EDIT_07
check the steps..
Re: Dopdown Listbox in ALV Grid OO Concept
and also Check this code.
also check the below threads...
List Box in ALV Grid
In ALV  list box
Dropdown list  in ALV
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7
REPORT  ZTEST1234_ALV_TOP    MESSAGE-ID ZZ                           .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_VALID TYPE C,
      V_FLAG,
      V_DATA_CHANGE,
      V_ROW TYPE LVC_S_ROW,
      V_COLUMN TYPE LVC_S_COL,
      V_ROW_NUM TYPE LVC_S_ROID.
DATA: IT_ROW_NO TYPE LVC_T_ROID,
      X_ROW_NO TYPE LVC_S_ROID.
DATA:BEGIN OF  ITAB OCCURS 0,
     VBELN LIKE LIKP-VBELN,
     POSNR LIKE LIPS-POSNR,
     CELLCOLOR TYPE LVC_T_SCOL, "required for color
     DROP(10),
     END OF ITAB.
"The Below Definitions Must.....
DATA:
* Reference to document
       DG_DYNDOC_ID       TYPE REF TO CL_DD_DOCUMENT,
* Reference to split container
       DG_SPLITTER          TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
* Reference to grid container
       DG_PARENT_GRID     TYPE REF TO CL_GUI_CONTAINER,
* Reference to html container
       DG_HTML_CNTRL        TYPE REF TO CL_GUI_HTML_VIEWER,
* Reference to html container
       DG_PARENT_HTML     TYPE REF TO CL_GUI_CONTAINER.
"up to here
*       CLASS lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER DEFINITION .
  PUBLIC SECTION .
    METHODS:
**Hot spot Handler
    HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                      IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Double Click Handler
    HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                                     IMPORTING E_ROW E_COLUMN ES_ROW_NO,
    TOP_OF_PAGE FOR EVENT TOP_OF_PAGE              "event handler
                         OF CL_GUI_ALV_GRID
                         IMPORTING E_DYNDOC_ID.
*        END_OF_LIST FOR EVENT end_of_list              "event handler
*                         OF CL_GUI_ALV_GRID
*                         IMPORTING E_DYNDOC_ID.
ENDCLASS.                    "lcl_event_handler DEFINITION
*       CLASS lcl_event_handler IMPLEMENTATION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
  METHOD HANDLE_HOTSPOT_CLICK .
    CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
    V_ROW  = E_ROW_ID.
    V_COLUMN = E_COLUMN_ID.
    V_ROW_NUM = ES_ROW_NO.
*    MESSAGE I000 WITH V_ROW 'clicked'.
    CLEAR IT_ROW_NO[].
    X_ROW_NO-ROW_ID = V_ROW.
    APPEND X_ROW_NO TO IT_ROW_NO .
    CALL METHOD G_GRID->SET_SELECTED_ROWS
      EXPORTING
        IT_ROW_NO = IT_ROW_NO.
  ENDMETHOD.                    "lcl_event_handler
*Handle Double Click
  METHOD  HANDLE_DOUBLE_CLICK.
    CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
    V_ROW  = E_ROW.
    V_COLUMN = E_COLUMN.
    V_ROW_NUM = ES_ROW_NO.
    IF E_COLUMN = 'VBELN'.
      SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
      CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
    ENDIF.
    IF E_COLUMN = 'POSNR'.
      SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
      CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN."
    ENDIF.
  ENDMETHOD.                    "handle_double_click
*  METHOD END_OF_LIST.                   "implementation
** Top-of-page event
*    PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
*  ENDMETHOD.                            "top_of_page
    METHOD TOP_OF_PAGE.                   "implementation
* Top-of-page event
    PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
  ENDMETHOD.                            "top_of_page
ENDCLASS.                    "LCL_EVENT_HANDLER IMPLEMENTATION
*&             Global Definitions
DATA:      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
            G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
DATA: OK_CODE LIKE SY-UCOMM,
      SAVE_OK LIKE SY-UCOMM,
      G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
      GS_LAYOUT TYPE LVC_S_LAYO.
data: v_lines type i.
data: v_line(3) type c.
*- Fieldcatalog for First and second Report
DATA: IT_FIELDCAT  TYPE  LVC_T_FCAT,
      X_FIELDCAT TYPE LVC_S_FCAT,
      LS_VARI  TYPE DISVARIANT.
*                START-OF_SELECTION
START-OF-SELECTION.
  SELECT VBELN
         POSNR
         FROM LIPS
         UP TO 20 ROWS
         INTO CORRESPONDING FIELDS OF TABLE ITAB.
describe table itab lines v_lines.
END-OF-SELECTION.
  IF NOT ITAB[] IS INITIAL.
    CALL SCREEN 100.
  ELSE.
    MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
  ENDIF.
*&      Form  CREATE_AND_INIT_ALV
*       text
FORM CREATE_AND_INIT_ALV .
  DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
  "attention.....from here
  "split your container here...into two parts
  "create the container
  CREATE OBJECT G_CUSTOM_CONTAINER
           EXPORTING CONTAINER_NAME = G_CONTAINER1.
  "this is for top of page
* Create TOP-Document
  CREATE OBJECT DG_DYNDOC_ID
                   EXPORTING STYLE = 'ALV_GRID'.
* Create Splitter for custom_container
  CREATE OBJECT DG_SPLITTER
             EXPORTING PARENT  = G_CUSTOM_CONTAINER
                       ROWS    = 2
                       COLUMNS = 1.
* Split the custom_container to two containers and move the reference
* to receiving containers g_parent_html and g_parent_grid
  "i am allocating the space for grid and top of page
  CALL METHOD DG_SPLITTER->GET_CONTAINER
    EXPORTING
      ROW       = 1
      COLUMN    = 1
    RECEIVING
      CONTAINER = DG_PARENT_HTML.
  CALL METHOD DG_SPLITTER->GET_CONTAINER
    EXPORTING
      ROW       = 2
      COLUMN    = 1
    RECEIVING
      CONTAINER = DG_PARENT_GRID.
*  CALL METHOD DG_SPLITTER->GET_CONTAINER
*    EXPORTING
*      ROW       = 2
*      COLUMN    = 1
*    RECEIVING
*      CONTAINER = DG_PARENT_HTML.
*  CALL METHOD DG_SPLITTER->GET_CONTAINER
*    EXPORTING
*      ROW       = 1
*      COLUMN    = 1
*    RECEIVING
*      CONTAINER = DG_PARENT_GRID.
  "you can set the height of it
* Set height for g_parent_html
  CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT
    EXPORTING
      ID     = 1
      HEIGHT = 5.
  "from here as usual..you need to specify parent as splitter part
  "which we alloted for grid
  CREATE OBJECT G_GRID
         EXPORTING I_PARENT = DG_PARENT_GRID.
* Set a titlebar for the grid control
  CLEAR GS_LAYOUT.
  GS_LAYOUT-GRID_TITLE = TEXT-003.
  GS_LAYOUT-ZEBRA = SPACE.
  GS_LAYOUT-CWIDTH_OPT = 'X'.
  GS_LAYOUT-NO_ROWMARK = 'X'.
  GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
  CALL METHOD G_GRID->REGISTER_EDIT_EVENT
    EXPORTING
      I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
  CREATE OBJECT G_HANDLER.
  SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
  SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
*  SET HANDLER G_HANDLER->END_OF_LIST FOR G_GRID.
  SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
  DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
  DATA: L_INDEX TYPE SY-TABIX.
  "Here i am changing the color of line 1,5,10...
  "so you can change the color of font conditionally
  LOOP AT ITAB.
    L_INDEX = SY-TABIX.
    IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
      LS_CELLCOLOR-FNAME = 'VBELN'.
      LS_CELLCOLOR-COLOR-COL = '6'.
      LS_CELLCOLOR-COLOR-INT = '0'.
      LS_CELLCOLOR-COLOR-INV = '1'.
      APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
      MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
      LS_CELLCOLOR-FNAME = 'POSNR'.
      LS_CELLCOLOR-COLOR-COL = '6'.
      LS_CELLCOLOR-COLOR-INT = '0'.
      LS_CELLCOLOR-COLOR-INV = '1'.
      APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
      MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
    ENDIF.
  ENDLOOP.
* setting focus for created grid control
  CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
    EXPORTING
      CONTROL = G_GRID.
* Build fieldcat and set editable for date and reason code
* edit enabled. Assign a handle for the dropdown listbox.
  PERFORM BUILD_FIELDCAT.
  PERFORM  SET_DRDN_TABLE.
* Optionally restrict generic functions to 'change only'.
*   (The user shall not be able to add new lines).
  PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
  LS_VARI-REPORT      = SY-REPID.
  LS_VARI-HANDLE      = SPACE.
  LS_VARI-LOG_GROUP   = SPACE.
  LS_VARI-USERNAME    = SPACE.
  LS_VARI-VARIANT     = SPACE.
  LS_VARI-TEXT        = SPACE.
  LS_VARI-DEPENDVARS  = SPACE.
**Calling the Method for ALV output
  CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
      IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
      IS_VARIANT           = LS_VARI
      IS_LAYOUT            = GS_LAYOUT
      I_SAVE               = 'A'
    CHANGING
      IT_FIELDCATALOG      = IT_FIELDCAT
      IT_OUTTAB            = ITAB[].
  "do these..{
* Initializing document
  CALL METHOD DG_DYNDOC_ID->INITIALIZE_DOCUMENT.
* Processing events
  CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
    EXPORTING
      I_EVENT_NAME = 'TOP_OF_PAGE'
      I_DYNDOC_ID  = DG_DYNDOC_ID.
  "end }
* Set editable cells to ready for input initially
  CALL METHOD G_GRID->SET_READY_FOR_INPUT
    EXPORTING
      I_READY_FOR_INPUT = 1.
ENDFORM.                               "CREATE_AND_INIT_ALV
*&      Form  EXCLUDE_TB_FUNCTIONS
*       text
*      -->PT_EXCLUDE text
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
* Only allow to change data not to create new entries (exclude
* generic functions).
  DATA LS_EXCLUDE TYPE UI_FUNC.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
*&      Form  build_fieldcat
*       Fieldcatalog
FORM BUILD_FIELDCAT .
  DATA: L_POS TYPE I.
  L_POS = L_POS + 1.
  X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
  X_FIELDCAT-FIELDNAME = 'VBELN'.
  X_FIELDCAT-TABNAME = 'IT_FINAL'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-NO_ZERO    = 'X'.
  X_FIELDCAT-OUTPUTLEN = '10'.
  X_FIELDCAT-HOTSPOT = 'X'.
  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.
  L_POS = L_POS + 1.
  X_FIELDCAT-SCRTEXT_M = 'Item'(025).
  X_FIELDCAT-FIELDNAME = 'POSNR'.
  X_FIELDCAT-TABNAME = 'IT_FINAL'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-OUTPUTLEN = '5'.
  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.
  L_POS = L_POS + 1.
  X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
  X_FIELDCAT-FIELDNAME = 'DROP'.
  X_FIELDCAT-TABNAME = 'IT_FINAL'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-OUTPUTLEN = '5'.
  X_FIELDCAT-EDIT = 'X'.
  X_FIELDCAT-DRDN_HNDL = '1'.
  X_FIELDCAT-DRDN_ALIAS = 'X'.
  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.
ENDFORM.                    " build_fieldcat
*&      Module  STATUS_0100  OUTPUT
*       text
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'MAIN100'.
  SET TITLEBAR 'MAIN100'.
  IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
    PERFORM CREATE_AND_INIT_ALV.
  ENDIF.
ENDMODULE.                 " STATUS_0100  OUTPUT
*&      Module  USER_COMMAND_0100  INPUT
*       text
MODULE USER_COMMAND_0100 INPUT.
  CASE SY-UCOMM.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
*&      Form  SET_DRDN_TABLE
*       text
FORM SET_DRDN_TABLE.
  DATA:LT_DRAL TYPE LVC_T_DRAL,
        LS_DRAL TYPE LVC_S_DRAL.
  LOOP AT ITAB .
* First listbox (handle '1').
    IF SY-INDEX = 1.
      LS_DRAL-HANDLE = '1'.
      LS_DRAL-VALUE =  ' '.
      LS_DRAL-INT_VALUE =  ' '.
    ELSE.
      LS_DRAL-HANDLE = '1'.
      LS_DRAL-VALUE =  ITAB-POSNR.
      LS_DRAL-INT_VALUE =  ITAB-POSNR.
    ENDIF.
    APPEND LS_DRAL TO LT_DRAL.
  ENDLOOP.
**Setting the Drop down table for Reason Code
  CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
    EXPORTING
      IT_DROP_DOWN_ALIAS = LT_DRAL.
ENDFORM.                               " set_drdn_table
*&      Form  EVENT_TOP_OF_PAGE
*       text
*      -->DG_DYNDOC_ID  text
FORM EVENT_TOP_OF_PAGE USING   DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT.
  "this is more clear.....check it
  "first add text, then pass it to comentry write fm
  DATA : DL_TEXT(255) TYPE C.  "Text
* Populating header to top-of-page
  CALL METHOD DG_DYNDOC_ID->ADD_TEXT
    EXPORTING
      TEXT      = 'Test Report'
      SAP_STYLE = CL_DD_AREA=>HEADING.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.
  CLEAR : DL_TEXT.
* Move program ID
  CONCATENATE 'Program Name :' SY-REPID
         INTO DL_TEXT SEPARATED BY SPACE.
* Add Program Name to Document
  PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.
  CLEAR : DL_TEXT.
* Move User ID
  CONCATENATE 'User ID :' SY-UNAME INTO DL_TEXT SEPARATED BY SPACE
* Add User ID to Document
  PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.
  CLEAR : DL_TEXT.
* Move count (no of records).
  move v_lines to v_line.
  CONCATENATE 'No of records :' v_line INTO DL_TEXT SEPARATED BY SPACE.
* Add Client to Document
  PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.
  CLEAR : DL_TEXT.
* Move date
  WRITE SY-DATUM TO DL_TEXT.
  CONCATENATE 'Date :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
* Add Date to Document
  PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.
  CLEAR : DL_TEXT.
* Move time
  WRITE SY-UZEIT TO DL_TEXT.
  CONCATENATE 'Time :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
* Add Time to Document
  PERFORM ADD_TEXT USING DL_TEXT.
* Add new-line
  CALL METHOD DG_DYNDOC_ID->NEW_LINE.
* Populating data to html control
  PERFORM HTML.
ENDFORM.                    " EVENT_TOP_OF_PAGE
*&      Form  ADD_TEXT
*       To add Text
FORM ADD_TEXT USING P_TEXT TYPE SDYDO_TEXT_ELEMENT.
* Adding text
  CALL METHOD DG_DYNDOC_ID->ADD_TEXT
    EXPORTING
      TEXT         = P_TEXT
      SAP_EMPHASIS = CL_DD_AREA=>HEADING.
ENDFORM.                    " ADD_TEXT
*&      Form  HTML
*       text
FORM HTML.
  DATA : DL_LENGTH  TYPE I,                           " Length
         DL_BACKGROUND_ID TYPE SDYDO_KEY VALUE SPACE. " Background_id
* Creating html control
  IF DG_HTML_CNTRL IS INITIAL.
    CREATE OBJECT DG_HTML_CNTRL
         EXPORTING
              PARENT    = DG_PARENT_HTML.
  ENDIF.
* Reuse_alv_grid_commentary_set
  CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET'
    EXPORTING
      DOCUMENT = DG_DYNDOC_ID
      BOTTOM   = SPACE
    IMPORTING
      LENGTH   = DL_LENGTH.
* Get TOP->HTML_TABLE ready
  CALL METHOD DG_DYNDOC_ID->MERGE_DOCUMENT.
* Set wallpaper
  CALL METHOD DG_DYNDOC_ID->SET_DOCUMENT_BACKGROUND
    EXPORTING
      PICTURE_ID = DL_BACKGROUND_ID.
* Connect TOP document to HTML-Control
  DG_DYNDOC_ID->HTML_CONTROL = DG_HTML_CNTRL.
* Display TOP document
  CALL METHOD DG_DYNDOC_ID->DISPLAY_DOCUMENT
    EXPORTING
      REUSE_CONTROL      = 'X'
      PARENT             = DG_PARENT_HTML
    EXCEPTIONS
      HTML_DISPLAY_ERROR = 1.
  IF SY-SUBRC NE 0.
    MESSAGE I999 WITH 'Error in displaying top-of-page'(036).
  ENDIF.
ENDFORM.                    " HTML

Similar Messages

  • Need to choose fields from alv grid output and send mail

    Hi,
    I need to choose few orders from alv grid output and send mail as PDF for chosen orders.
    Suggest if possible and how.

    Moderator message - Please do not post your requirements and ask the forum to do your work for you - post locked
    Rob

  • Set cursor in ALV grid output

    Hi guys,
    I generated a report which gives out put in ALV grid.
    In the ALV grid output, I have some editable fields.
    Lets suppose, there are some editable fields with no data in it.
    I have userdefined pushbutton in Application toolbar, when I press the pushbutton the cursor should go to the empty field in the ALV grid output.
    Can this be possible through SET CURSOR statement?
    Thanks,
    Shivaa......

    Hi,
        You can set the cursor field on the output list that too for the output fields which are vissible on the screen only.
    syntax
    SET CURSOR 11 3.   ---> 11Coloumn and 3 line
    for dynamically setting cursor, first you have to search for the empty fields then set the cursor dynamically.
    look at this help document it might be helpful
    http://help.sap.com/saphelp_nw70/helpdata/EN/9f/dba47e35c111d1829f0000e829fbfe/content.htm
    Regards
    Bala KRishna

  • F4 - Help for field in ALV Grid Output

    Hi,
    I generated a report which gives output in ALV Grid output.
    In the output, 1 of the field is editable.Here, for this field I need to have my own F4-Help.
    I think the procedure to be followed is:--
    Create a Search Help in SE11.
    Link the Search Help to the editable field.
    Please let me know if its the correct procedure.
    I f yes, how can I link user defined Search Help to the editable field?
    Thanks,
    Shivaa........

    Hi siva,
    you can also do that way.
    while filling the fieldcatalog use the parameter F4AVAILABL
    for more info check
    F4 help in ALV Grid...
    f4 help for a field in alv grid
    hope it helps you
    Thanks!
    Edited by: Prasanth on Mar 6, 2009 3:59 PM

  • How to send the ALV GRID output to spool by using the print button in std t

    How to send the ALV GRID output to spool by using the print button in standard tool bar.
    We have created a button in the va02 transaction.  If user click on the button the new screen will be display on that screen we are populating the alv grid output using the oops concept.  But i am unable to send the output to spool using the print button in the standard tool bar.
    I am able to display the Print parameter dialog box but i am not able to send it to spool.
    Kindly help.
    Thanks In Advance.
    G.V.Ramana

    Hi Shaik,
    There is not properties button in my print screen.
    MODULE user_command_0900 INPUT.
        WHEN 'EXCEL'.
          PERFORM excel_download.                              
        WHEN 'PRI'.
          PERFORM print_output.
    form Print_output.
    CALL FUNCTION 'RSPO_LIST_LAYOUT_FITS'
               EXPORTING
                    columns        = 80
                    device         = 'ANY '
                    lines          = 65
                    maxpenality    = 1999
               TABLES
                    layouts        = lt_layouts1
               EXCEPTIONS
                    unknown_device = 1
                    OTHERS         = 2.
          IF sy-subrc = 0.
            LOOP AT lt_layouts1.
              IF lt_layouts1-penality < 1000        AND
                 lt_layouts1-penality < l_min_penality.
                l_layout       = lt_layouts1-layout.
                l_min_penality = lt_layouts1-penality.
              ENDIF.
            ENDLOOP.
            IF NOT l_layout IS INITIAL.
              CALL FUNCTION 'GET_PRINT_PARAMETERS'
                   EXPORTING
                        mode                   = 'CURRENT'
                        line_size              = 80             "#EC *
                new_list_id            = l_new_list_id
                        no_dialog              = l_no_dialog
                        layout                 = l_layout
                   IMPORTING
                        out_archive_parameters = rs_arc_params
                        out_parameters         = rs_pri_params
                        valid                  = l_valid
                   EXCEPTIONS
                        archive_info_not_found = 1
                        invalid_print_params   = 2
                        invalid_archive_params = 3
                        OTHERS                 = 4.
              IF sy-subrc NE 0.                                 " INS SLIN
              ENDIF.                                            " INS SLIN
              IF rs_pri_params-linsz LT 80 OR
                 rs_pri_params-linsz LT gt_stack-s_lprint-width.
                gt_stack-print_line_break = 'X'.
              ELSE.
                CLEAR gt_stack-print_line_break.
              ENDIF.
              IF l_valid NE 'X'.
                rs_pri_params = ls_pri_params_sav.
                rs_arc_params = ls_arc_params_sav.
              ENDIF.
            ENDIF.
          ENDIF.
    endform.                    " Print_output
        CALL METHOD gv_cost_tot_alv_grand->set_table_for_first_display
                EXPORTING
                   is_layout         = gs_layout_cost_tot_grand
                CHANGING
                   it_fieldcatalog   = gt_fcat_cost_tot_grand[]
                   it_outtab         = gt_cost_tot_grand[].
    Please check my code

  • In ME2N  report for PO- How to get or add Vendor name in ALV grid output

    Hl Everyone
    How to get  or add Vendor Name and payment terms in the ALV grid output for the follwing reports like ME2N and ME2V.
    cuurently i am in 4.7 E version.
    Kindly suggest..........
    thanks in advance
    Regards
    Prashanth

    Hi Pankaj
    I knew that vendor name field is avaiable in ECC versions, but how to get the same field(vendor name) in 4.7 E vesion.
    Kindly suggest
    Regards
    Prashanth

  • How to download alv grid output(with field catalog) into excel file format

    Hi all,
    How to download alv grid output(with field catalogs) into excel file format and same file has to download to application server.
    Please help.
    Regards,
    Satya.

    Hi,
    On list where alv is displayed, select export icon( green color -> ),select spread sheet.
    This will display records in Excel sheet.

  • ALV Grid output

    Hi,
    I have one issue on ALV Grid output.
    Some times we will not have any values to display in ALV Grid output.
    In such cases we usually have to display 'No Data found' in report output message(Below report header).
    How to acheive this as all my ALV grid fields are of less length.
    Note: Message should be displayed below ALV Header (Where we usually get 1st record to be displayed).
    What is the solution for the same!
    Thanks,
    Deep.

    Hello Deep,
    You can try with,
    MESSATE 'Data not Found' TYPE 'I'.
    Bye
    Gabriel P.-

  • How to append ALV grid output to LIST output

    Hi,
    I am working with Basis AUDIT MANUAL report for which i have to integrate around 50 standard transactions (SM37,SM35...etc) output and make it into one single report.
    On execution of my report i have to get all the 50 transaction outputs sequentially.
    Some standard transactions have ALV list display output and some have GRID display.I can able to append only list outputs by submit program and exporting list to memory.
    Please suggest me how to get Alv grid output in midst of list output.
    Regards
    Kalpana.

    You should post your question to the ABAP forum:
    ABAP Development

  • Push Button in Every record in ALV grid output

    Dear Experts,
    I need to print a push button in first column of every record in ALV grid output. How ?
    No OOPS concepts please.
    Thanks,
    Siva.

    For this requirement, you have to copy the standard PF status of the ALV output. Do as below :-
    1) Go to SE41
    2) Enter the program name as SAPLKKBL
    3) In the field status enter STANDARD_FULLSCREEN
    4) Click on STATUS button on the application toolbar.
    5) Enter the name of your Program & a new status name.
    6) Click on COPY.
    This way the standard status will be copied to the custom status & call the same status in your program using SET PF STATUS statement. Then double click on the custom status name & you will be navigated to SE41, there you can add you new button on the application tool bar & assign a function code, which you can program by enabling the export parameter I_CALLBACK_USER_COMMAND of the Function module REUSE_ALV_GRID_DISPLAY.
    Just a sample code snippet for your reference :-
    FORM USER_COMMAND USING L_UCOMM LIKE SY-UCOMM
    LS_SELFIELD TYPE SLIS_SELFIELD.
    CASE L_UCOMM.
    WHEN 'your function code goes here'.
    Do further processing.
    This way you will have the standard PF status alongwith your button as well.
    Edited by: Kumar Manas Mishra on Jan 29, 2010 1:03 PM

  • Displaying the selected rows in ALV Grid output

    Hi Experts,
    I am developing one interactive ALV Grid report where user can process the selected records/rows from the ALV Grid output.
    for displaying the ALV Grid, I have used the class CL_GUI_ALV_GRID class. I am working on ECC 6.0 system.
    when I select any records/rows from output and then press any Application Toolbar button, PAI and then PBO modules of the screen gets executed as per the normal flow.
    however After PBO, when same ALV output comes, all the selected/highlighted rows appear as unselected, that means I want to retain the ALV
    rows selection during the round trip.
    please advise.
    Regards,
    Jagesh

    Hi,
    Feiyun Wu is correct.
    Get_selected_rows and set_selected_rows are the methods to be used .
    Some code:
    Note the sequence of code:
    FORM set_gui_alv_grid_1 .
      DATA: wa_layout TYPE lvc_s_layo ,
            wa_print TYPE lvc_s_prnt .
      DATA: it_sort TYPE lvc_t_sort ,
            wa_sort TYPE LINE OF lvc_t_sort .
      DATA: it_fieldcatalog TYPE lvc_t_fcat.
      IF gui_custom_container_1 IS INITIAL .
        CREATE OBJECT gui_custom_container_1
          EXPORTING
            container_name = 'GUI_CUSTOM_CONTAINER_1'
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6 .
        IF sy-subrc <> 0.
        ENDIF.
        PERFORM get_field_catalog
          USING gc_log_group_1
          CHANGING it_fieldcatalog  .
        CREATE OBJECT gui_alv_grid_1
          EXPORTING i_parent = gui_custom_container_1.
        CREATE OBJECT ob_event_receiver_1
          EXPORTING log_group = gc_log_group_1 .
    * registers the event handlers
        SET HANDLER ob_event_receiver_1->handle_toolbar      FOR gui_alv_grid_1 .
        SET HANDLER ob_event_receiver_1->handle_user_command FOR gui_alv_grid_1 .
        SET HANDLER ob_event_receiver_1->print_top_of_page   FOR gui_alv_grid_1 .
        SET HANDLER ob_event_receiver_1->hotspot_click       FOR gui_alv_grid_1 .
        wa_layout-cwidth_opt = abap_true .
    *   wa_layout-excp_fname = gc_excp_fname .
    *   wa_layout-ctab_fname = gc_ctab_fname.
    *   wa_layout-excp_led   = abap_true .
        CALL METHOD gui_alv_grid_1->set_table_for_first_display
          EXPORTING
            is_layout       = wa_layout
            is_print        = wa_print
            i_save          = 'A'
            is_variant      = gs_disvariant_1
          CHANGING
            it_sort         = it_sort
            it_fieldcatalog = it_fieldcatalog
            it_outtab       = it_alv_grid_1.
      ELSE .
        CALL METHOD gui_alv_grid_1->refresh_table_display.
    * Restore selections
        CALL METHOD gui_alv_grid_1->set_selected_rows
          EXPORTING
            it_index_rows = ob_event_receiver_1->it_rows.
    * Restore position
        CALL METHOD gui_alv_grid_1->set_scroll_info_via_id
          EXPORTING
            is_col_info = ob_event_receiver_1->wa_col
            is_row_no   = ob_event_receiver_1->wa_roid.
      ENDIF.
    ENDFORM .                    "set_gui_alv_grid_1
    Regards.

  • Hide a Column in ALV Grid Output

    Hi,
    I want to hide a column in ALV Grid Output through program.
    I am using   lwa_fieldcat-NO_OUT = 'X'. to hide the column in output but it is not working, column in not hided in the output.
    Kindly suggest.

    It should work..
    see the code :
    d_fieldcat_wa-fieldname = 'MATNR'.
    d_fieldcat_wa-seltext_l = 'material number'.
    d_fieldcat_wa-no_out = 'X'. * hide particular field
    append d_fieldcat_wa to d_fieldcat.
    clear d_fieldcat_wa.
    if not please paste your code here.
    Thanks
    Seshu

  • Bold line in ALv grid output

    Hi,
    I want show few line item informations in bold in ALV grid output.
    Please let me know your suggestions.

    You may check the below links.
    some methods to achieve this is mentioned out there.
    Re: BOLD cell in ALV.
    Re: ALV Row should apper in BOLD when order type is "ZSTP1" in the cloumn
    Regards,
    Anil

  • Color in ALV grid output based on condition

    Hi,
    I have generated a ALV Grid output.
    I have a internal table ITAB1. It has 2 fields - field1 and field2.
    Now, my requirement is if field1 is 'X', the row should be colored in RED, else if field1 is 'Y', the row should be colored in GREEN.
    How can it be done?
    Thanks,
    Shivaa.........

    Hi,
    add another field in the internal table with the type of char04.
    use the code given below....
    DATA : begin of itab occurs 0,
                  field1(10) type c,
                  field2(10) type c,
                  color(4) type c,
              end of itab.
    " fetch records in itab..
    loop at itab.
      if itab-field1 = 'X'.
          itab-color = 'C700'.         " Trial and error to get the color you want...
      elseif itab-field1 = 'Y'.
          itab-color = 'C300'.         " Trial and error to get the color you want...
      endif.
    endloop.
      fs_fcat-fieldname = 'FIELD1'.
      fs_fcat-col_pos = 1.
      fs_fcat-coltext = 'FIRST FIELD'.
      APPEND fs_fcat TO t_fcat.
      fs_fcat-fieldname = 'FIELD2'.
      fs_fcat-col_pos = 2.
      fs_fcat-coltext = 'SECOND FIELD'.
      APPEND fs_fcat TO t_fcat.
        fs_layo-sel_mode = 'A'.
        fs_layo-INFO_FNAME = 'COLOR'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
        EXPORTING
          i_callback_program    = sy_cprog
          is_layout_lvc         = fs_layo
          it_fieldcat_lvc       = t_fcat
        TABLES
          t_outtab              = itab
        EXCEPTIONS
          program_error         = 1
          OTHERS                = 2.
    This resolves you issue....
    Cheers,
    Siddarth

  • Menu in ALV grid output

    Hi all,
    Iam in need of a code that may help me out to get my cuztomized menu for my alv grid output.
    Please give your suggestions,
    Thanks,
    Rajesh.

    Hello Rajesh,
    First copy the standard ALV GUI Status STANDARD_FULLSCREEN to an ZSTANDARD_FULLSCREEN and make ur changes.
    FOr this u have
    DATA:g_callback_user_command TYPE slis_formname,
    g_callback_pf_status_set TYPE slis_formname.
    g_callback_pf_status_set = 'ZSTANDARD_FULLSCREEN'.
    g_callback_user_command = 'ALV_USER_COMMAND'.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
           I_INTERFACE_CHECK              = ' '
           I_BYPASSING_BUFFER             =
           I_BUFFER_ACTIVE                = ' '
         i_callback_program             = g_progname
         i_callback_pf_status_set       =
    g_callback_pf_status_set
    i_callback_user_command = g_callback_user_command       I_STRUCTURE_NAME               =
         is_layout                      = g_r_layout
         it_fieldcat                    = g_t_fieldcat
           IT_EXCLUDING                   =
           IT_SPECIAL_GROUPS              =
           IT_SORT                        =
           IT_FILTER                      =
           IS_SEL_HIDE                    =
           I_DEFAULT                      = 'X'
            i_save                         = 'A'
           IS_VARIANT                     =
           IT_EVENTS                      =
           IT_EVENT_EXIT                  =
         is_print                       = g_r_print
           IS_REPREP_ID                   =
            i_screen_start_column          = g_screen_start_column
            i_screen_start_line            = g_screen_start_line
            i_screen_end_column            = g_screen_end_column
            i_screen_end_line              = g_screen_end_line
         IMPORTING
           E_EXIT_CAUSED_BY_CALLER        =
           ES_EXIT_CAUSED_BY_USER         =
        TABLES
          t_outtab                       = p_t_liste
       EXCEPTIONS
         program_error                  = 1
         OTHERS                         = 2
    FORM alv_user_command USING r_ucomm     LIKE sy-ucomm
                                rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&IC1'.
    *--- Hotspot selektion
          CASE rs_selfield-sel_tab_field.
    *------ Material
            WHEN 'T_MAT-MATNR'.
              READ TABLE t_mat INDEX rs_selfield-tabindex.
              PERFORM call_mm02 USING t_mat-matnr.
            WHEN 'G_T_LISTE-PSPID' OR 'G_T_HEADER-PSPID'.
    *------ Projekt
    Click auf Projekt -> Projekt anzeigen (CJ20)
              SET PARAMETER ID 'PSP' FIELD rs_selfield-value.
              SET PARAMETER ID 'PRO' FIELD space.
              CALL TRANSACTION 'CJ20' AND SKIP FIRST SCREEN.
            WHEN 'G_T_LISTE-POSID'.
    *------ PSP-Element
    Click auf PSP Element -> PSP Element anzeigen (CJ12)
              SET PARAMETER ID 'PSP' FIELD space.
              SET PARAMETER ID 'PRO' FIELD rs_selfield-value.
              CALL TRANSACTION 'CJ12' AND SKIP FIRST SCREEN.
            WHEN 'G_T_LISTE-STTXT_INT'.
    *------ Systemstatus
             g_sttxt_int = rs_selfield-value.
    G_T_LEGENDE erfüllen
             PERFORM f_fill_g_t_legende_int.
             g_r_layout-window_titlebar = 'Systemstatus'(004).
             PERFORM f_status_legende_popup.
            WHEN 'G_T_LISTE-STTXT_EXT'.
    *------ Anwenderstatus
             g_sttxt_ext = rs_selfield-value.
    G_T_LEGENDE erfüllen
             PERFORM f_fill_g_t_legende_ext.
             g_r_layout-window_titlebar = 'Anwenderstatus'(005).
             PERFORM f_status_legende_popup.
            WHEN 'G_T_LISTE-ICON'.
    *------ Status Detail
             PERFORM f_fill_g_t_status_detail USING rs_selfield-tabindex.
             PERFORM f_status_detail_popup.
          ENDCASE.
        WHEN 'MTNR'.
          READ TABLE t_mat INDEX rs_selfield-tabindex.
          PERFORM call_mm02 USING t_mat-matnr.
        WHEN 'INFO'.
          READ TABLE t_mat INDEX rs_selfield-tabindex.
          CALL SCREEN 900 STARTING AT 20 5
                          ENDING AT 100 20.
      ENDCASE.
    ENDFORM. "ALV_USER_COMMAND
    Hope this will solve ur problem.
    Reward if helps.
    Vasanth
    Message was edited by: Vasanth M

Maybe you are looking for

  • Reg Module for ANSI 12 in Sender AS2 in PI7.4

    Hi Experts, I am facing the below error while testing a Scenario with Sender as AS2.I have configured a Sender Party which is the receiver id for the trading partner (AS2). I have added the module as localejbs/X12ConverterModule and given the paramet

  • Brightcove video through BM

    Hello all, I am having an issue with brightcove media. Brightcove.com provide media for sites like the history channel. When we visit the site, the prview of the video comes up but we can not get the actual videos. It seems to be any site that uses f

  • Append 'RH_STRUC_GET' FM result

    Does anyone knows, how to append 2 result from the FM 'RH_STRUC_GET' ?? Thanks for your help quentin

  • Importing jobs from CPS M33 to M28.44 failed

    Hi, Jobs in version M33.69 had new fields such as EquivalentObject and KeepForce which aren't in the old M28.44 version. We upgraded our development environment in version M33.69 last week and are still checking new features before upgrading producti

  • Something is wrong with my inbox

    I have an iPod touch 5th generation and my inbox says that I have 12 mail and when I check I have nothing even when I refresh and even when I turn my iPod off and on, please help, what do I do?