How to use Exceptions for a function module

Hi folks,
        I have created  a new function module.Its working fine, but i am not aware of using exceptions for a function module. I hav just declared an exception in the 'exception' tab. Could any body explain me how to use that in my FM source code....Thanks...

Hi Shyam,
Have a look at this,
START-OF-SELECTION.
  gd_file = p_infile.
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename                = gd_file
      has_field_separator     = 'X'  "file is TAB delimited
    TABLES
      data_tab                = it_record
    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 NE 0.
      write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
      skip.
    endif.
Regards,
Sai

Similar Messages

  • How to use ejbs for accessing Function Module.

    Hi,
    I want to call ABAP function module using ejb(Since I want to expose them as web service on different server). I know how to do that using Models, but dont know how to go ahead using ejbs.
    Could you please guide me on this?
    Regards,
    Abhijeet.

    Hi,
    In another thread with a similar question I found these references:
    /people/kathirvel.balakrishnan2/blog/2005/07/26/remote-enable-your-rfchosttoip-to-return-host-ip-to-jco
    Re: interfacing SAP with an existing java applications
    And this code example:
              HashMap result = new HashMap();
              Object ret = new Object();
              JCO.Client mConnection = null;
              mConnection = getConnection();
              JCO.Repository mRepository;
              mRepository = new JCO.Repository("R3", mConnection);
              JCO.Function function =
                   createFunction("Z_ISA_GET_ORDER_ITEM_INFO", mRepository);
              function.getImportParameterList().setValue(orderNum, "ORDER");
              if (function != null) {
                   mConnection.execute(function);
                   JCO.Table codes = function.getTableParameterList().getTable("INFO");
                   for (int i = 0; i < codes.getNumRows(); i++) {
                        codes.setRow(i);
                        int tmp = new Integer(codes.getString("POSNN")).intValue();
                        String tmpStr = new String(Integer.toString(tmp));
                        ret = result.put(tmpStr, codes.getString("VBELN"));
              } else {
                   System.out.print("Fxn call failed for Z_ISA_GET_ORDER_ITEM_INFO");
              JCO.releaseClient(mConnection);
    Good luck,
    Roelof

  • How to use Logical database in function module?

    I will create a function module in HR.
    but how to use Logical database  in function module ?  Logical database PNP always show screen.in function (RFC) code , it is a matter.

    You cannot attach the LDB to the main program of the function group.
    - So you may [SUBMIT|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=submit&adv=false&sortby=cm_rnd_rankvalue] a report which use the LDB and get back the data (export/import), by default in the syntax of SUBMIT the selection-screen will not be displayed
    - Use [LDB_PROCESS|https://www.sdn.sap.com/irj/sdn/advancedsearch?query=ldb_process&cat=sdn_all], fill a structured table for selection, and get data back in another table
    - Use [HR function modules to read Infotypes|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=hrfunctionmodulestoread+Infotypes&adv=false&sortby=cm_rnd_rankvalue].
    Regards

  • How to use a user defined function module in IP

    Hi All,
    Can you please guide me on how to use a user created function module in IP? My requirement is to have 2 exit function modules to be used in IP to load the falt file data into a cube..
    Regards,

    Hi,
    /people/marc.bernard/blog/2007/11/25/how-to-load-a-file-into-sap-netweaver-bi-integrated-planning-part-1
    thanks to Marc Bernard
    Regards

  • How to use ET_ATTACH importing parameter Function module BBP_PD_SC_CREATE

    hi,
    how to use ET_ATTACH importing parameter of Function module BBP_PD_SC_CREATE, my requirement is to create SC with attachment.
    an example would really help.
    Kind Regards,
    Kailash.

    Hi,
    Generally we create the SC from ITS or Portal, and there in the Create SC screen , once you add the item into the shopping cart , in the Item details, there is the section called , Documents and Attachements, where in you can upload the attachments which ever you want. Sometimes the extn .DOC, .pdf and .xls are allowed. but that also you can check which are the Authorized files extns avaialbe in Backend R/3.
    Using the FM RFC_READ_TABLE, in table pass TDWP and in the i_field pass 'APPSFX' and then you can get the authorized file formats. in Backend Transaction DC30 you can verify which are the allowed file formats.
    Moreover for restricting the User from uploading the attachment BADI BBP_ITEM_CHECK_BADI can be implemented for raising the error message if required.
    Regarding the ET_ATTACH, it is the structure of type BBPT_PDS_ATT_T,  so you have to provide the complete details for this structure. Like : GUID, P_GUID ,LOGICAL_SYSTEM, DESCRIPTION, URL, TYPE,DISP_URL, PHIO_EXT ,etc.
    Once all the entries are fine.
    You can create the SC, but the recommeded way for creating the SC is thru ITS or Portal.
    I hope this will help. Feel Free while asking questions.
    Thanks and Regards,
    Ankur Goyal

  • How to use exception for a Date Key Figure

    Hello All,
                    I have the following requirement.
    1. I have a Key Figure which is Date Type.
    2. I need to color the cell to green if the it is filled with date otherwise leave it as it is.
    Please suggest how to overcome it.
    Thanks & Regards,
    Rajib

    hi,
    Your requirement is not clear, you have the below setup
    I have the following requirement.
    1. I have a Key Figure which is Date Type.
    How can a KF be of date type, or is it the value of a date characteristic that you have extracted in KF using formula variable. If yes you just need to define exception for the value greater than 0.
    regards,
    Arvind.

  • How to use selection-screen in function module?

    Hello
    I've created a function module and i have to create within the function module a selection-screen(with select-options for entering data) but i get an error that within form routines and function modules this statement is not allowed.
    Can anybody help?
    thanx

    Hi,
       YOu cannot create a selection screen withing a function module.
    What you can do is to call a screen , say '0100'.
    Create a screen '0100' and then include a selection -screen as a subscreen in that screen.
    Regards,
    Ravi

  • How to use setTimeout for Callback function in ajax DWR?

    Hi,
    I am facing a problem of ajax request not returning back to the specified callback function. As a result my application screen gets locked waiting indefinitely.
    The timeout in DWR is controlled using a setTimeout method.
    Can someone plz tell me how to implement this in my javascript code so that my Callback function is invoked for sure.
    below is my code snippet...
    var dwrMap = new DWRMap(theMainForm);
         dwrMap['menuId'] = menuid;     
    CommonService.executeAutoLogOut(dwrMap, fnPerformLogOut);
    else{
         fnDoAnalyze(analyzeUrl);
    function fnPerformLogOut(response){
    if(response == "timedOut"){
         alert("Timed Out");
         fnAskToLogin();
    else{
         alert("Not timed out");
         fnDoAnalyze(analyzeUrl);
    Here CommonService.executeAutoLogOut(dwrMap, fnPerformLogOut); is sending ajax request.
    and fnPerformLogOut() is the callback function.

    Hi Shyam,
    Have a look at this,
    START-OF-SELECTION.
      gd_file = p_infile.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = gd_file
          has_field_separator     = 'X'  "file is TAB delimited
        TABLES
          data_tab                = it_record
        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 NE 0.
          write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
          skip.
        endif.
    Regards,
    Sai

  • Where used list for RFC function module

    Hi All,
    Is it possible to list where the RFC enabled FM is getting called? I mean in which all system (say RFC present in some Dev system, it might be called somewhere in other systems other than in Dev systems) RFC is getting called.
    Kindly suggest.
    Thanks,
    Ashwini

    Hi Ashwini,
    Is it possible to list where the RFC enabled FM is getting called?
    Yes, there are several ways to do it, if you just need the list of the systems that call your RFC,
    1) look up the technical designs of the interfaces(the ones which use RFCs) that are present in your project.
    2) Enable RFC trace on your system and go through the trace list, you can get help from your BASIS team.
    3) If you have a middleware through which all the interfaces are handled then you can work with the middleware team to identify the source systems which call your RFC.
    4) Add a line in your RFC to update a Z Table on when and from which UID it was called, based on this you can identify the source.
    5) You can add a bug so that your RFC shortdumps, the team from the source team will be sure get in touch with you in this case...just kidding, but a possible solution at the same time.
    Regards,
    Chen

  • Exception 7 in function module VIEW_KUAG2

    Hi all,
    When I try to process a Billing document in transaction VF04, has an error message "Customer 12334: Exception 7 in function module VIEW_KUAG2".
    Could you advise me why I receive this message?
    Is it possible that Customer master data it is not maintained propertly?

    Hi,
    When I checked there are only 5 exceptions for this functional module.  By the way which version are you in?  If you want to find out what the exception 7 is then go to SE37 and display this functional module.  There you can find a tab for exceptions.  Based on that you can proceed with changes in the customer master. 
    Its definitely the possibility of not maintaining the customer properly.
    Hope this helps.
    Thanks
    Krishna.

  • How to insert a code for a function module into a Customer Exit Variable?

    I have two Key Figures viz., Net Prchs Rtl, and Net Prchs Unt. Both these Key figures have This Week (TW) and Last Week (LW). There is a variable for This week but there is no variable defined for Last week.
    I need to get data in the column LW (Last Week) for both the key figures.
    In function module EXIT_SAPLRRS0_001 one of the functions I have is:
    Get the previous Fiscal Week
              CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
    I need to create a new variable to get values in the Last week column for different key figures and use function “'DATE_TO_PERIOD_CONVERT'” in that variable.
    Can anyone please explain me the steps as to how to use a function module in a variable so that when the variable is used in a key figure it shows the output.
    In other words what I want to know is after creating a Customer exit variable of type Characteristic value how do I refer the above mentioned function moduel and insert the code for the function module into the Customer exit variable that I created.
    Thank you.
    TR.

    Hi Wond,
    Thanks a lot for your reply. I understand what you mean but I have never done this before so can you please explain it in a detailed manner. I have the following code:
    Get the previous Fiscal Week
              CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
                EXPORTING
                  i_date         = ld_date
                  i_periv        = lc_periv
                IMPORTING
                  e_buper        = ln_poper
                  e_gjahr        = ln_bdatj
                EXCEPTIONS
                  input_false    = 1
                  t009_notfound  = 2
                  t009b_notfound = 3
                  OTHERS         = 4.
              IF sy-subrc <> 0.
                MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
              ELSE.
                lc_poper = ln_poper.
                CONCATENATE ln_bdatj lc_poper+1(2) INTO wa_e_t_range-low.
                wa_e_t_range-sign = 'I'.
                wa_e_t_range-opt = 'EQ'.
                APPEND wa_e_t_range TO e_t_range.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
    I believe I should now use the above code in my customer exit variable. If that's right can you please explain me the steps as to how should I do this so that the variable gets populated.
    Thank you.
    Regards,
    TR.

  • How do we trap exception inside the function module?

    How do we trap exception inside the function module?

    Use ABAP Help - CATCH, RAISE for starters. Or take a look at an existing function module, for example.

  • How to add Test data for a function module

    Hi experts,
    i want to add test data for a function module . i don't know how to proceed on it . please help me...
    with regards,
    James...
    Valuable answers will be rewarded...

    Hi,
    - Go to SE37 and execute your FM
    - Enter the data you want to pass to FM
    - Hit 'Save' button. Enter the meaningful name for your test scenario and save. That's it you have saved the test data.
    You can also enter some other test data and save that also. In short, you can save multiple test scenario. Also, you can give multiple test scenario a same name and they do not overwrite each other ( but normally you give different name to differentiate them)
    Next time you come to execute the FM again, hit the "test data" button and it will show you all the test scenario you have stored before. Select the one you want to use and it will load the data in FM parameters.
    Let me know if you need any other information.
    Regards,
    RS

  • How to check for a function module with its description and functionality

    Hi all,
    How to check for a function module,with its description and its functionality,in detail how can I know the purpose of a particular function module,how to search for a function module which suits my requirement .

    Hi,
    You can search a FM of your requirement by putting in the Key words and searching for a FM. Like * KEYWORD * and then pressing F4.
    Say for example you need to search something regarding converstion.
    Search for * CONVERT * and press F4.
    If there is something specfic like converting date to something you can give
    DATE * CONVERT *
    OR
    CONVERT * DATE *  and press F4.
    Once you narrow down your search you will have a Function module documentation inside the Function module. Please note that all the FMs willl not have documentation.
    Regards,
    Pramod

  • How to find suitable( existing) function group for a Function Module ?

    How to find suitable( existing) function group for a Function Module to be created?
    This is FM for converting amounts to text.

    Hi,
            If you are not sure into which Function group your FM should go in then its advised to create a Function group of your own. Its not advised to create a function module in any other function group unless its owned by you since your FM can get deleted by others or it can get changed.
    Create your own Function group. But if you want to create in an existing FG then best way is to find out the Function Group by searching for suitable existing Function module then see their function group
    Regards,
    Sesh

Maybe you are looking for

  • Changing a datagrid column image according to the datagrid column value

    Flash Builder 4.5 / SDK 4.5.1. Fairly new to Flash Builder & Flex Application targets tablets so it's a "mobile" project. Been beating my head up against the wall on trying to figure out how to do this. Watched videos on Lynda.com.  Read Adobe "docs"

  • Photoshop CS4 crashing -- need help

    I have recently installed PSCS4 and have just started using it. I am having trouble with the program crashing under Windows XP (SP3) on a 3.2 GHz, P4 single core machine e/w 2G RAM. I get the following error message: "The instruction at "0x262740db"

  • Example of  a Simple ALV Report using Function Modules (not OO)

    Hi, I am new to ABAP. Where can I get a proper Example of  a Simple ALV Report using Function Modules?  I searched the forum but did not find a proper solution. Kindly help. Smruthi. Edited by: Smruthi Acharya on Jan 29, 2009 7:13 PM

  • IDOC status "Message scheduled on outbound side"

    Hi, I am working on scenario file->XI->SAP R/3(Using IDOC). I am getting outbound status of IDOC as "Message Scheduled on Outbound side". When I go and see SM58 for user WF-BATCH there exists a entry with status Transcation Recorded". In SM58 if I ma

  • How to figureout the API Name from a table

    Hello, Is there anyway i can findout the name of the API which is used to save data in a particular table? for example the table ALR_ALERTS. I want to know which API is used to enter data into this alert. Thanks PK