Field column not found in the ALV Report

Hello all,
Sorry my problem is not solved.It is in hidden fields under the column set and it needs to be come
under displayed column for ever in the similar way the other fields like Bill to # , VAT registration number, company code etc. are getting dispalyed.
Thank you,
Sirisha

Snippet of the code
perform append_new_fieldcat USING:
'NAME1' 'TYPE_ALV' SPACE space 'Bill-To Name'
  space space SPACE CHANGING ct_fieldcat.
FORM append_new_fieldcat
USING       l_fieldname   TYPE slis_fieldcat_alv-fieldname
            l_ref_tabname TYPE slis_fieldcat_alv-ref_tabname
            l_ref_fieldname TYPE slis_fieldcat_alv-ref_fieldname
            l_cfieldname  TYPE slis_fieldcat_alv-cfieldname
            L_seltext TYPE SLIS_FIELDCAT_ALV-seltext_l
            l_no_out      TYPE slis_fieldcat_alv-no_out
            l_no_zero     TYPE slis_fieldcat_alv-no_zero
            l_do_sum      TYPE slis_fieldcat_alv-do_sum
  CHANGING  p_lt_fieldcat TYPE slis_t_fieldcat_alv.
  DATA: l_fieldcat TYPE slis_fieldcat_alv.        "Field string
  l_fieldcat-fieldname      = l_fieldname.
  l_fieldcat-ref_tabname    = l_ref_tabname.
  l_fieldcat-ref_fieldname  = l_ref_fieldname.
  l_fieldcat-cfieldname     = l_cfieldname.
  l_fieldcat-no_out         = l_no_out.
  l_fieldcat-no_zero        = l_no_zero.
  l_fieldcat-do_sum         = l_do_sum.
  if not l_seltext is initial.
    move l_seltext to l_fieldcat-seltext_l.
    move l_seltext to l_fieldcat-seltext_m.
    move l_seltext to l_fieldcat-seltext_s.
    MOVE 'L' TO   L_FIELDCAt-ddictxt.
  endif.
  APPEND l_fieldcat TO p_lt_fieldcat.
ENDFORM.                    " append_new_fieldcat

Similar Messages

  • Column Not found error while trying to access databse through JSP+Java Bean

    I am trying to acees MS Access 2003 db through JSP using Tomcat 5.0.28.The code for accessing the databse is incorporated in the bean.The jsp only calls the particular method of the bean .
    Code for Java Bean:
    package ActiveViewer;
    import java.sql.*;
    import java.util.*;
    public class CompanyBean
    Connection con;
    ResultSet rs=null;
    Statement st;
         public CompanyBean(){}
         public void connect()
         try
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("Here4");
    con=DriverManager.getConnection("jdbc:odbc:activeviewer","","");
         System.out.println("Here1");
         catch (ClassNotFoundException e)
         System.out.println("Could not locate driver.");
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
         e.printStackTrace();
         catch (Exception e)
    System.out.println("An unknown Exception has occured :: "+e);
         e.printStackTrace();
    public void disconnect()
         try
         if (con!=null)
    con.close();
         catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
         e.printStackTrace();
    public ResultSet select(String username)
    if(con!=null)
         try
    st=con.createStatement();
         rs=st.executeQuery("select * from company where username='" + username + "'");
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
         e.printStackTrace();
    catch (Exception e)
    System.out.println("An Exception has occured while retrieving :: "+e);
    e.printStackTrace();
    else
    System.out.println("Connection to database was lost.");
    return rs;
    The code for JSP that uses the above bean is:
    <%@ page language="java" import="java.sql.*,ActiveViewer.* " contentType="text/html"%>
    <jsp:useBean id="conn" scope="session" class="ActiveViewer.CompanyBean" />
    <html>
    <body>
    <% String username=request.getParameter("username");
    String password=request.getParameter("password");
    System.out.println("username:"+username);
    System.out.println("password:"+password);
    conn.connect();
    ResultSet rs=conn.select(username);
    System.out.println("Below select ");
    while (rs.next())
    String dbusername=rs.getString("username");
         String dbpassword=rs.getString("password");
         if(dbusername.equals(username) && dbpassword.equals (password))
    { %> out.println("OK");
              <% }
    else { %>Invalid Username and / or Password.
    <br>Clickhere to go back to Login Page.
    <% }
    } %>
    </body>
    </html>
    I get the following error:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Column not found
    though the database is not int he same folder as the jsp, the DSN is set correctly to pint to the db location.The jsp does print in stdout file:
    Here4 (from connect method above)
    Here 1 (from connect method above)
    Below Select (from jsp)
    This means that the jsp does connect to db but it gives the above error.Also the field name also matches that in the database and data is present in the db too.
    All other things like creating package for bean,incorporating the packakage are done.
    Can someone please help me with their precious advice?

    U're getting this error because there is no field called 'password' in ur database, the field in ur database is named 'cpassword' and not 'password'. So change the statement rs.getString("password"); to rs.getString("cpassword");

  • Column Not found error while trying to access database through JSP+Java Bea

    I am trying to access MS Access 2003 db through JSP using Tomcat 5.0.28.The code for accessing the database is incorporated in the bean.The JSP only calls the particular method of the bean .
    Code for Java Bean:
    package ActiveViewer;
    import java.sql.*;
    import java.util.*;
    public class CompanyBean
    Connection con;
    ResultSet rs=null;
    Statement st;
    public CompanyBean(){}
    public void connect()
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("Here4");
    con=DriverManager.getConnection("jdbc:odbc:activeviewer","","");
    System.out.println("Here1");
    catch (ClassNotFoundException e)
    System.out.println("Could not locate driver.");
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
    e.printStackTrace();
    catch (Exception e)
    System.out.println("An unknown Exception has occured :: "+e);
    e.printStackTrace();
    public void disconnect()
    try
    if (con!=null)
    con.close();
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
    e.printStackTrace();
    public ResultSet select(String username)
    if(con!=null)
    try
    st=con.createStatement();
    rs=st.executeQuery("select * from company where username='" + username + "'");
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
    e.printStackTrace();
    catch (Exception e)
    System.out.println("An Exception has occured while retrieving :: "+e);
    e.printStackTrace();
    else
    System.out.println("Connection to database was lost.");
    return rs;
    The code for JSP that uses the above bean is:
    <%@ page language="java" import="java.sql.*,ActiveViewer.* " contentType="text/html"%>
    <jsp:useBean id="conn" scope="session" class="ActiveViewer.CompanyBean" />
    <html>
    <body>
    <% String username=request.getParameter("username");
    String password=request.getParameter("password");
    System.out.println("username:"+username);
    System.out.println("password:"+password);
    conn.connect();
    ResultSet rs=conn.select(username);
    System.out.println("Below select ");
    while (rs.next())
    String dbusername=rs.getString("username");
    String dbpassword=rs.getString("password");
    if(dbusername.equals(username) && dbpassword.equals (password))
    { %> out.println("OK");
    <% }
    else { %>Invalid Username and / or Password.
    <br>Clickhere to go back to Login Page.
    <% }
    } %>
    </body>
    </html>
    I get the following error:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Column not found
    though the database is not int he same folder as the jsp, the DSN is set correctly to pint to the db location.The jsp does print in stdout file:
    Here4 (from connect method above)
    Here 1 (from connect method above)
    Below Select (from jsp)
    This means that the jsp does connect to db but it gives the above error.Also the field name also matches that in the database and data is present in the db too.
    All other things like creating package for bean in WEB-INF/classes,incorporating the packakage are done.
    Can someone please help me with their precious advice?

    Hi, I too have a problem with an SQL exception, the message is Column not found.
    I'm using the sun jdbc odbc driver with access.
    the first few lines of the stack trace are
    sun.jdbc.odbc.JdbcOdbcResultSet.findColumn(JdbcOdbcResultSet.java:1852)
    sun.jdbc.odbc.JdbcOdbcResultSet.getInt(JdbcOdbcResultSet.java:603)
    net.homeip.sdaniels.MemberBean.ejbFindByUnamePwd(MemberBean.java:127)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    I am of course sure that the column does infact exist. I can insert into the column no problems. the sql looks like this:
    SELECT * FROM Members WHERE uName ='Stewart' AND encPwd='�F2C�3����h�1Y�'
    Can any one tell me if there is a common cause to this problem?
    Thanks

  • Sap upgrade-Error when using DP90-OK 530-field catalog not found

    Hello,
    We are upgrading from 4.6c to mySAP ERP 2004 version. In 4.6c, we are using VA90 to create a sales order from service order to bill the customer. However in mySAP ERP 2004 version, VA90 does not exist. So we created DP profile and are  using transaction code DP90 to create billling request for the service order. However, System gives an error 'Field catalog not found'. The diagnosis says that -The field catalog cannot be determined because the output table structure name was not specified.
    Please help us how to solve the above problem.
    Thanks
    Mala

    hi mala,
    did you see SAP-message 442170?
    it is all about conversion VA90/DP90.
    hope this helps.
    br,
    matthias
    Message was edited by: Matthias Leitner

  • "Field Catalog not found" ...problem in ALV reporting !!

    Hi,
    When i execute my report program where in I generate a Selection screen, I am able to select the values in the selection screen. Once I click on the execute button I get the message
    "Field Catalog not found"...
    The elabore message is
    "Field Catalog cannot be determined becaus the output table structure name was not specified"
    Where am I wrong ??
    Find below my code ...
    *& Report  Z_MIGO_TXJCD_REPORT
    REPORT  Z_MIGO_TXJCD_REPORT.
    TYPE-POOLS: slis.
    TABLES:  makt,mseg,zmigo_extend,ttxj,mkpf.
    DATA: BEGIN OF migo_data OCCURS 0,
           matnr LIKE mseg-matnr,
           werks LIKE mseg-werks,
           lgpla LIKE mseg-lgpla,
           bwart LIKE mseg-bwart,
           menge LIKE mseg-menge,
           dmbtr LIKE mseg-dmbtr,
           budat LIKE mkpf-budat,
           txjcd LIKE zmigo_extend-txjcd,
          END OF migo_data.
    DATA: it_cat TYPE slis_t_fieldcat_alv,
          wa_lay TYPE slis_layout_alv.
    FIELD-SYMBOLS: <fs_cat> LIKE LINE OF it_cat.
    SELECT-OPTIONS: so_matnr FOR makt-matnr,
                    so_budat FOR mkpf-budat,
                    so_werks FOR mseg-werks,
                    so_lgpla FOR mseg-lgpla,
                    so_bwart FOR mseg-bwart,
                    so_txjcd FOR ttxj-txjcd.
    START-OF-SELECTION.
      SELECT amatnr awerks algpla abwart
             amenge admbtr bbudat ctxjcd INTO TABLE
             migo_data
        FROM mseg AS a INNER JOIN mkpf AS b ON amblnr = bmblnr INNER JOIN
             zmigo_extend AS c ON amblnr = cmblnr
       WHERE a~matnr IN so_matnr
         AND b~budat IN so_budat
         AND a~werks IN so_werks
         AND a~lgpla IN so_lgpla
         AND a~bwart IN so_bwart
         AND c~txjcd IN so_txjcd.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = sy-cprog
          i_internal_tabname     = 'migo_data'
          i_inclname             = sy-cprog
        CHANGING
          ct_fieldcat            = it_cat
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      LOOP AT it_cat ASSIGNING <fs_cat>.
        CLEAR <fs_cat>-key.
      ENDLOOP.
      wa_lay-zebra = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_grid_title  = 'MIGO report with Tax Jurisdiction Code'
          is_layout     = wa_lay
          it_fieldcat   = it_cat
        TABLES
          t_outtab      = migo_data
        EXCEPTIONS
          program_error = 1
          OTHERS        = 2.

    Give 'migo_data' in uppercase as ''MIGO_DATA'.

  • To edit the field in the ALV report

    Hi,
        i want to edit the field of the ALV report what i need to do for that..
    Thanks & Regards
    Ashu Singh

    hi,
    check the code,
    REPORT  zalv_fcat.* Output table T006 structure declarationTYPES : BEGIN OF ty_t006.
            INCLUDE STRUCTURE t006.
    TYPES : END OF ty_t006.*Internal table and wa declaration for T006
    DATA : it_t006 TYPE STANDARD TABLE OF ty_t006,
           wa_t006 TYPE ty_t006.*declarations for ALV
    DATA: ok_code               TYPE sy-ucomm,
    fieldcatalog for T006
          it_fielcat           TYPE lvc_t_fcat,
    fieldcatalog for fieldcatalog itself:
          it_fielcatalogue           TYPE lvc_t_fcat,
          it_layout           TYPE lvc_s_layo.*declaration for toolbar function
    DATA:   it_excl_func        TYPE ui_functions.
    Controls to display it_t006 and corresponding fieldcatalog
    DATA: cont_dock TYPE REF TO cl_gui_docking_container,
          cont_alvgd     TYPE REF TO cl_gui_alv_grid.*controls to display the fieldcatalog as editable alv grid and container
    DATA: cont_cust TYPE REF TO cl_gui_custom_container,
          cont_editalvgd     TYPE REF TO cl_gui_alv_grid.*intialization event
    INITIALIZATION.*start of selection event
    START-OF-SELECTION.
    LOCAL CLASS Definition for data changed in fieldcatalog ALV
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS handle_data_changed
          FOR EVENT data_changed OF cl_gui_alv_grid
          IMPORTING er_data_changed.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    LOCAL CLASS implementation for data changed in fieldcatalog ALV
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_data_changed.
      ENDMETHOD.                    "handle_data_changed
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION*data declaration for event receiver
    DATA: event_receiver TYPE REF TO lcl_event_receiver.*end of selection event
    END-OF-SELECTION.*setting the screen for alv output for table display and
    *changed fieldcatalalogue display
    SET SCREEN 600.
    On this statement double click  it takes you to the screen painter SE51. Enter the attributes
    *Create a Custom container and name it CCONT and OK code as OK_CODE.
    *Save check and Activate the screen painter.
    *Now a normal screen with number 600 is created which holds the ALV grid.
    PBO of the actual screen , Here we can give a title and customized menus
    *Go to SE41 and create status 'STATUS600' and create THE function code 'SUBMIT'
    *and 'EXIT' with icons and icon texts
    Also create a TitleBar 'TITLE600' and give the relevant title.&----
    *&      Module  STATUS_0600  OUTPUT
    MODULE status_0600 OUTPUT.
      SET PF-STATUS 'STATUS600'.
      SET TITLEBAR 'TITLE600'.
    CREATE ALV GRID CONTROL IF DOES NOT EXISTS INITIALLY
      IF cont_dock IS INITIAL.
        PERFORM create_alv.
      ENDIF.ENDMODULE.                             " STATUS_0600  OUTPUT* PAI module of the screen created. In case we use an interactive ALV or
    *for additional functionalities we can create OK codes and based on the
    *user command we can do the coding as shown below
    *&      Module  USER_COMMAND_0600  INPUT
    MODULE user_command_0600 INPUT.
      CASE ok_code.
        WHEN 'SUBMIT'.
    *TO GET THE CURRENT FIELDCATALOGUE FROM THE FRONTEND
          CALL METHOD cont_alvgd->set_frontend_fieldcatalog
            EXPORTING
              it_fieldcatalog = it_fielcat.
    *refresh the alv
          CALL METHOD cont_alvgd->refresh_table_display.
    *to Send Buffered Automation Queue to Frontend
          CALL METHOD cl_gui_cfw=>flush.*Exit button clicked to leave the program
        WHEN 'EXIT'.
          LEAVE PROGRAM.  ENDCASE.ENDMODULE.                             " USER_COMMAND_0600  INPUT&----
    *&      Form  CREATE_ALV
    &----FORM create_alv.*create a docking container and dock the control at the botton
      CREATE OBJECT cont_dock
          EXPORTING
               dynnr = '600'
               extension = 100
               side = cl_gui_docking_container=>dock_at_bottom.*create the alv grid for display the table
      CREATE OBJECT cont_alvgd
          EXPORTING
               i_parent = cont_dock.*create custome container for alv
      CREATE OBJECT cont_cust
          EXPORTING
               container_name = 'CCONT'.
    *create alv editable grid
      CREATE OBJECT cont_editalvgd
          EXPORTING
               i_parent = cont_cust.* register events for the editable alv
      CREATE OBJECT event_receiver.
      SET HANDLER event_receiver->handle_data_changed FOR cont_editalvgd.  CALL METHOD cont_editalvgd->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_modified.*building the fieldcatalogue for the initial display
      PERFORM build_fieldcat CHANGING it_fielcat it_fielcatalogue.*building the fieldcatalogue after the user has changed it
      PERFORM change_fieldcat CHANGING it_fielcatalogue.*fetch data from the table
      PERFORM fetch_data.*    Get excluding functions for the alv editable tool bar  APPEND cl_gui_alv_grid=>mc_fc_loc_append_row TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_loc_insert_row TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_loc_cut TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_sort TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_sort_asc TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_sort_dsc TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_subtot TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_sum TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_graph TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_info TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_print TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_filter TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_views TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_mb_export TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_mb_sum TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_mb_sum TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_mb_paste TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_find TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_loc_copy  TO it_excl_func.
    *Alv display for the T006 table at the bottom
      CALL METHOD cont_alvgd->set_table_for_first_display
        CHANGING
          it_outtab       = it_t006[]
          it_fieldcatalog = it_fielcat[].
    optimize column width of grid displaying fieldcatalog
      it_layout-cwidth_opt = 'X'.* Get fieldcatalog of table T006 - alv might have
    modified it after passing.
      CALL METHOD cont_alvgd->get_frontend_fieldcatalog
        IMPORTING
          et_fieldcatalog = it_fielcat[].to Send Buffered Automation Queue to Frontend  CALL METHOD cl_gui_cfw=>flush. Display fieldcatalog of table T006 in editable alv grid
      CALL METHOD cont_editalvgd->set_table_for_first_display
        EXPORTING
          is_layout            = it_layout
          it_toolbar_excluding = it_excl_func
        CHANGING
          it_outtab            = it_fielcat[]
          it_fieldcatalog      = it_fielcatalogue[].
    ENDFORM.                               " CREATE_alv
    *&      Form  fetch_data
    FORM fetch_data.* select data of T006
      SELECT * FROM t006 INTO TABLE it_t006 UP TO 50 ROWS.
    ENDFORM.                               " fetch_data
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat CHANGING it_fldcat TYPE lvc_t_fcat
                                       it_fcat TYPE lvc_t_fcat.
    Fieldcatalog for table T006: it_fldcat
    to generate the fields automatically  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'T006'
        CHANGING
          ct_fieldcat            = it_fldcat[]
        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.*----
    Fieldcatalog for table LVC_T_FCAT:it_fcat
    Generate fieldcatalog of fieldcatalog structure.
    This fieldcatalog is used to display fieldcatalog 'it_fldcat'
    on the top of the screen.  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'LVC_S_FCAT'
        CHANGING
          ct_fieldcat            = it_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.
    ENDFORM.                               " BUILD_FIELDCAT
    *&      Form  CHANGE_FIELDCAT
    *after the user has modified the fieldcatalogue we build another fieldcat
    *for the modified alv display
    FORM change_fieldcat CHANGING it_fcat TYPE lvc_t_fcat.  DATA ls_fcat TYPE lvc_s_fcat.  LOOP AT it_fcat INTO ls_fcat.
        ls_fcat-coltext = ls_fcat-fieldname.
        ls_fcat-edit = 'X'.    IF ls_fcat-fieldname = 'COL_POS' OR ls_fcat-fieldname = 'FIELDNAME'.
          ls_fcat-key = 'X'.
        ENDIF.    MODIFY it_fcat FROM ls_fcat.
      ENDLOOP.
    ENDFORM.                               " CHANGE_FIELDCAT
    ref:saptechnical tutorial.
    Regards,
    Anirban

  • Setting the column labels in webdynpro abap alv report

    Hello,
    Right now I have programmed an ALV report. The selection criterion and the display of the report all work.
    However, there is an issue with the labels of columns in the ALV report. The report takes the field names of the structure I am using in the ALV report as the labels of the report. I have been trying to play around with the ALV class model to see if something will change the labels of the fields but to no avail. Would you guys know of some code or way to change the labels of the columns in the ALV report.
    Thank you for your help in advance.
    Sumit.
    Here is some of the code I tried but does no work in the wdInit() method. It does not change the label. Any suggestions???
    METHOD wddoinit .
    * instantiate used component from wizard
    DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
    lo_cmp_usage =   wd_this->wd_cpuse_alv( ).
    IF lo_cmp_usage->has_active_component( ) IS INITIAL.
      lo_cmp_usage->create_component( ).
    ENDIF.
    * call a method in the used component from wizard
      DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
      lo_interfacecontroller =   wd_this->wd_cpifc_alv( ).
        DATA lo_value TYPE REF TO cl_salv_wd_config_table.
        lo_value = lo_interfacecontroller->get_model(
    DATA: lr_field TYPE REF TO cl_salv_wd_field.
    lr_field = lo_value->if_salv_wd_field_settings~get_field( 'CUSTOMER_NUMBER' ).
    * change the label of the report.
    DATA: lr_CUSTOMER_NUMBER TYPE REF TO cl_salv_wd_column.
                CALL METHOD lo_value->if_salv_wd_column_settings~get_column
                  EXPORTING
                    id     = 'CUSTOMER_NUMBER'   receiving value  = LR_CUSTOMER_NUMBER.
    * SET THE LABEL OF THE COLUMN
    DATA: HR_CUSTOMER_NUMBER TYPE REF TO CL_SALV_WD_COLUMN_HEADER.
    CALL METHOD lr_customer_number->get_header
      receiving
        value  = HR_CUSTOMER_NUMBER.
    ***** set the text of the column
    CALL METHOD hr_customer_number->set_text
      EXPORTING
        value  = 'Customer1 Number1'.
    ENDMETHOD.

    You have to disable the DDic binding on the column before your override text will show up:
    data: l_ref_cmp_usage type ref to if_wd_component_usage.
      l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
      if l_ref_cmp_usage->has_active_component( ) is initial.
        l_ref_cmp_usage->create_component( ).
      endif.
      data l_salv_wd_table type ref to iwci_salv_wd_table.
      l_salv_wd_table = wd_this->wd_cpifc_alv( ).
      data l_table type ref to cl_salv_wd_config_table.
      l_table = l_salv_wd_table->get_model( ).
      data l_column type ref to cl_salv_wd_column.
      l_column = l_table->if_salv_wd_column_settings~get_column( 'POSTING_DATE' ).
      data l_header type ref to cl_salv_wd_column_header.
      l_header = l_column->get_header( ).
      l_header->set_prop_ddic_binding_field(
        property =  if_salv_wd_c_ddic_binding=>bind_prop_text
        value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).
      l_header->set_text( `Posting Date` ).

  • ALV field catalog not found

    Hello there,
    I am having problem changing a classic ABAP report to ALV as am hitting the error "field catalog not found".
    I am using  this 2 functions to help me convert it to ALV format.
    and a snippet from my code :
        MODIFY gt_i_data FROM wa_i_data TRANSPORTING priokx.
         ENDLOOP .
      gt_report[] = gt_i_data[].
      perform f_assign_alv.
      perform f_display_alv.
    1.f_assign_alv
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                i_program_name     = c_repid
                i_internal_tabname = 'GT_REPORT'
                i_inclname         = c_repid
           CHANGING
                ct_fieldcat        = gt_fieldcat.
    2._display_alv.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_grid_title  = v_grid_title
                is_layout     = v_layout
                it_fieldcat   = gt_fieldcat
           TABLES
                t_outtab      = GT_REPORT
           EXCEPTIONS
                program_error = 1
                OTHERS        = 2.
      IF sy-subrc NE 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    I noticed during debug,inside 'REUSE_ALV_GRID_DISPLAY' the possible location of error cud be at :
    if i_screen_start_column is initial and -
    >all these values are empty
         i_screen_start_line   is initial and
         i_screen_start_column   is initial and
         i_screen_end_line     is initial.
        gt_grid-flg_popup = space.
        call screen 500.  else. -
    >point of error
        gt_grid-flg_popup = 'X'.
        call screen 700
                  starting at i_screen_start_column i_screen_start_line
                  ending   at i_screen_end_column i_screen_end_line.
      endif.
    Need your expert advice, please guide.Thanks so much!!

    Hi Neesha,
    If you are using FM 'REUSE_ALV_FIELDCATALOG_MERGE', during data/types declaration, you have to use the LIKE keyword and not the TYPE keyword.
    If you use TYPE, the fieldcat will not be populated.
    DATA: BEGIN OF GT_REPORT OCCURS 0,
    ebeln LIKE ekpo-ebeln,
    ebelp LIKE ekpo-ebelp,
    matnr LIKE ekpo-matnr,
    werks LIKE ekpo-werks,
    menge LIKE ekpo-menge,
    netpr LIKE ekpo-netpr,
    peinh LIKE ekpo-peinh,
    netwr LIKE ekpo-netwr,
    END OF GT_REPORT.
    Regards,
    Jovito.
    Edited by: dsouzajovito on Jan 10, 2011 11:32 AM

  • 'Field Catalog not Found' - ALV Grid using CustomContainer+Fcat

    The Following piece of code throws 'Field Catalgo not found'
    Please give me necessary changes in the code.
    Thanks & Regards
    Harsha Ch.
    *& Report  ZCHK_ALV_CUSCONT1                                           *
    REPORT  zchk_alv_cuscont1                       .
    DATA itab LIKE STANDARD TABLE OF mara WITH HEADER LINE.
    SELECT matnr meins mbrsh  FROM mara INTO CORRESPONDING FIELDS OF TABLE itab UP TO 10 ROWS.
    CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
      DATA fcat1 TYPE lvc_t_fcat WITH HEADER LINE.
      DATA  fcat TYPE STANDARD TABLE OF  lvc_s_fcat.
      DATA: c1 TYPE REF TO cl_gui_custom_container.
      DATA: a1 TYPE REF TO cl_gui_alv_grid.
      CREATE OBJECT c1 EXPORTING container_name = 'CC_ALV'.
      CREATE OBJECT a1 EXPORTING i_parent = c1.
      PERFORM populate_fcat.
      PERFORM generate_grid.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Form  POPULATE_FCAT
          text
    -->  p1        text
    <--  p2        text
    FORM populate_fcat .
      fcat1-reptext = 'MATNR'.
      fcat1-fieldname = 'MATNR'.
      fcat1-col_pos = '1'.
      APPEND fcat1.
      CLEAR fcat1.
      fcat1-reptext = 'MEINS'.
      fcat1-fieldname = 'MEINS'.
      fcat1-col_pos = '2'.
      APPEND fcat1.
      CLEAR fcat1.
      fcat1-reptext = 'MBRSH'.
      fcat1-fieldname = 'MBRSH'.
      fcat1-col_pos = '3'.
      APPEND fcat1.
      CLEAR fcat1.
    ENDFORM.                    " POPULATE_FCAT
    *&      Form  GENERATE_GRID
          text
    -->  p1        text
    <--  p2        text
    FORM generate_grid .
    CALL METHOD a1->set_table_for_first_display
    EXPORTING
       I_BUFFER_ACTIVE               =
       I_BYPASSING_BUFFER            =
       I_CONSISTENCY_CHECK           =
         I_STRUCTURE_NAME              = 'MARA'
       IS_VARIANT                    =
       I_SAVE                        =
       I_DEFAULT                     = 'X'
       IS_LAYOUT                     =
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
      CHANGING
        it_outtab                     = itab[]
       IT_FIELDCATALOG               = fcat
       IT_SORT                       =
       IT_FILTER                     =
    EXCEPTIONS
       INVALID_PARAMETER_COMBINATION = 1
       PROGRAM_ERROR                 = 2
       TOO_MANY_LINES                = 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.
    ENDFORM.                    " GENERATE_GRID

    Hi
    This works fine:
    *& Report ZCHK_ALV_CUSCONT1 *
    DATA ITAB LIKE STANDARD TABLE OF MARA WITH HEADER LINE.
    DATA FCAT1 TYPE LVC_T_FCAT WITH HEADER LINE.
    DATA FCAT TYPE STANDARD TABLE OF LVC_S_FCAT.
    DATA: C1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: A1 TYPE REF TO CL_GUI_ALV_GRID.
    START-OF-SELECTION.
      SELECT MATNR MEINS MBRSH FROM MARA INTO CORRESPONDING FIELDS OF TABLE
      ITAB UP TO 10 ROWS.
      CALL SCREEN 100.
    *& Module STATUS_0100 OUTPUT
    * TEXT
    MODULE STATUS_0100 OUTPUT.
    *  PERFORM POPULATE_FCAT.
      PERFORM GENERATE_GRID.
    ENDMODULE. " STATUS_0100 OUTPUT
    *       FORM POPULATE_FCAT                                            *
    FORM POPULATE_FCAT .
      FCAT1-REPTEXT = 'MATNR'.
      FCAT1-FIELDNAME = 'MATNR'.
      FCAT1-COL_POS = '1'.
      APPEND FCAT1.
      CLEAR FCAT1.
      FCAT1-REPTEXT = 'MEINS'.
      FCAT1-FIELDNAME = 'MEINS'.
      FCAT1-COL_POS = '2'.
      APPEND FCAT1.
      CLEAR FCAT1.
      FCAT1-REPTEXT = 'MBRSH'.
      FCAT1-FIELDNAME = 'MBRSH'.
      FCAT1-COL_POS = '3'.
      APPEND FCAT1.
      CLEAR FCAT1.
    ENDFORM. " POPULATE_FCAT
    *       FORM GENERATE_GRID                                            *
    FORM GENERATE_GRID .
      CHECK C1 IS INITIAL.
      CREATE OBJECT C1 EXPORTING CONTAINER_NAME = 'CC_ALV'.
      CREATE OBJECT A1 EXPORTING I_PARENT = C1.
      CALL METHOD A1->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME = 'MARA'
        CHANGING
          IT_OUTTAB = ITAB[].
    ENDFORM. " GENERATE_GRID
    Max

  • '@' not getting displayed in the ALV report

    Hello,
    I am facing  a strange issue in the ALV report display. A string starting with '@' is not getting displayed and says "default icon " on the report. and this is varying from system to system for the same user.
    can anyone please help me in resolving the issue.
    Thanks in advance.
    Thanks and Regards,
    Santhosh Guptha N.

    @ is a default value as per ALV internal process. This is used in icons .
    I think this is causing the confusion.
    Check in the fieldcat if there is any adjsutment to be made to handle this.
    Br,
    Vijay

  • Cannot add hub-managed content type with external list lookup columns to a list -- Error:Id field is not set on the external data field

    This is a variation on the issue mentioned in this
    post
    We are using SP 2010 Content Hub to manage our content types.  On the content hub we've created a couple of exteranl lists, and then created some site columns as lookups against these lists.  We then added the columns to one of our content types
    and set it to publish.
    After the publishing job executed, I tried adding the content type (which now appears on the subscriber sites) to one of the document libraries on one of the subscriber sites.  When I did that it threw the following error:
    Microsoft.SharePoint.WebControls.BusinessDataListConfigurationException: Id field is not set on the external data field    
    at Microsoft.SharePoint.SPBusinessDataField.CreateIdField(SPAddFieldOptions op)     
    at Microsoft.SharePoint.SPBusinessDataField.OnAdded(SPAddFieldOptions op)     
    at Microsoft.SharePoint.SPFieldCollection.AddFieldAsXmlInternal(String schemaXml, Boolean addToDefaultView, SPAddFieldOptions op, Boolean isMigration, Boolean fResetCTCol)     
    at Microsoft.SharePoint.SPContentType.ProvisionFieldOnList(SPField field, Boolean bRecurAllowed)     
    at Microsoft.SharePoint.SPContentType.ProvisionFieldsOnList()     
    at Microsoft.SharePoint.SPContentType.DeriveContentType(SPContentTypeCollection cts, SPContentType& ctNew)     
    at Microsoft.SharePoint.SPContentTypeCollection.AddContentTypeToList(SPContentType contentType)     
    at Microsoft.SharePoint.SPContentTypeCollection.AddContentType(SPContentType contentType, Boolean updateResourceFileProperty, Boolean checkName, Boolean setNextChildByte)     
    at Microsoft.SharePoint.SPContentTypeCollection.Add(SPContentType contentType)     
    at Microsoft.SharePoint.ApplicationPages.AddContentTypeToListPage.Update(Object o, EventArgs e)     
    at System.Web.UI.WebControls.Button.OnClick(EventArgs e)     
    at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     
    at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)     
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    b55297ed-717f-466d-8bdc-297b20344d3f
    I checked the external  content type configuration and it did specify an "id column".  Anyone know if what I am attempting to do is possible and if so, what special configurations are required?
    Thanks

    The issue is not External Content type or external list but the look up column.
    It's not possible to publish a look up column via the Content Type Hub.
    If you need to do this then an alternate way is to use a Managed Metadata column instead, otherwise you will have to implement this via a feature.
    Varun Malhotra
    =================
    If my post solves your problem could you mark the post as Answered or Vote As Helpful if my post has been helpful for you.

  • Field Catalog Not Found in ALV

    Hi Experts,
    I am trying to exceute the below code its shows the Field CataLog Not Found
    Code is:
    TYPE-POOLS:slis.
    TABLES:ekpo,mseg.
    TYPES: BEGIN OF ty_ekpo,
           ebeln TYPE ekpo-ebeln,
           ebelp TYPE ekpo-ebelp,
           matnr TYPE ekpo-matnr,
           menge TYPE ekpo-menge,
           END OF ty_ekpo.
    TYPES: BEGIN OF ty_mseg,
           ebeln TYPE mseg-ebeln,
           ebelp TYPE mseg-ebelp,
           matnr TYPE mseg-matnr,
           menge TYPE mseg-menge,
           bwart TYPE mseg-bwart,
           END OF ty_mseg.
    TYPES: BEGIN OF ty_final,
            ebeln TYPE ebeln,
            ebelp TYPE ebelp,
            qtysup TYPE MENGE_D,
            qtyact TYPE MENGE_D,
            qtyrej TYPE MENGE_D,
           END OF ty_final.
    DATA: it_mseg  TYPE  TABLE OF ty_mseg WITH HEADER LINE,
          it_ekpo  TYPE  TABLE OF ty_ekpo WITH HEADER LINE,
          it_final TYPE  TABLE OF ty_final WITH HEADER LINE.
    DATA: wa_fieldcat TYPE slis_fieldcat_alv,
          it_fieldcat TYPE slis_t_fieldcat_alv.
    DATA:wa_mseg LIKE LINE OF it_mseg,
         wa_ekpo LIKE LINE OF it_ekpo ,
         wa_final LIKE LINE OF  it_final.
    SELECT-OPTIONS: p_ebeln FOR ekpo-ebeln.
    START-OF-SELECTION.
    SELECT ebeln ebelp matnr menge FROM ekpo
                                     INTO TABLE it_ekpo
                                     WHERE ebeln IN p_ebeln.
      IF it_ekpo[] IS NOT INITIAL.
        SELECT ebeln ebelp matnr menge bwart FROM mseg
                                                    INTO TABLE it_mseg
                                                    FOR ALL ENTRIES IN it_ekpo[]
                                                    WHERE ebeln EQ it_ekpo-ebeln
                                                    AND   ebelp EQ it_ekpo-ebelp
                                                    AND bwart EQ '122'.
      ENDIF.
      LOOP AT  it_mseg  .
        READ TABLE it_ekpo WITH KEY ebeln = it_mseg-ebeln.
        IF sy-subrc EQ 0.
          it_final-qtyrej = it_mseg-menge.
          it_final-qtysup = it_ekpo-menge.
          it_final-ebeln  = it_mseg-ebeln.
          it_final-ebelp  = it_mseg-ebelp.
        ENDIF.
    IF sy-subrc EQ 0.
          it_final-qtyact = ( it_final-qtysup ) - ( it_final-qtyrej ).
        ENDIF.
        APPEND it_final.
      ENDLOOP.
      wa_fieldcat-fieldname = 'EBELN'.
      wa_fieldcat-tabname   = 'IT_FINAL'.
      wa_fieldcat-seltext_l = 'Purchase Doc'.
      wa_fieldcat-seltext_m = wa_fieldcat-seltext_l.
      wa_fieldcat-seltext_s = wa_fieldcat-seltext_l.
      wa_fieldcat-col_pos     = 1.
      wa_fieldcat-outputlen   = 10.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'EBELP'.
      wa_fieldcat-tabname   = 'IT_FINAL'.
      wa_fieldcat-seltext_l = 'Item'.
      wa_fieldcat-seltext_m = wa_fieldcat-seltext_l.
      wa_fieldcat-seltext_s = wa_fieldcat-seltext_l.
      wa_fieldcat-col_pos     = 2.
      wa_fieldcat-outputlen   = 5.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'QTYSUP'.
        wa_fieldcat-tabname   = 'IT_FINAL'.
      wa_fieldcat-seltext_l = 'QuatitySupply'.
      wa_fieldcat-seltext_m = wa_fieldcat-seltext_l.
      wa_fieldcat-seltext_s = wa_fieldcat-seltext_l.
      wa_fieldcat-col_pos     = 3.
      wa_fieldcat-outputlen   = 13.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'QTYACT'.
        wa_fieldcat-tabname   = 'IT_FINAL'.
      wa_fieldcat-seltext_l = 'QualityAccepted'.
      wa_fieldcat-seltext_m = wa_fieldcat-seltext_l.
      wa_fieldcat-seltext_s = wa_fieldcat-seltext_l.
      wa_fieldcat-col_pos     = 4.
      wa_fieldcat-outputlen   = 13.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'QTYREJ'.
      wa_fieldcat-tabname   = 'IT_FINAL'.
      wa_fieldcat-seltext_l = 'QualityRejected'.
      wa_fieldcat-seltext_m = wa_fieldcat-seltext_l.
      wa_fieldcat-seltext_s = wa_fieldcat-seltext_l.
      wa_fieldcat-col_pos     = 5.
      wa_fieldcat-outputlen   = 13.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      DATA: repid LIKE sy-repid.
      repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
          I_CALLBACK_PROGRAM             = repid
        TABLES
          t_outtab                       = it_final[]
      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.
    Thanks In Advance
    Poorna

    Hi,
    pass parametrs as it is given below...
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
      I_CALLBACK_PROGRAM             = repid
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
      I_STRUCTURE_NAME               =
      IS_LAYOUT                      =
      IT_FIELDCAT                    = it_fieldcat
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_EVENTS                      =
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
      IR_SALV_LIST_ADAPTER           =
      IT_EXCEPT_QINFO                =
      I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
      TABLES
        t_outtab                       = it_final[]
    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.
    Thanks & Regards
    Ashu

  • Short dump when I do total or sub total in the ALV report

    Hi,
    When I do total or sub-total on the currency field in the ALV report, it'll give a short dump like
    " The current application program detected a situation which really
    should not occur. Therefore, a termination with a short dump was
    triggered on purpose by the key word MESSAGE (type X)".
       Short text of error message:
       Technical information about the message:
       Message classe...... "0K"
       Number.............. 000
       Variable 1.......... " "
       Variable 2.......... " "
       Variable 3.......... " "
       Variable 4.......... " "
       Variable 3.......... " "
       Variable 4.......... " "
    Trigger Location of Runtime Error
        Program                                 SAPLSLVC
        Include                                 LSLVCF36
        Row                                     2,726
        Module type                             (FORM)
        Module Name                             FILL_DATA_TABLE
    sometime when I do the page down on the ALV report, the same short dump is coming.
    Can anyone help me out.
    Thanks
    Selva

    Hi,
    I'm getting this short dump in the standard program.
    I'm getting ALV report display perfectly. the problem is, when I do total or subtotal on the currency fields.
    2704
    2705 ************************************
    2706 * Column per Fieldcat Entry
    2707 ************************************
    2708         ls_lvc_data-value = space.
    2709         clear ls_lvc_data-style.
    2710         loop at it_fcat_local assigning <ls_fcat>
    2711                 where tech ne 'X' and no_out ne 'X'.
    2712           if l_invisible eq 'X'.
    2713             clear l_invisible.
    2714             if <ls_fcat>-do_sum is initial.
    2715               continue.
    2716             else.
    2717               clear ls_lvc_data-col_pos.
    2718             endif.
    2719           endif.
    2720
    2721           add 1 to ls_lvc_data-col_pos.
    2722
    2723           assign component <ls_fcat>-fieldname
    2724                            of structure <ls_data> to <l_field_value>.
    2725           if sy-subrc ne 0.
    >>>>>             message x000(0k).
    2727           endif.
    2728
    in this standard program, I'm getting the dump. the line is mentioned above in the code.

  • Download the ALV Report output into excel sheet or notepad

    Hi,
    how to downlaod the alv report out into excel sheet or notepad in a proper manner. program contain large number records....
    Thanks in advance!!!!
    Regards,
    kranthi.

    Hi
    Download a report to excel with format (border, color cell, etc) 
    Try this program...it may help you to change the font ..etc.
    Code:
    REPORT ZSIRI NO STANDARD PAGE HEADING.
    this report demonstrates how to send some ABAP data to an
    EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
          H_MAPL TYPE OLE2_OBJECT,         " list of workbooks
          H_MAP TYPE OLE2_OBJECT,          " workbook
          H_ZL TYPE OLE2_OBJECT,           " cell
          H_F TYPE OLE2_OBJECT.            " font
    TABLES: SPFLI.
    DATA  H TYPE I.
    table of flights
    DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
    *&   Event START-OF-SELECTION
    START-OF-SELECTION.
    read flights
      SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
    display header
      ULINE (61).
      WRITE: /     SY-VLINE NO-GAP,
              (3)  'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (4)  'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (8)  'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
      ULINE /(61).
    display flights
      LOOP AT IT_SPFLI.
      WRITE: / SY-VLINE NO-GAP,
               IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
      ENDLOOP.
      ULINE /(61).
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-007
           EXCEPTIONS
                OTHERS     = 1.
    start Excel
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
    PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 1.
    CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
    PERFORM ERR_HDL.
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-008
           EXCEPTIONS
                OTHERS     = 1.
    get list of workbooks, initially empty
      CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      PERFORM ERR_HDL.
    add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP.
      PERFORM ERR_HDL.
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-009
           EXCEPTIONS
                OTHERS     = 1.
    output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - start
    CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP  EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    tell user what is going on
      SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-009
           EXCEPTIONS
                OTHERS     = 1.
    output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - end
    disconnect from Excel
         CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING  #1 = 'C:\SKV.XLS'.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
          FORM FILL_CELL                                                *
          sets cell at coordinates i,j to value val boldtype bold       *
    FORM FILL_CELL USING I J BOLD VAL.
      CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_ZL 'Value' = VAL .
      PERFORM ERR_HDL.
      GET PROPERTY OF H_ZL 'Font' = H_F.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_F 'Bold' = BOLD .
      PERFORM ERR_HDL.
    ENDFORM.
    *&      Form  ERR_HDL
          outputs OLE error if any                                       *
    -->  p1        text
    <--  p2        text
    FORM ERR_HDL.
    IF SY-SUBRC <> 0.
      WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
      STOP.
    ENDIF.
    ENDFORM.                    " ERR_HDL
    Please note that this example maybe slow at filling the excel table
    (perhaps four fields per second on a 900 MHz machine - almost 30 seconds
    for a short example).
    To get the data on properties and methods - there is a bit of smoke and mirrors
    going on here; they are EXCEL properties and methods, not sap ones - so you need
    to look at excel help to determine how a particular function is structured. then
    build the block in sap, as shown in the example.
    If you only want to transfer the data to Excel like when you transfer the data from
    ALV to Excel simply use the Function Modules:
    XXL_SIMPLE_API
    If you want more modifications when you transfer it to Excel use:
    XXL_FULL_API

  • Clear the values in the ALV report after calculating Subtotals

    Hi All,
    In my ALV report, I am displaying subtotals by passing DO_SUM in the Field Catalog.
    Now my problem is in the display I do not want the individual values to be displayed, I want to hide the values in the column(Not the whole column) but I want to display the subtotal of these values in the Subtotal Row.
    Example:
    Item1   10   20
    Item2   20   30
    Item3   10   50
               40   100
    As per our requirements, the output should be
    Item1
    Item2
    Item3
              40   100
    How can this be done? Please suggest.

    Populate i_sort table for the fields for which u want subtotal as shown below:
    *&      Form  sub_populate_sort
          Populate ALV sort table
          No Parameter
    FORM sub_populate_sort .
    Sort on material
      wa_sort-spos = '01' .
      wa_sort-fieldname = 'MATNR'.
      wa_sort-tabname = 'I_EKPO'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO i_sort .
      CLEAR wa_sort.
    Sort on plant
      wa_sort-spos = '02'.
      wa_sort-fieldname = 'WERKS'.
      wa_sort-tabname = 'I_EKPO'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO i_sort .
      CLEAR wa_sort.
    ENDFORM.                    " sub_populate_sort
    Then when populating the field catalog tables use:
    wa_lfl_fcat-no_out         =  'X'.        "No output
    Then display ur data:
    This function module for displaying the ALV report
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = l_repid
          i_callback_top_of_page   = 'SUB_ALV_TOP_OF_PAGE'
          is_layout                = wa_layout
          it_fieldcat              = i_fieldcat
          it_sort = i_sort
          it_events                = i_event
          i_default                = 'X'
          i_save                   = 'A'
        TABLES
          t_outtab                 = i_ekpo
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
    Regards,
    Joy.

Maybe you are looking for

  • Error When Deleting From A Trigger

    When I use a trigger to delete from my Oracle Spatial table, the triggering delete statement will fail if the Oracle Spatial table has a spatial index. Details: Tables CHEV_WELLBORE and CHEV_WELLBORE_SDO need to stay in sync. CHEV_WELLBORE_SDO has an

  • Find Item number based on Sales document and material in GTS system

    Dear experts, I have a situation where in I created a Sales order in ECC system and transmitted the document to GTS for compliance check. Now, during my subsequent processing in ECC side, there is a situation where in I need to check if the document

  • Problem logging in SAP B1 2007 SP00 PL30

    Hi all. One of our SAP users is having a problem in logging in to SAP B1 2007. Last time, the user can login to SAP by just keying  the correct username and password. Now, the user will get an error message when she try to login to SAP using the same

  • Can I get credit for an in-App purchase my 3 year old made?

    Is it possilbe to get credit for an in-App purchase my 3 year old made?

  • Email RMAN backup logs in OEM 12c

    I am scheduling my RMAN daily backups via OEM 12c. My goal is that the email notification includes the full log, rather than just the status of results. I was able to do this in 11g fairly easily. I have created a ticket with Oracle, to which they ha