ALV validation

Hi,
I have a screen with some fields.
And below it I have a custom container with an <b>Editable</b> ALV (<b>Classical</b> ALV).
I have fields order number, <b><i>currency</i></b>, etc.
When I enter the order number, I validate the order number in the <b>Data Changed</b> event.
For currency, i can either enter order currency or company code currency.
How do I validate this ?
I am currently planning to get the entered value of currency at the data_changed event, read the alv table for order number and company code.
now check db table for order and company code if the currency entered is either of them.
Is this the right event at which validation should be done. And am I doing it the right way. Or is there a better event to do this ?
2. also, If i throw an error straight away, the screen aborts. so i chose the cl_alv_changed_data_protocol way of writing to logs.
I cant do the same in data_changed_finished because this event (unlike data_changed) doesnt generate an object to this protocol.
Kindly suggest.
Rgds,
Prashanth

hi, list what I know as following, hope it will be helpful:
DATA_CHANGED: will be triggered after user inputted, you can get the user inputted in the event.
DATA_CHANGED_FINISHED: will be triggered after the ALV automated validation. The ALV will automated check the inputted data format after DATA_CHANGED and before this event.
E.G. if you input alphabet into a DATE field, you can get the inputted alphabet in DATA_CHANGED, and ALV will do the validation after DATA_CHANGED, it blank the unvalid format data, and you can only get the blank in the DATA_CHANGED_FINISHED.
So if you need to get the data inputted, you can get it in DATA_CHANGED, like this:
  METHOD HANDLE_DATA_CHANGED.
    DATA:
      TMP_LS_GOOD    TYPE  LVC_S_MODI.
    LOOP AT ER_DATA_CHANGED->MT_GOOD_CELLS INTO TMP_LS_GOOD.
    ENDLOOP.
  ENDMETHOD.
Hope my reply is helpful
thanks

Similar Messages

  • OO ALV validation check without event DATA_CHANGED and results via popup

    Hi Gurus,
    I'm working on SAP ECC 6.0 and I'm facing a problem during the ALV validation check. My requirement is to show an ALV with one editable field. In addition I have to pre-initialize this field in order to give a reference value to the user, but this is not always correct, or better, this field represent the maximum amount available, but, because of other validation checks, this field is not always correct (and it's ok, it's not a problem), and if it is greater than another amount I have to display an error.
    I was thinking about catching the event DATA_CHANGED and do the checks inside of it. It works but not completely, because if the user do not change anything the event is not raised and I cannot do my checks.
    My solution is to do the checks without catching the DATA_CHANGED event and display the errors in a separate popup window.
    The checks are ok, but I have problems during the displaying of the results: I would like to use the class CL_ALV_CHANGED_DATA_PROTOCOL in order to display the errors, I tried creating the Object:
      Data: go_Error Type Ref To CL_ALV_CHANGED_DATA_PROTOCOL.
      Create Object go_Error
        Exporting
    *      i_container =
          i_calling_alv = go_0200_Alv
    giving it a reference to the ALV (the go_0200_Alv is my CL_GUI_ALV_GRID object).
    Then I did many Call Methods to the Add_Protocol_Entry to add the message in the protocol and then display them calling the Display_Protocol Method of my "go_Error".
    The Popup is shown and the "links" to the ALV are correct (if I double click a message it selects the corresponding row of the ALV, but (and it's my problem) I cannot see the Description of the Column with the error: the popup window is an ALV grid itself with 3 columns ("Message Type", "Name of the Column" and "Message Text") where I can see correctly the Message Type and the Message Text but not the name of the column.
    Debugging the code I found that If I catch the event, the parameter er_Data_Changed (the class CL_ALV_CHANGED_DATA_PROTOCOL) is filled with some other informations like Modified Rows and other attributes like FieldCatalog, Row-ID, so I thought the problem was related to that, and that's why I replicated the whole case in my processing, filling every table I would see if I use the "standard way" for validation. Bu it didn't correct the error. I still don't see the name of the Column.
    This is my code, it's only the part interested, If you need other informations, please ask me and I will copy them.
    form CHECK_ALV_0200_0110 Changing pc_Error Type Char01.
      Data: lt_MatchK1 Type tp_Matches1_Key_t,
            l_Message  Type Char100,
            l_MessX    Type String,
            l_QtaRes   Type ZDM_AMT_ASSIGNED,
            l_QtaAcc   Type ZDM_AMT_ACCRUED,
            l_QtaStep  Type ZDM_AMT_ASSIGNED.
      Field-Symbols: <fs_Table>    Type Standard Table,
                     <fs_Master>   Type Standard Table,
                     <fs_Mod_Cell> Type LVC_S_MODI,
                     <fs_Line>     Type Any,
                     <fs_Field>    Type Any,
                     <fs_Any>      Type Any.
      Data lt_Matches_Alv_Mod Type tp_Matches1_Alv_t.
      Data ls_Modi Type LVC_S_MODI.
      Data: l_Row_ID Type I,
            l_Tabix  Type I.
      Field-Symbols: <fs_Match_ALV> Type tp_Matches1_Alv_s.
      Free go_Error.
      CREATE OBJECT go_Error
        EXPORTING
    *      i_container =
          i_calling_alv = go_0200_Alv
    * Validation Checks
      Clear pc_Error.
      Clear ls_Modi.
      Loop At gt_Matches1_Alv Assigning <fs_Match_ALV>.
        l_Tabix = Sy-Tabix.
        Check <fs_Match_ALV>-Status Eq con_Status_Temp.
    *   Set the Modified Row for the CL_ALV_CHANGED_DATA_PROTOCOL object
          Append <fs_Match_ALV> To lt_Matches_Alv_Mod.
          Add 1 To ls_Modi-Row_Id.
          ls_Modi-FieldName = 'AMT_DEDUCTED'.
          Write <fs_Match_ALV>-Amt_Deducted To ls_Modi-Value Currency <fs_Match_ALV>-Waers.
          Condense ls_Modi-Value No-Gaps.
          ls_Modi-Tabix = l_Tabix.
          Append ls_Modi To: go_Error->mt_Mod_Cells,
                             go_Error->mt_Good_Cells.
          l_Row_ID = ls_Modi-Row_Id.
        Clear l_Message.
        If <fs_Match_ALV>-Amt_Deducted Eq 0.
          pc_Error = con_X.
          CALL METHOD go_Error->Add_Protocol_Entry
            EXPORTING
              i_msgid     = 'ZDMV'
              i_msgty     = 'E'
              i_msgno     = '005'
    *          i_msgv1     =
    *          i_msgv2     =
    *          i_msgv3     =
    *          i_msgv4     =
              i_fieldname = 'AMT_DEDUCTED'
              i_row_id    = l_Row_ID
    *          i_tabix     =
          Continue.
        EndIf.
        Case g_Dynnr.
          When '0110'.
            Perform Get_ResQtaDispute1 Using lt_MatchK1
                                             <fs_Match_ALV>
                                       Changing l_QtaRes.
            Perform Get_ResQtaAccrued1 Using <fs_Match_ALV>
                                       Changing l_QtaAcc.
    *      When '0111'.
    *        Perform Get_ResQtaDispute2 Using lt_MatchK2
    *                                         <fs_Match_ALV>
    *                                   Changing l_QtaRes.
    *        Perform Get_ResQtaAccrued2 Using <fs_Match_ALV>
    *                                   Changing l_QtaAcc.
        EndCase.
        Add <fs_Match_ALV>-Amt_Deducted To l_QtaStep.
        If l_QtaStep > l_QtaRes.
    *     Store the Error
          pc_Error = con_X.
          Write l_QtaRes To l_Message Currency <fs_Match_ALV>-Waers.
          Condense l_Message No-Gaps.
          CALL METHOD go_Error->Add_Protocol_Entry
            EXPORTING
              i_msgid     = 'ZDMV'
              i_msgty     = 'E'
              i_msgno     = '002'
              i_msgv1     = l_Message
    *          i_msgv2     =
    *          i_msgv3     =
    *          i_msgv4     =
              i_fieldname = 'AMT_DEDUCTED'
              i_row_id    = l_Row_ID
    *          i_tabix     =
        EndIf.
        If l_QtaStep > l_QtaAcc.
    *     Store the Error
          pc_Error = con_X.
          Write l_QtaAcc To l_Message Currency <fs_Match_ALV>-Waers.
          Condense l_Message No-Gaps.
          CALL METHOD go_Error->Add_Protocol_Entry
            EXPORTING
              i_msgid     = 'ZDMV'
              i_msgty     = 'E'
              i_msgno     = '002'
              i_msgv1     = l_Message
    *          i_msgv2     =
    *          i_msgv3     =
    *          i_msgv4     =
              i_fieldname = 'AMT_DEDUCTED'
              i_row_id    = l_Row_ID
    *          i_tabix     =
        EndIf.
      EndLoop.
      If pc_Error Eq con_X.
    *   If there was at least one error, Display the Popup
        go_Error->mt_FieldCatalog[]   = gt_0200_FCat[].
        go_Error->ms_Layout-Zebra     = con_X.
        Get Reference Of lt_Matches_Alv_Mod[] Into go_Error->Mp_Mod_Rows.
        CALL METHOD go_error->display_protocol
    *      EXPORTING
    *        i_container        =
    *        i_display_toolbar  =
    *        i_optimize_columns =
      EndIf.
    EndForm.
    Do you know if there is a particular issue about that? Or, maybe, I'm doing something wrong...
    Please help me
    Regards,
    Claudio
    Edited by: Claudio Distrutti on Oct 31, 2008 12:38 PM

    Hello Claudio
    Nobody prevents you from calling your event handler method go_grid->HANDLE_DATA_CHANGED directly!
    What do I mean with that?
    I assume you are calling method go_grid->CHECK_CHANGED_DATA at the beginning of the PAI module to catch any changes from the editable ALV grid. Within the event handler method you do your validation and send the error popup if necessary.
    Now when the user closes the error popup and pushes e.g. the SAVE button then I can happen that method HANDLE_DATA_CHANGED does not trigger event DATA_CHANGED because nothing was indeed changed on the ALV grid. Yet the invalid value is still there.
    However within the FORM routine for saving the data you can just call your event handler method directly:
    FORM save_data.
    CALL METHOD go_grid->handle_data_changed
        EXPORTING
    *      er_data_changed =
          e_ucomm = 'SAVE'.
    ENDFORM.
    Now within your event handler method you always know when the method was called because if method CHECK_CHANGED_DATA triggers event DATA_CHANGED the IMPORTING parameter ER_DATA_CHANGED is bound whereas it is empty when the method is called from your SAVE routine.
    METHOD handle_data_changed.
      DATA: lo_log   TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.
        IF ( er_data_changed IS BOUND ).
          lo_log = er_data_changed.
        ELSE.
          CREATE OBJECT lo_log.
        ENDIF.
    " Do the validations and send error log if necessary
      lo_log->DISPLAY_PROTOCOL( ).
    ENDMETHOD.
    Regards
      Uwe

  • Editing a field in ALV and validating the newly entered Value

    Hi Experts,
       I have an ALV report in grid display (not object oriented). My requirement is to edit a field on the output and write the validations to validate the value that was edited on the ALV output.
    This can be done using object oriented coding by using the method check_changed_data. For this to happen, i need to change the entire scope of my report into object oriented, which is like reinventing the wheel.
    Since my report was developed using classical ABAP, what needs to be done to get this functionality. Any suggestions are welcome.
    Thanks.

    in the FM 'REUSE_ALV_GRID_DISPLAY'  import parameter IS_LAYOUT check out the columsn EDIT and EDIT_COLUMN. Also Use FM 'REUSE_ALV_EVENTS_GET' to get list possible event and pass a subroutine name which will be called when ever event is fired.
    example:
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = l_events.
      READ TABLE l_events WITH KEY name = slis_ev_top_of_page
                                   INTO g_event.
      IF sy-subrc = 0.
        MOVE top_of_page TO g_event-form.
        APPEND g_event TO t_events.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_buffer_active    = 'X'
          i_callback_program = t_repid
          is_layout          = t_layout
          it_fieldcat        = t_fieldcat[]
          i_save             = t_save
          it_events          = t_events[]
        TABLES
          t_outtab           = g_editpos1[].

  • Date validation in ALV Grid output

    Hi Experts,
    I have created an OOP ALV output. There are a couple of date fields on the report output which are editable. I have referred the standard DATS type and hence I ma getting F4 help for date on the report output.
    Now, If the user enters an invalid date manually (without F4), the CHECK_CHANGED_DATA method of the CL_GUI_ALV_GRID does not read this invalid value and hence I am not able to validate the date.
    I do not want to create a custom search help for date.
    Please suggest how to validate the date in this case.
    Thanks.
    Regards,
    Rudresh

    Hi Rudresh,
    In PBO module, set handler for event 'DATA_CAHNGED'
    In PAI module always call 'check_changed_data( )' after a custom button click like below.
    Inside handler method of event 'DATA_CAHNGED' do validation for date.
    *PBO
    module status_0100 output.
    *Setting handler for event data_changed
            set handler g_o_main->data_changed for g_o_grid.
    endmodule.  
    *PAI
    module user_command_0100 input.
      clear: ok_code.
      ok_code = sy-ucomm.
      case ok_code.
        when 'SAVE'.  " Function code of ur custom button
          g_o_grid->check_changed_data( ).  " Raises event 'DATA_CAHNGED'
    endmodule. 
    *Class method
    method data_changed. " Handler method
    " Use table        er_data_changed->mt_good_cells[]  or er_data_changed->mt_mod_cells to get entered date
      endmethod.
    Thanks
    Edited by: Sap Fan on Sep 29, 2009 8:51 AM
    Edited by: Sap Fan on Sep 29, 2009 9:46 AM

  • Validation of data in editable ALV report output for particular field

    Hi Experts,
    I have one input enabled field in ALV output. How to validate the data once user enters  in that field and press enter? Is it possible to capture the value, hit the enter after user enters the data?
    Thanks,
    Surya Prakash

    Halo Prakash,
    1 First you should registeer the ENTER Event.
    call method g_grid->register_edit_event
                   exporting
                      i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    2 Declare event handler method for Event data_changed of cl_gui_alv_grid.
    handle_data_changed
             for event data_changed of cl_gui_alv_grid
                 importing er_data_changed.
    3 Inside the Event handler method , you get the event parameter er_data_changed type ref to CL_ALV_CHANGED_DATA_PROTOCOL.
    loop at er_data_changed->mt_good_cells into ls_good.
          case ls_good-fieldname.
            when 'FIELD1'.
              call method check_FIELD1.
            when 'FIELD2 '.
              call method check_FIELD2
          endcase.
        endloop.
    4 Inside the Method check_FIELD1 and check_FIELD2 you can do the validation check .
    call method er_data_changed->get_cell_value( Passing the row no and field name).
    if the check  fails you can use add_protocol_entry to write the error.
    5 Finally call
    er_data_changed->display_protocol.
    Regards
    Arshad

  • Validation in alv report

    Hi friends i am new to abap.i am doing some validation in my report .my program is executing properly but i need  some modification.... its alv report on bapi for GOODS MOVEMENT TYPE For tht i am uploading a flat file using gui_upload.but i need some modification on validation..this program is abt goods transfer from one plant to another plant,s location .so in my flat file i am having material,from plant ,from location,to plant,to location and quantity .here is the code:
    *&      Form  VALIDATE_DATA
    1.Check Material in Table MARC >> Material Plant Validation
    If not found, Fill Remarks with 'Material Not Found in Plant'
    2.Check Plant is Assigned to POrg in Table T024W >> Plant POrg Validation
    If not found, Fill Remarks with 'Invalid POrg for Plant'
    3.Check Location for Plant and Location in Table T001L >> Plant SLoc Validation
    If not found, Fill Remarks with 'Invalid Storage Location for Plant'
    FORM validate_data .
      DATA: lv_ekorg TYPE t024e-ekorg.
    Get POrg for CompanyCode
      SELECT SINGLE ekorg INTO lv_ekorg FROM t024e
            WHERE bukrs EQ p_bukrs.
      LOOP AT it_final.
    Check-1
        SELECT SINGLE * FROM marc
                        WHERE matnr = it_final-matnr
                          AND werks = it_final-f_werks.
        IF sy-subrc = 4.
          it_final-remark = 'Material Not Found in Plant'.
          MODIFY it_final.
        ELSE.
    Check-2
          SELECT SINGLE * FROM t024w
                       WHERE werks = it_final-t_werks
                         AND ekorg = lv_ekorg.
          IF sy-subrc = 4.
            it_final-remark = 'Invalid POrg for Plant'.
            MODIFY it_final.
          ELSE.
    Check-3
            SELECT SINGLE * FROM t001l
                                 WHERE werks  = it_final-t_werks
                                  AND lgort = it_final-t_lgort.
            IF sy-subrc = 4.
              it_final-remark = 'Invalid Storage Location for Plant'.
              MODIFY it_final.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " VALIDATE_DATA
    for this code i am getting output as if plant value is wrong then there will be a remark in the output as material is 'Material Not Found in Plant'....and as same for location n purchase organization....
    But in my output i want ,if there is plant n location is wrong the then 2 remarks should display in 2 rows but like wise now i am getting only one remark for 2 errors also..........getting  remark based on first condition....
    can any one help me hw to solve ...

    *& Report  YSG_IM_F2_002                                               *
    *&   This object is  for goods transfer from one plant to another      *
    *&   plant using FM-BAPI_GOODSMVT_CREATE                               *
    REPORT  YSG_IM_F2_002                           .
    TABLES: marc, t024w, t001l.
    TYPE-POOLS:slis.
    TYPES:  BEGIN OF i_list,
            matnr LIKE mard-matnr,
            f_werks LIKE mard-werks,
            f_lgort LIKE mard-lgort,
            t_werks LIKE mard-werks,
            t_lgort LIKE mard-lgort,
            labst LIKE mard-labst,
            remark TYPE c,
           END OF i_list.
    TYPES: BEGIN OF i_mara,
           matnr LIKE mara-matnr,
           END OF i_mara.
    TYPES:BEGIN OF i_marc,
          matnr LIKE marc-matnr,
          werks LIKE marc-werks,
          END OF i_marc.
    TYPES: BEGIN OF i_mard,
            matnr LIKE mard-matnr,
            f_werks LIKE mard-werks,
            f_lgort LIKE mard-lgort,
            t_werks LIKE mard-werks,
            t_lgort LIKE mard-lgort  ,
            labst LIKE mard-labst,
            END OF i_mard.
    TYPES: BEGIN OF i_t001l,
           bukrs TYPE t001l-werks,
           lgort TYPE t001l-lgort,
           END OF i_t001l.
    TYPES: BEGIN OF i_t024e,
           ekorg TYPE t024e-ekorg,
           bukrs TYPE t024e-bukrs,
           END OF i_t024e.
    TYPES: BEGIN OF i_mkpf,
           xblnr type mkpf-xblnr,
           END OF i_mkpf.
    TYPES: BEGIN OF i_final,
           matnr LIKE mard-matnr,
           f_werks LIKE mard-werks,
           f_lgort LIKE mard-lgort,
           t_werks LIKE mard-werks,
           t_lgort LIKE mard-lgort,
           labst type c ,
           remark(50) type c,
          END OF i_final.
    DATA : filename TYPE string,
           title type c.
    DATA: it_list TYPE STANDARD TABLE OF i_list WITH HEADER LINE,
          it_mara TYPE STANDARD TABLE OF i_mara WITH HEADER LINE,
          it_marc TYPE STANDARD TABLE OF i_marc WITH HEADER LINE,
          it_mard TYPE STANDARD TABLE OF i_mard WITH HEADER LINE,
          it_t001l TYPE STANDARD TABLE OF i_t001l WITH HEADER LINE,
          it_t024e TYPE STANDARD TABLE OF i_t024e WITH HEADER LINE,
          it_mkpf TYPE STANDARD TABLE OF i_mkpf WITH HEADER LINE,
          it_final TYPE STANDARD TABLE OF i_final WITH HEADER LINE.
    DATA: fs_fldcat TYPE slis_fieldcat_alv ,   "Structure for Field catalog
          it_fldcat LIKE TABLE OF fs_fldcat,
          layout    TYPE slis_layout_alv,
          V_REPID   LIKE sy-repid.
    DATA: GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
          EVENTS TYPE SLIS_T_EVENT,
          GW_EVENT       TYPE SLIS_ALV_EVENT,
          GI_LISTHEADER  TYPE SLIS_T_LISTHEADER.
    DATA: lv_matnr TYPE mara-matnr,
          lv_ekorg TYPE t024e-ekorg.
    DATA: BEGIN OF gmhead.
            INCLUDE STRUCTURE bapi2017_gm_head_01.
    DATA: END OF gmhead.
    DATA: BEGIN OF gmcode.
            INCLUDE STRUCTURE bapi2017_gm_code.
    DATA: END OF gmcode.
    DATA: BEGIN OF mthead.
            INCLUDE STRUCTURE bapi2017_gm_head_ret.
    DATA: END OF mthead.
    DATA: BEGIN OF itab OCCURS 100.
            INCLUDE STRUCTURE bapi2017_gm_item_create.
    DATA: END OF itab.
    DATA: BEGIN OF errmsg OCCURS 10.
            INCLUDE STRUCTURE bapiret2.
    DATA: END OF errmsg.
    *data: wmenge like iseg-menge,
         errflag.
    *Selection Screen Declaration
    SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text-001.
    PARAMETERS: p_bukrs LIKE t024e-bukrs OBLIGATORY,
                ekorg LIKE t024e-ekorg,
                f_file LIKE ibipparms-path OBLIGATORY,
                xblnr like mkpf-xblnr,
                Doc_Post type checkbox.
    SELECTION-SCREEN END OF BLOCK blk .
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR f_file .
      CLEAR f_file.
      CALL FUNCTION 'F4_FILENAME'
       EXPORTING
         PROGRAM_NAME  = .
         DYNPRO_NUMBER = SYST-DYNNR
        IMPORTING
          file_name     = f_file.
    START-OF-SELECTION.
      filename = f_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = filename
          filetype                = 'ASC'
          has_field_separator     = 'x'
        TABLES
          data_tab                = it_final
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      PERFORM validate_data.
      PERFORM bapi_goods_mvt.
      PERFORM alv_grid_display.
    endif.
    PERFORM BAPI_GOODS_MVT.
    *&      Form  VALIDATE_DATA
    1.Check Material in Table MARC >> Material Plant Validation
    If not found, Fill Remarks with 'Material Not Found in Plant'
    2.Check Plant is Assigned to POrg in Table T024W >> Plant POrg Validation
    If not found, Fill Remarks with 'Invalid POrg for Plant'
    3.Check Location for Plant and Location in Table T001L >> Plant SLoc Validation
    If not found, Fill Remarks with 'Invalid Storage Location for Plant'
    FORM validate_data .
    Get POrg for CompanyCode
      SELECT SINGLE ekorg INTO lv_ekorg FROM t024e
            WHERE bukrs EQ p_bukrs.
      LOOP AT it_final.
    Check-1
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            input  = it_final-matnr
          IMPORTING
            output = lv_matnr.
        SELECT SINGLE * FROM marc
                        WHERE matnr = lv_matnr
                          AND werks = it_final-f_werks.
         IF sy-subrc <> 0.
          it_final-remark = 'Material Not Found in Plant'.
          append it_final .
         endif  .
        SELECT SINGLE * FROM marc
                       WHERE matnr = lv_matnr
                         AND werks = it_final-t_werks.
         IF sy-subrc <> 0.
          it_final-remark = 'Material Not Found in Plant'.
          append it_final .
         endif.
    Check-2
          SELECT SINGLE * FROM t024w
                       WHERE werks = it_final-t_werks
                         AND ekorg = lv_ekorg.
          IF sy-subrc <> 0.
            it_final-remark = 'Invalid POrg for Plant'.
                  append it_final .
          Endif.
          SELECT SINGLE * FROM t024w
                       WHERE werks = it_final-f_werks
                         AND ekorg = lv_ekorg.
          IF sy-subrc <> 0.
            it_final-remark = 'Invalid POrg for Plant'.
                 append it_final .
          Endif.
    Check-3
            SELECT SINGLE * FROM t001l
                                 WHERE werks  = it_final-t_werks
                                  AND lgort = it_final-t_lgort.
            IF sy-subrc <> 0.
              it_final-remark = 'Invalid Storage Location for Plant'.
                    append it_final .
            ENDIF.
            SELECT SINGLE * FROM t001l
                                  WHERE werks  = it_final-f_werks
                                   AND lgort = it_final-f_lgort.
            IF sy-subrc <>  0.
              it_final-remark = 'Invalid Storage Location for Plant'.
                   append it_final .
            ENDIF.
         ENDIF.
       ENDIF.
      ENDLOOP.
    ENDFORM.                    " VALIDATE_DATA
    *&      Form  ALV_GRID_DISPLAY
          text
    FORM alv_grid_display.
      DATA:l_edit TYPE lvc_s_glay.
      PERFORM build_fieldcat.
      PERFORM layout_build  USING layout.
      PERFORM fill_list_header USING gi_listheader.
      v_repid = sy-repid.
      gw_event-name = slis_ev_top_of_page.
      gw_event-form = 'TOP_OF_PAGE'.
      APPEND gw_event TO events.
      l_edit-edt_cll_cb = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = V_REPID
        i_callback_pf_status_set          = 'SET_PF_STATUS'
       I_CALLBACK_USER_COMMAND           = ' '
       I_CALLBACK_TOP_OF_PAGE            = ' '
        i_grid_title                      = title
       I_GRID_SETTINGS                   =
         is_layout                         = layout
         it_fieldcat                       = it_fldcat
         i_save                            = 'x'
       IS_VARIANT                        =
        IT_EVENTS                         = events
        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.
    ENDFORM.                    "ALV_GRID_DISPLAY
    *&      Form  build_fieldcat
          text
    FORM build_fieldcat.
      PERFORM fieldcat  USING: 'IT_FINAL'       "Internal table name
                               'MATNR'         "CREDIT CONTROL AREA
                               '10'             "length
                               'MATERIAL'   "Description
                               'L'             "Dictionary long text
                               ' '             "Database table name
                               ' '             "Database tab' field name
                               ' '             "Justification R/M/L
                               ' '             "To do total
                               ' '             "emphasize
                               ' '             "emphasize
                               ' '             "emphasize
                               ' '            "Data type
                               ' '            "edit.
                               ' '.          "round
      PERFORM fieldcat USING: 'IT_FINAL'       "Internal table name
                               'F_WERKS'         "CREDIT CONTROL AREA
                               '10'             "length
                               'FROM PLANT'   "Description
                               'L'             "Dictionary long text
                               ' '             "Database table name
                               ' '             "Database tab' field name
                               ' '             "Justification R/M/L
                               ' '             "To do total
                               ' '             "emphasize
                               ' '             "emphasize
                               ' '             "emphasize
                               ' '            "Data type
                               ' '          "edit.
                               ' '.          "round
      PERFORM fieldcat  USING: 'IT_FINAL'       "Internal table name
                                'F_LGORT'         "CREDIT CONTROL AREA
                                '10'             "length
                                'LOCATION'   "Description
                                'L'             "Dictionary long text
                                ' '             "Database table name
                                ' '             "Database tab' field name
                                ' '             "Justification R/M/L
                                ' '             "To do total
                                ' '             "emphasize
                                ' '             "emphasize
                                ' '             "emphasize
                                ' '            "Data type
                                ' '           "edit.
                                ' '.          "round
      PERFORM fieldcat USING: 'IT_FINAL'       "Internal table name
                                'T_WERKS'         "CREDIT CONTROL AREA
                                '10'             "length
                                'TO PLANT'   "Description
                                'L'             "Dictionary long text
                                ' '             "Database table name
                                ' '             "Database tab' field name
                                ' '             "Justification R/M/L
                                ' '             "To do total
                                ' '             "emphasize
                                ' '             "emphasize
                                ' '             "emphasize
                                ' '            "Data type
                                ' '           "edit.
                                ' '.          "round
      PERFORM fieldcat  USING: 'IT_FINAL'       "Internal table name
                              'T_LGORT'         "CREDIT CONTROL AREA
                              '10'             "length
                              'LOCATION'   "Description
                              'L'             "Dictionary long text
                              ' '             "Database table name
                              ' '             "Database tab' field name
                              ' '             "Justification R/M/L
                              ' '             "To do total
                              ' '             "emphasize
                              ' '             "emphasize
                              ' '             "emphasize
                              ' '            "Data type
                              ' '            "edit.
                              ' '.            "round
      PERFORM fieldcat USING: 'I_FINAL'       "Internal table name
                              'LABST'         "CREDIT CONTROL AREA
                                '10'             "length
                                'QUANTITY'   "Description
                                'L'             "Dictionary long text
                                ' '             "Database table name
                                ' '             "Database tab' field name
                                ' '             "Justification R/M/L
                                ' '             "To do total
                                ' '             "emphasize
                                ' '             "emphasize
                                ' '             "emphasize
                                ' '            "Data type
                                ' '            "edit.
                                ' '.           "round
      PERFORM fieldcat USING: 'I_FINAL'       "Internal table name
                                'REMARK'         "CREDIT CONTROL AREA
                                '50'             "length
                                'REMARK'   "Description
                                'L'             "Dictionary long text
                                ' '             "Database table name
                                ' '             "Database tab' field name
                                ' '             "Justification R/M/L
                                ' '             "To do total
                                ' '             "emphasize
                                ' '             "emphasize
                                ' '             "emphasize
                                ' '            "Data type
                                ' '            "edit.
                                ' '.           "round
    ENDFORM.                    "build_fieldcat
    *&      Form  fieldcat
          text
    FORM fieldcat  CHANGING value(p_tname)
                            value(p_fname)
                            value(p_length)
                            value(p_ltext)
                            value(p_typet)
                            value(p_rtab)
                            value(p_rfield)
                            value(p_just)
                            value(p_dosum)
                            value(p_emphasize)
                            value(p_datatype)
                            value(p_no_zero)
                            value(p_hotspot)
                            value(p_edit)
                            value(p_round).
      fs_fldcat-tabname       = p_tname.
      fs_fldcat-fieldname     = p_fname.
      fs_fldcat-outputlen     = p_length.
      fs_fldcat-seltext_l     = p_ltext.
      fs_fldcat-input         = p_typet.
      fs_fldcat-edit          = p_rtab.
      fs_fldcat-ref_fieldname = p_rfield.
      fs_fldcat-just          = p_just.
      fs_fldcat-do_sum        = p_dosum.
      fs_fldcat-emphasize     = p_emphasize.
      fs_fldcat-datatype      = p_datatype.
      fs_fldcat-lzero         =  p_no_zero.
      fs_fldcat-hotspot       = p_hotspot.
      fs_fldcat-edit          = p_edit.
      fs_fldcat-decimals_out = p_round.
      APPEND  fs_fldcat TO it_fldcat.
    ENDFORM.                    "fieldcat
    *&      Form  fill_list_header
          text
         -->FV_I_LISTHEADER  text
    FORM fill_list_header  USING fv_i_listheader TYPE slis_t_listheader.
    DATA: lw_line TYPE slis_listheader,
            l_date(10),
            l_time(10).
      DATA : p_date LIKE sy-datum.
      DATA : p_time LIKE sy-uzeit.
      DATA : ztext(17).
      DATA : ztext1(80).
      p_date = sy-datum.
      p_time = sy-uzeit.
       CLEAR fv_i_listheader.
      CONCATENATE p_date6(2) '.' p_date4(2) '.' p_date+0(4) INTO l_date.
      CONCATENATE p_time0(2) ':' p_time2(2) ':' p_time+4(2) INTO l_time.
    IF doc_post = 'X'.
        ztext = 'Execute Mode'.
      ELSE.
        ztext = 'Update Mode'.
      ENDIF.
       CLEAR lw_line.
      lw_line-typ  = 'H'.
      lw_line-info = sy-repid.
      APPEND lw_line TO fv_i_listheader.
       CLEAR lw_line.
      lw_line-typ  = 'H'.
      lw_line-info = l_date.
      APPEND lw_line TO fv_i_listheader.
       CLEAR lw_line.
      lw_line-typ  = 'H'.
      lw_line-info = l_time.
      APPEND lw_line TO fv_i_listheader.
       CLEAR lw_line.
      lw_line-typ  = 'H'.
      lw_line-info = sy-uname.
      APPEND lw_line TO fv_i_listheader.
       CLEAR lw_line.
      lw_line-typ  = 'H'.
      lw_line-info =  ztext.
      APPEND lw_line TO fv_i_listheader.
    endform.                    "fill_list_header
    *&      Form  top_of_page
          text
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = gi_listheader.
    ENDFORM.                    "top_of_page
    *&      Form  layout_build
          text
         -->LAYOUT     text
    FORM layout_build  USING layout TYPE slis_layout_alv.
    layout-box_fieldname     = 'BOX'.
      layout-zebra             = 'X'. " STRIPED PATTERN
      layout-numc_sum          = 'X'. " TOTALS FOR NUMC-FIELDS
      layout-no_keyfix         = ' '. " DO NOT FIX KEYCOLUMNS
      layout-colwidth_optimize = ' ' .
      layout-flexible_key      = ' '. " KEY COLUMNS MOVABLE,...
      layout-detail_popup      = ' '. " SHOW DETAIL IN POPUP
    ENDFORM.                    "layout_build
    *&      Form  BAPI_GOODS_MVT
          text
    FORM bapi_goods_mvt.
      DATA: dc_numner TYPE  bapi2017_gm_head_ret-mat_doc,
            dc_year TYPE  bapi2017_gm_head_ret-doc_year.
      clear: dc_numner, dc_year.
      if doc_post = 'X'.
        gmhead-pstng_date = sy-datum.
        gmhead-doc_date = sy-datum.
        gmhead-pr_uname = sy-uname.
        gmhead-REF_DOC_NO = it_mkpf-xblnr.
        gmcode-gm_code = '04'.   "04 - MB1B - Transfer Posting
        LOOP AT it_final.
          itab-move_type   = '301'.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = it_final-matnr
            IMPORTING
              output = itab-material.
          itab-plant            = it_final-f_werks .
          itab-stge_loc         = it_final-f_lgort .
          itab-MOVE_PLANT       = it_final-t_werks .
          itab-move_stloc       = it_final-t_lgort .
          itab-entry_qnt        = it_final-labst .
          APPEND itab.
        ENDLOOP.
        CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
          EXPORTING
            goodsmvt_header             = gmhead
            goodsmvt_code               = gmcode
        TESTRUN                     = ' '
         IMPORTING
           goodsmvt_headret            = mthead
           materialdocument            = dc_numner
           matdocumentyear             = dc_year
          TABLES
            goodsmvt_item               = itab
        GOODSMVT_SERIALNUMBER       =
            return                      = errmsg.
        IF errmsg[] IS INITIAL.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              wait = 'X'.
          LOOP AT it_final.
            it_final-remark = dc_numner.
            MODIFY it_final.
          ENDLOOP.
        endif.
      ELSE.
    clear errflag.
        LOOP AT errmsg.
          IF errmsg-type EQ 'E'.
            WRITE:/'Error in function', errmsg-message.
         errflag = 'X'.
          ELSE.
            WRITE:/ errmsg-message.
          ENDIF.
        ENDLOOP.
      endif.
    ENDFORM.                    "BAPI_GOODS_MVT

  • Editable alv: add custom validation and display "errors" in protocol list

    Hi,
    What I want to do:
    PAI validation of editable alv with displaying error's in the protocol list by adding custom entries to the existing protocol object.
    What is my problem:
    After registering "data_changed event", the protocol list don't appear.
    My understanding is, that the object "er_data_changed" is passed by the event "data_changed"
    an so I thought I can add some more entries to the protocol list.
    After "de-registering" the "data_changed" event, the protocol appears with the standard errros messages (e.g. "input to numeric" by enter charachters)
    One more hint:
    By creating a new object "er_data_changed" in the handler method the protocol list works, but I would like to append entries to the object that was passed with the event.
    Probably I've misunderstand something, please help !
    My coding:
    PAI:
    trigger event "data_changed" -> calls handler method
      CALL METHOD r_myalv->check_changed_data
        IMPORTING
          e_valid = is_valid.
    stop processing
      IF is_valid NE 'X'.
        MESSAGE 'invalid input' TYPE 'E' .
      ENDIF.
    handler method:
    handle_data_changed FOR EVENT data_changed  OF cl_gui_alv_grid  IMPORTING e_ucomm
                                                                                    er_data_changed.
    METHOD handle_data_changed.
        data: ls_mod_cell type lvc_s_modi.
         CALL METHOD er_data_changed->add_protocol_entry
                    EXPORTING
                           i_msgid     = 'SU'
                           i_msgty     = 'E'
                           i_msgno     = '000'
                           i_msgv1     = 'This is a test !'
                           i_fieldname = ls_mod_cell-fieldname.
         er_data_changed->refresh_protocol( ).
         er_data_changed->DISPLAY_PROTOCOL( ).
    ENDMETHOD.                    "handle_data_changed

    Dear Olaf,
        If understood correctly, you want to Edit an ALV and do some data validations when some data is changed in an ALV.   To do this follow the following steps:
    1.   Before displaying ALV, Register the edit event.
    * Set cell modified to trigger data_changed
    CALL METHOD go_alv_grid->register_edit_event
    EXPORTING
    i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    2.  Register the event DATA_CHANGED of class CL_GUI_ALV_GRID & handle the event.
    SET HANDLER lo_event_receiver->handle_data_changed FOR go_alv_grid.
    The event DATA_CHANGED of class CL_GUI_ALV_GRID has a parameter ER_DATA_CHANGED which is of type CL_ALV_CHANGED_DATA_PROTOCOL.
    This er_data_changed has internal table MT_MOD_CELLS(contains index of records changed ) & MP_MOD_ROWS(contains the changed row), using these update your internal table accordingly.
    DATA : wa_mod_cell TYPE lvc_s_modi.
    FIELD-SYMBOLS: <fs> TYPE table.
    LOOP AT er_data_changed->mt_mod_cells INTO wa_mod_cell.
    ASSIGN er_data_changed->mp_mod_rows->* TO <fs>.
    READ TABLE <fs> INTO wa_output INDEX wa_mod_cell-tabix.
    MODIFY lt_output FROM wa_output INDEX wa_mod_cell-row_id.
    ENDLOOP.
    3.   Here it self you can do the required data validations(No need of any PAI modules) as below.
    IF wa_orders-zfstfirmtyp = c_9.
    MESSAGE s288(zcsp).
    DELETE er_data_changed->mt_mod_cells.
    EXIT.
    ENDIF.
    Regards
    Kesava

  • Validations and default Values in ALV Grid

    All,
    I am using "set_table_for_first_display" to display a grid with empty editable rows wherein which users can enter data and process certain transactions.
    My requirement is to know if we can provide drop-downs and default values in this grid. for ex. if user want to insert a row, that row should automatically have some default values like company code, sales org etc.
    Also, if there is an error while validating the data, I should be able to set the focus on that field while displaying the error message. I was able to display error message but could not set the focus on the field that need to be corrected.
    Your earlier response is much appreciated.
    Regards
    Kasi

    Hi kasi,
    check these links:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/an easy reference for alv grid control.pdf
    http://www.abap4.it/download/ALV.pdf
    hope this helps,
    keerthi.

  • Unwanted field validation when adding new line to ALV (ABAP OO)

    Hi,
    We are using OO Controls to create an editable ALV grid, whose structure contains debit/credit indicator.
    When we click on the standard add new line button, a new line is added but an error message appears telling the user to enter a valid credit/ debit indicator (of course it is blank in the new line).
    This is annoying for users - is there any way to suppress this when....but just when a new line is being created?
    Thanks,
    Tristan

    Debug and find out what is the sy-ucomm when you add a new line in the ALV. And then In the validation of "enter a valid credit/ debit indicator " put a IF condition to check the if the SY-ucomm is not for inseting new line.
    Hope this helps.
    Fran

  • Validation I/P Enabled field in the ALV grid

    Hi all,
    Which method is used for validating a value entered in a reprot output field of an ALV Grid OO report.
    can some one please throw some light on this.
    with a few example programs where it has been implemented.
    Regrds

    Hi sushi,
      check this Program :  BCALV_EDIT_04
      to check out, Execute it , select the checkbox , and give any non numeric amount in the amount field , it will display an error

  • Alv table validations

    Hi all,
    I have alv table for create PR. i have entered values in first row but incomplete and tries to add another row but it show the message like enter the value in the field(field name). after the values are entered completely in the first row, it should allow to add the others rows..
    can anybody suggest where exactly in alv i should write this validations.?
    Thanks all

    Hi ,
    Are you using the standard alv button or custom button.
    regards
    Kuldeep

  • Selecting multiple lines from ALV output for further validation

    Hi guru's,
             i have created a ALV report with a check box in the output,i need to select multiple lines by checking 'X' in the check box
    after that i need to do further validation..like updating etc..how to read the selected lines( check box = 'X' )from the output of the ALV report.Is there any function for that.plz help me with this regard.
    Thanks & Regards,
    Balaji.S

    Hi Balaji,
    Try this way.
    <font color=blue><pre>
    REPORT ztest_alv_row_selection.
    DATA: BEGIN OF it_output OCCURS 0,
            select TYPE c,          "This variable stores the value when row selected.
            bukrs  TYPE t001-bukrs,
            butxt  TYPE t001-butxt,
          END OF it_output.
    TYPE-POOLS:slis.
    DATA:it_events            TYPE STANDARD TABLE OF slis_alv_event,
         it_fieldcat          TYPE STANDARD TABLE OF slis_fieldcat_alv,
         wa_fieldcat          TYPE slis_fieldcat_alv,
         wa_events            TYPE slis_alv_event,
         wa_layout            TYPE slis_layout_alv.
    DATA:g_program            TYPE sy-repid VALUE sy-repid.
    START-OF-SELECTION.
      SELECT * FROM t001 INTO CORRESPONDING FIELDS OF TABLE it_output UP TO 100 ROWS.
      DEFINE fieldcatalog.
        wa_fieldcat-fieldname = &1.
        wa_fieldcat-tabname   = &2.
        wa_fieldcat-seltext_l = &3.
        append wa_fieldcat to it_fieldcat.
        clear  wa_fieldcat.
      END-OF-DEFINITION.
      fieldcatalog: "Column table       col text
                    'BUKRS' 'IT_OUTPUT' 'BUKRS',
                    'BUTXT' 'IT_OUTPUT' 'BUTXT'.
      wa_layout-box_fieldname     = 'SELECT'. "This has to be set to get selection
      wa_layout-colwidth_optimize = 'X'.
      wa_events-name              = 'PF_STATUS_SET'.
      wa_events-form              = 'PF_STATUS_SET'.
      APPEND wa_events TO it_events.
      CLEAR wa_events.
      wa_events-name              = 'USER_COMMAND'.
      wa_events-form              = 'USER_COMMAND'.
      APPEND wa_events TO it_events.
      CLEAR wa_events.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = g_program
          is_layout          = wa_layout
          it_fieldcat        = it_fieldcat
          it_events          = it_events
        TABLES
          t_outtab           = it_output.
    *&      Form  PF_STATUS_SET
    FORM pf_status_set USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZTEST'.
    1. When you set Pf status ZTEST, standard application tools will be removed.
    2. Goto SE41 give program 'SAPLKKBL' and status 'STANDARD_FULLSCREEN'.
    3. Copy the status from those to ZTEST of our program. Now you will see all standard functions.
    ENDFORM.                    "PF_STATUS_SET
          FORM USER_COMMAND                                          *
    FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
    Check function code
      CASE r_ucomm.
        WHEN 'DISPLAY'.  "user presses SAVE
          LOOP AT it_output.
            IF it_output-select EQ 'X'.
          Process records that have been selected
              WRITE:/ it_output.
            ENDIF.
          ENDLOOP.
      ENDCASE.
    ENDFORM.                    "user_command</pre></font>
    Thanks
    Venkat.O

  • Validations on ALV Grid

    Hi,
    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.
    handle_data_changed
             FOR EVENT data_changed OF cl_gui_alv_grid
                 IMPORTING er_data_changed.
    Program reports errors without any problem for the first time when the user enters data and press Enter key.
    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.
    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.
    Please let me know how to handle this issue.
    Sample code given below:
        LOOP AT er_data_changed->mt_good_cells INTO ls_good.
          CASE ls_good-fieldname.
    check if values in columns of this row was changed
            WHEN 'VBELN'.
            CALL METHOD check_item_no
                     EXPORTING
                        ps_good_item_no = ls_good
                        pr_data_changed   = er_data_changed.
    Regards
    Kasi

    Step 1 - Create a screen using screen painter in the report program.
    Step 2 -Set the size of the screen.
    Step 3 -Place a custom control on the screen set its name to ‘C_CONTAINER’ and set the size of the custom control .
    Step 4 -Save and activate the screen.
    Step 5 -Code the Data Declarations
    o_container_alv   type REF TO cl_gui_custom_container,
    o_alv_grid        TYPE REF TO cl_gui_alv_grid,
    Step 6-   Define the Receiver Class
    *Event handler (local class) definition
    CLASS lcl_event_receiver DEFINITION.
    *Object for changed data
         PUBLIC SECTION.
                METHODS:
    *Method to Handle Changed Data
              handle_data_changed
              FOR EVENT data_changed OF cl_gui_alv_grid
             IMPORTING er_data_changed.
             METHODS:
    *Method that check data and display message
          check_data
            IMPORTING
              pr_row          TYPE lvc_s_modi
              pr_msg          TYPE symsgno
              pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.
    ENDCLASS. "lcl_event_receiver DEFINITION
    Step 7-  Create the Reference and implement the Class
        DATA:
    *Object declaration for local class
        o_event_receiver  TYPE REF TO lcl_event_receiver.
    *Event handler (local class) implementation
    CLASS lcl_event_receiver IMPLEMENTATION.
    *Method Check Data to display Error Message
      METHOD check_data.
    Get the particular cell value in this case it is
    of labels
        CALL METHOD pr_data_changed->get_cell_value
          EXPORTING
            i_row_id    = pr_row-row_id
            i_fieldname = c_labels
          IMPORTING
            e_value     = v_value.
    Checking if labels value is 0 or initial
        IF v_value IS INITIAL OR v_value EQ  0 .
          v_flg_check = c_flg_x.
    *Call method to display message
          CALL METHOD pr_data_changed->add_protocol_entry
            EXPORTING
              i_msgid     = c_msg_id
              i_msgty     = c_msg_typ_e
              i_msgno     = pr_msg
              i_msgv1     = pr_row-value
              i_fieldname = pr_row-fieldname
              i_row_id    = pr_row-row_id.
        ENDIF .
      ENDMETHOD.                    "check_data
    *Method to handle change data
      METHOD handle_data_changed.
    *Local Data Declarations
        DATA:
          l_rec_mod_cells TYPE lvc_s_modi.
    *Loop at all modified lines of ALV grid
        LOOP AT er_data_changed->mt_mod_cells INTO l_rec_mod_cells.
    Check data needs to be fired only when we have checked
    the checkbox
          IF l_rec_mod_cells-fieldname = c_select AND
                l_rec_mod_cells-value = c_flg_x.
            CALL METHOD check_data
              EXPORTING
                pr_row          = l_rec_mod_cells
                pr_msg          = c_203
                pr_data_changed = er_data_changed.
          ENDIF.
        ENDLOOP.
      ENDMETHOD.                    "handle_data_changed
    ENDCLASS.      "lcl_event_receiver IMPLEMENTATION
    Step 8 -      Display the ALV .PBO needs to implemented for the same
           In PBO
    Create the Object References
      CREATE OBJECT o_container_alv
             EXPORTING container_name = v_container_name.
      CREATE OBJECT o_alv_grid
             EXPORTING i_parent = o_container_alv.
    If you wish you can exclude some of the Functionallity Like Create New
      l_wa_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
      APPEND l_wa_exclude TO fp_i_exclude.
      l_wa_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
      APPEND l_wa_exclude TO fp_i_exclude.
      l_wa_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
      APPEND l_wa_exclude TO fp_i_exclude.
      l_wa_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
      APPEND l_wa_exclude TO fp_i_exclude.
      l_wa_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
      APPEND l_wa_exclude TO fp_i_exclude.
      l_wa_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
      APPEND l_wa_exclude TO fp_i_exclude.
      l_wa_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
      APPEND l_wa_exclude TO fp_i_exclude.
      l_wa_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
      APPEND l_wa_exclude TO fp_i_exclude.
      l_wa_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
      APPEND l_wa_exclude TO fp_i_exclude.
      l_wa_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
      APPEND l_wa_exclude TO fp_i_exclude.
    Call The Method to display the ALV and set the handler for the Receiver Object
      CALL METHOD o_alv_grid->set_table_for_first_display
        EXPORTING
          is_layout            = l_rec_layout
          it_toolbar_excluding = i_exclude
        CHANGING
          it_fieldcatalog      = fp_i_field_cat
          it_outtab            = fp_i_final_data.
      CREATE OBJECT o_event_receiver.
      SET HANDLER o_event_receiver->handle_data_changed FOR o_alv_grid.
    This receiver object handles the error if encountered

  • ALV GRID Edit Validations (how to do your own)

    Hi folks, I am using ALV Grid to enter some data, I would like to do some validations on save and also adjust data in the table and validate it upon another few buttons.
    All is good and works fine using the standard events, however these events are only triggered if you directly change the data yourself, <b>I need validates once a button is hit</b>.
    I have been playing with the following methods, and the cells are returned in the "good" list and the mod list (as expected), but the cell on the screen is not highlighted in red, and if you change something on the screen, the messages you have added are then lost.
      CALL METHOD p_grid->change_data_from_inside
        EXPORTING
          it_style_cells = lt_modi.
    Has anyone added there own custom validations upon hitting a button - in a manner that the red cell border is shown?
    I have tried both of these handlers:
    CALL METHOD p_defn-grid->register_edit_event
       EXPORTING
         i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    **Own event on enter or ucomm
      CALL METHOD p_defn-grid->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    I am adding in my messages in event data_changed, using method add_protocol_entry of class cl_alv_changed_data_protocol - this is passed to me in the data_changed event.
    I have also looked at the data_changed_finished event, but cant get anything from that either - it doesn’t even keep my good fields.
    Ps I have also played with the layout setting layout-val_data = 'X' and space and "C" - but the messages are still not kept, and cells not bordered in red.
    The solution may have something to do with triggering the event manually somehow - but i cant find a way to call a method that would do it as they are all private!
    thanks in advance - this is a tricky one!

    Adobe Pat 206
    You cannot create a Premiere Elements (any version) DVD Template from scratch using Photoshop Elements (any version). To do that you need Photoshop CS or higher. The reason for "higher" is that earlier Photoshop versions do not support Layers Groups within the Layer Groups.
    But, providing you find a version of Photoshop Elements on a given computer operating system that will open the Photoshop Layer Groups in its key structure (.psd file), you can use Photoshop Elements to edit (not create from scratch) the .psd file for the main and scene menus of a given existing Adobe theme. I am careful on my language here since there have been recent difficulties getting Photoshop Elements to do this job which it once did without issue.
    The process is easy enough, but very detail dependant, with strict requirements for names files as well as Layer Groups, sublayers groups, and layers in the .psd file. To give you an idea of what is involved, please check out two articles I have written related to Premiere Elements DVD Template creation and customization.
    http://www.elementsvillage.com/forums/showthread.php?t=56244
    http://www.atr935.blogspot.com/2013/05/pe-one-page-14-scene-buttons-dvd-menu.html
    Not placing the new menu in the correct directory and any error in spelling and such are just some of the ingredients for failure in this type of project.
    Unless you want to add extra buttons to a menu, it might be easier for you to explore customization opportunties in the Movie Menu section of the program. See Tools/Movie Menus. The Movie Menus customization area should look like this
    Note that the Adjustments...Menu Background shows Video or Stills among other things.
    If you have questions on anything that I have written, please ask me here in your thread.
    You can also check out the Adobe documentation on this type of topic.
    http://help.adobe.com/en_US/premiereelements/using/WS09e4b3c48f3a79fc19b622510385d4355c-7e 0c.html
    Thanks.
    ATR

  • Validating in ALV grid output for double entry

    Hi All,
             I am trying to validate the ALV output while adding records to the screen.
    I need to validate if the same primary key exist while user is creating a new record in the ALV output. If the same record is entered many time ( with the same primary key), it should pop up some error and i am calling
    call method pr_data_changed->add_protocol_entry.
    But i'm not able to apply the logic for 2 fields as primary key.
    I check the method check_double_entry in program BCALV_EDIT_04. it does the same but it checks i field 'FLDATE' as primary key.
    Algorithm: Copy all entries in MT_GOOD_CELLS to a dummy table.
               During the copying procedure check if there exists
               already a line with the same Flight date.
        loop at pr_data_changed->mt_good_cells into ls_good.
          case ls_good-fieldname.
            when 'FLDATE'.
              call method pr_data_changed->get_cell_value
                          exporting
                                i_row_id = ls_good-row_id
                                i_fieldname = ls_good-fieldname
                          importing e_value = l_flightdate.
              read table lt_good_cells with key
                                value = l_flightdate
                                transporting no fields.
              if sy-subrc = 0.
    There exists already a line with the same flight date!
                call method pr_data_changed->add_protocol_entry
                             exporting
                  i_msgid = '0K' i_msgno = '000'  i_msgty = 'E'
                  i_msgv1 = text-m01
                  i_fieldname = ls_good-fieldname
                  i_row_id = ls_good-row_id.
                error_in_data = 'X'.
              else.
                ls_good-value = l_flightdate.
                append ls_good to lt_good_cells.
              endif.
          endcase.
        endloop.
    Could you pls help me how to use this logic in case where more than 1 field is primary key.
    Regards,
    Santos P

    Hi
    ALV option is available from 4.7 onwards only.
    the following needs to be followed in 4.7 to get in ALV:
    We can get the results in ALV format just by changing the IMG settings.
    Go to IMG under Materials Management -> Purchasing ->Reporting -> Maintain Purchasing Lists -> Scope of List -> Define Scope of List. Select any one option & double click. A new screen will display with lot of check boxes. in the end will find a check box for "Settings for ALV grid control. Just tick that box & save this as new name like BEST_ALV.
    regards
    Srinivas

Maybe you are looking for

  • Error 150.30 with Photoshop Elements

    My Windows 7 PC died, and I've transferred photographs to my old Dell XP machine.  When I execute Elements, I get the error 150.30 message asking me to restart the maching.  I did that, but still get the error when executing Adobe.

  • Flash videos choppy in IE8 but not Firefox?

    I noticed when watching most Flash content in IE8 it has a lot of brief pauses which makes videos appear choppy, But if I open the same video in Firefox it plays fine, Is there anything I can check that might be causing this issue? Im running the sam

  • Why TTY doesn't work?

    i am learning jdb (very new), when i compile and execute example of TTY, error says "handle is not available". i use windows. i think i miss something because TTy code tries to load a file in user directory, but i don't have the file - if this is rea

  • I don't know my passcode?

    My ipod touch is locked & I don't know the passscode. How do I unlock it?

  • Liquid and Elastic Layout

    My first attempt at a liquid layout seems to work well in the sense it fits various browser sizes. I then discovered elastic layout and thought I should incorporate it for users to resize the text. Now I am having problems with text spilling all over