Grid Format in JSP

I just wanted to know whether any Grid form is available in JSP to display the result from the database as we do in VB.

This is the code for database grid control
<PRE lang=jsp id=pre2 style="MARGIN-TOP: 0px" nd="109"><%@ taglib uri="/WEB-INF/tags/datagrid.tld" prefix="grd" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="com.freeware.gridtag.*" %>
<%
int intCurr = 1;
int intSortOrd = 0;
String strTmp = null;
String strSQL = null;
String strSortCol = null;
String strSortOrd = "ASC";
boolean blnSortAsc = true;
strSQL = "SELECT CLICORPORATION, CLICLIENT, CLIDESCRIPTION, " +
         "CLIENABLED, CLIUPDSTAMP FROM CLIENTMASTER ";
Connection objCnn    = null;
Class      objDrvCls = null;
objDrvCls = Class.forName("oracle.jdbc.driver.OracleDriver");
objCnn = DriverManager.getConnection("<A class=iAs style="FONT-WEIGHT: normal; FONT-SIZE: 100%; PADDING-BOTTOM: 1px; COLOR: darkgreen; BORDER-BOTTOM: darkgreen 0.07em solid; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" href="#" target=_blank itxtdid="3346226">jdbc</A>:oracle:thin:@Host:port:sid",
                                     "cashincpri", "cashincpri");
if (objDrvCls != null) objDrvCls = null;
strTmp = request.getParameter("txtCurr");
try
  if (strTmp != null)
  intCurr = Integer.parseInt(strTmp);
catch (NumberFormatException NFEx)
strSortCol = request.getParameter("txtSortCol");
strSortOrd = request.getParameter("txtSortAsc");
if (strSortCol == null) strSortCol = "CLICLIENT";
if (strSortOrd == null) strSortOrd = "ASC";
blnSortAsc = (strSortOrd.equals("ASC"));
%>
<html>
<head>
<title>Grid Tag Demonstration</title>
<link REL="StyleSheet" HREF="css/GridStyle.css">
<script LANGUAGE="javascript">
function doNavigate(pstrWhere, pintTot)
  var strTmp;
  var intPg;
  strTmp = document.frmMain.txtCurr.value;
  intPg = parseInt(strTmp);
  if (isNaN(intPg)) intPg = 1;
  if ((pstrWhere == 'F' || pstrWhere == 'P') && intPg == 1)
    alert("You are already viewing first page!");
    return;
  else if ((pstrWhere == 'N' || pstrWhere == 'L') && intPg == pintTot)
    alert("You are already viewing last page!");
    return;
  if (pstrWhere == 'F')
    intPg = 1;
  else if (pstrWhere == 'P')
    intPg = intPg - 1;
  else if (pstrWhere == 'N')
    intPg = intPg + 1;
  else if (pstrWhere == 'L')
    intPg = pintTot;
  if (intPg < 1) intPg = 1;
  if (intPg > pintTot) intPg = pintTot;
  document.frmMain.txtCurr.value = intPg;
  document.frmMain.submit();
function doSort(pstrFld, pstrOrd)
  document.frmMain.txtSortCol.value = pstrFld;
  document.frmMain.txtSortAsc.value = pstrOrd;
  document.frmMain.submit();
</script>
</head>
<body>
<h2>Grid Example</h2>
<form NAME="frmMain" METHOD="post">
<grd:dbgrid id="tblStat" name="tblStat" width="100" pageSize="10"
    currentPage="<%=intCurr%>" border="0" cellSpacing="1" cellPadding="2"
    dataMember="<%=strSQL%>" dataSource="<%=objCnn%>" cssClass="gridTable">
<grd:gridpager imgFirst="images/First.gif" imgPrevious="images/Previous.gif"
      imgNext="images/Next.gif" imgLast="images/Last.gif"/>
<grd:gridsorter sortColumn="<%=strSortCol%>" sortAscending="<%=blnSortAsc%>"/>
<grd:rownumcolumn headerText="#" width="5" HAlign="right"/>
<grd:imagecolumn headerText="" width="5" HAlign="center"
      imageSrc="images/Edit.gif"
      linkUrl="javascript:doEdit('{CLICORPORATION}', '{CLICLIENT}')"
      imageBorder="0" imageWidth="16" imageHeight="16"
      alterText="Click to edit"/>
<grd:textcolumn dataField="CLICLIENT" headerText="Client"
      width="10" sortable="true"/>
<grd:textcolumn dataField="CLIDESCRIPTION" headerText="Description"
      width="50" sortable="true"/>
<grd:decodecolumn dataField="CLIENABLED" headerText="Enabled" width="10"
      decodeValues="Y,N" displayValues="Yes,No" valueSeperator=","/>
<grd:datecolumn dataField="CLIUPDSTAMP" headerText="Last Updated"
      dataFormat="dd/MM/yyyy HH:mm:ss" width="20"/>
</grd:dbgrid>
<input TYPE="hidden" NAME="txtCurr" VALUE="<%=intCurr%>">
<input TYPE="hidden" NAME="txtSortCol" VALUE="<%=strSortCol%>">
<input TYPE="hidden" NAME="txtSortAsc" VALUE="<%=strSortOrd%>">
</form>
</body>
</html>
<%
try
    if (objCnn != null)
        objCnn.close();
catch (SQLException SQLExIgnore)
if (objCnn != null) objCnn = null;
%>
</PRE>

Similar Messages

  • ALV GRID FORMAT IN BACKGROUND

    Dear All,
             There is t code called MB51 which the user use, we recommend them to execute that report in the background using this method -- t code-- execute in background--- enter the printer name and generate the temporary spool to veiw the report, however when we veiw that report using spo2, the <b>tool bar</b> (that comes when we execute  in the foreround) is missing, which is used to veiw it in the ALV grid format, actually the user easily select the feilds in that format and download them to excel sheets, in the background that <b>" Details"</b> <b>option</b> is not there, is there any work around for this.
    Thanks,..
    Ravi.

    Hi Clemens,
    Thanks for that valuable suggestion, atleast I got a direction to think about, so from here on its gotta be xml...
    But, since I have no idea about xml coding, also I went through those 2 links you had sent, but I'm still unable to understand the following points:
    1.How do I generate the xml code, relevant to formatting that I did in ALV Grid using the FM "REUSE_ALV_GRID_DISPLAY"?
    2. How do I go about saving the xml file onto the Application server?
    3. Can you please provide any sample ALV report code, where such XML formatting has been used?
    Thanks in advance.
    Regards,
    Azeem Ahmed Matte

  • Regarding downlaod the output from ALV grid format

    Hi 
    i want to download the output ALV grid format into excel sheet .
    but condition is when ever user press the button (&ZDL) the should be downloaded.
    and also how to convert the output into CSV format.

    hi,
    when '&ZDL'.
    use this condition
    check this one for down loading
    try to download an ALV report in excel format using (list ->export -> local file-> soread sheet )
    Re: advantages of alv reports
    Excel Download to ALV report
    hi this is full program
    REPORT ZCR_BOMPLANT_DOWNLOAD.
    TABLES : MAST , "Material to BOM Link
    STKO , "BOM Header
    MARA . "General Material Data
    TYPES : BEGIN OF TY_MASTER ,
    MATNR TYPE MAST-MATNR , "Material Number
    WERKS TYPE MAST-WERKS , "Plant
    STLAN TYPE MAST-STLAN , "BOM Usage
    STLNR TYPE MAST-STLNR , "Bill of material
    STLAL TYPE MAST-STLAL , "Alternative BOM
    ANDAT TYPE MAST-ANDAT , "Date record created on
    AEDAT TYPE MAST-AEDAT , "Date of Last Change
    AENAM TYPE MAST-AENAM , "Name of Person Who Changed Object
    STLST TYPE STKO-STLST , "BOM status
    ZPLP1 TYPE MBEW-ZPLP1 , "Future Planned Price 1
    DWERK TYPE MVKE-DWERK , "Delivering Plant (Own or External)
    END OF TY_MASTER .
    TYPES : MY_TYPE(20) TYPE C.
    DATA : IT_MASTER TYPE STANDARD TABLE OF TY_MASTER,
    WA_MASTER TYPE TY_MASTER .
    DATA : IT_HEADER TYPE TABLE OF MY_TYPE.
    DATA : W_PTH TYPE RLGRAP-FILENAME.
    DATA : W_FILE TYPE RLGRAP-FILENAME.
    *--- Add Header Fields to Header Table ---
    APPEND 'Material Number' TO IT_HEADER .
    APPEND 'Plant' TO IT_HEADER .
    APPEND 'BOM Usage' TO IT_HEADER .
    APPEND 'Bill Code' TO IT_HEADER .
    APPEND 'Alternative BOM' TO IT_HEADER .
    APPEND 'Created On' TO IT_HEADER .
    APPEND 'Changed On' TO IT_HEADER .
    APPEND 'Changed By' TO IT_HEADER .
    APPEND 'BOM Status' TO IT_HEADER .
    APPEND 'Planned Price' TO IT_HEADER .
    APPEND 'Delivery Plant' TO IT_HEADER .
    IF SY-MANDT = '700'.
    W_PTH = '
    lkdb01\ISD\IS\Software Developments\Developments\Data Files\SAP Dumps\BOM_Available\'.
    ELSE.
    W_PTH = 'C:\'.
    ENDIF.
    START-OF-SELECTION.
    *--- Load Data to Internal Table ---
    SELECT MASTMATNR MASTWERKS MASTSTLAN MASTSTLNR MASTSTLAL MASTANDAT MASTAEDAT MASTAENAM STKO~STLST
    INTO TABLE IT_MASTER
    FROM MAST
    INNER JOIN STKO ON STKOSTLNR EQ MASTSTLNR
    AND STKOSTLAL EQ MASTSTLAL
    INNER JOIN MARA ON MARAMATNR EQ MASTMATNR
    WHERE MARA~MTART LIKE 'ZFG%'
    AND STKO~LKENZ NE 'X'
    AND STKO~LOEKZ NE 'X'
    AND STKO~STLST EQ '1'.
    SELECT MAST~MATNR MAST~WERKS MAST~STLAN MAST~STLNR MAST~STLAL MAST~ANDAT MAST~AEDAT MAST~AENAM STKO~STLST MBEW~ZPLP1 MVKE~DWERK
    INTO TABLE IT_MASTER
    FROM MAST
    INNER JOIN STKO ON STKO~STLNR EQ MAST~STLNR
    AND STKO~STLAL EQ MAST~STLAL
    INNER JOIN MARA ON MARA~MATNR EQ MAST~MATNR
    INNER JOIN MBEW ON MBEW~MATNR EQ MAST~MATNR
    AND MBEW~BWKEY EQ MAST~WERKS
    INNER JOIN MVKE ON MVKE~MATNR EQ MAST~MATNR
    WHERE MARA~MTART LIKE 'ZFG%'
    AND STKO~LKENZ NE 'X'
    AND STKO~LOEKZ NE 'X'
    AND STKO~STLST EQ '1'.
    IF SY-SUBRC <> 0.
    MESSAGE I014(ZLOAD).
    ENDIF.
    *--- Set Path to Function Module ---
    CONCATENATE W_PTH SY-DATUM ' - ' 'BOM_AVAILABLE_PLANT.XLS' INTO W_FILE.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    FILENAME = W_FILE
    FILETYPE = 'DAT'
    TABLES
    DATA_TAB = IT_MASTER
    FIELDNAMES = IT_HEADER
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_WRITE_ERROR = 2
    INVALID_FILESIZE = 3
    INVALID_TYPE = 4
    NO_BATCH = 5
    UNKNOWN_ERROR = 6
    INVALID_TABLE_EIDTH = 7
    GUI_REFUSE_FILETRANSFER = 8
    CUSTOMER_ERROR = 9
    OTHERS = 10.
    IF SY-SUBRC = 0.
    SUBMIT ZI005_MARA_DUMP_SOLIDEAL_N.
    MESSAGE I023(ZLOAD) WITH text-001.
    ELSE.
    MESSAGE I022(ZLOAD) WITH W_FILE. "Errors while downloading.
    ENDIF.
    END-OF-SELECTION.
    SUBMIT ZI005_MARA_DUMP_SOLIDEAL_N.

  • How can I arrange bookmarks in a grid format instead of a vertical line?

    Windows has a IE Favorites folder, containing favorite websites, and all of these favorite website folders and links can be viewed in a grid format (spread horizontally and vertically). Firefox Bookmarks: I can only get to display in a very long vertical line. Is there an internal file folder containing all of my Firefox Bookmarks? And if so, can I display them in a grid? Thx.

    Sorry, no there is no way to arrange or view bookmarks in multiple columns or a grid built into Firefox.
    Bookmarks aren't stored in a folder in Windows like with IE, they are stored in a database file named '''places.sqlite''', along with browsing history and downloads history.
    There have been a couple of different extensions available over the years that did display bookmarks in multiple columns, but those extensions were short lived and never were really finished before the developer lost interest and stopped working on them.
    Suggestion - folders within folders will spread out to the right, somewhat in a "columns fashion" across the screen. But with the current placement of the bookmarks button I don't know how well that would work; I haven't even tried it out. Personally, I have used the Bookmarks Sidebar for viewing my bookmarks since I started using Firefox in 2002.

  • Alv grid format

    I hav an internal table with 35 fields. I want to get the output in the ALV grid format.
    How can i Pl help me

    Hi
    Dont bother about how many fields are there in internal table just write your coding in a simple and easy way such that there should not be any performance issue
    Check this sample report
    *& Report  ZALVGRID_WITH_RADIOBUTTONS                                  *
    REPORT  ZALVGRID_WITH_RADIOBUTTONS              .
    TYPE-POOLS: abap, icon. " INCLUDE <icon>. for releases < 6.20
    TYPES: BEGIN OF ty_s_sflight.
    INCLUDE TYPE sflight.
    TYPES: button1 TYPE iconname.
    TYPES: button2 TYPE iconname.
    TYPES: button3 TYPE iconname.
    TYPES: button4 TYPE iconname.
    TYPES: END OF ty_s_sflight.
    DATA:gt_sflight TYPE STANDARD TABLE OF ty_s_sflight,
         gs_layout TYPE lvc_s_layo,
         gt_fcat TYPE lvc_t_fcat.
    DATA:gd_okcode TYPE ui_func,
         go_docking TYPE REF TO cl_gui_docking_container,
         go_grid TYPE REF TO cl_gui_alv_grid.
    *icon_wd_radio_button_empty TYPE REF TO icon_wd_radio_button_empty.
    * CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
    PUBLIC SECTION.
    CLASS-METHODS:
    handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
    IMPORTING
    e_row_id
    e_column_id
    es_row_no
    sender.
    ENDCLASS. "lcl_eventhandler DEFINITION
    * CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
    METHOD handle_hotspot_click.
    * define local data
    FIELD-SYMBOLS:
    <ls_entry> TYPE ty_s_sflight,
    <ld_fld> TYPE ANY.
    READ TABLE gt_sflight ASSIGNING <ls_entry> INDEX es_row_no-row_id.
    CHECK ( <ls_entry> IS ASSIGNED ).
    * Set all radio buttons "unselected"
    <ls_entry>-button1 = icon_wd_radio_button_empty.
    <ls_entry>-button2 = icon_wd_radio_button_empty.
    <ls_entry>-button3 = icon_wd_radio_button_empty.
    <ls_entry>-button4 = icon_wd_radio_button_empty.
    ASSIGN COMPONENT e_column_id-fieldname OF STRUCTURE <ls_entry>
    TO <ld_fld>.
    IF ( <ld_fld> IS ASSIGNED ).
    * Set selected radio button "selected".
    <ld_fld> = icon_wd_radio_button.
    ENDIF.
    * Force PAI followed by refresh of table display in PBO
    CALL METHOD cl_gui_cfw=>set_new_ok_code
    EXPORTING
    new_code = 'REFRESH'
    * IMPORTING
    * RC =
    ENDMETHOD. "handle_hotspot_click
    ENDCLASS. "lcl_eventhandler IMPLEMENTATION
    * MAIN *
    START-OF-SELECTION.
    PERFORM select_data.
    PERFORM init_controls.
    PERFORM build_fieldcatalog.
    PERFORM set_layout.
    CALL METHOD go_grid->set_table_for_first_display
    EXPORTING
    * i_structure_name = 'SFLIGHT'
    is_layout = gs_layout
    CHANGING
    it_fieldcatalog = gt_fcat
    it_outtab = gt_sflight.
    * Link docking container to dynpro
    CALL METHOD go_docking->link
    EXPORTING
    repid = syst-repid
    dynnr = '0100'
    * CONTAINER =
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    lifetime_dynpro_dynpro_link = 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.
    CALL SCREEN 100.
    END-OF-SELECTION.
    * MODULE PBO OUTPUT *
    MODULE pbo OUTPUT.
    SET PF-STATUS 'MAIN100'.
    SET TITLEBAR 'MAIN100'.
    ENDMODULE. "PBO OUTPUT
    * MODULE PAI INPUT *
    MODULE pai INPUT.
    * Leave report
    CASE gd_okcode.
    WHEN 'BACK' OR
    'EXIT' OR
    'CANC'.
    SET SCREEN 0. LEAVE SCREEN.
    * Refresh table display
    WHEN 'REFRESH'.
    PERFORM refresh_display.
    WHEN OTHERS.
    * do nothing
    ENDCASE.
    CLEAR gd_okcode.
    ENDMODULE. "PAI INPUT
    *& Form BUILD_FIELDCATALOG
    * text
    * --> p1 text
    * <-- p2 text
    FORM build_fieldcatalog .
    * define local data
    DATA:
    ls_fcat TYPE lvc_s_fcat.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    * I_BUFFER_ACTIVE =
    i_structure_name = 'ICON'
    * I_CLIENT_NEVER_DISPLAY = 'X'
    * I_BYPASSING_BUFFER =
    * I_INTERNAL_TABNAME =
    CHANGING
    ct_fieldcat = gt_fcat
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 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.
    DELETE gt_fcat WHERE ( fieldname <> 'NAME' ).
    * NOTE: field ICON-NAME has data element ICONNAME.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    * I_BUFFER_ACTIVE =
    i_structure_name = 'SFLIGHT'
    * I_CLIENT_NEVER_DISPLAY = 'X'
    * I_BYPASSING_BUFFER =
    * I_INTERNAL_TABNAME =
    CHANGING
    ct_fieldcat = gt_fcat
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 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.
    READ TABLE gt_fcat INTO ls_fcat
    WITH KEY fieldname = 'NAME'.
    IF ( syst-subrc = 0 ).
    DELETE gt_fcat INDEX syst-tabix.
    ENDIF.
    ls_fcat-fieldname = 'BUTTON4'.
    ls_fcat-coltext = ls_fcat-fieldname.
    ls_fcat-icon = 'X'.
    ls_fcat-hotspot = 'X'.
    INSERT ls_fcat INTO gt_fcat INDEX 5.
    ls_fcat-fieldname = 'BUTTON3'.
    ls_fcat-coltext = ls_fcat-fieldname.
    INSERT ls_fcat INTO gt_fcat INDEX 5.
    ls_fcat-fieldname = 'BUTTON2'.
    ls_fcat-coltext = ls_fcat-fieldname.
    INSERT ls_fcat INTO gt_fcat INDEX 5.
    ls_fcat-fieldname = 'BUTTON1'.
    ls_fcat-coltext = ls_fcat-fieldname.
    INSERT ls_fcat INTO gt_fcat INDEX 5.
    * Renumbering of the columns
    LOOP AT gt_fcat INTO ls_fcat.
    ls_fcat-col_pos = syst-tabix.
    MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
    ENDLOOP.
    ENDFORM. " BUILD_FIELDCATALOG
    *& Form SELECT_DATA
    * text
    * --> p1 text
    * <-- p2 text
    FORM select_data .
    * define local data
    DATA:
    ls_sflight TYPE ty_s_sflight.
    SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE gt_sflight.
    ls_sflight-button1 = icon_wd_radio_button. " selected radiobutton
    ls_sflight-button2 = icon_wd_radio_button_empty.
    ls_sflight-button3 = icon_wd_radio_button_empty.
    ls_sflight-button4 = icon_wd_radio_button_empty.
    * Alternatively: create icons using function module 'ICON_CREATE'
    * on SAP releases where these icons are not available.
    MODIFY gt_sflight FROM ls_sflight
    TRANSPORTING button1 button2 button3 button4
    WHERE ( carrid IS NOT INITIAL ).
    ENDFORM. " SELECT_DATA
    *& Form INIT_CONTROLS
    * text
    * --> p1 text
    * <-- p2 text
    FORM init_controls .
    CHECK ( go_docking IS NOT BOUND ).
    * Create docking container
    CREATE OBJECT go_docking
    EXPORTING
    parent = cl_gui_container=>screen0
    * REPID =
    * DYNNR =
    * SIDE = DOCK_AT_LEFT
    * EXTENSION = 50
    * STYLE =
    * LIFETIME = lifetime_default
    * CAPTION =
    * METRIC = 0
    ratio = 90
    * NO_AUTODEF_PROGID_DYNNR =
    * NAME =
    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.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    * Size of container = full screen size
    CALL METHOD go_docking->set_extension
    EXPORTING
    extension = 99999
    EXCEPTIONS
    cntl_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.
    * Create ALV grid instance
    CREATE OBJECT go_grid
    EXPORTING
    * I_SHELLSTYLE = 0
    * I_LIFETIME =
    i_parent = go_docking
    * I_APPL_EVENTS = space
    * I_PARENTDBG =
    * I_APPLOGPARENT =
    * I_GRAPHICSPARENT =
    * I_NAME =
    * I_FCAT_COMPLETE = SPACE
    EXCEPTIONS
    error_cntl_create = 1
    error_cntl_init = 2
    error_cntl_link = 3
    error_dp_create = 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.
    * Set event handler for event HOTSPOT_CLICK
    SET HANDLER:
    lcl_eventhandler=>handle_hotspot_click FOR go_grid.
    ENDFORM. " INIT_CONTROLS
    *& Form REFRESH_DISPLAY
    * Refresh table display after switching the radiobuttons
    * --> p1 text
    * <-- p2 text
    FORM refresh_display .
    * define local data
    DATA:
    ls_stable TYPE lvc_s_stbl.
    ls_stable-row = abap_true.
    ls_stable-col = abap_true.
    CALL METHOD go_grid->refresh_table_display
    EXPORTING
    is_stable = ls_stable
    * I_SOFT_REFRESH =
    EXCEPTIONS
    finished = 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. " REFRESH_DISPLAY
    *& Form SET_LAYOUT
    * Set layout for ALV list
    * --> p1 text
    * <-- p2 text
    FORM set_layout .
    CLEAR: gs_layout.
    gs_layout-cwidth_opt = abap_true. " optimize column width
    gs_layout-zebra = abap_true.
    ENDFORM. " SET_LAYOUT
    Reward all helpfull answers
    Regards
    Pavan

  • Out put in ALV grid format

    Hi,
      i need a help from you my dear friend I'm providing you the following information in which i have extract some of the fields from two internal tables and i have to display it in the alv grid format. All the work was done successfully but the problem is the values from internal table are moved but the values are not coming in output in ALV grid format. so pleease try to solve my problem.
    Thanking you
    TABLES: J_1IEXCHDR, J_1IEXCDTL.
    type-pools: slis.
    DATA: ITAB1 TYPE J_1IEXCHDR OCCURS 0 WITH HEADER LINE.
    DATA: ITAB2 TYPE J_1IEXCHDR OCCURS 0 WITH HEADER LINE.
    DATA: ITAB3 TYPE J_1IEXCHDR OCCURS 0 WITH HEADER LINE.
    DATA: OK_CODE LIKE SY-UCOMM,
          GT_SFLIGHT TYPE TABLE OF itab,
          G_CONTAINER TYPE  SCRFNAME VALUE 'BCALV_GRID_DEMO_0100_CONT1',
          GRID1  TYPE REF TO CL_GUI_ALV_GRID,
          G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA:   LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA:   GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
    DATA:    G_TABNAME TYPE SLIS_TABNAME VALUE 'RTAB_ALV'.
    data: fieldcat  type slis_t_fieldcat_alv.
    data: begin of itab occurs 0,
         lifnr type j_1iexchdr-lifnr,
         docno type j_1iexchdr-docno,
         exyear type j_1iexchdr-exyear,
         budat type j_1iexchdr-budat,
         exbed type j_1iexcDTL-exbed,
         rdoc1 type j_1iexcDTL-rdoc1,
         ecs type j_1iexcDTL-ecs,
         exbas type j_1iexcDTL-exbas,
         end of itab.
    start-of-selection.
    perform get_data.
    perform call_alv.
    form get_data.
    select * into corresponding fields of table itab
             from  J_1IEXCHDR
                     inner join  J_1IEXCDTL
                        on  J_1IEXCDTLlifnr =  J_1IEXCHDRlifnr
                     where  J_1IEXCHDr~status = 'P'.
    append itab.
    endform.
    CALL_ALV
    form call_alv.
    perform build_field_catalog.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
        i_callback_program = i_repid
    IT_SORT               = gt_sort
         it_fieldcat        = fieldcat[]
       TABLES
         t_outtab           = itab
       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.
    Call ABAP List Viewer (ALV)
    call function 'REUSE_ALV_GRID_DISPLAY'
      exporting
        it_fieldcat  = fieldcat
      tables
         t_outtab     = itab.
    endform.
    form build_field_catalog.
    clear: fieldcat. refresh: fieldcat.
    data: tmp_fc type slis_fieldcat_alv.
    tmp_fc-reptext_ddic = 'Vendor No'.
    tmp_fc-fieldname    = 'lifnr'.
    tmp_fc-tabname      = 'itab'.
    tmp_fc-outputlen    = '10'.
    append tmp_fc to fieldcat.
    tmp_fc-reptext_ddic = 'docno'.
    tmp_fc-fieldname    = 'docno'.
    tmp_fc-tabname      = 'itab'.
    tmp_fc-outputlen    = '10'.
    append tmp_fc to fieldcat.
      tmp_fc-reptext_ddic = 'exyear'.
    tmp_fc-fieldname    = 'exyear'.
    tmp_fc-tabname      = 'itab'.
    tmp_fc-outputlen    = '10'.
    append tmp_fc to fieldcat.
    tmp_fc-reptext_ddic = 'budat'.
    tmp_fc-fieldname    = 'budat'.
    tmp_fc-tabname      = 'itab'.
    tmp_fc-outputlen    = '10'.
    append tmp_fc to fieldcat.
    tmp_fc-reptext_ddic = 'exbas'.
    tmp_fc-fieldname    = 'exbas'.
    tmp_fc-tabname      = 'itab'.
    tmp_fc-outputlen    = '10'.
    append tmp_fc to fieldcat.
      tmp_fc-reptext_ddic = 'exbed'.
    tmp_fc-fieldname    = 'exbed'.
    tmp_fc-tabname      = 'itab'.
    tmp_fc-outputlen    = '10'.
    append tmp_fc to fieldcat.
    tmp_fc-reptext_ddic = 'rdoc1'.
    tmp_fc-fieldname    = 'rdoc1'.
    tmp_fc-tabname      = 'itab'.
    tmp_fc-outputlen    = '10'.
    append tmp_fc to fieldcat.
    tmp_fc-reptext_ddic = 'ecs'.
    tmp_fc-fieldname    = 'ecs'.
    tmp_fc-tabname      = 'itab'.
    tmp_fc-outputlen    = '10'.
    append tmp_fc to fieldcat.
    endform.
    *loop at itab.
    *WRITE: /  ITAB-LIFNR,
             ITAB-DOCNO,
             ITAB-EXYEAR,
             ITAB-BUDAT,
             ITAB-EXBAS,
             ITAB-EXBED,
             ITAB-RDOC1,
             ITAB-ECS.
    *endloop.

    Hi Praveen,
    In the field cat internal tabel for fieldname you have to pass the values in caps.look at the followig eg:
    tmp_fc-fieldname = 'LIFNR'.
    let me know if you still have a problem after this change.
    regards,
    Raju

  • Grid Control in JSP

    Support me, to create Grid Control through jsp coding
    should able to add, delete, update the rows in grid and also if possible change the colors.

    i am create one grid contro in jsp.
    grid control features dynamic edit,add records.
    so plz help me in your ideas sent my mail id
    [email protected]

  • How to disply internal table with grid format .

    HI ,
    how to disply internal table with grid format .
    Regards
    venkat

    Grid format can be disaplyed using two ways,
    1. Using reuse_alv_grid_display
    2. using object oriented ABAP with the methos set_table_for_first_display.
    For example program search in where used list for standard SAP programs.
    If this is not the answer then please explain your issue in detail
    Thanks,
    Rama Krishna

  • To Display Report in a ALV GRID Format

    Hi All,
    I want to display dome information in ALV Grid format.
    Can anybody give example for displaying data in ALV Grid Format.
    Thanks in advance.
    Thanks & Regards,
    Rayeez.

    Hi ,
    1.FOR ALV Lists..
    REPORT Y_DEMO_ALV NO STANDARD PAGE HEADING.
    Data to be displayed
    DATA: I_SFLIGHT TYPE TABLE OF SFLIGHT.
    Selection
      SELECT * FROM SFLIGHT INTO TABLE I_SFLIGHT.
    Call ABAP List Viewer (ALV)
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                I_STRUCTURE_NAME   = 'SFLIGHT'
           TABLES
                T_OUTTAB           = I_SFLIGHT.
    2.Using Grids..
    REPORT Y_DEMO_ALV_1.
    Data to be displayed
    DATA: I_SFLIGHT TYPE TABLE OF SFLIGHT.
    Selection
      SELECT * FROM SFLIGHT INTO TABLE I_SFLIGHT.
    Call ABAP List Viewer (ALV)
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_STRUCTURE_NAME   = 'SFLIGHT'
           TABLES
                T_OUTTAB           = I_SFLIGHT.
    3.Demo Using most of the ALv Functionalities..
    REPORT  ZSATTRIAL4.
    TYPE-POOLS: slis.
    DB-Table
    TABLES sflight.
    Includes
    INCLUDE <icon>.
    INCLUDE <symbol>.
    CONSTANTS:
    c_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
          i_layout   TYPE slis_layout_alv,
          i_sp_group TYPE slis_t_sp_group_alv,
          i_events   TYPE slis_t_event,
          i_print    TYPE slis_print_alv,
          i_sort     TYPE slis_t_sortinfo_alv.
    *internal table for data to be displayed
    DATA: BEGIN OF i_sflight OCCURS 0.
            INCLUDE STRUCTURE sflight.
    DATA:  box,
           lights.
    DATA: END OF i_sflight.
    DATA: w_repid LIKE sy-repid.
    DATA: i_list_top_of_page TYPE slis_t_listheader.
    Report Selections
    SELECT-OPTIONS s_carrid FOR sflight-carrid.
    SELECT-OPTIONS s_connid FOR sflight-connid.
    SELECT-OPTIONS s_fldate FOR sflight-fldate.
    *SELECTION-SCREEN SKIP 1.
    Parameters
    PARAMETERS: p_maxrow TYPE i DEFAULT 30."to limit the selection
    SELECTION-SCREEN SKIP 1.
    Variant for ALV display
    SELECTION-SCREEN BEGIN OF BLOCK 0 WITH FRAME TITLE text-000.
    PARAMETERS: p_varnt LIKE disvariant-variant.
    SELECTION-SCREEN END OF BLOCK 0.
    Layout of the report display
    SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
    PARAMETERS: p_zebra AS CHECKBOX DEFAULT ' ',        "Striped pattern
                p_nocolh AS CHECKBOX DEFAULT ' ',        "No column heading
                p_novlin AS CHECKBOX DEFAULT ' ',        "No vertical lines
                p_colopt AS CHECKBOX DEFAULT ' ',        "Optimizes col. wd
                p_keyhot AS CHECKBOX DEFAULT ' ',        "Key fields hot
                p_noinpt AS CHECKBOX DEFAULT ' '.        "No field for input
    SELECTION-SCREEN END OF BLOCK a.
    SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-002.
    PARAMETERS: p_lights AS CHECKBOX DEFAULT 'X',
                p_lightc AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF BLOCK b.
    SELECTION-SCREEN BEGIN OF BLOCK c WITH FRAME TITLE text-003.
    PARAMETERS: p_totonl AS CHECKBOX DEFAULT ' ',
                p_totext(60),
                p_sttext(60).
    SELECTION-SCREEN END OF BLOCK c.
    SELECTION-SCREEN BEGIN OF BLOCK d WITH FRAME TITLE text-004.
    PARAMETERS: p_chkbox AS CHECKBOX DEFAULT 'X',
                p_detpop AS CHECKBOX DEFAULT 'X',
                p_groupb AS CHECKBOX DEFAULT ' ',
                p_groups AS CHECKBOX DEFAULT ' '.
    SELECTION-SCREEN END OF BLOCK d.
    SELECTION-SCREEN BEGIN OF BLOCK e WITH FRAME TITLE text-005.
    PARAMETERS: p_print AS CHECKBOX DEFAULT ' ',
                p_nosinf AS CHECKBOX DEFAULT ' ',
                p_nocove AS CHECKBOX DEFAULT ' ',
                p_nonewp AS CHECKBOX DEFAULT ' ',
                p_nolinf AS CHECKBOX DEFAULT ' ',
                p_reserv TYPE i.
    SELECTION-SCREEN END OF BLOCK e.
    DATA: w_boxnam TYPE slis_fieldname VALUE  'BOX',
                w_f2code LIKE sy-ucomm       VALUE  '&ETA',
                w_lignam TYPE slis_fieldname VALUE  'LIGHTS',
                w_save(1) TYPE c,
                w_default(1) TYPE c,
                w_exit(1) TYPE c,
                i_variant LIKE disvariant,
                i_variant1 LIKE disvariant.
    INITIALIZATION.
      w_repid = sy-repid.
      PERFORM fieldcat_init USING i_fieldcat.
      PERFORM eventtab_build USING i_events.
      PERFORM comment_build USING i_list_top_of_page.
      PERFORM sp_group_build USING i_sp_group.
      PERFORM t_sort_build USING i_sort.
    Set Options: save variant userspecific or general
    'A or 'U' are for user-specific variants list
    'X' or 'space' for general
      w_save = 'A'.
      PERFORM variant_init.
    Get default variant
      i_variant1 = i_variant.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                i_save     = w_save
           CHANGING
                cs_variant = i_variant1
           EXCEPTIONS
                not_found  = 2.
      IF sy-subrc = 0.
        p_varnt = i_variant1-variant.
      ENDIF.
    Process on value request (list of possible variants)
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_varnt.
      PERFORM f4_for_variant.
    PAI
    AT SELECTION-SCREEN.
      PERFORM pai_of_selection_screen.
    START-OF-SELECTION.
      PERFORM selection.
    END-OF-SELECTION.
      PERFORM layout_build USING i_layout. "wg. Parameters
      PERFORM print_build USING i_print.  "wg. Parameters
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                i_program_name         = w_repid
             i_internal_tabname     = 'I_SFLIGHT'
                i_structure_name       = 'SFLIGHT'
                i_client_never_display = 'X'
                i_inclname             = w_repid
           CHANGING
                ct_fieldcat            = i_fieldcat[]
           EXCEPTIONS
                inconsistent_interface = 1
                program_error          = 2
                OTHERS                 = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Call ABAP/4 List Viewer
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            I_INTERFACE_CHECK           = ' '
               i_callback_program          =  w_repid
            I_CALLBACK_PF_STATUS_SET    = ' '
            I_CALLBACK_USER_COMMAND     = ' '
            I_CALLBACK_TOP_OF_PAGE      = ' '
            I_CALLBACK_HTML_TOP_OF_PAGE = ' '
            I_CALLBACK_HTML_END_OF_LIST = ' '
               i_structure_name            = 'SFLIGHT'
               i_background_id         = 'ALV_BACKGROUND'
            I_GRID_TITLE                =
            I_GRID_SETTINGS             =
               is_layout                   = i_layout
               it_fieldcat                 = i_fieldcat[]
            IT_EXCLUDING                =
               it_special_groups           = i_sp_group[]
               it_sort                     = i_sort[]
            IT_FILTER                   =
            IS_SEL_HIDE                 =
            I_DEFAULT                   = 'X'
               i_save                      = w_save
               is_variant                  = i_variant
               it_events                   = i_events[]
            IT_EVENT_EXIT               =
               is_print                    = i_print
            IS_REPREP_ID                =
            I_SCREEN_START_COLUMN       = 0
            I_SCREEN_START_LINE         = 0
            I_SCREEN_END_COLUMN         = 0
            I_SCREEN_END_LINE           = 0
       IMPORTING
            E_EXIT_CAUSED_BY_CALLER     =
            ES_EXIT_CAUSED_BY_USER      =
           TABLES
                t_outtab                    = i_sflight
          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.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
               i_callback_program      = w_repid
               i_structure_name        = 'SFLIGHT'
               is_layout               = i_layout
               it_fieldcat             = i_fieldcat[]
              IT_EXCLUDING            =
               it_special_groups       = i_sp_group[]
               it_sort                 = i_sort[]
              IT_FILTER               =
              IS_SEL_HIDE             =
              i_default                = W_DEFAULT
               i_save                  = w_save
               is_variant              = i_variant
               it_events               = i_events[]
              IT_EVENT_EXIT           =
               is_print                = i_print
              I_SCREEN_START_COLUMN   = 0
              I_SCREEN_START_LINE     = 0
              I_SCREEN_END_COLUMN     = 0
              I_SCREEN_END_LINE       = 0
         IMPORTING
              E_EXIT_CAUSED_BY_CALLER =
          TABLES
               t_outtab                = i_sflight.
          FORM FIELDCAT_INIT                                        *
    -->  L_FIELDCAT                                               *
    FORM fieldcat_init USING l_fieldcat TYPE slis_t_fieldcat_alv.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'SEATSOCC'.
    *The field is not displayed in the initial output, can be interactively
    chosen for display
      ls_fieldcat-no_out    = 'X'.
    *This field is assigned to a special group with tech. key 'A' and can be
    *displayed using the special group buttons
      ls_fieldcat-sp_group  = 'A'.
    *The field cannot be summed irrespective of its data type
      ls_fieldcat-no_sum    = 'X'.
      APPEND ls_fieldcat TO l_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'SEATSMAX'.
      ls_fieldcat-no_out    = 'X'.
      ls_fieldcat-sp_group  = 'A'.
      APPEND ls_fieldcat TO l_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'PRICE'.
      ls_fieldcat-no_out    = 'X'.
      ls_fieldcat-sp_group  = 'B'.
      APPEND ls_fieldcat TO l_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname    = 'CARRID'.
      ls_fieldcat-outputlen    = 7.
      APPEND ls_fieldcat TO l_fieldcat.
    ENDFORM.
          FORM DATA_ADD                                             *
    --> L_SFLIGHT
    FORM data_add TABLES l_sflight STRUCTURE i_sflight.
      LOOP AT l_sflight.
        IF sy-tabix > 10.
          l_sflight-box  = 'X'.
          l_sflight-lights = '3'.
        ELSE.
          IF sy-tabix = 1.
            l_sflight-lights = '2'.
          ELSE.
            l_sflight-lights = '1'.
          ENDIF.
        ENDIF.
        MODIFY l_sflight.
      ENDLOOP.
    ENDFORM.
          FORM EVENTTAB_BUILD                                       *
    -->  l_EVENTS                                                 *
    FORM eventtab_build USING l_events TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                i_list_type = 0
           IMPORTING
                et_events   = l_events.
      READ TABLE l_events WITH KEY name = slis_ev_top_of_page INTO ls_event.
      IF sy-subrc = 0.
        MOVE c_formname_top_of_page TO ls_event-form.
        APPEND ls_event TO l_events.
      ENDIF.
    ENDFORM.
          FORM COMMENT_BUILD                                        *
    -->  L_TOP_OF_PAGE                                            *
    FORM comment_build USING l_top_of_page TYPE slis_t_listheader.
      DATA: ls_line TYPE slis_listheader.
    ***Header
      CLEAR ls_line.
      ls_line-typ  = 'H'.
    LS_LINE-KEY: not used for this type
      ls_line-info = 'Heading list'.
      APPEND ls_line TO l_top_of_page.
    ***Selection
      CLEAR ls_line.
      ls_line-typ  = 'S'.
      ls_line-key  = 'Key 1'.
      ls_line-info = 'Information'.
      APPEND ls_line TO l_top_of_page.
      ls_line-key  = 'Key 2'.
      APPEND ls_line TO l_top_of_page.
    ***Action
      CLEAR ls_line.
      ls_line-typ  = 'A'.
    LS_LINE-KEY: not used for this type
      Ls_line-info = 'Status list'.
      APPEND ls_line TO l_top_of_page.
    ENDFORM.
          FORM LAYOUT_BUILD                                         *
    <->  LS_LAYOUT                                                 *
    FORM layout_build USING ls_layout TYPE slis_layout_alv.
      ls_layout-f2code            = w_f2code.
      ls_layout-zebra             = p_zebra.
      ls_layout-colwidth_optimize = p_colopt.
      IF p_chkbox = 'X'.
    *Fieldname for check box on the report output
        ls_layout-box_fieldname     = w_boxnam.
      ELSE.
        ls_layout-box_fieldname     = space.
      ENDIF.
      ls_layout-no_input          = p_noinpt.
      ls_layout-no_vline          = p_novlin.
      ls_layout-no_colhead        = p_nocolh.
      IF p_lights = 'X' OR p_lightc = 'X'.
    **Fieldname for lights on the report output
        ls_layout-lights_fieldname = w_lignam.
      ELSE.
        CLEAR ls_layout-lights_fieldname.
      ENDIF.
      ls_layout-lights_condense   = p_lightc.
      ls_layout-totals_text       = p_totext.
      ls_layout-subtotals_text    = p_sttext.
      ls_layout-totals_only       = p_totonl.
      ls_layout-key_hotspot       = p_keyhot.
      ls_layout-detail_popup      = p_detpop.
      ls_layout-group_change_edit = p_groups.
    E05_LS_LAYOUT-GROUP_BUTTONS     = P_GROUPB.
    ls_layout-group_buttons     = 'X'.
    ENDFORM.
          FORM SP_GROUP_BUILD                                       *
    -->  L_SP_GROUP                                               *
    FORM sp_group_build USING l_sp_group TYPE slis_t_sp_group_alv.
      DATA: ls_sp_group TYPE slis_sp_group_alv.
    *Fields are assigned to the special group
      CLEAR ls_sp_group.
      ls_sp_group-sp_group = 'A'.
      ls_sp_group-text     = 'Reservation status'.
      APPEND ls_sp_group TO l_sp_group.
      CLEAR ls_sp_group.
      ls_sp_group-sp_group = 'B'.
      ls_sp_group-text     = 'Flight charges'.
      APPEND ls_sp_group TO l_sp_group.
    ENDFORM.
          FORM SELECTION                                                *
    FORM selection.
      SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE i_sflight
               UP TO p_maxrow ROWS WHERE carrid IN s_carrid
               AND connid IN s_connid AND fldate IN s_fldate.
      PERFORM data_add TABLES i_sflight.
    ENDFORM.
          FORM TOP_OF_PAGE                                              *
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                i_logo             = 'ENJOYSAP_LOGO'
                it_list_commentary = i_list_top_of_page.
    ENDFORM.
          FORM F4_FOR_VARIANT                                           *
    FORM f4_for_variant.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
           EXPORTING
                is_variant          = i_variant
                i_save              = w_save
              it_default_fieldcat =
           IMPORTING
                e_exit              = w_exit
                es_variant          = i_variant1
           EXCEPTIONS
                not_found = 2.
      IF sy-subrc = 2.
        MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        IF w_exit = space.
          p_varnt = i_variant1-variant.
        ENDIF.
      ENDIF.
    ENDFORM.
    *&      Form  PAI_OF_SELECTION_SCREEN
          to check whether right variant is entered on the selection scr
    FORM pai_of_selection_screen.
      IF NOT p_varnt IS INITIAL.
        MOVE i_variant TO i_variant1.
        MOVE p_varnt TO i_variant1-variant.
        CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
             EXPORTING
                  i_save     = w_save
             CHANGING
                  cs_variant = i_variant1.
        i_variant = i_variant1.
      ELSE.
        PERFORM variant_init.
      ENDIF.
    ENDFORM.                               " PAI_OF_SELECTION_SCREEN
    *&      Form  VARIANT_INIT
    FORM variant_init.
      CLEAR i_variant.
      i_variant-report = w_repid.
    ENDFORM.                               " VARIANT_INIT
          FORM PRINT_BUILD                                          *
    FORM print_build USING l_print TYPE slis_print_alv.
      l_print-print              = p_print.
      l_print-no_print_selinfos  = p_nosinf.
      l_print-no_coverpage       = p_nocove.
      l_print-no_new_page        = p_nonewp.
      l_print-no_print_listinfos = p_nolinf.
      l_print-reserve_lines      = p_reserv.
      l_print-print              = p_print.
    ENDFORM.
          FORM T_SORT_BUILD                                         *
    FORM t_sort_build USING l_sort TYPE slis_t_sortinfo_alv.
      DATA: ls_sort TYPE slis_sortinfo_alv.
      ls_sort-fieldname = 'CARRID'.
      ls_sort-spos      = 1.
      ls_sort-up        = 'X'.
      ls_sort-subtot    = 'X'.
      APPEND ls_sort TO l_sort.
    ps : reward points for helpful answers and mark the post as closed..

  • Displaying data in Grid Format?

    Hello Developers,
    How to display data in a grid format using BSP in mobiles(Supporting all handheld devices)?
    I have read that we can use HTMLB to display data in a Tableview.But will it supported by all mobile devices?
    What's the solution to achieve above challenge?
    Thanks

    I suggest you ask that question in the ABAP forum.
    Markus

  • How to change the date time format in jsp

    Hello Sir,
    I am trying to convert the date from one format into another format.
    In SQLServer one fields type as datetime.
    when i tried to display it in jsp with String variable it shown like below,
    2006-08-16 09:11:23.0
    how to format this value as
    Wed, Aug 16, 2006 09:11 AM
    my code is
    java.text.SimpleDateFormat fmt= new java.text.SimpleDateFormat("EEE, MMM d, yyyy K:mm a ");
    fmt.format(string value fetch from dtabase field);
    Plz provide me the solution asap. very urgent request.
    Regards
    venki.

    Hello Sir,
    I am trying to convert the date from one format into
    another format.
    In SQLServer one fields type as datetime.
    when i tried to display it in jsp with String
    variable it shown like below,
    2006-08-16 09:11:23.0
    how to format this value as
    Wed, Aug 16, 2006 09:11 AM
    my code is
    java.text.SimpleDateFormat fmt= new
    java.text.SimpleDateFormat("EEE, MMM d, yyyy K:mm a
    fmt.format(string value fetch from dtabase field);
    Plz provide me the solution asap. very urgent
    request.
    Regards
    venki.Have a look in to the below code
    import java.text.SimpleDateFormat;
    import java.util.Date;
    public class DateFormatTest
    public static void main( String[] cmdArgs )
    throws Exception
    SimpleDateFormat sdfInput =
    new SimpleDateFormat( "yyyy-MM-dd" );
    SimpleDateFormat sdfOutput =
    new SimpleDateFormat ( "EEE, d MMM yyyy hh:mm aaa" ); //Change the patterns in to what ever u need
    String textDate = "2001-01-04";
    Date date = sdfInput.parse( textDate );
    System.out.println( sdfOutput.format( date ) );
    i will suggest u to look in to the API doc you will come to know lot many things.

  • Display Date Format in JSP

    I've got a date that is being displayed as YYYY-MM-DD in spite of having set it to be displayed as MM/DD/YYYY in both the VO and EO. I've edited my formatinfo.xml file, and the format is there, but for some reason on this one date field (others are working fine) the changes aren't getting propogated to the JSP. I've changed the display label, and that change IS getting propogated out. I know this has to be simple...what am I missing?

    Maybe you need to configure that "application"? Or if you actually have access to the source code, then just take a look in it.
    Without any more details about the "application" we can't help you any much further.
    Generally, when you want to convert a Date or Calendar object to a human readable String, the SimpleDateFormat [1] is been used.
    [1] http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html

  • How to send mail in html format in jsp???

    Hello everybody,
    I have two jsp pages.In one page I have the heading like Date,Transaction.I am retriving data from my second jsp page.And I hae included the second jsp page to my first jsp page.How to send mail this content in html format.
    Thanks
    Srikant

    MimeMessage m = new MimeMessage(session);
    BodyPart messageBodyPart = new MimeBodyPart();
    messageBodyPart.setContent(content, "text/html");this if u need to send a mail content as html

  • Workbook Analysis Grid & formatting/positioning

    Hello xperts,
    When designing/formatting a workbook with an analysis grid linked to a
    dataprovider and the use of formulas, refreshing the workbook <b>resets</b>
    all applied formatting and shows the default analysis layout (as if
    changes to column/row positions are disregarded).
    E.g. When inserting blank rows or centering text in a column, refreshing the query resets this formatting!
    This is frontend functionality that <b>should</b> be supported in 2004s.
    Anyone experienced this yet/knows a workaround/solution for this?
    OSS message with prio high concerning this problem is pending as well, but it seems they're quite busy at SAP. I guess a SAP frontend patch is the only way to solve this.
    Installed Frontend Patch is <b>10</b>
    Please any good input is welcome!
    best regards,
    JvB

    Hello,
    I am using front end patch 9 and when I use to functionality 'Convert to Formula' this works fine.
    In the analysis grid you would right-click in the body of the grid and select 'Convert to Formula'.  Then when you refresh your workbook the format modifications should remain.
    If you have not tried this already I think it should resolve your problem.
    Fred

  • Dynamic Formatting of jsp

    How do i format elements in a jsp dynamically in a jsp.
    For ex
    <td width=100% colspan=18>
    <%= titleName %>
    </td>Instead of specifying colspan as 18, i want it to automatically adjust according to the length of the word (titleName).
    Thank You

    Use EL.
    colspan=${someDynamicValue}And replace that scriptlet by EL. Writing raw Java code in JSP files is a bad practice.

Maybe you are looking for