How to perform Error Handling in this Bdc Code

Hi,
I had created this BDC for the tcode MB1B and i want to know how to perform the ERROR HANDLING in it ..
Plzz provide me guidelines for doing it . here's d code:-
report ZBDC_MB1B
       no standard page heading line-size 255.
include bdcrecx1.
data: begin of record OCCURS 0,
      WERKS_001(004),     "Plant
      MATNR_002(018),     "ItemId
      ERFMG_003(013),     "Quantity in Unit of Entry
      ERFME_004(003),     "Unit of Entry
      LGORT_005(004),     "Storage Location
      CHARG_006(010),     "BatchId
      KDAUF_007(010),     "Sales Order Number
      KDPOS_008(006),     "Item Number in Sales Order
      end of record.
PARAMETERS : P_FILNAM LIKE RLGRAP-FILENAME.
  initialization.
  CTUMODE = 'A'.
  CUPDATE = 'A'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILNAM.
  CALL FUNCTION 'WS_FILENAME_GET'
   EXPORTING
     MASK                   = ',. '
     MODE                   = 'O'
     IMPORTING
     FILENAME                 = P_FILNAM
   EXCEPTIONS
     INV_WINSYS             = 1
     NO_BATCH               = 2
     SELECTION_CANCEL       = 3
     SELECTION_ERROR        = 4
     OTHERS                 = 5
  IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
start-of-selection.
CALL FUNCTION 'WS_UPLOAD'
   EXPORTING
     FILENAME                      = P_FILNAM
     FILETYPE                      = 'DAT'
    TABLES
      DATA_TAB                     = RECORD
   EXCEPTIONS
     CONVERSION_ERROR              = 1
     FILE_OPEN_ERROR               = 2
     FILE_READ_ERROR               = 3
     INVALID_TYPE                  = 4
     NO_BATCH                      = 5
     UNKNOWN_ERROR                 = 6
     INVALID_TABLE_WIDTH           = 7
     GUI_REFUSE_FILETRANSFER       = 8
     CUSTOMER_ERROR                = 9
     NO_AUTHORITY                  = 10
     OTHERS                        = 11
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT RECORD.
  BEGIN OF SCREEN 1
perform bdc_dynpro      using 'SAPMM07M' '0400'.
perform bdc_field       using 'BDC_CURSOR'
                              'RM07M-SOBKZ'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
*perform bdc_field       using 'MKPF-BLDAT'
                             '22.12.2008'.
*perform bdc_field       using 'MKPF-BUDAT'
                             '22.12.2008'.
perform bdc_field       using 'RM07M-BWARTWA'
                              '411'.
perform bdc_field       using 'RM07M-SOBKZ'
                              'E'.
perform bdc_field       using 'RM07M-WERKS'
                              RECORD-WERKS_001.             "Plant
perform bdc_field       using 'XFULL'
                              'X'.
perform bdc_field       using 'RM07M-WVERS2'
                              'X'.
  BEGIN OF SCREEN 2
perform bdc_dynpro      using 'SAPMM07M' '0421'.
perform bdc_field       using 'BDC_CURSOR'
                              'MSEG-CHARG(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'MSEG-MATNR(01)'
                              RECORD-MATNR_002.             "ITEMID
perform bdc_field       using 'MSEG-ERFMG(01)'
                              RECORD-ERFMG_003.             "QTY.
perform bdc_field       using 'MSEG-ERFME(01)'
                              RECORD-ERFME_004.             "UOM
perform bdc_field       using 'MSEG-LGORT(01)'
                              RECORD-LGORT_005.             "ST.LOC
perform bdc_field       using 'MSEG-CHARG(01)'
                              RECORD-CHARG_006.             "BATCHID
perform bdc_field       using 'MSEGK-MAT_KDAUF'
                              RECORD-KDAUF_007.             "S.O.
perform bdc_field       using 'MSEGK-MAT_KDPOS'
                              RECORD-KDPOS_008.             "S.O.LINE ITEM
perform bdc_field       using 'DKACB-FMORE'
                              'X'.
  BEGIN OF SCREEN 3
perform bdc_dynpro      using 'SAPLKACB' '0002'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTE'.
perform bdc_field       using 'DKACB-FMORE'
                              'X'.
perform bdc_dynpro      using 'SAPLKACB' '0002'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ENTE'.
perform bdc_dynpro      using 'SAPMM07M' '0421'.
perform bdc_field       using 'BDC_CURSOR'
                              'MSEG-ERFMG(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=BU'.
perform bdc_field       using 'DKACB-FMORE'
                              'X'.
  BEGIN OF SCREEN 4
perform bdc_dynpro      using   'SAPLKACB' '0002'.
perform bdc_field       using      'BDC_OKCODE'
                                            '=ENTE'.
perform bdc_transaction using 'MB1B'.
ENDLOOP.

hi,
check this code in bold letters.
INCLUDE BDCRECX1.
TABLES : MARC.
TYPES : BEGIN OF TY_UPLOAD,
        MATNR TYPE MARA-MATNR,
        WERKS TYPE MARC-WERKS,
        STEUC TYPE MARC-STEUC,
        END OF TY_UPLOAD.
TYPES : BEGIN OF TY_MARC,
        MATNR TYPE MARA-MATNR,
        WERKS TYPE MARC-WERKS,
        END OF TY_MARC.
TYPES : BEGIN OF TY_MTART,
        MATNR TYPE MARA-MATNR,
        MTART TYPE MARA-MTART,
        END OF TY_MTART.
DATA : T_MARC TYPE STANDARD TABLE OF TY_MARC,
     : T_UPLOAD TYPE STANDARD TABLE OF TY_UPLOAD,
     : T_BASIC TYPE STANDARD TABLE OF TY_UPLOAD,
     : T_SALES TYPE STANDARD TABLE OF TY_UPLOAD,
     : T_ERROR TYPE STANDARD TABLE OF TY_UPLOAD.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
       IT_BDCDATA_VIEW LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
       IT_DATA(3200) OCCURS 0 WITH HEADER LINE,
       IT_FIELD(3200) OCCURS 0 WITH HEADER LINE,
       IT_BDCMSG TYPE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA GI_MSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : CHAR1(500),
      CHAR2(500),
      CHAR3 TYPE STRING,
      V_SELECTION TYPE STRING.  " For View Selection
DATA : W_MARC TYPE TY_MARC,
       WA_UPLOAD TYPE TY_UPLOAD,
       WA_BASIC TYPE TY_UPLOAD,
       WA_SALES TYPE TY_UPLOAD,
       WA_ERROR TYPE TY_UPLOAD,
       WA_MTART TYPE TY_MTART.
DATA : VAR TYPE N,
       VAR1 TYPE STRING.
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.   "SELECTION SCREEN
PARAMETERS: P_FNAM LIKE RLGRAP-FILENAME.
PARAMETERS: P_BAS LIKE RLGRAP-FILENAME.
PARAMETERS: P_SAL LIKE RLGRAP-FILENAME.
PARAMETERS: P_ERR LIKE RLGRAP-FILENAME.
SELECTION-SCREEN : END OF BLOCK B1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAM.
  PERFORM SEARCH USING P_FNAM.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BAS.
  PERFORM SEARCH USING P_BAS.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_SAL.
  PERFORM SEARCH USING P_SAL.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_ERR.
  PERFORM SEARCH USING P_ERR.
*&      Form  SEARCH
      text
     -->PFNAME     text
FORM SEARCH USING PFNAME.
  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
      STATIC    = 'X'
    CHANGING
      FILE_NAME = PFNAME.
ENDFORM.                    "SEARCH
START-OF-SELECTION.
  PERFORM UPLOAD_PROCESS USING P_FNAM.
  PERFORM OPEN_GROUP.
  PERFORM PROCESS.
  PERFORM CLOSE_GROUP.
  IF NOT T_BASIC[] IS INITIAL.
    PERFORM DOWNLOAD TABLES T_BASIC[] USING P_BAS .
  ENDIF.
  IF NOT T_SALES[] IS INITIAL.
    PERFORM DOWNLOAD TABLES T_SALES[] USING P_SAL .
  ENDIF.
  IF NOT T_ERROR[] IS INITIAL.
    PERFORM DOWNLOAD TABLES T_ERROR[] USING P_ERR.
  ENDIF.
*&      Form  PROCESS
      text
FORM PROCESS.
  LOOP AT T_UPLOAD INTO WA_UPLOAD.
    PERFORM CONV_ROUTINE  USING WA_UPLOAD-MATNR
                        CHANGING WA_UPLOAD-MATNR.
    SELECT COUNT(*) FROM MARA WHERE MATNR = WA_UPLOAD-MATNR.
    IF SY-SUBRC NE 0.
      MOVE-CORRESPONDING  WA_UPLOAD TO WA_BASIC.
      APPEND WA_BASIC TO T_BASIC.
      CLEAR WA_BASIC.
      CONTINUE.
    ENDIF.
    SELECT COUNT(*) FROM MARC WHERE MATNR = WA_UPLOAD-MATNR
                                    AND WERKS = WA_UPLOAD-WERKS
                                    AND PSTAT LIKE '%V%'.
    IF SY-SUBRC NE 0.
      MOVE-CORRESPONDING  WA_UPLOAD TO WA_SALES.
      APPEND WA_SALES TO T_SALES.
      CLEAR WA_SALES.
      CONTINUE.
    ENDIF.
    CLEAR : WA_MTART.
    SELECT SINGLE MATNR MTART FROM MARA INTO WA_MTART WHERE MATNR = WA_UPLOAD-MATNR.
    PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '0060'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'RMMG1-MATNR'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=AUSW'.
    PERFORM BDC_FIELD       USING 'RMMG1-MATNR'
                                  WA_UPLOAD-MATNR.
    CALL FUNCTION 'MATERIAL_BTCI_SELECTION_NEW'     " Function module
    EXPORTING
      MATERIAL                  = WA_UPLOAD-MATNR  " Material number
      MATERIALART               = WA_MTART-MTART          " Material Type
      SELECTION                 = 'V'              "
      TCODE                     = 'MM02'           " Tcode where view's are called.
    TABLES
      BTCI_D0070                = IT_BDCDATA_VIEW
    EXCEPTIONS
      MATERIAL_NOT_FOUND        = 1
      MATERIAL_NUMBER_MISSING   = 2
      MATERIAL_TYPE_MISSING     = 3
      MATERIAL_TYPE_NOT_FOUND   = 4
      NO_ACTIVE_DYNPRO_SELECTED = 5
      NO_AUTHORITY              = 6
      OTHERS                    = 7.
    READ TABLE IT_BDCDATA_VIEW WITH KEY FVAL  = 'X'.
    IF SY-SUBRC = 0.
      V_SELECTION = IT_BDCDATA_VIEW-FNAM.
    ELSE.
      CONTINUE.
    ENDIF.
    VAR = IT_BDCDATA_VIEW-FNAM+17(2).
    VAR = VAR + 3.
    CONCATENATE 'MSICHTAUSW-KZSEL(' '0' VAR ')' INTO VAR1.
    PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '0070'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'MSICHTAUSW-DYTXT(06)'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=ENTR'.
    PERFORM BDC_FIELD       USING VAR1
                                   'X'.
    CLEAR VAR.
    CLEAR VAR1.
   PERFORM BDC_FIELD       USING 'MSICHTAUSW-KZSEL(06)'
                                 'X'.
    PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '0080'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'RMMG1-VKORG'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=ENTR'.
    PERFORM BDC_FIELD       USING 'RMMG1-WERKS'
                                  WA_UPLOAD-WERKS.
    PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '4004'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=BU'.
   PERFORM BDC_FIELD       USING 'MAKT-MAKTX'
                                 'MTI_ESE_HALB_01'.
    PERFORM BDC_FIELD       USING 'MARC-STEUC'
                                  WA_UPLOAD-STEUC.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'MARC-HERKR'.
    PERFORM BDC_FIELD       USING 'MARC-HERKL'
                                  'IN'.
    PERFORM BDC_FIELD       USING 'MARC-HERKR'
                                  'MAH'.
    PERFORM BDC_TRANSACTION USING 'MM02'.
move the error record into seperate internal table nad down load it ****
    IF MESSTAB-MSGTYP = 'E'.
      MOVE-CORRESPONDING WA_UPLOAD TO WA_ERROR.
      APPEND WA_ERROR TO T_ERROR.
      CLEAR WA_ERROR.
    ENDIF.
  ENDLOOP.
ENDFORM.                    "PROCESS
*&      Form  UPLOAD_PROCESS
      text
     -->PFNAME     text
FORM UPLOAD_PROCESS USING PFNAME.
  DATA : PFNAME1 TYPE STRING.
  PFNAME1 = PFNAME.
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      FILENAME            = PFNAME1
      FILETYPE            = 'ASC'
      HAS_FIELD_SEPARATOR = 'X'
    TABLES
      DATA_TAB            = T_UPLOAD[].
  IF SY-SUBRC <> 0.
  ENDIF.
ENDFORM.                    "UPLOAD_PROCESS
*&      Form  CONV_ROUTINE
      text
     -->P_INPUT    text
     -->P_OUTPUT   text
FORM CONV_ROUTINE   USING    P_INPUT
                 CHANGING P_OUTPUT.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      INPUT  = P_INPUT
    IMPORTING
      OUTPUT = P_OUTPUT.
ENDFORM.                    "CONV_ROUTINE
*&      Form  DOWNLOAD
      text
     -->GI_FINAL   text
     -->PFNAME     text
FORM DOWNLOAD TABLES
              GI_FINAL
                     USING  PFNAME .
  DATA : FNAME TYPE STRING.
  FNAME = PFNAME.
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      FILENAME                        = FNAME
      FILETYPE                        = 'DAT'
     WRITE_FIELD_SEPARATOR           = 'x'
        HEADER                          = '00'
      IMPORTING
        FILELENGTH                      =
    TABLES
      DATA_TAB                        =  GI_FINAL[]
      FIELDNAMES                      = GI_FIELDNAMES[]
  IF SY-SUBRC = 0.
    MESSAGE 'FILE DOWNLOADED SUCCESSFULLY' TYPE 'I'.
  ENDIF.
ENDFORM.                    " DOWNLOAD
Regards
Siva Prasad

Similar Messages

  • How do perform error handling in production environment?

    Hi,
    I am using CKM and flow control true, tp trace the invalid records while moving data from File to DB. For all invalid records it make n entry in E$_ Table.
    But when I correct the record in file and if its success full, those error gets deleted... I want to keep those error as a history?? How can i do that?
    Secondly, If there is an error records in E$ table..and when i run next time.. Will it insert only the error records or entire file again???????????????
    Thanks:)

    To your first question,
    Yes this can be achieved by amending the CKM. You can remove the step to 'delete previous errors' and make sure that the 'DROP_ERROR_TABLE' option is not set to 'true', therefore all errors will remain in the E$ table even if they have been loaded.
    Your second question is dependent on what you are trying to achieve and how.
    Are you using IKM incremental update/control Append to load your data?
    You may want to have the RECYCLE_ERRORS' set to false on your IKM, then the previously error'ed records will not be re-inserted to your I$ table.
    Your third point is basically due to to incorrect model definition in ODI and probably your target database. This is not an error in ODI terms but incorrect data modelling.
    Edited by: Bos on Apr 13, 2011 11:38 AM

  • HT201442 How to fix  Error 3194 or "This device isn't eligible for the requested build"

    how can fix Error 3194 or "This device isn't eligible for the requested build

    Generally the result of a jailbroken or hacked phone.

  • Error Handling when excel vba code does not find the file

    Hi Below is my code:
    file1 = Dir("Q:\Budget\Historical Budgets\" & new_dept_folder & "\*.xls*")
    col = 2
    col_new = 3
    Application.DisplayAlerts = False
    While (file1 <> "")
            filename = Left$(file1, 6)
            ' Open the newly selected workbook
            Set wb = Workbooks.Open("Q:\Budget\Historical Budgets\" & new_dept_folder & "\" & file1)
            udds = filename & " - " & wb.Sheets("Budget").Range("J1").Value
            ThisWorkbook.Sheets(1).Cells(1, col).Value = udds
            For x = LBound(data_new) To UBound(data_new)
                wb.Sheets("Budget").Select
                Range(data_new(x)).Select
                Selection.Copy
                ThisWorkbook.Sheets(1).Cells(x + 5, col_new).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
            Next x
             ' Close the current workbook
            wb.Close SaveChanges:=False
            On Error GoTo Errhandler
            Set wb_old = Workbooks.Open("Q:\Budget\Historical Budgets\" & old_dept_folder & "\" & file1)  
    <--- Need Error handling on this line (i.e. if I get error here)
            For x = LBound(data) To UBound(data)
                wb_old.Sheets("Budget").Select
                Range(data(x)).Select
                Selection.Copy
                ThisWorkbook.Sheets(1).Cells(x + 5, col).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,   SkipBlanks:=False, Transpose:=False
            Next x
            Application.CutCopyMode = False
            ' Close the current workbook
            On Error Resume Next
            wb_old.Close SaveChanges:=False
    Errhandler:
            For x = LBound(data) To UBound(data)
            ThisWorkbook.Sheets(1).Cells(x + 5, col).Value = 0
            Next x
            ' Select the next file in the dir array
            file1 = Dir
            col = col + 5
            col_new = col_new + 5
    Wend
    Everytime I run the code the errhandler which I don't need. Could you please help me on this.
    Regards, Hitesh

    Hi,
    You could check whether the file is exist, then open it.
    If Dir(path)<>”” Then
    There are three On Error Statements, On Error GoTo <line>, On Error Resume Next and On Error GoTo 0.
    More information, please refer to:
    # How to Use "On Error" to Handle Errors in a Macro
    https://support.microsoft.com/en-us/kb/141571?wa=wsignin1.0
    Regards
    Starain
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How's my error handling?

    I'll keep this short.
    I have TONS of CFTRY/CFCATCH blocks encapsulating different logic.  In the event an error throws, I send the CFCATCH data and usually a descriptive message along with the invokation to a custom tag called cf_errorhandler.  I haven't coded the logic yet in that page, but I'm wondering if this sounds convoluted.
    I understand that this will only address 'caught' exceptions, and I will utilize the onError method in the application.cfc for unhandled exception handling, but I'd love to hear other people's input on how their error handler for caught exceptions work.
    It's just that I get this feeling that I'm doing it the hard way.

    Hmm.  Thanks for that info, p. sim.
    One of the things I'm adamount about with a framework solution is that:
    a. It allows me to maintain my own URL format., ie, I can use domain.com/apples/oranges or domain.com/blog/this-is-an-article/comments rather than it forcing functionality into the url like domain.com/files/functions.cfm?do=that.  I mean, it's one thing if I can call functionality in the framework with an AJAX or other "behind the scenes" HTTP request, that's fine.  But when it comes to the user seeing the URL in the address bar, I want that to be all me.
    b. It allows me to have my own directory structure for where I put files.  Though I understand that MVC in its very nature is about separation of logic, presentation and data (and I'm fine with that), it would need to support my naming structures for the application's directories.
    I've heard about Fusebox the most, and in the few CF job postings I've seen, when they mention framework familiarity, they usually list Fusebox as the preference.  I do like your line on spending time on what to build than how to build.
    Can you recommend a good place to learn Fusebox?  Their website seems to suffer from what I call "Developer-itis", where it's not necessarily being presented in an easy to consume manner (though I understand that's a subjective statement).  Fusebox seems like something well worth learning since it can optimize my build process.

  • How to fix Error 3194 or "This device isn't eligible for the requested build" in i5 using Windows

    While updating my iphone 5 to ios7.0.4 an Error 3194 or "This device isn't eligible for the requested build" has occered so i can't restore my iphone am using my itunes in Windows 8. So what can i do to recover my iphone

    Hello OmPRakash69,
    Thank you for your question!
    It sounds like you are trying to update the phone to the latest version of iOS but are getting an errorr message saying the phone is not eligible for the requested build. Try out the troubleshooting in this article named:
    Error 3194 or "This device isn't eligible for the requested build"
    http://support.apple.com/kb/ts4451
    These steps will get you started, and there are additional troubleshooting steps if needed in the article:
    Important: If you see one of these messages and need help updating or restoring your iOS device, Install the latest version of iTunes and try to update or restore again. After that, follow these steps if you need more help.
    Check your "hosts" file
    After you've updated iTunes to the latest version, you can check the hosts file to be sure your computer can contact the update server. Use the numbered steps below if you’re on a Mac.
    If you’re using a Windows computer, follow steps in this Microsoft support article, noting that resetting the hosts file will affect software services that rely on hosts file redirects. If you're using Windows on a business computer, consult your IT department to be sure applications will still work correctly after resetting the hosts file.
    In the Finder, choose Applications > Utilities.
    Open Terminal.
    Enter this command and then press Return:
    sudo nano /private/etc/hosts
    Enter the password you use to sign in to your computer and press Return. You won't see text appear in the Terminal window when you enter the password. Make sure you use a nonblank administrator password.
    Terminal will display the hosts file. Navigate using the arrow keys and look for an entry containing “gs.apple.com”.
    Add the # symbol and a space ("# ") to the beginning of the gs.apple.com entry.
    Press Control-O to save the file. Then, press Enter when prompted for the filename and Control-X to exit the editor.
    Restart your computer.
    Try to update or restore your iOS device again.
    Thank you for using Apple Support Communities.
    All the very best,
    Sterling

  • How to fix Error 3194 or "This device isn't eligible for the requested build

    Error 3194 or "This device isn't eligible for the requested build

    Hi haqbeen,
    If you are having issues with Error 3194, you may find the following article helpful:
    Apple Support: Error 3194 or "This device isn't eligible for the requested build"
    http://support.apple.com/kb/ts4451
    Regards,
    - Brenden

  • Error Handling in Stored Procedure code

    Hi All,
    I need to know which step is failing and whats the error message when i run a stored procedure.
    Lets say i have a stored procedure with below content.So i want to know which of the below four statements failed,and
    the error message belonging to it.
    How can i modify the below code to achieve my output.
    begin try
    DELETE FROM Table1 WHERE Column1 = 'A'
    UPDATE Table1 SET Column1 = 'C' WHERE Column2 = 'B'
    SELECT * FROM Table1 WHERE Column3 = 'C'
    SELECT * FROM Table1 WHERE Column4 = 'D'
    end try
    begin catch
    end catch
    Thanks in Advance!!

    Take a look at this excellent TechNet Wiki article
    Structured
    Error Handling Mechanism in SQL Server 2012
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Error Handler Returning 200 Status Code

    Greetings,
    I have a section of my site assigned to be an "Error Handler" however when a user is brought to this page, the status code is a 200. As you can imagine, this has the potential to cause a lot of problems for processes that rely on status codes to operate.
    I have found the following solution on another site, indicating to place this Idoc Script code at the top of the Page Template:
    <!--$setValue("#local", "ssChangeHTTPHeader", "true")-->
    Unfortunately, doing the above does not work. Am I missing something?
    Any help is appreciated. Thanks!
    Josh

    Hi Srinath,
    First of all, thanks for taking time to help. I removed the tag that I previously had inside of my Page Template and put yours in the body, however my page still returns a 200. I completely stripped the Page Template of all but the necessary markup.
    <!DOCTYPE html>
    <html lang="en">
    <head>
         <meta charset="UTF-8">
         <!--$include ss_layout_head_info-->
         <meta http-equiv="X-UA-Compatible" content="IE=edge" />
         <meta name="viewport" content="width=device-width, initial-scale=1">
         <script id="ssInfo" type="text/xml" warning="DO NOT MODIFY!">
              <ssinfo></ssinfo>
         </script>
    </head>
    <body>
         <!--$ssSet404Response("true")-->
    </body>
    </html>
    Thanks!

  • How to treat error handling in the consumer loop in the queue message handler structure?

    Hi,
    I'd like to know how to stop the producer loop(event loop) in the QMH structure when the error happened in the consumer loop.
    I've construct a demo code by myself as the attached image, but it's a pity that I have to create a recdundant indicator "End" to trigger the value change event to stop the program. This is not a good way to do it. Could someone give me some better idea how to deal with it? Very appreciated to you sharing ideas.

    Concerning your doubts about the "traditional" implementation of this pattern, I hear you. As I have written many times before, its main benefit is that it is easy to explain in a training class. It unfortunately has a lot of drawbacks.
    Tim's suggestion about User Events, is a good one. But to use it to the best advantage, you will need to get away from having everything on one block diagram. If you think about it there is no real need for the two loops to be on the same block diagram and a lot of really good reasons for them not to be. For example, if they are in separate VIs, they can both be event driven and any communication problems between loops evaporates.
    Its also more modular, easier to maintain, more reusable, etc...
    Check the link in my signature.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How to implement Error handling in Openscript

    Hi All,
    Please help me to implement this .
    I am creating Load test script for ebs - approve requisitions process. 
    The script will login to check any requisitions are waiting for approval, if found then it will click on random requisitions then approve it.  
    There are no requisitions for approval then I want to call the log-out function then start the iteration again.
    What function to be used to start the iteration again .
    //After login, I am checking no of requisition to approve.
    beginStep("Login");
    getScript("MyFunc").callFunction("ebsLogin");
      http.assertText("LoginCheckString", "window[@index='0']","Oracle Applications Home Page", Source.Html,TextPresence.PassIfPresent, MatchOption.Exact);
      try {                          
      http.solve("noOfFound", "window[@index='0']", "<a id=\"N39:(.+?)\" title=\"Purchase Requisition ", "No Requisitions Found", false, Source.Html, null, EncodeOptions.None);
      }catch (Exception e){
      info("No Requisitions to Approve");                                              
            getScript("UtilityFunc").callFunction("ebsLogOut"); 
      // I want to start the iteration again after this point, but it's continue executing the remaining steps.
    endStep();
    beginStep("ClkRequisitions");
      http.link(716,"window[@index='0']//a[@id='N39:{{sRndChoice}}']").click();
    endStep();
    beginStep("Logout");
    getScript("UtilityFunc").callFunction("ebsLogOut");                
    endStep();

    Create a flag(boolean) and loop till true, ie.
    boolean flag =true;
    while(flag){
    ---your steps----
    try{
    ----your steps---
    flag=false;
    catch(Exception e){
    ---your steps---
    Cheers,
    Deepu M
    [email protected]

  • How to solve error when run Depreciation (T-Code:AFAB)

    Dear All Experts,
    Hi,
    I found error when run Depreciation for period 9 FYI. I had run Planed posting period Depreciation (TCode: AFAB).  with fiscal year: 2010, posting period: 9, reason for posting run: Planed posting run. Select on Test Run. Then i found error message as below.
    Documents manually posted within dep.doc.number range
         Message no. AA728
    Diagnosis
         In the number range interval for the document type for posting
         depreciation, a document  has been posted which was not created within
         the framework of depreciation posting. The last document posted by
         depreciation posting was assigned the number .
    Procedure
         Contact your Systems Specialist. When changing the number range interval
         for the document type in depreciation posting, you have to specify a new
         interval in which no documents exist. Using organizational measures, you
         can guarantee that there are no documents apart from those created by
         depreciation posting in this number range.
    Would you help me how to solve this error?
    Thank you in advance
    Best Regards
    Utarat.P

    Hi Utarat,
    first question is: have you really manually posted a Documents within dep.doc.number range 
    If you post with RABUCH00, note 193984 could be relevant for you. 
    Check if the intervall in Table TABA don't fits with the Intervall in BKPF.
    Example:
    TABA
    MANDT BUKRS  AFBLGJ AFBLPE AFBANZ BLNRF      BLNRT      XBUKZ  
    100   XXXX   2010   004    01     4200000013 4200000016 X      
    100   XXXX   2010   005    01     4200000017 4200000020 X      
    100   XXXX   2010   006    01     4200000021 4200000024        
    On the other Hand In Table BKPF (or Tr. FB03) you can see that 4200000037 already   
    exits.                                                                               
    BUKRS  BELNR      GJAHR BLART BUDAT      CPUDT      CPUTM    TCODE
    XXXX   4200000024 2010  YY    30.06.2010 06.07.2010 19:36:30 ABF1 
    XXXX   4200000037 2010  YY    30.06.2010 06.07.2010 19:37:47 ABF1 
    Regards Bernhard

  • Got error while compiling this source code?

    [code =java]package com.agent.client.movies;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    import java.util.ArrayList;
    public interface DataSourceMovies extends Remote{
    ArrayList<String[]> getAllMovies() throws RemoteException;
    ArrayList<String[]> findMoviesByYear( int year) throws RemoteException;
    ArrayList<String[]> findMoviesByDirector(String director) throws RemoteException;
    ArrayList<String[]> findMoviesByGenre(String genre) throws RemoteException;
    ArrayList<String[]> findMoviesByName(String name) throws RemoteException;
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    * MovieClient.java
    * Created on Apr 24, 2012, 10:49:58 AM
    package com.agent.client.movies;
    import com.agent.client.songs.SongsClient;
    import com.agent.client.Utility;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.StringTokenizer;
    import javax.naming.InitialContext;
    import javax.swing.DefaultListModel;
    import javax.swing.JOptionPane;
    import javax.swing.table.DefaultTableModel;
    public class MovieClient extends javax.swing.JFrame {
    ArrayList<String> mappedips = new ArrayList<String>();
    DefaultListModel<String> modelmsg = new DefaultListModel<String>();
    InitialContext ctx;
    /** Creates new form MovieClient */
    public MovieClient(String ips) {
    setLookAndFeel();
    initComponents();
    Utility.setInCenter(this);
    StringTokenizer stok = new StringTokenizer(ips, ":");
    while(stok.hasMoreTokens())
    mappedips.add(stok.nextToken());
    public void setLookAndFeel(){
    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
    * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
    try {
    for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
    if ("Nimbus".equals(info.getName())) {
    javax.swing.UIManager.setLookAndFeel(info.getClassName());
    break;
    } catch (ClassNotFoundException ex) {
    java.util.logging.Logger.getLogger(SongsClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
    java.util.logging.Logger.getLogger(SongsClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
    java.util.logging.Logger.getLogger(SongsClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
    java.util.logging.Logger.getLogger(SongsClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    //</editor-fold>
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
    buttonGroup1 = new javax.swing.ButtonGroup();
    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jPanel2 = new javax.swing.JPanel();
    btclose = new javax.swing.JButton();
    jPanel3 = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    jPanel8 = new javax.swing.JPanel();
    jLabel2 = new javax.swing.JLabel();
    txtkey = new javax.swing.JTextField();
    btsearch = new javax.swing.JButton();
    jPanel9 = new javax.swing.JPanel();
    rdbyname = new javax.swing.JRadioButton();
    rdbydirector = new javax.swing.JRadioButton();
    rdbygenre = new javax.swing.JRadioButton();
    rdbyyear = new javax.swing.JRadioButton();
    jPanel5 = new javax.swing.JPanel();
    jPanel6 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    lstMessages = new javax.swing.JList(modelmsg);
    jPanel7 = new javax.swing.JPanel();
    jScrollPane2 = new javax.swing.JScrollPane();
    tabmovies = new javax.swing.JTable();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setMinimumSize(new java.awt.Dimension(500, 500));
    jLabel1.setFont(new java.awt.Font("Simplified Arabic", 1, 24));
    jLabel1.setForeground(new java.awt.Color(0, 102, 204));
    jLabel1.setText("Mobile Agent: Find Movie Information");
    jPanel1.add(jLabel1);
    getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START);
    btclose.setText("Close");
    btclose.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    btcloseActionPerformed(evt);
    jPanel2.add(btclose);
    getContentPane().add(jPanel2, java.awt.BorderLayout.PAGE_END);
    jPanel3.setLayout(new java.awt.BorderLayout());
    jPanel4.setLayout(new java.awt.GridLayout(2, 1));
    jLabel2.setText("Key");
    btsearch.setText("Search");
    btsearch.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    btsearchActionPerformed(evt);
    javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
    jPanel8.setLayout(jPanel8Layout);
    jPanel8Layout.setHorizontalGroup(
    jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel8Layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(txtkey, javax.swing.GroupLayout.PREFERRED_SIZE, 482, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
    .addComponent(btsearch)
    .addContainerGap(130, Short.MAX_VALUE))
    jPanel8Layout.setVerticalGroup(
    jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel8Layout.createSequentialGroup()
    .addGap(14, 14, 14)
    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel2)
    .addComponent(txtkey, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(btsearch))
    .addContainerGap(13, Short.MAX_VALUE))
    jPanel4.add(jPanel8);
    buttonGroup1.add(rdbyname);
    rdbyname.setSelected(true);
    rdbyname.setText("By name");
    buttonGroup1.add(rdbydirector);
    rdbydirector.setText("By director");
    buttonGroup1.add(rdbygenre);
    rdbygenre.setText("By genre");
    buttonGroup1.add(rdbyyear);
    rdbyyear.setText("By year");
    javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
    jPanel9.setLayout(jPanel9Layout);
    jPanel9Layout.setHorizontalGroup(
    jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel9Layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(rdbyname)
    .addGap(36, 36, 36)
    .addComponent(rdbydirector)
    .addGap(37, 37, 37)
    .addComponent(rdbygenre)
    .addGap(33, 33, 33)
    .addComponent(rdbyyear)
    .addContainerGap(352, Short.MAX_VALUE))
    jPanel9Layout.setVerticalGroup(
    jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel9Layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(rdbyname)
    .addComponent(rdbydirector)
    .addComponent(rdbygenre)
    .addComponent(rdbyyear))
    .addContainerGap(20, Short.MAX_VALUE))
    jPanel4.add(jPanel9);
    jPanel3.add(jPanel4, java.awt.BorderLayout.PAGE_START);
    jPanel5.setLayout(new java.awt.BorderLayout());
    jPanel6.setLayout(new java.awt.BorderLayout());
    lstMessages.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102)));
    jScrollPane1.setViewportView(lstMessages);
    jPanel6.add(jScrollPane1, java.awt.BorderLayout.CENTER);
    jPanel5.add(jPanel6, java.awt.BorderLayout.PAGE_END);
    jPanel7.setLayout(new java.awt.BorderLayout());
    tabmovies.setModel(new javax.swing.table.DefaultTableModel(
    new Object [][] {
    new String [] {
    "Name", "Director", "Genre", "Release Year"
    jScrollPane2.setViewportView(tabmovies);
    jPanel7.add(jScrollPane2, java.awt.BorderLayout.CENTER);
    jPanel5.add(jPanel7, java.awt.BorderLayout.CENTER);
    jPanel3.add(jPanel5, java.awt.BorderLayout.CENTER);
    getContentPane().add(jPanel3, java.awt.BorderLayout.CENTER);
    pack();
    }// </editor-fold>//GEN-END:initComponents
    private void btcloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btcloseActionPerformed
    System.exit(0);
    }//GEN-LAST:event_btcloseActionPerformed
    private void btsearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btsearchActionPerformed
    searchMovies();
    }//GEN-LAST:event_btsearchActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btclose;
    private javax.swing.JButton btsearch;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JList lstMessages;
    private javax.swing.JRadioButton rdbydirector;
    private javax.swing.JRadioButton rdbygenre;
    private javax.swing.JRadioButton rdbyname;
    private javax.swing.JRadioButton rdbyyear;
    private javax.swing.JTable tabmovies;
    private javax.swing.JTextField txtkey;
    // End of variables declaration//GEN-END:variables
    private void searchMovies() {
    if(txtkey.getText().trim().length()==0){
    JOptionPane.showMessageDialog(null, "Please enter some words...");
    return;
    for(String ip : mappedips){
    modelmsg.addElement("Looking up node : " + ip);
    DataSourceMovies movies = null;
    try {
    ctx = new InitialContext();
    movies = (DataSourceMovies)ctx.lookup("rmi://" + ip + "/movieserver");
    } catch (Exception e) {
    modelmsg.addElement("Error contacting node...");
    e.printStackTrace();
    break;
    List<String[]> movieslist = null;
    try{
    if(rdbyname.isSelected())
    movieslist = movies.findMoviesByName(txtkey.getText().trim());
    else if(rdbydirector.isSelected())
    movieslist = movies.findMoviesByDirector(txtkey.getText().trim());
    else if(rdbygenre.isSelected())
    movieslist = movies.findMoviesByGenre(txtkey.getText().trim());
    else if(rdbyyear.isSelected()){
    try {
    movieslist = movies.findMoviesByYear(Integer.parseInt(txtkey.getText().trim()));
    } catch (Exception e) {
    JOptionPane.showMessageDialog(null, "Invalid year...");
    return;
    if(movieslist!=null && movieslist.size()>0){
    modelmsg.addElement("Songs found...");
    DefaultTableModel model = (DefaultTableModel) tabmovies.getModel();
    while(model.getRowCount()>0){
    model.removeRow(0);
    tabmovies.revalidate();
    for(String[] moviedata : movieslist)
    model.addRow(moviedata);
    catch(Exception ex) {               
    modelmsg.addElement("Error reading data...");
    break;
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package com.agent.client.movies;
    import com.agent.client.Utility;
    import java.io.DataInputStream;
    import java.io.DataOutputStream;
    import java.net.Socket;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JWindow;
    import javax.swing.SwingConstants;
    public class MovieSplashScreen {
    private javax.swing.JLabel lbimage;
    private javax.swing.JLabel lbloading;
    private javax.swing.JLabel lbmobile;
    private javax.swing.JPanel panelBack;
    public static void main(String[] ar) {
    new MovieSplashScreen().displaySplash(ar[0]);
    public void displaySplash(String mapperip) {
    JWindow window = new JWindow();
    window.getContentPane().add(
    new JLabel("Loading JFrame...", SwingConstants.CENTER));
    window.setSize(525, 240);
    Utility.setInCenter(window);
    panelBack = new javax.swing.JPanel();
    lbimage = new javax.swing.JLabel();
    lbloading = new javax.swing.JLabel();
    lbmobile = new javax.swing.JLabel();
    panelBack.setBackground(new java.awt.Color(255, 255, 255));
    panelBack.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
    panelBack.setLayout(null);
    lbimage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/agent/client/splash.jpg"))); // NOI18N
    panelBack.add(lbimage);
    lbimage.setBounds(250, 20, 250, 180);
    lbloading.setFont(new java.awt.Font("Showcard Gothic", 0, 30)); // NOI18N
    lbloading.setText("Loading...");
    panelBack.add(lbloading);
    lbloading.setBounds(50, 120, 210, 70);
    lbmobile.setFont(new java.awt.Font("Tekton Pro Cond", 0, 24)); // NOI18N
    lbmobile.setForeground(new java.awt.Color(0, 51, 51));
    lbmobile.setText("Mobile Agents 1.0");
    panelBack.add(lbmobile);
    lbmobile.setBounds(30, 20, 230, 40);
    window.add(panelBack, java.awt.BorderLayout.CENTER);
    window.setVisible(true);
    try {
    Thread.sleep(5000);
    } catch (InterruptedException e) {
    Socket client = null;
    try {
    client = new Socket(mapperip,2222);
    } catch (Exception e) {
    JOptionPane.showMessageDialog(null, "Mapping server down...");
    System.exit(0);
    DataInputStream din = null;
    DataOutputStream dout = null;
    String ips = null;
    try {
    din = new DataInputStream(client.getInputStream());
    dout = new DataOutputStream(client.getOutputStream());
    dout.writeUTF("movies");
    ips = din.readUTF();
    } catch (Exception e) {
    JOptionPane.showMessageDialog(null, "Cannot retrieve mappings...");
    e.printStackTrace();
    System.exit(0);
    window.setVisible(false);
    MovieClient sclient = new MovieClient(ips);
    sclient.setVisible(true);
    window.dispose();

    {code = java}package com.agent.client.movies;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    import java.util.ArrayList;
    public interface DataSourceMovies extends Remote{
    ArrayList<String[]> getAllMovies() throws RemoteException;
    ArrayList<String[]> findMoviesByYear( int year) throws RemoteException;
    ArrayList<String[]> findMoviesByDirector(String director) throws RemoteException;
    ArrayList<String[]> findMoviesByGenre(String genre) throws RemoteException;
    ArrayList<String[]> findMoviesByName(String name) throws RemoteException;
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    * MovieClient.java
    * Created on Apr 24, 2012, 10:49:58 AM
    package com.agent.client.movies;
    import com.agent.client.songs.SongsClient;
    import com.agent.client.Utility;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.StringTokenizer;
    import javax.naming.InitialContext;
    import javax.swing.DefaultListModel;
    import javax.swing.JOptionPane;
    import javax.swing.table.DefaultTableModel;
    public class MovieClient extends javax.swing.JFrame {
    ArrayList<String> mappedips = new ArrayList<String>();
    DefaultListModel<String> modelmsg = new DefaultListModel<String>();
    InitialContext ctx;
    /** Creates new form MovieClient */
    public MovieClient(String ips) {
    setLookAndFeel();
    initComponents();
    Utility.setInCenter(this);
    StringTokenizer stok = new StringTokenizer(ips, ":");
    while(stok.hasMoreTokens())
    mappedips.add(stok.nextToken());
    public void setLookAndFeel(){
    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
    * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
    try {
    for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
    if ("Nimbus".equals(info.getName())) {
    javax.swing.UIManager.setLookAndFeel(info.getClassName());
    break;
    } catch (ClassNotFoundException ex) {
    java.util.logging.Logger.getLogger(SongsClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
    java.util.logging.Logger.getLogger(SongsClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
    java.util.logging.Logger.getLogger(SongsClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
    java.util.logging.Logger.getLogger(SongsClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    //</editor-fold>
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
    buttonGroup1 = new javax.swing.ButtonGroup();
    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jPanel2 = new javax.swing.JPanel();
    btclose = new javax.swing.JButton();
    jPanel3 = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    jPanel8 = new javax.swing.JPanel();
    jLabel2 = new javax.swing.JLabel();
    txtkey = new javax.swing.JTextField();
    btsearch = new javax.swing.JButton();
    jPanel9 = new javax.swing.JPanel();
    rdbyname = new javax.swing.JRadioButton();
    rdbydirector = new javax.swing.JRadioButton();
    rdbygenre = new javax.swing.JRadioButton();
    rdbyyear = new javax.swing.JRadioButton();
    jPanel5 = new javax.swing.JPanel();
    jPanel6 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    lstMessages = new javax.swing.JList(modelmsg);
    jPanel7 = new javax.swing.JPanel();
    jScrollPane2 = new javax.swing.JScrollPane();
    tabmovies = new javax.swing.JTable();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setMinimumSize(new java.awt.Dimension(500, 500));
    jLabel1.setFont(new java.awt.Font("Simplified Arabic", 1, 24));
    jLabel1.setForeground(new java.awt.Color(0, 102, 204));
    jLabel1.setText("Mobile Agent: Find Movie Information");
    jPanel1.add(jLabel1);
    getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START);
    btclose.setText("Close");
    btclose.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    btcloseActionPerformed(evt);
    jPanel2.add(btclose);
    getContentPane().add(jPanel2, java.awt.BorderLayout.PAGE_END);
    jPanel3.setLayout(new java.awt.BorderLayout());
    jPanel4.setLayout(new java.awt.GridLayout(2, 1));
    jLabel2.setText("Key");
    btsearch.setText("Search");
    btsearch.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    btsearchActionPerformed(evt);
    javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
    jPanel8.setLayout(jPanel8Layout);
    jPanel8Layout.setHorizontalGroup(
    jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel8Layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(txtkey, javax.swing.GroupLayout.PREFERRED_SIZE, 482, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
    .addComponent(btsearch)
    .addContainerGap(130, Short.MAX_VALUE))
    jPanel8Layout.setVerticalGroup(
    jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel8Layout.createSequentialGroup()
    .addGap(14, 14, 14)
    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel2)
    .addComponent(txtkey, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(btsearch))
    .addContainerGap(13, Short.MAX_VALUE))
    jPanel4.add(jPanel8);
    buttonGroup1.add(rdbyname);
    rdbyname.setSelected(true);
    rdbyname.setText("By name");
    buttonGroup1.add(rdbydirector);
    rdbydirector.setText("By director");
    buttonGroup1.add(rdbygenre);
    rdbygenre.setText("By genre");
    buttonGroup1.add(rdbyyear);
    rdbyyear.setText("By year");
    javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
    jPanel9.setLayout(jPanel9Layout);
    jPanel9Layout.setHorizontalGroup(
    jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel9Layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(rdbyname)
    .addGap(36, 36, 36)
    .addComponent(rdbydirector)
    .addGap(37, 37, 37)
    .addComponent(rdbygenre)
    .addGap(33, 33, 33)
    .addComponent(rdbyyear)
    .addContainerGap(352, Short.MAX_VALUE))
    jPanel9Layout.setVerticalGroup(
    jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel9Layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(rdbyname)
    .addComponent(rdbydirector)
    .addComponent(rdbygenre)
    .addComponent(rdbyyear))
    .addContainerGap(20, Short.MAX_VALUE))
    jPanel4.add(jPanel9);
    jPanel3.add(jPanel4, java.awt.BorderLayout.PAGE_START);
    jPanel5.setLayout(new java.awt.BorderLayout());
    jPanel6.setLayout(new java.awt.BorderLayout());
    lstMessages.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102)));
    jScrollPane1.setViewportView(lstMessages);
    jPanel6.add(jScrollPane1, java.awt.BorderLayout.CENTER);
    jPanel5.add(jPanel6, java.awt.BorderLayout.PAGE_END);
    jPanel7.setLayout(new java.awt.BorderLayout());
    tabmovies.setModel(new javax.swing.table.DefaultTableModel(
    new Object [][] {
    new String [] {
    "Name", "Director", "Genre", "Release Year"
    jScrollPane2.setViewportView(tabmovies);
    jPanel7.add(jScrollPane2, java.awt.BorderLayout.CENTER);
    jPanel5.add(jPanel7, java.awt.BorderLayout.CENTER);
    jPanel3.add(jPanel5, java.awt.BorderLayout.CENTER);
    getContentPane().add(jPanel3, java.awt.BorderLayout.CENTER);
    pack();
    }// </editor-fold>//GEN-END:initComponents
    private void btcloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btcloseActionPerformed
    System.exit(0);
    }//GEN-LAST:event_btcloseActionPerformed
    private void btsearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btsearchActionPerformed
    searchMovies();
    }//GEN-LAST:event_btsearchActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btclose;
    private javax.swing.JButton btsearch;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JList lstMessages;
    private javax.swing.JRadioButton rdbydirector;
    private javax.swing.JRadioButton rdbygenre;
    private javax.swing.JRadioButton rdbyname;
    private javax.swing.JRadioButton rdbyyear;
    private javax.swing.JTable tabmovies;
    private javax.swing.JTextField txtkey;
    // End of variables declaration//GEN-END:variables
    private void searchMovies() {
    if(txtkey.getText().trim().length()==0){
    JOptionPane.showMessageDialog(null, "Please enter some words...");
    return;
    for(String ip : mappedips){
    modelmsg.addElement("Looking up node : " + ip);
    DataSourceMovies movies = null;
    try {
    ctx = new InitialContext();
    movies = (DataSourceMovies)ctx.lookup("rmi://" + ip + "/movieserver");
    } catch (Exception e) {
    modelmsg.addElement("Error contacting node...");
    e.printStackTrace();
    break;
    List<String[]> movieslist = null;
    try{
    if(rdbyname.isSelected())
    movieslist = movies.findMoviesByName(txtkey.getText().trim());
    else if(rdbydirector.isSelected())
    movieslist = movies.findMoviesByDirector(txtkey.getText().trim());
    else if(rdbygenre.isSelected())
    movieslist = movies.findMoviesByGenre(txtkey.getText().trim());
    else if(rdbyyear.isSelected()){
    try {
    movieslist = movies.findMoviesByYear(Integer.parseInt(txtkey.getText().trim()));
    } catch (Exception e) {
    JOptionPane.showMessageDialog(null, "Invalid year...");
    return;
    if(movieslist!=null && movieslist.size()>0){
    modelmsg.addElement("Songs found...");
    DefaultTableModel model = (DefaultTableModel) tabmovies.getModel();
    while(model.getRowCount()>0){
    model.removeRow(0);
    tabmovies.revalidate();
    for(String[] moviedata : movieslist)
    model.addRow(moviedata);
    catch(Exception ex) {
    modelmsg.addElement("Error reading data...");
    break;
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package com.agent.client.movies;
    import com.agent.client.Utility;
    import java.io.DataInputStream;
    import java.io.DataOutputStream;
    import java.net.Socket;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JWindow;
    import javax.swing.SwingConstants;
    public class MovieSplashScreen {
    private javax.swing.JLabel lbimage;
    private javax.swing.JLabel lbloading;
    private javax.swing.JLabel lbmobile;
    private javax.swing.JPanel panelBack;
    public static void main(String[] ar) {
    new MovieSplashScreen().displaySplash(ar[0]);
    public void displaySplash(String mapperip) {
    JWindow window = new JWindow();
    window.getContentPane().add(
    new JLabel("Loading JFrame...", SwingConstants.CENTER));
    window.setSize(525, 240);
    Utility.setInCenter(window);
    panelBack = new javax.swing.JPanel();
    lbimage = new javax.swing.JLabel();
    lbloading = new javax.swing.JLabel();
    lbmobile = new javax.swing.JLabel();
    panelBack.setBackground(new java.awt.Color(255, 255, 255));
    panelBack.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
    panelBack.setLayout(null);
    lbimage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/agent/client/splash.jpg"))); // NOI18N
    panelBack.add(lbimage);
    lbimage.setBounds(250, 20, 250, 180);
    lbloading.setFont(new java.awt.Font("Showcard Gothic", 0, 30)); // NOI18N
    lbloading.setText("Loading...");
    panelBack.add(lbloading);
    lbloading.setBounds(50, 120, 210, 70);
    lbmobile.setFont(new java.awt.Font("Tekton Pro Cond", 0, 24)); // NOI18N
    lbmobile.setForeground(new java.awt.Color(0, 51, 51));
    lbmobile.setText("Mobile Agents 1.0");
    panelBack.add(lbmobile);
    lbmobile.setBounds(30, 20, 230, 40);
    window.add(panelBack, java.awt.BorderLayout.CENTER);
    window.setVisible(true);
    try {
    Thread.sleep(5000);
    } catch (InterruptedException e) {
    Socket client = null;
    try {
    client = new Socket(mapperip,2222);
    } catch (Exception e) {
    JOptionPane.showMessageDialog(null, "Mapping server down...");
    System.exit(0);
    DataInputStream din = null;
    DataOutputStream dout = null;
    String ips = null;
    try {
    din = new DataInputStream(client.getInputStream());
    dout = new DataOutputStream(client.getOutputStream());
    dout.writeUTF("movies");
    ips = din.readUTF();
    } catch (Exception e) {
    JOptionPane.showMessageDialog(null, "Cannot retrieve mappings...");
    e.printStackTrace();
    System.exit(0);
    window.setVisible(false);
    MovieClient sclient = new MovieClient(ips);
    sclient.setVisible(true);
    window.dispose();

  • Regarding Error Handling  by using VBA code

    I want to skip the "Server Error in '/' Application" in one page( page 5), and goback to previews worked page (page 4) , continue to next page( page 6).
    If errNumber = -1 Then
    RSWApp.GoBack
    RSWApp.GotoPage (6)
    End If
    but it didn't go back.

    Then try adding the code for GoBack in the Before Play event of Page 5.
    If errNumber = -1 Then
    blnPg5Err = True
    RSWApp.GoBack
    End If
    Also add a boolean so when you go back to Page 4, you know that the reason you are there is because of error on Page 5. And in the code for Page 4, add validation like
    If blnPg5Err = True then
    'whatever you need to do
    rswapp.gotopage(6)
    end if
    You will have to declare blnPg5Err in the Shared Module
    Public blnPg5Err as boolean.
    Hope this works for you.

  • How to manage the memory within this JNI code

    This is a piece of JNI code that i had written..........
    i am calling these methods in a infinite loop to listen for changes......
    if a change has occured it shpuld get changed. other wise not....
    But the memory is allocated 4 bytes every second.... even if the user doesnt makes a change....... ( memory increases with TIME....... )
    How to get rid of this problem
    Please Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    #include <jni.h>
    #include "ParameterClass.h"
    #include <stdio.h>
    #include <scrpcdll.h>
    const char *NetAddr = "";
    const char *str = NULL;
    int sp= 0;
    double value= 0;
    jsize doubleLen = 0;
    jsize strLen = 0;
    int val=0;
    int i= 0 ;
    jdouble *body = NULL;
    const char *name = NULL;
    jstring *string = NULL;
    const char *tableStr = NULL;
    int sp1 = 0;
    double value1 = 0;
    JNIEXPORT jdouble JNICALL
    Java_ParameterClass_IdentificationValue(JNIEnv *env, jobject obj,jstring parameterName,jdouble parameterValue)
         if(SC_ConnectToSoftcar(NetAddr))
              str = (*env)->GetStringUTFChars(env,parameterName,NULL);
              sp = SC_AddVari(str, 6, "M");
              SC_Set(sp,parameterValue);
              (*env)->ReleaseStringUTFChars(env,parameterName,str);
              (*env)->ReleaseStringUTFChars(env,parameterName,NULL);
              value = SC_Get(sp);
         (*env)->DeleteLocalRef(env,parameterName);
         return value;
    JNIEXPORT void JNICALL
    Java_ParameterClass_OnlineValue(JNIEnv *env1,jobject obj1,jobjectArray str,jdoubleArray doArr)
         if(SC_ConnectToSoftcar(NetAddr))
              doubleLen = (*env1)->GetArrayLength(env1, doArr);
              strLen = (*env1)->GetArrayLength(env1,str);
              body = (*env1)->GetDoubleArrayElements(env1,doArr,NULL);
              for(i = 0; i < doubleLen; i++)
                   *string = (jstring)(*env1)->GetObjectArrayElement(env1,str,i);
                   name = (*env1)->GetStringUTFChars(env1,*string,NULL);
                   val = SC_AddVari(name, 6, "revs");
                   SC_Set(val,body);
                   (*env1)->ReleaseStringUTFChars(env1,*string,name);
                   (*env1)->ReleaseStringUTFChars(env1,*string,NULL);
              (*env1)->ReleaseDoubleArrayElements(env1,doArr,body,0);
              (*env1)->DeleteLocalRef(env1, *string);
         SC_DisconnectFromSoftcar();
         return;

    Hai,
    Thanks for your comments.......
    In Java i call the JNI methods inside a Infinite loop...
    when i comment this Infinite loop then the memory doesnt Increase at all.....
    but i cannot comment since i need a functionality to execute through JNI.....
    so if i uncomment this Infinte loop then i get a Probelm.........
    This is the JAVA CODE which calls JNI CODE:::::::::::::::::::::
    while(loopForever)
         streamWrite();
         System.gc();
    public void streamWrite()
    // Getting the Parameter Value from the Softcar
         for(i = 0; i < newparameterArray.length; i++)
              newparameterArray[i] = valueClass.returnIdentificationValue(prefix+parent.parameterName);
              System.gc();
    /*Checking the Array of values: Checking which value of the Array has changed in Softcar      Checking for the Elements of the Array which had been changed by the User if the change is made then Updating to the ASAP-3 Server.........*/
         if(Arrays.equals(parameterArray,newparameterArray) == true)
              for(i = 0; i < newparameterArray.length; i++)
              newparameterArray[i] = valueClass.returnIdentificationValue(prefix+parent.parameterName[i]);
              System.gc();
         else{
              for(i = 0; i < newparameterArray.length; i++)
                   if(parameterArray[i] != newparameterArray[i])
                        parameterArray[i] = newparameterArray[i];
                             parent.commandparameters.setapsparameters.parameterField.setText(parent.parameterName[i]);
                             parent.commandparameters.setapsparameters.parameterValueField.setText(Double.toString(newparameterArray[i]));
              try{
                   bos.write((byte[])parent.commandparameters.setapsparameters.setParameterArray());
                   bos.flush();
                   Thread.sleep(500);
                   readfromStream();
                   serverResponse();
              }catch(IOException exception){System.err.println(" Write Stream Exception" + exception.getMessage());}
              catch(InterruptedException ie){System.err.println(ie.getMessage());};
              //parameterArray[i] = newparameterArray[i];
              System.gc();
    //Getting the TableValue from Softcar.......
              for(j = 0; j < Integer.parseInt(parent.xDimension); j++)
                   newtableValueArray[j] = valueClass.returngetTableValue(arrayString[j]);
                   System.gc();
    //Comparing the Values ( whether the user has chaged the TableValue )
              if(Arrays.equals(tableValueArray,newtableValueArray) == true)
                   for(j = 0; j < newtableValueArray.length; j++)
                        newtableValueArray[j] = valueClass.returngetTableValue(arrayString[j]);
                        System.gc();
              else
                   for(j = 0; j < newtableValueArray.length; j++)
                        if((tableValueArray[j] != newtableValueArray[j]))
                             tableValueArray[j] = newtableValueArray[j];
                             parent.commandparameters.setlookupparameters.yindexField.setText(parent.yDimension);
                             parent.commandparameters.setlookupparameters.xindexField.setText(Integer.toString(j+1));
                             parent.commandparameters.setlookupparameters.valueField.setText(Double.toString(newtableValueArray[j]));
                             try{
                                  bos.write((byte[])parent.commandparameters.setlookupparameters.setlookupArray());
                                  bos.flush();
                                  Thread.sleep(500);
                                  readfromStream();
                                  serverResponse();
                             }catch(IOException exception){System.err.println(" Write Stream Exception" + exception.getMessage());}
                             catch(InterruptedException ie){System.err.println(ie.getMessage());};
                             System.gc();

Maybe you are looking for