Handling error messages in OOPs ALV

The question below is foolish.But I am a beginner so please excuse.
I have successfully displayed an OOPs ALV which displays the material, batch and plant.
A custom toolbar button(delete batches) has been appended to the standard toolbar.
Now when I do not select any rows from the ALV  and click the button(delete batches) I have ensured that an error message flahes at the bottom of the screen.
If I repeat the same procedure without coming out of the program it exits from the program itself. i want to avoid this.
I want to flash the error message continually without coming out of the program till the user commits the mistake. Please note that I have not used any leave screen commands etc.
Can someone please help me..
Thanks in advance

I assume you have the ON TOOLBAR event regiistered and the ENTER event for example.
method constructor .
create object grid_container1
        exporting
*           container_name = 'CCONTAINER1'.
    container_name = cfname.
    create object  grid1
       exporting
          i_parent = grid_container1.
    set handler z_object->on_user_command for grid1.
    set handler z_object->on_toolbar for grid1.
    set handler z_object->handle_data_changed for grid1.
    set handler z_object->handle_data_changed_finished for grid1.
    set handler z_object->on_dubbelklik for grid1.
    set handler z_object->on_hotspot for grid1.
    call method grid1->register_edit_event
        exporting
           i_event_id = cl_gui_alv_grid=>mc_evt_enter.
  endmethod.
So the easy way to do this is in your ON USER COMMAND routine when you can check to see if you selected any rows and the issue a popup warnimg message with the standard SAP MESSAGE statement.
For example in my TEST function here I call a method to get the selected cell.
If none are selected you can then issue your message and you will then be returned back to your GRID display after the user presses the OK button on the message popup.
the grid1 object refers to the class cl_gui_alv_grid.
in your case call a method that gets selected cells rather than selected cell. Use the standard method in cl_gui_alv_grid.
If nothing selected then issue your message.
(Note that your method ON DATA CHANGE / ON DATA CHANGED FINISHED might also be entered as well  so insure that you haven't got any coding in these methods that will interfere with processing flow).
method on_user_command .
*        FOR EVENT before_user_command OF cl_gui_alv_grid
*        IMPORTING
*          e_ucomm
*          sender
case e_ucomm.
      when 'EXIT'.
        leave program.
      when 'EXCEL'.
       call method me->download_to_excel.
      when 'SAVE'.
      when 'PROC'.
        call method me->process.
      when 'REFR'.
        call method me->refresh.
        when 'SWITCH'.
        call method me->switch.
       when 'TEST'.
        call method me->get_cell.
       endcase.
method get_cell .
break-point 1.
call method grid1->get_current_cell
importing
e_row     = ls_row
e_value   = ls_value
e_col     = ls_col
es_row_id = ls_row_id
es_col_id = ls_col_id
es_row_no = ls_row_no.
endmethod.
cheers
jimbo

Similar Messages

  • Prob. while using error message in OOPS ALV

    Friends,
    I have developed an OOPS ALV to display the records with cost field as editable. And the cost should not accept decimals values, if the user enter the same (12.56) and click the save button (user-defined) then need to populate the error message. I am populating the error message, then the user change the value (12) and click the save, then in the ALV screen the chanegd value 12 is automatically back to prv. one 12.56 and the same error messgae is displaying.
    If i change the message type from Error to Info, then its working fine... but the client wants only error message. So anybody came across the same scenario? if yes.. pls share the solution..
    Ganesh C

    Hi,
    In this case, after the error message issued though the value is corrected , corrected data is not transferred to progarm.
    Program still works with old data. Check how you are issuing message and how you refereshing the table after user inputs.
    you can check program BCALV_EDIT_03 for vlidating fileds.
    I believe you can simply refer a data element which does not accepts decimal values.
    Regards,
    Ravi.

  • Can't open PDF's on my Mac coming in on MS Outlook 2010. Reinstalled Adobe software 4 x and still get "Adobe PDF Preview Handler" error message.

    Can't open PDF's on my Mac coming in on MS Outlook 2010. Reinstalled Adobe software 4 x and still get "Adobe PDF Preview Handler" error message.

    No. Reader will not damage files. It is only meant to read pdf files. PDF files are frequently damaged when sent as email due to encoding issues.

  • Handle error message

    hi
    How to handle error message for following FM?
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                        = lv_filename
        filetype                        = 'DBF'
        write_field_separator           = 'X'
    IMPORTING
      filelength                      = lv_file_len
       TABLES
        data_tab                        = it_final
        fieldnames                      = t_header
        EXCEPTIONS
       file_write_error                = 1
       no_batch                        = 2
       gui_refuse_filetransfer         = 3
       invalid_type                    = 4
       no_authority                    = 5
       unknown_error                   = 6
       header_not_allowed              = 7
       separator_not_allowed           = 8
       filesize_not_allowed            = 9
       header_too_long                 = 10
       dp_error_create                 = 11
       dp_error_send                   = 12
       dp_error_write                  = 13
       unknown_dp_error                = 14
       access_denied                   = 15
       dp_out_of_memory                = 16
       disk_full                       = 17
       dp_timeout                      = 18
       file_not_found                  = 19
       dataprovider_exception          = 20
       control_flush_error             = 21
       OTHERS                          = 22.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    Error Message:  GUI_DOWNLOAD
    GUI_DOWNLOAD - Access Denied!! Why its throwing error message?
    Control flush error in gui_download
    Error in GUI_DOWNLOAD in background processing
    Error In Gui_download
    Reward points..

  • Handling Error message in Module Pool screen

    Hi Folks,
    I have developed a ALV report for table maintenace and I am calling the Dialog screen (small one) and Create and update the records of the Ztable through that screen.
    Presently I am handling the error message in the main ALV screen .
    My requirement is that I have to handle those error messages in small module screen.
    How to do the same ?
    Thanks.
    Hemum.

    crate message se91.
    insert failure
    if sy-subrc  <>0.
    message e001 with 'all readt exist'.
    endif.

  • How To Handle Error Message In TCD Recording?

    Hi All,
      I tried recording a transaction (my own transaction) by not enterring value in an obligatory field. the error message came. but when i executed the script, it showed an error. but actualy, the error message was expected right? how to handle this situation? i tried with tcd and sapgui recording. both gave almot the same result.
      i am including the script which i have written.
    MESSAGE ( MSG_1 ).
    *TCD ( ZCUST , ZCUST_1 , ECC ).
    SAPGUI ( SAP_1 , ECC ).
    ENDMESSAGE ( E_MSG_1 ).
    v_mno = &tfill.
    v_msg = E_MSG_1[v_mno]-msgtext.
    v_mtp = E_MSG_1[v_mno]-msgtyp.
    If Msg Type is E *** **** It Has To Be E ****
    IF ( v_mtp = 'E' and v_msg = 'Account no AC02 does not exist EXIT = X').
    logtext(0,'Passed').
    ELSE.
    log(v_mtp).
    log(v_msg).
    logtext(1,'Failed').
    ENDIF.
    End Of The Condition For Message Type E ******

    I have recording messages using the TCD command.
    My script (very simple):
    MESSAGE ( MSG_2 ).
    TCD ( ME21 , ME21_1 , R3 ).
    ENDMESSAGE ( E_MSG_2 ).
    In the MESSAGE command interface, I defined rules to allow several kind of messages.
    Execution: 3 mesages found:
          * transform PR into PO
           MESSAGE     MSG_2 [1,009 sec]
             RULES  MSG_2 = XML-DATA-01
            Message  MODE  EXIT  TYPE  ID    NR
            [1]      'A'         'I'   06    456
            [2]      'A'         'W'   'ME'  080
            [3]      'A'         'E'   'ZE'  029
             TCD    ME21                 [0,545 sec N] Target sys R3 -> ZDA010A219
            S06017 Standard PO created under the number 8201075606
               Tgt System Z_A219->R3->ZDA010A219 (ZDA 010 ... HP-UX ORACLE)
               CALL TRANSACTION ME21 ME21_1 XML-DATA-01
               03 MESSAGES FROM ME21 ME21_1 XML-DATA-01
               I  06 456 Release effected with release code 00001
               W  ME  080 Delivery date: next workday is 02.05.2007
               S  06 017 Standard PO created under the number 8201075606
           ENDMESSAGE  E_MSG_2 (&TFILL = 0)
    As you can see, 3 messages are found but the &TFILL variable is still 0.
    I guess (but cannot test yet) I would manage to record those messages using SAPGUI command.
    Is there anything wrong with my script?
    My SAP_BASIS component is in version 620. I'm not using the ultimate version of eCATT (no WEBDYNPRO command, etc.). Could it be an explanation?
    Thank you in advance,
    Olivier

  • How to handle error message during PAI?

    Hi Experts,
    Need help here.
    In my dialog screen, I have a field which is typed 'QUAN'.
    In entering different format , e.g. with non numeric value or a negative value, an error message appear and it does not process the MODULES inside the chain or FIELD MODULE ON REQUEST.
    Does anyone knows how to handle this kind of error. I need to display into a separate screen the errors I encountered coz I'm creating a new RF transaction.
    Points will be rewarded.
    Thanks in advance.

    Hai
    in your case(RF case) it is other way...
    yes you can use
    field x_currency module check_currency.
    in module check_currency.
    you have to display errors in another screen say 200.
    in that there will be 4 fields, all are display only fields.
    X_MESSAGE-MSGV1  of type sy-msgv1
    X_MESSAGE-MSGV2  of type sy-msgv2
    X_MESSAGE-MSGV3 of type sy-msgv3
    X_MESSAGE-MSGV4 of type sy-msgv4
    you populate the messages with these fields and then display it in the screen.
      method check_currency.
    *--do all your checks here....
           if error
             clear x_message.
            x_message-msgv1 = 'Enter Valid Employee Number'(004).
            leave to screen 0200.
          endif.
        endif.
    ENDMODULE.                 " VALIDATE_Currency
    in screen 200 PBO you need to format the message
    using the below logic.
           Method for formatting the message
      method message_format.
        data : lt_text type table of tline,         "text table
               lx_text type tline.                  "work area
        refresh lt_text.
        clear lx_text.
        concatenate x_message-msgv1 x_message-msgv2 into lx_text-tdline
          separated by space.
        append lx_text to lt_text.
        clear lx_text.
        concatenate x_message-msgv3 x_message-msgv4 into lx_text-tdline
          separated by space.
        append lx_text to lt_text.
    *- formatting the message
        call function 'FORMAT_TEXTLINES'
          exporting
            formatwidth = 20
          tables
            lines       = lt_text
          exceptions
            bound_error = 1
            others      = 2.
        clear: x_message.
    *- transfer the message data to screen fields
        loop at lt_text into lx_text.
          if sy-tabix = 1.
            x_message-msgv1 = lx_text-tdline.
          elseif sy-tabix = 2.
            x_message-msgv2 = lx_text-tdline.
          elseif sy-tabix = 3.
            x_message-msgv3 = lx_text-tdline.
          elseif sy-tabix = 4.
            x_message-msgv4 = lx_text-tdline.
          else.
            exit.
          endif.
        endloop.
      endmethod.                    "message_format
    Regards
    Vijay

  • How to handle error messages in BDC background mode

    Hi experts,
      I got one problem in BDC, We are uploading data throgh BDC program,that program is calling Standard Batch Input programs,
    Now we got one requirement, i.e., In some special cases we have to send one message as a error message.I handled this in foreground but, how to handle this in background.

    Hi,
    if session is being used
    automatically the log will begenereated in the sm35 transaction
    but if call transaction is used
    put all the error messages in the applicationserver using
    open data set
    and after the exectionof the program in the background
    you have to run another progam which reads the data stroed inthe application server
    that also with open data set only...
    thanks & regards,
    Venkatesh

  • Handling error & messages in standard forms

    Hi all,
    I'm customizing Oracle HR through CUSTOM.pll and I need to handle some messages in standard forms.
    I have tried using ON-MESSAGE and ON-ERROR trigger, but I can't substitute the "not user-friendly" "FRM-40150: Cannot update record" with anything else!
    Is it possible to do this??
    In that case....should someone show me some examples??
    Thx a lot.
    If needed I can attach my code to help you..
    Thx
    Jacopo

    Whatever you do, never change the message level, it's just like hiding behind your finger, you'll be in denial of the error, but the error will be there...
    the best way is to handle them in on-error triggers, trap the error number and use your own message, you can create a user defined error and associate it with the error number of a choice.
    search the online help of the forms builder for user defined errors. there is a very clear example there.
    Tony

  • Capturing the error messages generated by ALV Grid

    Hi,
    I have a ALV Grid, and a field date of DATS type.
    If i enter wrong date a message pops up with invalid date entry.
    How can i capture this error message in ALV Grid.

    Hi,
    Instead of displaying the error message directly, capture the message into a string variable and display it along with the grid display.
    Thanks,
    Sri.

  • Could Not Open Handler Error Message

    Any suggestions on what to do after receiving the "could not open handler. system memory is probably very low" error message.
    The weird thing is the project I was working on worked fine, never receiving that message. Then, I returned to the project after a two week break and now I receive that message.
    Any help would be greatly appreciated.

    David, Thanks for the reply.
    I'm guessing by project details you're asking about DV/HDV etc etc.
    The project is a play/show that was taped from two cameras each about 2hrs long. In addition, there are over 7 hrs of behind the scenes footage. The show is shot in regular DV, and the behind the scenes footage is in DV but has 4:3 and 16:9 footage intermixed. I've edited the show sequence, the behind the scenes sequence, a gag reel sequence, and a slideshow sequence.
    I'm doing all this on a MacPro 3.0 GHz Dual-Core Xeon 4GB Ram.
    If there is more information needed please let me know. Thanks for your patience, first time you know
    David

  • Problem handling error messages in Axis

    I am consuming a web service, and all calls work fine. However, when the web service raises an error (for example I pass the wrong login), my Java application returns the following:
    java.lang.ClassCastException: org.apache.axis.message.Text
    The error soap packet that gets returned looks fine, but the Java (or Axis) can't seem to parse out the error message. I am doing a simple catch
    catch(Exception e){
              System.out.print(e.getCause());
    Here is an example of a Soap message it couldn't parse:
    HTTP/1.1 500 Internal Server Error
    Connection: close
    Date: Tue, 16 Aug 2005 19:59:50 GMT
    Server: Microsoft-IIS/6.0
    X-Powered-By: ASP.NET
    Content-Type: text/xml
    Connection: Keep-Alive
    Content-Length: 366
    <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP:Body>
    <SOAP:Fault>
    <faultcode>SOAP:Server</faultcode>
    <faultstring>Unable to authenticate technician. Either the Technician ID or password is incorrect, or there is more than one technician with submitted credentials.</faultstring>
    <detail>1030</detail>
    </SOAP:Fault>
    </SOAP:Body></SOAP:Envelope>
    I've tried all versions of Axis and keep getting the same problem. Am I catching the wrong type of Exception? Does the SOAP packet look weird? Is there something special I need to do when creating the classes from the WSDL2Java? Some setting?
    I don't know. Thanks.

    The format of the SOAP Fault is valid, and can be properly deserialized using oc4j DP4 release.
    Maybe you are having trouble in the processing of the detail element; the message.Text axis is complening about.
    Instead of catching a generic Exception, try catching javax.xml.rpc.soap.SOAPFaultException. Then, you will have accessor for each part of the fault. Based on your sample fault, the following code:
    } catch (SOAPFaultException sfe) {
    System.out.println("Expected error: " + sfe.getFaultString());
    outputs:
    Expected error: Unable to authenticate technician. Either the Technician ID or password is incorrect, or there is more than one technician with submitted credentials.
    Process exited with exit code 0.
    Hope this helps,
    eric

  • Handling Error Messages in Process Chain

    Hi Gurus,
    I am developing a process chain which contains more than 40 Master Data Objects. Those are connected serially with "always" link.
    Start -> Load Data -> DTP -> Load Data -> DTP -
    EX-OR (connected to all Processes for error message)
    Here the EX-OR Process is not allowing me to connect with "Error" link to all processes (by default it is giving "Always" link). i.e i want to get the error message from EX-OR process only in the case of failure not always.
    Can any one help me out.
    Thanks in advance,
    Chenna.

    Greetings Chenna,
    First we need to check why the "always" link is used to connect the process chain steps?
    If you take such "always" link to connect the steps, we cannot raise an error message link to EXOR( by default it will also take "always" link)
    Here we can explore an error message thru EXOR step whenever a failure occurs in the process.
    Things we need to do:
    1. Steps in the process chain should be connected only on "successful" option selected.
    2. We need to link the required steps to the EXOR step with "errors" selected on the pop up.
    3. Need to link an Error message to EXOR step by selecting "Create message" on EXOR step.
    Now if any failure occurs in the process the error message will be raised.
    this helps...

  • Handling error messages in BAPI

    Hello,
       I am doing a replica of an SAP R3 std report in portal. I've converted the report pgm to a BAPI. My question is how to populate the BAPIRETURN table with the error messages raised from a std report? I mean how to capture these error messages? I am doing a SUBMIT to call this report from within the BAPI.
    Thanks in advance.
    Rgds,
    Nathan.

    Hi,
      Collect all the errors in an internal table..Lets say ITAB.
      At the end of the program export it to the memory.
      EXPORT T_ERRORS TO MEMORY ID 'BAPI_CALL'.
    In the Bapi after the program is completed..use the import statement to get it from the memory...
      SUBMIT 'ZREPORT' AND RETURN.
      IMPORT T_ERRORS FROM MEMORY ID 'BAPI_CALL'.
      Then pass the errors to the return parameter of the BAPI..
    Thanks,
    Naren

  • Handling Error Message in BADI BEFORE_TRIP_SETTLEMT

    Hi All,
    We have implemented BADI BEFORE_TRIP_SETTLEMT. As can be seen, there are no exceptions for the only method CHANGE_TRV_RULES. However, we have to throw error message on some condition. We wrote:
    MESSAGE 'Error' TYPE 'E'.
    This is taking the control out of the screen and throwing message. And when 'ENTER" is pressed, the control is continuing and saving the trip, which should not be allowed.
    I have checked a lot of posts but didn't find any suitable solution.
    Please suggest. Thanks a lot.
    Any suggestions?
    Edited by: Srinivas Kalluri on Mar 15, 2011 2:39 PM

    Hi,
    Since exception is not present in the method, giving error message in this BADI is not a good choice.
    Try to use FM 'POPUP_TO_CONFIRM' to display the message.
    Regards,
    Soumya.

Maybe you are looking for

  • Error in trigger: PLS-00049: bad bind variable

    Hi, I am trying one of the XML/XDK samples from technet (http://otn.oracle.com/tech/xml/htdocs/XDBDemo2.html) and get this error while compiling the trigger: here's the code snippet create or replace trigger PURCHASEORDEREXPLOSION instead of insert o

  • Flash player and excessive popups

    Yes, I was once plagued by flash player based ads opening tons of popups so I set flash player to ask for activation, solved my problem.... BUT, I managed to press "Allow and remember" instead of just "Allow now", so my question is, where to do I fin

  • My menu bar got inverted in IE

    I have build the page and it has been up for a long time, today i was checking it in Internet explores and my menu bar got inverted, i checked yesterday and was fine and today is no working right. does any one knows how ti fix this? zlowatersports.co

  • Re e-mail from verizon

    I rec'd an e-mail from verizon to update server settings third attempt to reach me?  What is this and I am not sure what settings I have currently.  Need tech to help me .

  • I keep getting the error code 7 (windows error 127)

    I keep getting the error code 7 (windows error 127) when I try to install iTunes. Any suggestions?