<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Validations on ALV Grid in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/validations-on-alv-grid/m-p/1649088#M288543</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have used ALV grid for accepting user inputs and therby triggering certain transactions. I have made some validations on the user inputs using event data_changed of CL_GUI_ALV_GRID. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;handle_data_changed&lt;/P&gt;&lt;P&gt;         FOR EVENT data_changed OF cl_gui_alv_grid&lt;/P&gt;&lt;P&gt;             IMPORTING er_data_changed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Program reports errors without any problem for the first time when the user enters data and press Enter key. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is when the user changes data on the input screen, internal table er_data_changed will only get the changed values which can be validated. I want to get whole table to validate due to some dependencies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For ex: I have validation on field Doc# which will check if the line item# entered on screen is valid. first time, it checks fine but if the user changes item# again, er_data_changed will only capture this field and I dont have any validation on this field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know how to handle this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample code given below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT er_data_changed-&amp;gt;mt_good_cells INTO ls_good.&lt;/P&gt;&lt;P&gt;      CASE ls_good-fieldname.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;check if values in columns of this row was changed&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        WHEN 'VBELN'.&lt;/P&gt;&lt;P&gt;        CALL METHOD check_item_no&lt;/P&gt;&lt;P&gt;                 EXPORTING&lt;/P&gt;&lt;P&gt;                    ps_good_item_no = ls_good&lt;/P&gt;&lt;P&gt;                    pr_data_changed   = er_data_changed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kasi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Oct 2006 20:44:15 GMT</pubDate>
    <dc:creator>kasithunuguntla</dc:creator>
    <dc:date>2006-10-25T20:44:15Z</dc:date>
    <item>
      <title>Validations on ALV Grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validations-on-alv-grid/m-p/1649088#M288543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have used ALV grid for accepting user inputs and therby triggering certain transactions. I have made some validations on the user inputs using event data_changed of CL_GUI_ALV_GRID. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;handle_data_changed&lt;/P&gt;&lt;P&gt;         FOR EVENT data_changed OF cl_gui_alv_grid&lt;/P&gt;&lt;P&gt;             IMPORTING er_data_changed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Program reports errors without any problem for the first time when the user enters data and press Enter key. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is when the user changes data on the input screen, internal table er_data_changed will only get the changed values which can be validated. I want to get whole table to validate due to some dependencies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For ex: I have validation on field Doc# which will check if the line item# entered on screen is valid. first time, it checks fine but if the user changes item# again, er_data_changed will only capture this field and I dont have any validation on this field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know how to handle this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample code given below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT er_data_changed-&amp;gt;mt_good_cells INTO ls_good.&lt;/P&gt;&lt;P&gt;      CASE ls_good-fieldname.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;check if values in columns of this row was changed&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        WHEN 'VBELN'.&lt;/P&gt;&lt;P&gt;        CALL METHOD check_item_no&lt;/P&gt;&lt;P&gt;                 EXPORTING&lt;/P&gt;&lt;P&gt;                    ps_good_item_no = ls_good&lt;/P&gt;&lt;P&gt;                    pr_data_changed   = er_data_changed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kasi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2006 20:44:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validations-on-alv-grid/m-p/1649088#M288543</guid>
      <dc:creator>kasithunuguntla</dc:creator>
      <dc:date>2006-10-25T20:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Validations on ALV Grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validations-on-alv-grid/m-p/1649089#M288544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Kasi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sample report BCALV_EDIT_03 describes how to verify modified values in an editable ALV grid. Here is part of the documentation (in the program header) that may be interesting for you:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*-----------------------------------------------------------------
* Essential steps (search for '§')
* ~~~~~~~~~~~~~~~
* 1.Set status of columns PLANETYPE and SEATSOCC to editable.
* 2.Optionally restrict generic functions to 'change only'.
*   (The user shall not be able to add new lines).
* 3.Optionally register ENTER to raise event DATA_CHANGED.
*   (Per default the user may check data by using the check icon).
* 4.Define and implement event handler to handle event DATA_CHANGED.
* 5.Loop over table MT_GOOD_CELLS to check all values that are
*   valid due to checks according to information of the DDIC.
* 6.Within a check cycle:
* 6a.Get new cell value to check it using method GET_CELL_VALUE.
*    (In this case SEATSOCC).
* 6b.If the value is valid you may want to change values of
*    other cells.
* 6c.If the value is not valid create an protocol entry in
*    the application log.
&amp;lt;b&amp;gt;* 6d.To access old values (which where not changed in this check cycle)
*    use your output table GT_OUTTAB.&amp;lt;/b&amp;gt;
* 7.Display application log if an error has occured.
*-----------------------------------------------------------------------
*&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 21:35:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validations-on-alv-grid/m-p/1649089#M288544</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2006-10-27T21:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Validations on ALV Grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validations-on-alv-grid/m-p/1649090#M288545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Step 1 - Create a screen using screen painter in the report program.&lt;/P&gt;&lt;P&gt;Step 2 -Set the size of the screen.&lt;/P&gt;&lt;P&gt;Step 3 -Place a custom control on the screen set its name to &amp;#145;C_CONTAINER&amp;#146; and set the size of the custom control .&lt;/P&gt;&lt;P&gt;Step 4 -Save and activate the screen.&lt;/P&gt;&lt;P&gt;Step 5 -Code the Data Declarations&lt;/P&gt;&lt;P&gt;o_container_alv   type REF TO cl_gui_custom_container,&lt;/P&gt;&lt;P&gt;o_alv_grid        TYPE REF TO cl_gui_alv_grid,&lt;/P&gt;&lt;P&gt;Step 6-   Define the Receiver Class&lt;/P&gt;&lt;P&gt;*Event handler (local class) definition&lt;/P&gt;&lt;P&gt;CLASS lcl_event_receiver DEFINITION.&lt;/P&gt;&lt;P&gt;*Object for changed data&lt;/P&gt;&lt;P&gt;     PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;            METHODS:&lt;/P&gt;&lt;P&gt;*Method to Handle Changed Data&lt;/P&gt;&lt;P&gt;          handle_data_changed&lt;/P&gt;&lt;P&gt;          FOR EVENT data_changed OF cl_gui_alv_grid&lt;/P&gt;&lt;P&gt;         IMPORTING er_data_changed.&lt;/P&gt;&lt;P&gt;         METHODS:&lt;/P&gt;&lt;P&gt;*Method that check data and display message&lt;/P&gt;&lt;P&gt;      check_data&lt;/P&gt;&lt;P&gt;        IMPORTING&lt;/P&gt;&lt;P&gt;          pr_row          TYPE lvc_s_modi&lt;/P&gt;&lt;P&gt;          pr_msg          TYPE symsgno&lt;/P&gt;&lt;P&gt;          pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.&lt;/P&gt;&lt;P&gt;ENDCLASS. "lcl_event_receiver DEFINITION&lt;/P&gt;&lt;P&gt;Step 7-  Create the Reference and implement the Class&lt;/P&gt;&lt;P&gt;    DATA:&lt;/P&gt;&lt;P&gt;*Object declaration for local class&lt;/P&gt;&lt;P&gt;    o_event_receiver  TYPE REF TO lcl_event_receiver.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Event handler (local class) implementation&lt;/P&gt;&lt;P&gt;CLASS lcl_event_receiver IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Method Check Data to display Error Message&lt;/P&gt;&lt;P&gt;  METHOD check_data.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the particular cell value in this case it is&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;of labels&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CALL METHOD pr_data_changed-&amp;gt;get_cell_value&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        i_row_id    = pr_row-row_id&lt;/P&gt;&lt;P&gt;        i_fieldname = c_labels&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        e_value     = v_value.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Checking if labels value is 0 or initial&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    IF v_value IS INITIAL OR v_value EQ  0 .&lt;/P&gt;&lt;P&gt;      v_flg_check = c_flg_x.&lt;/P&gt;&lt;P&gt;*Call method to display message&lt;/P&gt;&lt;P&gt;      CALL METHOD pr_data_changed-&amp;gt;add_protocol_entry&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;          i_msgid     = c_msg_id&lt;/P&gt;&lt;P&gt;          i_msgty     = c_msg_typ_e&lt;/P&gt;&lt;P&gt;          i_msgno     = pr_msg&lt;/P&gt;&lt;P&gt;          i_msgv1     = pr_row-value&lt;/P&gt;&lt;P&gt;          i_fieldname = pr_row-fieldname&lt;/P&gt;&lt;P&gt;          i_row_id    = pr_row-row_id.&lt;/P&gt;&lt;P&gt;    ENDIF .&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "check_data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Method to handle change data&lt;/P&gt;&lt;P&gt;  METHOD handle_data_changed.&lt;/P&gt;&lt;P&gt;*Local Data Declarations&lt;/P&gt;&lt;P&gt;    DATA:&lt;/P&gt;&lt;P&gt;      l_rec_mod_cells TYPE lvc_s_modi.&lt;/P&gt;&lt;P&gt;*Loop at all modified lines of ALV grid&lt;/P&gt;&lt;P&gt;    LOOP AT er_data_changed-&amp;gt;mt_mod_cells INTO l_rec_mod_cells.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Check data needs to be fired only when we have checked&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;the checkbox&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      IF l_rec_mod_cells-fieldname = c_select AND&lt;/P&gt;&lt;P&gt;            l_rec_mod_cells-value = c_flg_x.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        CALL METHOD check_data&lt;/P&gt;&lt;P&gt;          EXPORTING&lt;/P&gt;&lt;P&gt;            pr_row          = l_rec_mod_cells&lt;/P&gt;&lt;P&gt;            pr_msg          = c_203&lt;/P&gt;&lt;P&gt;            pr_data_changed = er_data_changed.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "handle_data_changed&lt;/P&gt;&lt;P&gt;ENDCLASS.      "lcl_event_receiver IMPLEMENTATION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 8 - 	Display the ALV .PBO needs to implemented for the same &lt;/P&gt;&lt;P&gt;       In PBO&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create the Object References&lt;/P&gt;&lt;P&gt;  CREATE OBJECT o_container_alv&lt;/P&gt;&lt;P&gt;         EXPORTING container_name = v_container_name.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT o_alv_grid&lt;/P&gt;&lt;P&gt;         EXPORTING i_parent = o_container_alv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you wish you can exclude some of the Functionallity Like Create New &lt;/P&gt;&lt;P&gt;  l_wa_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_copy_row.&lt;/P&gt;&lt;P&gt;  APPEND l_wa_exclude TO fp_i_exclude.&lt;/P&gt;&lt;P&gt;  l_wa_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_delete_row.&lt;/P&gt;&lt;P&gt;  APPEND l_wa_exclude TO fp_i_exclude.&lt;/P&gt;&lt;P&gt;  l_wa_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_append_row.&lt;/P&gt;&lt;P&gt;  APPEND l_wa_exclude TO fp_i_exclude.&lt;/P&gt;&lt;P&gt;  l_wa_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_insert_row.&lt;/P&gt;&lt;P&gt;  APPEND l_wa_exclude TO fp_i_exclude.&lt;/P&gt;&lt;P&gt;  l_wa_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_move_row.&lt;/P&gt;&lt;P&gt;  APPEND l_wa_exclude TO fp_i_exclude.&lt;/P&gt;&lt;P&gt;  l_wa_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_copy.&lt;/P&gt;&lt;P&gt;  APPEND l_wa_exclude TO fp_i_exclude.&lt;/P&gt;&lt;P&gt;  l_wa_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_cut.&lt;/P&gt;&lt;P&gt;  APPEND l_wa_exclude TO fp_i_exclude.&lt;/P&gt;&lt;P&gt;  l_wa_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_paste.&lt;/P&gt;&lt;P&gt;  APPEND l_wa_exclude TO fp_i_exclude.&lt;/P&gt;&lt;P&gt;  l_wa_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_paste_new_row.&lt;/P&gt;&lt;P&gt;  APPEND l_wa_exclude TO fp_i_exclude.&lt;/P&gt;&lt;P&gt;  l_wa_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_undo.&lt;/P&gt;&lt;P&gt;  APPEND l_wa_exclude TO fp_i_exclude.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Call The Method to display the ALV and set the handler for the Receiver Object&lt;/P&gt;&lt;P&gt;  CALL METHOD o_alv_grid-&amp;gt;set_table_for_first_display&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      is_layout            = l_rec_layout&lt;/P&gt;&lt;P&gt;      it_toolbar_excluding = i_exclude&lt;/P&gt;&lt;P&gt;    CHANGING&lt;/P&gt;&lt;P&gt;      it_fieldcatalog      = fp_i_field_cat&lt;/P&gt;&lt;P&gt;      it_outtab            = fp_i_final_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CREATE OBJECT o_event_receiver.&lt;/P&gt;&lt;P&gt;  SET HANDLER o_event_receiver-&amp;gt;handle_data_changed FOR o_alv_grid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This receiver object handles the error if encountered&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Oct 2006 06:36:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validations-on-alv-grid/m-p/1649090#M288545</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-28T06:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Validations on ALV Grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validations-on-alv-grid/m-p/1649091#M288546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your response. I have used exact similar coding posted by both of you. My situation is little bit different.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Event "Data_changed" has import parameter  "er_data_changed" which will return only changed values from input screen for validation. I want to see all values because I have certain dependencies on my validations. for ex: I have written validation on field Doc# which will get and validate other values entered on the input screen (say for suppose if the order type, material number entered are correct for this Doc#). once I correct other values, I will see these values in "er_data_changed" but I dont have validations on these fields. my validation is limited to Doc# field which has not changed. So, the program will not re-check if what I have corrected is CORRECT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only option I could see is writing validation on every field but I am worried I have 33 fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am hoping SAP would have provided er_get_all_data kind of parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any other work-around idea is well appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kasi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2006 16:21:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validations-on-alv-grid/m-p/1649091#M288546</guid>
      <dc:creator>kasithunuguntla</dc:creator>
      <dc:date>2006-10-30T16:21:29Z</dc:date>
    </item>
  </channel>
</rss>

