ALV Grid: Problem with errors

Hi,
  Many of you must have definitely experienced this problem.
I have some default rows on ALV screen for user to enter data.
Say field1, field2 are in the fields list. Now if user puts values in field2, I consider that as a change and I validate entire row. Say field1 is mandatory. I show an error on field1 when field2 has been changed by adding protocol entry.
Now if user changes different row and presses enter, mod_cells does not contain entries related to field1 for first row even though protocol contains errors for field1 on first row. Because of this, first row is not getting validated again.
I added adding an entry in mod_cells for field1. It does not seem to work.
Please let me know if you have any solution for this problem.
Thanks.
Srinivas.

Hi Aaron,
set_selected_cells or so is the method. then user is positioned at the error cell.
regards,
Clemens

Similar Messages

  • ALV GRID Problem with reading contents

    Hi there! I'm quite new with ABAP and I have some problems with the syntax of it. Maybe I should first describe my aim and then I'll show you my code.
    1. I read contents from two database tables, called 'zbc_dan_registry' and 'zbc_dan_category'.
    'zbc_dan_registry' has 2 columns: name, value.
    zbc_dan_category' has 1 column: category.
    Now I want to have an ALV Grid, that displays the contents of 'zbc_dan_registry' and one additional column with dropdown fields, where the user can select a category for each row. This is, what my code already does.
    Now I want to save the contents of the whole table in a new table 'zbc_dan_registrz' (you see: 'registrz', not 'registry'!) with 3 columns:
    name, category, value.
    My problem is, how can I read the contents of the ALV Grid, with the user selected category for each row, and save them in an internal table? I've tried to adapt the code of "BCALV_EDIT_04", but I don't get it running.
    Some detailled help would be great, you know, I'm really working hard to understand ABAP, but it's really hard for me. Thanks for your support and help!!
    Here's my code so far:
    *& Report  ZBC400_DAN_TESTNO4
    REPORT  ZBC400_DAN_TESTNO4.
    DATA: lt_registrz TYPE TABLE OF zbc_dan_regstrz WITH HEADER LINE,
          lt_category TYPE TABLE OF zbc_dan_category WITH HEADER LINE,
          ls_category TYPE zbc_dan_category, "Struktur Kategorie
          ok_code LIKE sy-ucomm,
          container_r TYPE REF TO cl_gui_custom_container,
          grid_r TYPE REF TO cl_gui_alv_grid,
          gc_custom_control_name TYPE scrfname VALUE 'CONTAINER_REG',
          fieldcat_r TYPE lvc_t_fcat,
          layout_r TYPE lvc_s_layo,
          lt_ddval TYPE lvc_t_drop,
          ls_ddval TYPE lvc_s_drop,
          c TYPE i.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
      DATA g_verifier TYPE REF TO lcl_event_receiver.
      DATA: BEGIN OF gt_outtab OCCURS 0.
        INCLUDE STRUCTURE zbc_dan_regstrz.
        DATA: celltab TYPE lvc_t_styl.
      DATA: END OF gt_outtab.
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
      TYPES: BEGIN OF lt_registrz_key.         "Struktur mit den Schlüsseln der Tabelle 'Registry'
        TYPES:  name TYPE zbc_dan_name,
                value TYPE zbc_dan_value,
                category TYPE zbc_dan_cat.
      TYPES: END OF lt_registrz_key.
      TYPES:  ls_registrz_keys TYPE STANDARD TABLE OF lt_registrz_key,
              ls_registrz_table TYPE STANDARD TABLE OF zbc_dan_regstrz.
      METHODS: get_inserted_rows EXPORTING inserted_rows TYPE ls_registrz_keys.
      METHODS: refresh_delta_tables.
      METHODS: handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING er_data_changed.
    *  METHODS: get_inserted_rows EXPORTING inserted_rows TYPE registrz_keys.
    *  METHODS: refresh_delta_tables.
      PRIVATE SECTION.
      DATA: inserted_rows TYPE ls_registrz_keys.
      DATA: error_in_data TYPE c.
      METHODS: get_cell_values IMPORTING row_id TYPE int4 pr_data_changed TYPE REF TO cl_alv_changed_data_protocol EXPORTING key TYPE lt_registrz_key.
    ENDCLASS.
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_data_changed.
        DATA: ls_good TYPE lvc_s_modi,
              ls_new TYPE lvc_s_moce.
        error_in_data = space.
        IF error_in_data = 'X'.
          CALL METHOD er_data_changed->display_protocol.
        ENDIF.
      ENDMETHOD.
      METHOD get_cell_values.
        CALL METHOD pr_data_changed->get_cell_value
          EXPORTING i_row_id = row_id i_fieldname = 'NAME'
            IMPORTING e_value = key-name.
        CALL METHOD pr_data_changed->get_cell_value
          EXPORTING i_row_id = row_id i_fieldname = 'VALUE'
            IMPORTING e_value = key-value.
        CALL METHOD pr_data_changed->get_cell_value
          EXPORTING i_row_id = row_id i_fieldname = 'CATEGORY'
            IMPORTING e_value = key-category.
      ENDMETHOD.
      METHOD get_inserted_rows.
        inserted_rows = me->inserted_rows.
      ENDMETHOD.
      METHOD refresh_delta_tables.
        clear me->inserted_rows[].
      ENDMETHOD.
    ENDCLASS.
    START-OF-SELECTION.
        SELECT client name value
          INTO CORRESPONDING FIELDS OF TABLE lt_registrz FROM zbc_dan_regstry.
        SELECT category INTO CORRESPONDING FIELDS OF TABLE lt_category FROM zbc_dan_category.
    CALL SCREEN 0100.
    MODULE user_command_0100 INPUT.
      CASE ok_code.
        WHEN 'BACK'.
          SET SCREEN 0.
          MESSAGE ID 'BC400' TYPE 'S' NUMBER '057'.
        WHEN 'SAVE'.
          PERFORM save_data.
        WHEN OTHERS.
      ENDCASE.
    ENDMODULE.
    MODULE clear_ok_code OUTPUT.
      CLEAR ok_code.
    ENDMODULE.
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'DYNPRO100'.
      SET TITLEBAR 'D0100'.
    ENDMODULE.
    MODULE display_alv OUTPUT.
      PERFORM display_alv.
    ENDMODULE.
    FORM display_alv.
    IF grid_r IS INITIAL.
    *----Creating custom container instance
      CREATE OBJECT container_r
      EXPORTING
        container_name = gc_custom_control_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.
    *--Exception handling
        ENDIF.
    *----Creating ALV Grid instance
        CREATE OBJECT grid_r
        EXPORTING
          i_parent = container_r
        EXCEPTIONS
          error_cntl_create = 1
          error_cntl_init = 2
          error_cntl_link = 3
          error_dp_create = 4
          others = 5.
          IF sy-subrc <> 0.
    *--Exception handling
          ENDIF.
          CREATE OBJECT g_verifier.
          SET HANDLER g_verifier->handle_data_changed FOR grid_r.
    *----Preparing field catalog.
          PERFORM prepare_field_catalog CHANGING fieldcat_r.
    *----Preparing layout structure
          PERFORM prepare_layout CHANGING layout_r.
    *----Here will be additional preparations
    *--e.g. initial sorting criteria, initial filtering criteria, excluding
    *--functions
          CALL METHOD grid_r->set_table_for_first_display
          EXPORTING
    * I_BUFFER_ACTIVE =
    * I_CONSISTENCY_CHECK =
    * I_STRUCTURE_NAME =
    * IS_VARIANT =
    * I_SAVE =
    * I_DEFAULT = 'X'
            is_layout = layout_r
    * IS_PRINT =
    * IT_SPECIAL_GROUPS =
    * IT_TOOLBAR_EXCLUDING =
    * IT_HYPERLINK =
          CHANGING
            it_outtab = lt_registrz[]
            it_fieldcatalog = fieldcat_r
    * IT_SORT =
    * IT_FILTER =
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error = 2
            too_many_lines = 3
            OTHERS = 4.
          IF sy-subrc <> 0.
    *--Exception handling
          ENDIF.
          ELSE.
            CALL METHOD grid_r->refresh_table_display
    * EXPORTING
    * IS_STABLE =
    * I_SOFT_REFRESH =
          EXCEPTIONS
            finished = 1
            OTHERS = 2.
          IF sy-subrc <> 0.
    *--Exception handling
          ENDIF.
        ENDIF.
        CALL METHOD grid_r->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        CALL METHOD grid_r->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    ENDFORM.
    FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
      EXPORTING
        i_structure_name = 'ZBC_DAN_REGSTR2'
      CHANGING
        ct_fieldcat = pt_fieldcat[]
      EXCEPTIONS
        inconsistent_interface = 1
        program_error = 2
        OTHERS = 3.
      IF sy-subrc <> 0.
    *--Exception handling
      ENDIF.
      LOOP AT pt_fieldcat INTO ls_fcat.
        CASE ls_fcat-fieldname.
          WHEN 'NAME'.
            ls_fcat-coltext = 'Name'.
            ls_fcat-outputlen = '40'.
            MODIFY pt_fieldcat FROM ls_fcat.
          WHEN 'VALUE'.
            ls_fcat-coltext = 'Wert'.
            ls_fcat-outputlen = '30'.
            MODIFY pt_fieldcat FROM ls_fcat.
          WHEN 'CATEGORY'.
              LOOP AT lt_category into ls_category.
                ls_ddval-handle = 1.
                ls_ddval-value = ls_category-category.
    *            ls_ddval-style = cl_gui_alv_grid=>mc_style_enabled.
                APPEND ls_ddval TO lt_ddval.
             ENDLOOP.
             CALL METHOD grid_r->set_drop_down_table
                EXPORTING it_drop_down = lt_ddval.
            ls_fcat-edit = 'X'.
            ls_fcat-drdn_hndl = '1'.
            ls_fcat-coltext = 'Kategorie'.
            MODIFY pt_fieldcat FROM ls_fcat.
        ENDCASE.
      ENDLOOP.
    ENDFORM.
    FORM prepare_layout CHANGING ps_layout TYPE lvc_s_layo.
      ps_layout-zebra = 'X'.
      ps_layout-grid_title = 'Kategorie zur Registry hinzufügen'.
      ps_layout-smalltitle = 'X'.
    ENDFORM.
    FORM save_data.
      DATA: ls_ins_keys TYPE g_verifier->ls_registrz_keys,
            ls_ins_key TYPE g_verifier->lt_registrz_key,
            ls_registrz TYPE zbc_dan_regstrz,
            ls_outtab LIKE LINE OF gt_outtab,
            lt_instab TYPE TABLE OF zbc_dan_regstrz.
      CALL METHOD g_verifier->get_inserted_rows IMPORTING inserted_rows = ls_ins_keys.
      LOOP AT ls_ins_keys INTO ls_ins_key.
        READ TABLE gt_outtab INTO ls_outtab
        WITH KEY  name = ls_ins_key-name
                  value = ls_ins_key-value
                  category = ls_ins_key-category.
        IF sy-subrc = 0.
          MOVE-CORRESPONDING ls_outtab TO ls_registrz.
          APPEND ls_registrz TO lt_instab.
        ENDIF.
      ENDLOOP.
      INSERT zbc_dan_regstrz FROM TABLE lt_instab.
      CALL METHOD g_verifier->refresh_delta_tables.
      ENDFORM.

    Hi Hans,
    You raised the Question in the Webdynpro ABAP forum. Here its very diffcult to get the answer from this forum. Please close it here and raise the same question in ABAP General Forum there you will get faster and so many anwsers.
    Please close the question here.
    Warm Regards,
    Vijay

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

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

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

  • Problems with error-page in web.xml and page caching

    Having a few problems with error pages and web.xml with browsers caching the error pages and strange errors coming out of weblogic.servlet.intenal.WebAppServletContext
    I'm trying to set a web app up so that all http errors and all exceptions are routed thruogh predefined resources. For now, I'm simply send 400 errors to 400.html and the ServletException, IOException and RuntimeException to respective html pages.
    What I'm finding is that the error codes work fine but the exceptions are only be routed to the correct error page for the first call to the servlet after server restart.
    So for example, I have my servlet throwing a ServletException as a test case. The weblogic server log shows that ServletException is thrown, and the correct error page for ServletExceptions is shown.
    If I change the Servlet code to throw IOException in place of SevletException, the weblogic.log shows that IOExceptyion is being thrown (so the servlet has deployed successfully), however the Servletxception error page is shown on the browser.
    I'm using IE6 and I've changed the setting such that a new page is requested every time using the tools-internet options-temp internet files-settings option to "check for new versions of stored pages: Every visit to the page".
    Despite this, the servlet exception error page still appears.
    If you clear the cache from the temp intenet files->delete files IE option, the correct errror page will be shown so it appears that the browser cache is being used after all.
    everytime I delete the temp intenet files I get the correct error page on the first request after but then not after that.
    I have implemented the service method for this test to throw the exceptions - does this make a differecne?
    As a test, I have moved the imlpementation to the doGet method instead bu I now get a strange eror from weblogic comlpaining about an arrayOutOfBoundsException because eror codes in the web.xml are not supported! - see error above.
    Any help is appreciated

    After further investigation: -
    There are no problems with error pages based on error codes, only error exceptions.
    As a test case, I have a service method in a servlet throwing either one of the three exception types that servlets can throw (Runtime, Servlet & IO) the following rules apply. The exception to be thrown is hardcoded and is changed and the web app rebuilt each time. The correct web.xml has been deployed to the app server (checked through console). the webapp is being redeployed correctly - this can be seen in the weblogic log, where the correct exception is reported.
    I am using WLS 8.1, Servlet 2.3, JDK 1.4.1_02
    In all cases, the weblogic log reports that the servlet is throwing the exception as expected.
    Despite having set error-page for exception javax.servlet.ServletException, the exceptions are diverted to the error page that has been set up for http error code 500
    The error page for ServletException is therefore never reached.
    I have the browser set to request pages every time it is asked.
    Once the servlet has thrown an IOException, the only way to get the browser to report an IO or Runtime exception error-page is to clear the browser cache. Restarting the server has no effect.
    Once the servlet has responded with ANY exception, it is not possible to get it to report a ServletException (which is incorrectly reported as a 500 anyway) unless the cache is cleared. Restarting the server has no effect.
    In the case where the servlet throws ServletException, it has no root exception. The servlet 2.3 spec states that if ServletException is thrown but cannot be found in the error pages, the root excpetion will be extracted and the error page list traversed again. Knowing that the RuntimeException error page is correct shown when RuntimeException is throwm, I have nested this inside the ServletException, however error page for http error 500 is still shown.
    I don't believe this is a WLS 8.1 problem, as the console shows that the correct exception is thrown each time. this is backed up by the fact that the correct exception page is thrown when the cache is cleared regardless of what exception was previousdly thrown by the servlet. This excludes ServletException which is always incorrectly thrown as a 500.

  • ALV Grid Problem in WebGUI

    Hi All,
    We've created an ALV grid using classes in R3 and we're testing it in WebGUI.  All of those scenarios are working fine in R3 however the behavior in WebGUI is different.  We're encountering a problem wherein the cellstyles are not being reflected (eg. a particular cell for a particular row should be grayed out if a particular field has this value).  Furthermore, if we enter a value in this field, it should automatically populate values for other fields (eg. column name - PERNR.  Once pernr is entered; column name - NAME should have a value automatically).  Another thing is, the Refresh button is  missing in WebGUI.  One more problem is that the error message for that particular column was not shown.  We're using the add_protocol_entry method, so it should generate a pop-up screen.
    Any solution for all these problems?  Are these problems limitations of the ALV Grid in WebGUI? 
    We'll appreciate all your responses.  Thanks a lot.

    Have a look at example code: BCALV_GRID_01, where they suppress the error by catching it...
    If you are using the ABAP Grid Control (OO object), you can still create the ALV list as a spool listing for the background job.
    The easiest way to do this is to put all the create object statements and method calls for the custom container and ALV grid object inside a subroutine (for example, present_grid).
    All that is required is a simple check of the sy-batch variable to determine if the program is being executed in the foreground or background.
    e.g. if sy-batch is initial.
    call screen 0100.
    else.
    perform present_grid.
    endif.
    In a PBO module of screen 0100, the subroutine present_grid is also performed.
    The set_table_for_first_display method will be invoked in the routine present_grid, however, due to the job being executed in the background, the ALV list output will be written as spool output for the background job.

  • Alv grid problem

    Hi,
    I m getting one problem in alv grid control.
    My o/p is looking like
    prog     xyz
    year      2006
    custno     country     name
    1256     uk     xy
    1563     us     mg
    The o/p is correct but when i press f3 button i got again heading as
    prog     xyz
    year     2006
    Will u tell me what is the problem here. I wanted to when i press f3 it will display my selection screen.
    Plz give me proper solution.

    Hi,
    This occurs because your output for alv is printed twice.
    1st with the header and then with the item.
    Try to print the whole at the same time.
    Regards,
    rajesh.

  • ITS 6.20 patch 18 ALV Grid problems

    Hi,
    We are in the midst of testing the ITS 6.20 patch 18 with EP6 SP12 and we have run into some problems that were not evident with 6.10. 
    First.  With IAC PP_MY_REQUIREMENTS (Requirements Profile) and PP_MY_PROFILEMATCHUP (Profile Matchup), there is now a visible horizontal bar that goes across the whole window.  It can be moved up and down.  This is not there in 6.10.
    Second.  With the new PZ31_EWT (Edit Qualifications) transaction, when you select a qualification on the left and it then appears on the right, the dropdown for the ALV grid does not stay droped down when clicked.  You have to hold the mouse button, and then when you drag over top of the choice that you want, it doesn't select it, BUT, if you use your arrow keys on the keyboard, it changes the value.
    Third.  With PV8I (Internal Training), when viewing the Booking Information in the bottom of the screen, the top line/header of the window is only 1/8 visible.
    Has anyone run into any of these problems before?  Does patch 19 or 20 (when it comes out) solve any of these problems?
    Sorry for all the ranting!!
    Cheers,
    Kevin

    May be try this in ITS forum for a better response.
    Internet Transaction Server (ITS)
    Regards
    Raja

  • Alv grid (automatic) message error

    I've written a table maintenance program with an editable alv grid as per SAP example (BCALV_EDIT_04).
    It works like a charm except for the NON desired message error log on a specific field/column (<b>PROD_NUM</b>) for appended rows. That is, when I click 'ENTER' (or 'check entries' button) a message error log is raised somehow, which I didn't cater for!
    I am calling my grid as follows:
    *...initialize alv grid
        CALL METHOD g_grid->set_table_for_first_display
          EXPORTING
            is_layout            = ps_layout
            it_toolbar_excluding = lt_exclude
          CHANGING
            it_fieldcatalog      = pt_fieldcat
            it_outtab            = pt_outtab[].
    I also cater for changed data event as follows:
    SET HANDLER g_event_receiver->handle_data_changed FOR g_grid.
    *---register ENTER to raise event DATA_CHANGED.
        CALL METHOD g_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    As said before, I don't handle any checks for data (or existance) integrity or anything of the sort in my handle_data_changed method. This error seems to be raised almost automatically.
    My field catalog is derived from the structure. In the structure, PROD_NUM is defined as Built-in type CHAR 02.
    Is there a way to deactivate this error checking?
    Nhlanhla Ndlovu

    Hi,
    Try following code..
    *...initialize alv grid
        CALL METHOD g_grid->set_table_for_first_display
          EXPORTING
            is_layout            = ps_layout
            it_toolbar_excluding = lt_exclude
          CHANGING
            it_fieldcatalog      = pt_fieldcat
            it_outtab            = pt_outtab[].
    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 HANDLER g_event_receiver->handle_data_changed FOR g_grid.
    *---register ENTER to raise event DATA_CHANGED.
        CALL METHOD g_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards,
    Shashank

  • Reg: Download alv grid data with top of page into excel sheet

    Hi All,
    I have a selection screen with radio button for download .
    If that radio button was selected then the data will download into excel sheet (like if we execute normal ALV grid display from there we can download top-of-page and body as it is).
    AOO : 2009P               
    Fiscal year : 2009               
    Posting period : 00               
    Local Currency : USD               
    CO Area Currency :               
    Accounting standard:               
    Sector : 23               
    BB code     Period Value LC     Periodic Quantity
    AHDKGKAJ   200                         0

    Did not get your question

  • ALV grid display with more than 1000 columns

    Hi Friends,
    I have to prepare a report output which have 1015 columns.
    User will give 100 weeks of data to retrieve. I have to display the output in day wise.
    100*7 + 315 = 1015 columns.
    I am using ALV grid display for this in 4.6C.
    My Question is, whether I have to declare the output table type with 1015 fields.?
    Is there any other way to do this, without declaring 1015 cloumns.
    Please guide me to solve this.
    Regards,
    Viji.

    I'm thinking when your End-user will press Ctrl + P feeding A4 size to printer
    Thomas:
    Maybe the functional consultant is pulling your leg?
    May be OP is pulling our legs or something further?
    Cheers

  • Alv grid display with dynamic colums

    Hi,
    i have an alv grid program in which i have to display the 22 fields as rows and i want to freeze them.i also want to display data for the 22 fields for a variable date range i.e. if you consider i have colums A to Z then i have have this sort of display:
    Sel screen:
    year(select-options):
    alv output:
                   Year1 Year2 ...........................Year N
    A
    B
    C
    D
    E
    F
    Z
    Please help me.
    i tried using fieldcatalog-row_pos = my row numbers i.e. 1,2....22.
    Thanks,
    Anand.

    Hi Anand,
    U need to create a dynamic field catalog as well as internal table to handle the year select option and to display the grid.
    See the below code creating dynamic field catalogue and internal table.   The same requirement like urs.
        LOOP AT i_month.
          CASE i_month-date+4(2).
            WHEN '01'.
              IF i_month-tag = 'A'.
                CONCATENATE 'Actual JAN-'
                            i_month-date(4)
                            ' Surcharge'
                       INTO i_month-desc.
              ELSE.
                CONCATENATE 'With JAN-'
                            i_month-date(4)
                            ' Pricing'
                       INTO i_month-desc.
              ENDIF.
            WHEN '02'.
              IF i_month-tag = 'A'.
                CONCATENATE 'Actual FEB-'
                            i_month-date(4)
                            ' Surcharge'
                       INTO i_month-desc.
              ELSE.
                CONCATENATE 'With FEB-'
                            i_month-date(4)
                            ' Pricing'
                       INTO i_month-desc.
              ENDIF.
            WHEN '03'.
              IF i_month-tag = 'A'.
                CONCATENATE 'Actual MAR-'
                            i_month-date(4)
                            ' Surcharge'
                       INTO i_month-desc.
              ELSE.
                CONCATENATE 'With MAR-'
                            i_month-date(4)
                            ' Pricing'
                       INTO i_month-desc.
              ENDIF.
            WHEN '04'.
              IF i_month-tag = 'A'.
                CONCATENATE 'Actual APR-'
                            i_month-date(4)
                            ' Surcharge'
                       INTO i_month-desc.
              ELSE.
                CONCATENATE 'With APR-'
                            i_month-date(4)
                            ' Pricing'
                       INTO i_month-desc.
              ENDIF.
            WHEN '05'.
              IF i_month-tag = 'A'.
                CONCATENATE 'Actual MAY-'
                            i_month-date(4)
                            ' Surcharge'
                       INTO i_month-desc.
              ELSE.
                CONCATENATE 'With MAY-'
                            i_month-date(4)
                            ' Pricing'
                       INTO i_month-desc.
              ENDIF.
            WHEN '06'.
              IF i_month-tag = 'A'.
                CONCATENATE 'Actual JUN-'
                            i_month-date(4)
                            ' Surcharge'
                       INTO i_month-desc.
              ELSE.
                CONCATENATE 'With JUN-'
                            i_month-date(4)
                            ' Pricing'
                       INTO i_month-desc.
              ENDIF.
            WHEN '07'.
              IF i_month-tag = 'A'.
                CONCATENATE 'Actual JUL-'
                            i_month-date(4)
                            ' Surcharge'
                       INTO i_month-desc.
              ELSE.
                CONCATENATE 'With JUL-'
                            i_month-date(4)
                            ' Pricing'
                       INTO i_month-desc.
              ENDIF.
            WHEN '08'.
              IF i_month-tag = 'A'.
                CONCATENATE 'Actual AUG-'
                            i_month-date(4)
                            ' Surcharge'
                       INTO i_month-desc.
              ELSE.
                CONCATENATE 'With AUG-'
                            i_month-date(4)
                            ' Pricing'
                       INTO i_month-desc.
              ENDIF.
            WHEN '09'.
              IF i_month-tag = 'A'.
                CONCATENATE 'Actual SEP-'
                            i_month-date(4)
                            ' Surcharge'
                       INTO i_month-desc.
              ELSE.
                CONCATENATE 'With SEP-'
                            i_month-date(4)
                            ' Pricing'
                       INTO i_month-desc.
              ENDIF.
            WHEN '10'.
              IF i_month-tag = 'A'.
                CONCATENATE 'Actual OCT-'
                            i_month-date(4)
                            ' Surcharge'
                       INTO i_month-desc.
              ELSE.
                CONCATENATE 'With OCT-'
                            i_month-date(4)
                            ' Pricing'
                       INTO i_month-desc.
              ENDIF.
            WHEN '11'.
              IF i_month-tag = 'A'.
                CONCATENATE 'Actual NOV-'
                            i_month-date(4)
                            ' Surcharge'
                       INTO i_month-desc.
              ELSE.
                CONCATENATE 'With NOV-'
                            i_month-date(4)
                            ' Pricing'
                       INTO i_month-desc.
              ENDIF.
            WHEN '12'.
              IF i_month-tag = 'A'.
                CONCATENATE 'Actual DEC-'
                            i_month-date(4)
                            ' Surcharge'
                       INTO i_month-desc.
              ELSE.
                CONCATENATE 'With DEC-'
                            i_month-date(4)
                            ' Pricing'
                       INTO i_month-desc.
              ENDIF.
          ENDCASE.
          MODIFY i_month.
          IF i_month-tag = 'A'.
    Field for reference month surcharge
           CONCATENATE i_month-tag i_month-date(6) INTO
    fs_fldcat-fieldname.
            fs_fldcat-datatype  = 'CHAR'.
            fs_fldcat-intlen    = 18.
            CONDENSE fs_fldcat-fieldname NO-GAPS.
            APPEND fs_fldcat TO i_fldcat.
          ELSE.
    Fields for Compared month surcharge
           CONCATENATE i_month-tag i_month-date(6) INTO
    fs_fldcat-fieldname.
            fs_fldcat-datatype  = 'CHAR'.
            fs_fldcat-intlen    = 18.
            CONDENSE fs_fldcat-fieldname NO-GAPS.
            APPEND fs_fldcat TO i_fldcat.
    Field for indicator
            CONCATENATE 'I' i_month-date(6) INTO fs_fldcat-fieldname.
            fs_fldcat-datatype  = 'CHAR'.
            fs_fldcat-intlen    = 1.
            CONDENSE fs_fldcat-fieldname NO-GAPS.
            APPEND fs_fldcat TO i_fldcat.
    Field for difference surcharge
            CONCATENATE 'D' i_month-date(6) INTO fs_fldcat-fieldname.
            fs_fldcat-datatype  = 'CHAR'.
            fs_fldcat-intlen    = '18'.
            CONDENSE fs_fldcat-fieldname NO-GAPS.
            APPEND fs_fldcat TO i_fldcat.
          ENDIF.                           " IF i_month-tag = 'A'.
        ENDLOOP.                           " LOOP AT i_month.
      ENDIF.                               " IF NOT i_month[] IS INITIAL.
    Method to create dynamic table.
      IF NOT i_fldcat[] IS INITIAL.
        CALL METHOD cl_alv_table_create=>create_dynamic_table
          EXPORTING
            it_fieldcatalog           = i_fldcat[]
          IMPORTING
            ep_table                  = i_table
          EXCEPTIONS
            generate_subpool_dir_full = 1
            OTHERS                    = 2
        IF sy-subrc <> 0.
        ENDIF.                             " IF sy-subrc <> 0.
        ASSIGN i_table->* TO <i_output>.
        CREATE DATA fs_line LIKE LINE OF <i_output>.
        ASSIGN fs_line->* TO <fs_output>.
      ENDIF.                               " IF NOT i_fldcat[] IS INITIAL.

  • Need simple ALV Grid prgm with interactive

    Hi experts,
    pls anyone provide some sample code for simple alv grid for the study purpose.
    i want to knw how the Interactive alv works, how to display some header details like company name and address in the top of the grid.

    hi,
    check this programme..
    Display a Secondary List using ALV Grid
    To display a secondary list when you click on one of the row items in an alv grid. The secondary list should also be an alv.
    Try out this code. You will have to make a structure ZSTR same as the output internal table.
    REPORT ZTEST_REP1 .
    TABLES : MARA,
             BHDGD,
             zstr.
    TYPES:     BEGIN OF T_MARA,
                  MATNR LIKE MARA-MATNR,
                  ERNAM LIKE MARA-ERNAM,
               END OF T_MARA.
    CLASS LCL_EVENT_RECEIVER DEFINITION DEFERRED.
    *Constants for ALV Implementation
    CONSTANTS:  C_SET                        VALUE 'X',
                C_RESET                      VALUE '0',
                C_SAVE                       VALUE 'A',
                C_EXIT(4)                    VALUE 'EXIT',
                C_BACK(4)                    VALUE 'BACK',
                C_CANC(4)                    VALUE 'CANC',
                C_PGTOP(5)                   VALUE 'PGTOP',
                C_PGUP(4)                    VALUE 'PGUP',
                C_PGDN(4)                    VALUE 'PGDN',
                C_PGEND(5)                   VALUE 'PGEND'.
    DATA : I_MARA TYPE STANDARD TABLE OF T_MARA WITH HEADER LINE,
         Internal table for fields catalouge
           I_FIELDCAT TYPE LVC_T_FCAT WITH HEADER LINE,
          i_fieldcat2 type lvc_t_fcat with header line,
         Internal table for cursor position
           I_GT_SELROWS TYPE LVC_T_ROW .
    DATA : WA_MARA LIKE I_MARA,
           WA_GRIDROW LIKE LVC_S_ROW,
           WA_GRIDCOL LIKE LVC_S_COL.
    *Data for ALV Implementation.
    DATA:  OK_CODE       LIKE SY-UCOMM,
           W_OK_CODE     LIKE SY-UCOMM,
           W_CALL        TYPE I VALUE 1,
           W_TAB         LIKE SY-UCOMM VALUE 'TAB1',
           W_SAVE,                                 "For Parameter I_SAVE
           W_VARIANT     TYPE DISVARIANT,          "For parameter IS_VARIANT
           W_GRID        TYPE REF TO CL_GUI_ALV_GRID,
          w_grid1       type ref to cl_gui_alv_grid,
           W_CONTAINER  TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          w_container1  type ref to cl_gui_custom_container,
           W_REPID       LIKE SY-REPID,
           W_GS_PRINT    TYPE LVC_S_PRNT,
           W_GS_LAYOUT   TYPE LVC_S_LAYO,
           W_EVENT_REC   TYPE REF TO LCL_EVENT_RECEIVER,
           W_CONT_MAIN   TYPE SCRFNAME VALUE 'CCCONTAINER',
           W_LN          TYPE I,                            "line number
           W_INDEX       LIKE SY-TABIX,
           W_FLAG,
           W_TEMP_VAL    TYPE I.
    Definition:
    CLASS LCL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
        METHODS:
        HANDLE_TOP_OF_PAGE
            FOR EVENT PRINT_TOP_OF_PAGE OF CL_GUI_ALV_GRID,
        HANDLE_DOUBLE_CLICK
            FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                    IMPORTING E_ROW E_COLUMN.
    ENDCLASS.
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
      METHOD HANDLE_TOP_OF_PAGE.
        PERFORM F_GET_HEADER.
      ENDMETHOD.                           "handle_top_of_page
      METHOD HANDLE_DOUBLE_CLICK.
      The event DOUBLE_CLICK provides parameters for row and column
      of the click. We use row parameter to select a line of the
      corresponding internal table.
      read selected row from internal table
          READ TABLE I_MARA INDEX E_ROW-INDEX INTO WA_MARA.
          IF SY-SUBRC <> 0.
           message i001. " Cursor position not correct.
          ELSE.
          call dialog screen and display the details
            call screen 200 starting at 10 5.
          ENDIF.
      ENDMETHOD.                           "handle_double_click
    ENDCLASS.
    start-of-selection.
    START-OF-SELECTION.
    SELECT MATNR ERNAM FROM MARA INTO TABLE I_MARA.
    End-of-Selection.
    END-OF-SELECTION.
    Start of ALV part.
      W_REPID = SY-REPID.
      W_VARIANT-REPORT = W_REPID.
      W_SAVE = C_SAVE.
      W_CONT_MAIN = W_CONT_MAIN.
      W_GS_LAYOUT = W_GS_LAYOUT.
      W_GS_PRINT  = W_GS_PRINT.
      I_FIELDCAT  = I_FIELDCAT.
      CALL SCREEN 100.
    *&      Form  f_get_header
          text
    -->  p1        text
    <--  p2        text
    FORM F_GET_HEADER.
      DATA: L_LINE1 LIKE BHDGD-LINE1,
            L_LINE2 LIKE BHDGD-LINE2.
      CONSTANTS LC_SPACE VALUE ' '.
      DATA: L_F1(7), L_F2(11), L_F3(9), L_F4(6), L_F5(11), L_F6(4), L_F7(8),
            L_F8(4),L_F9(10), L_F11(11), L_F12(24), L_F13(4),
            L_F14(3).
    take the values of line1 and line2 into two new variables, otherwise
    after coming back to the first screen from the print preview, the
    header shows the condensed lines
      L_LINE1 = BHDGD-LINE1.
      L_LINE2 = BHDGD-LINE2.
      CONDENSE L_LINE1.
      CONDENSE L_LINE2.
    *split the lines to display the whole lines within the
    *stipulated report-width
    SPLIT L_LINE1 AT LC_SPACE INTO L_F1 L_F2 L_F3 L_F4 L_F5 L_F6 L_F7 L_F8
                                        L_F9 .
      SPLIT L_LINE2 AT LC_SPACE INTO L_F11 L_F12 L_F13 L_F14.
      L_F14 = SY-PAGNO.
        WRITE:/1 L_F1, 9 L_F2, 40 L_F3, 50 L_F4, 57 L_F5, 88 L_F6, 93 L_F7 ,
               103 L_F8 , 108 L_F9 .
        WRITE:/1 L_F11, 40 TEXT-012, 78 L_F12, 103 L_F13, 108 L_F14.
    ENDFORM.                    " f_get_header
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'STAT'.
      SET TITLEBAR 'TITL'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM .
        WHEN C_EXIT OR C_BACK OR C_CANC.
          IF NOT W_CONTAINER  IS INITIAL.
            CALL METHOD W_CONTAINER->FREE.
          ENDIF.
          LEAVE TO SCREEN 0.
        WHEN C_PGTOP.
          WA_GRIDROW-INDEX = 1.
        WHEN C_PGUP.
          IF WA_GRIDROW-INDEX <= 15.
            WA_GRIDROW-INDEX = 1.
          ELSE.
            WA_GRIDROW-INDEX = WA_GRIDROW-INDEX - 15.
          ENDIF.
        WHEN C_PGDN.
          PERFORM F_GET_NO_ROWS.
          W_TEMP_VAL = W_LN - WA_GRIDROW-INDEX.
          IF W_TEMP_VAL < 15.
            WA_GRIDROW-INDEX = W_LN.
          ELSE.
            WA_GRIDROW-INDEX = WA_GRIDROW-INDEX + 15.
          ENDIF.
        WHEN C_PGEND.
          PERFORM F_GET_NO_ROWS.
          WA_GRIDROW-INDEX = W_LN.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  f_get_no_rows
          text
    -->  p1        text
    <--  p2        text
    FORM F_GET_NO_ROWS.
        DESCRIBE TABLE I_MARA  LINES W_LN.
    ENDFORM.                    " f_get_no_rows
    *&      Module  DISPLAY_0100  OUTPUT
          text
    MODULE DISPLAY_0100 OUTPUT.
      IF NOT WA_GRIDROW IS INITIAL
      AND NOT WA_GRIDCOL IS INITIAL.
        CALL METHOD W_GRID->SET_SCROLL_INFO_VIA_ID
          EXPORTING
            IS_ROW_INFO = WA_GRIDROW
            IS_COL_INFO = WA_GRIDCOL .
        CALL METHOD W_GRID->SET_CURRENT_CELL_VIA_ID
          EXPORTING
            IS_ROW_ID = WA_GRIDROW
            IS_COLUMN_ID = WA_GRIDCOL .
      ENDIF.
      CALL METHOD W_GRID->GET_SCROLL_INFO_VIA_ID
      IMPORTING
        ES_ROW_INFO = WA_GRIDROW
        ES_COL_INFO = WA_GRIDCOL .
      CALL METHOD W_GRID->GET_SELECTED_ROWS
        IMPORTING
          ET_INDEX_ROWS = I_GT_SELROWS[].
    Build the fieldcat according to structure
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
           EXPORTING
                I_STRUCTURE_NAME = 'ZSTR'
           CHANGING
                CT_FIELDCAT      = I_FIELDCAT[].
      LOOP AT I_FIELDCAT.
        W_INDEX = SY-TABIX.
        CASE I_FIELDCAT-FIELDNAME.
          WHEN 'MATNR'.
            I_FIELDCAT-SCRTEXT_S = 'MATNR'.
            I_FIELDCAT-KEY       = ' '.
            I_FIELDCAT-COL_POS   = '1'.
          WHEN 'ERNAM'.
            I_FIELDCAT-SCRTEXT_S = 'ERDAT'.
            I_FIELDCAT-OUTPUTLEN = '18'.
            I_FIELDCAT-COL_POS   = '2'.
        ENDCASE.
        MODIFY I_FIELDCAT INDEX W_INDEX.
      ENDLOOP.
      READ TABLE I_FIELDCAT INDEX 1 .
      IF W_CALL = 1.
        PERFORM F_STD_HEADER.
        CALL METHOD W_GRID->SET_TABLE_FOR_FIRST_DISPLAY
                          EXPORTING
                            IS_VARIANT                    = W_VARIANT
                            I_SAVE                        = W_SAVE
                          CHANGING
                            IT_OUTTAB                     = I_MARA[]
                            IT_FIELDCATALOG               = I_FIELDCAT[]
                         EXCEPTIONS
                           INVALID_PARAMETER_COMBINATION = 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.
          EXIT.
        ENDIF.
        CREATE OBJECT W_EVENT_REC.
        SET HANDLER W_EVENT_REC->HANDLE_TOP_OF_PAGE FOR W_GRID.
        CREATE OBJECT W_EVENT_REC.
        SET HANDLER W_EVENT_REC->HANDLE_DOUBLE_CLICK FOR W_GRID.
        W_FLAG = C_RESET.
        CALL METHOD CL_GUI_CONTROL=>SET_FOCUS EXPORTING CONTROL = W_GRID.
        W_CALL = 0.
      ENDIF.
    ENDMODULE.                 " DISPLAY_0100  OUTPUT
    *&      Form  f_std_header
          text
    -->  p1        text
    <--  p2        text
    FORM F_STD_HEADER.
    ENDFORM.                    " f_std_header
    *&      Module  DYNPRONR_CHECK_500  OUTPUT
          text
    MODULE DYNPRONR_CHECK_500 OUTPUT.
    if w_dynpronr is initial.
       w_dynpronr = '0100'.
    endif.
      ENDMODULE.                 " DYNPRONR_CHECK_500  OUTPUT
    *&      Module  create_objects_0100  OUTPUT
          text
    MODULE create_objects_0100 OUTPUT.
      check w_container is initial .
      create object w_container
        exporting
           container_name = 'CC'.
      create object w_grid
        exporting
           i_parent = w_container.
      w_flag = c_set.
      w_flag = w_flag.
    ENDMODULE.                 " create_objects_0100  OUTPUT
    *&      Module  STATUS_0200  OUTPUT
          text
    MODULE STATUS_0200 OUTPUT.
      SET PF-STATUS 'ST20'.
      SET TITLEBAR '200'.
      zstr-matnr    = wa_mara-matnr.
      zstr-ernam    = wa_mara-ernam.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
          text
    MODULE USER_COMMAND_0200 INPUT.
      move ok_code to w_ok_code.
      clear ok_code.
      case w_ok_code.
        when c_back or c_exit or c_canc.
          leave to screen 0.
      endcase.
      clear w_ok_code.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    *-- End of Program
    Regards,
    Deepthi.

  • SAPGUI for JAVA 7.00 rev 5 - ALV grid problem

    Hello all,
    I've created simple program using editable ALV grid to edit custom database table in the dictionary.
    After upgrading to rev 5 I can't delete any row from the grid. After clicking the minus sign on the grid toolbar nothing happens. In the release note for the rev. 5 is written that protected rows can be no longer deleted. But I haven't written any code to protect any row in the grid.
    When run on SAPGUI 7.00 rev 4 or SAPGUI for windows 7.10 it works.
    Thanks for any help.

    Hello Petr,
    both in "BCALV_GRID_EDIT" and in "BCALV_GRID_VERIFY" which we use as testreports for editable ALV grid, I can select a line and delete it using the the "delete line" icon in the grid's toolbar running SAP GUI for Java 7.00 rev 5.
    Can you somehow reproduce the issue with the mentioned reports (playing with the options)?
    Otherwise we would need access to your custom program. Then it would be helpful if you could <a href="http://service.sap.com/message">create a message</a> on component BC-FES-JAV and make your system available to us.
    Best regards
    Rolf-Martin

  • ALV Grid Problem - User command Back Cancel Exit

    Hi Guys,
                 I was trying to use the ALV grid and my problem is, on the grid display, when i try to hit the back button or exit or cancel, then a blank screen appears and i need to hit either back or other buttons one more time to go back to the selection screen.
                 Is there any thing I am missing here? Please suggest me the solution.
    Thanks in advance,
    Srinivas.

    hi srinivas,
    we have 2 options in this case.
    1) i think ur using EVENTS_GET function module. If u use sometimes we are facing this kind of problem. i think accroding to my knowliege its bug in SAP....
    2) See in debug mode what is the user command for this back button everty time USERCOMMAND FOR BACK BUTTON not 'BACK' .If it ios correct plaese add the code for back button in user command event.
    if u dont want to face that problem remove that events_get fm and write the code manually. i am not sure abt ur code.
    i hope u got the point what i am saying.
    Thanks,
    Maheedhar

  • Alv grid problem  quantity zero not displaying

    Hi
    i am displaying quantity fields kwmeng and bmeng in alv, in code am subtracting the two quantities,
    the final subtracted value is displaying in alv when it is >0, when it is equal to zero ,it is displaying blank .
    Thanks
    Srini

    Hi Srinivas,
    See this link, it ll help you.
    Value Display with Currency/Quantity Unit - ALV Grid Control - SAP Library
    Cheers,
    pravin

Maybe you are looking for

  • IPhone always logs me out of youtube

    Hi there, my iPhone always logs me out of youtube. I can log in but when getting back to the app another day it did not keep the credentials. I always have to log in again. Do you have any idea what the issue is? Cheers, Kai

  • Total Tax and Non-Deductible column in Tax report

    Hi all, My client is using AU/NZ localization.  We need to customise a Tax report based on existing Tax Report in Financal Report-> Accounting> Tax> Tax Report. Does anyone know where to pull the information for colum "Total Tax" and "Non-Deductible"

  • HT3728 AIRPORT UTILITY IS UNABLE TO FIND ANY WIRELESS DEVICE 5.6.1

    Ok So I have bought a 2TB Time Capsule, for the past few weeks we have been doing our backups on it etc and just using our already installed Netgear wireless router. Tonight I decided I would "extend an already existing wireless router" - after follo

  • Automatic update of condition

    Dear all, i am working on SAP ECC5.0 environment with tax procedure TAXINJ. one problem i am facing with my excise condition type i.e. in an existing sales order (whose partial delivery is already done) when i am updating order qty, my condition valu

  • Running backend jobs and bc4j

    Hie I have an ADF app in which there is one functionality which is suppose to be run everyday like a cron job. This functionality is using BC4j to process and commit data. Currently I am invoking it via a UI button bound to the managed bean calling t