How to detect if there is an error on a Import on code using Call IMPORTSIL () from GIMPOBJ

SUGGESTED

I am creating a Credit Note or Debit Memo under certain circumstances using:

Call IMPORTSIL ("YBIC",filpath("TMP",YFILENAME,"TXT)) from GIMPOBJ

If everything works OK a message is displayed for each Credit Note or Debit Memo created and that is fine. User can see that the creation worked.

But if there is an error, there is no message displayed. Instead a TRACE file is created.

How can I tell if there was a TRACE file created and how doI display it so the error can be corrected?

Thanks,

Mario

  • 0 in reply to Esfahani
    The problem in my case is that I can not Open a trace file because the user wants to see when the Credit Note is created and what number is assigned. This code is executed only under certain circumstances.

    The trace file is only created on error. And that is what I want to detect.

    I see there is a Call ERR_IMPORT but I am not sure how to use it or what to expect back.
    Can you help me with Call ERR_IMPORT?

    Thanks,
    Mario
  • 0 in reply to Mario L

    Hello,

    In the example Call ERR_IMPORT([M:IMP2]STAT, MESSAGE) From GIMPOBJ , is just setting the Message variable based on STAT field.

    But for your question, I suggest you open and show the log when there is error, in other words, if you have a variable like ZOK that you know if it's set to 1 it means an error happened, then you use below.

    ########### at the end of your routine , you would close the log if there is no error. or show the log if there was an error.

    $IMP_END
      If !GSERVEUR
        Call FERME_TRACE From LECFIC # Close the log
    If ZOK=1 #### this is a variable you set if there is an error.
          Call LEC_TRACE From LECFIC # Display the log only if the document is not created (means errors before or during the import)
    endif
      Endif

    Return