UFFE file naming Answered

John Cobby

Hi,

Is it possible to make the UFFE export a file with a unique name each time? At the moment we are exporting the file as 'Invoice_DocKey@' but I would like for it to save a unique file name each time. Perhaps a time stamp or something at the end after the DocKey number?

 

Many thanks.

Comments

4 comments

  • Comment author
    Thomas
    • Edited
    • Official comment

    Hi John,

    Yes, you can create the directory and the file name with SQL: -syntax.

    For example to get the timestamp put this in the output file name:

    SQL:SELECT 'C:\Invoice_'+ REPLACE(CONVERT(VARCHAR(10), GETDATE(), 101), '/', '') +'_DocKey@.xml'

    In HANA, this syntax is (Thanks Tim Verholt):

    SQL:SELECT 'C:\Invoice_'  || TO_VARCHAR(NOW(), 'yyyyMMdd') || '_DocKey@.xml'

    This would give you C:\Invoice_08032016-241.xml as the output name.

    -Thomas

  • Comment author
    John Cobby

    Awesome! Thanks a lot Thomas

    Regards,

    John

    0
  • Comment author
    John Cobby
    • Edited

    Hi,

     

    Could I please add on an additional question? Could you help me with the SQL for the validation?

    I want it to check if the field U_DestType in OCRD contains the values of 1, 2 or 6 before processing the UFFE for that record.

    I have tried the below code in SQL Manager and it works but for some reason it's not giving the expected results when applied in the validation.

    IF (SELECT T0.U_DestType FROM OCRD T0 INNER JOIN ODLN T1 ON T1.CardCode = T0.CardCode WHERE T1.DocEntry = 'DocKey@') NOT IN ('1','2','6')

    BEGIN
    SELECT 'SHOW_ERROR' FOR BROWSE
    END

     

    Thanks again,

    John

    0
  • Comment author
    Thomas

    Hi John,

    Can't see anything wrong there, you could try without the single quotes in dockey and the numbers.

    -Thomas

    0

Please sign in to leave a comment.