cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in Unix and SAP after year change...

Former Member
0 Kudos

Hi,

I have python program in unix that gets .csv files from invoice service and copies them to sap.

Invoice service uses windows servers unfortunately.

All files have gone thru that script prior 01.01.2013 - after year change we noticed that backround job running in sap gets terminated without short dump.

Error:

Date       Time     Message text                                                                     Message class Message no. Message type

01.01.2013 11:04:37 Job started                                                                           00           516          S

01.01.2013 11:04:37 Step 001 started                                                                      BT           611          S

01.01.2013 11:04:37 External program: /usr/local/bin/get_invoices.py                                      BT           612          S

01.01.2013 11:04:37 Related parameter:                                                                    BT           613          S

01.01.2013 11:04:39 Ext. prog.: ok1 /home/sapuser/invoice_files/XXXX.IWFOUT_H.20130101.1234.csv            BT           606          S

01.01.2013 11:04:39 Ext. prog.: SAPXPG started on sapxxx_XXX_02, Process ID 22245, Process Number 25      BT           606          S

01.01.2013 11:04:39 Step 002 started (program ZINVOICE_IMPORT, variant , user ID ADMIN)                    00           550          S

01.01.2013 11:04:39 Specify valid date                                                                    SG           102          E

01.01.2013 11:04:39 Job cancelled after system exception ERROR_MESSAGE                                    00           564          A

When googleing error message it seems as if files are empty - allthough they are not.

Nothing has changed in file structure and no updates have been made on SAP linux server.

Program itselt that manages linefeed input and writeout is:

def toUNIX( fileName,outfile 😞

    FILE = open( fileName, 'r' )

    if not os.path.isfile(outfile):

        os.system( "touch "+outfile )

    OUTFILE = open( outfile, 'a' )

    char = FILE.read( 1 )

    last = 0

    first_line = True

    last_char = ''

    while char:

        if char == chr(0x0d) and last != chr(0x0a):

            if first_line == False:

                last_char = chr(0x0a)

            last = chr(0x0a)

            first_line = False

        else:

            if first_line == False:

                OUTFILE.write( last_char )

                last_char = ''

                OUTFILE.write( char )

                last = char

        char = FILE.read( 1 )

    OUTFILE.write(chr(0x0a))

    FILE.close()

    OUTFILE.close()

I think that there is some misunderestanding with line end?

When I'm looking file via Vi line end shows as: ^M

Any help or ideas what to change or try?

Br,

Kristjan T.

Message was edited by: Kristjan T

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi all,

And thak you for reply.

Problem resided in one of SAP standard function that we used for file reading.

Problem was that in function:

call function 'CONVERSION_EXIT_INVDT_INPUT'
    exporting
      input  = sy-datum
    importing
      output = d2.

That function read date not from file but from system (and inverted time in a manner: 999999 - 20130101 = 79879898)

Problem was that there was no support after year 2012 so that function did not know how to read that.

Problem was fixed by our ABAP developer.

Thank you all,

Kristjan T.

former_member603880
Participant
0 Kudos

Thanks for zero points...

Former Member
0 Kudos

Hi, I'am awfully sorry - did not see "CONVERSION_EXIT_INVDT_INPUT" in your text :S

As got not much time ought just to put quick solution and close thread.

Again - I'm sorry - points should have been yours

Br,

KT.

former_member603880
Participant
0 Kudos

Answers (2)

Answers (2)

BTP_Architect
Participant
0 Kudos

Hello Kritsjen,

Could you kindly suggest how did you fixed this point throw ABAP.

Wa are facing the same issue.

thank you in advance.

Moez.

Former Member
0 Kudos

Hi,

And sorry for not posting full solution.

I just sent e-mail to our ABAP dev asking for complete solution.

In mean time , please check:

http://scn.sap.com/thread/3286601

I think there might be ABAP solution in Volker von Gloeden post

Br,

Kristjan T

Former Member
0 Kudos

Seems that this program works normally tho. lines.dat and header.dat are OK in Vi. Newline works correctly. Probably problem in SAP program - Still investigateing.

former_member603880
Participant
0 Kudos

Kristjan,

We have an error in VF01 after Year End change...

In our Z include, we pass the date like AAAA.MM.DD (2012.12.01) to function FM CONVERSION_EXIT_INVDT_INPUT but the function presumes DD.MM.AA (20.12.12). So, its works until 31.12.2012. After change the yaer to 2013, we receive the following message SG102 (Incorrect date) because there isn´t month number 13.

So, check your ZINVOICE_IMPORT or others FM calls.

Hope this clarify your way.

Happy new year and best regards.

Gabriel