Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Batch Job

Former Member
0 Likes
1,813

Hi Friend,

I'm executing one report through Batch job and its generate one file in application server,

the same report executed manually and downloding the file in local.

Now I'm comparing both the file and I'm getting the diffrence between that two files.Through batch run the file having 25 records and through manual download its having 32 records.

I'm executed both for the same variant, only difference is one is downloading at application server and another is local.

can u please tell what could be the reason for missing that 7 data in batch file. The report logic is same upto end of selection, (i.e to fill the final internal table there is no conditions based on batch or manual)

After getting the records in final internal table, I'm checking the check box for local download r batch run(application server), as per that its sending the data to particular file.

so what could be the reason for these two files?

In SM37 its showing the job was successfully finished, there I am seeing the duration and delay time, here the delay time is showing as 1 sec, let me know whether it could be the reason? or else please tell me that delay 1 sec is for what??

Thanks and regards,

Magesh.S

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,664

Kindly Use Meaningful Subject lines

14 REPLIES 14
Read only

Former Member
0 Likes
1,665

Kindly Use Meaningful Subject lines

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,664

How can we know if you don't give more precisions about the code. Where is the error, on the application server, or on the presentation server?

About the delay of 1s, it's just an internal wait, don't worry (because it couldn't find available workprocess at that time).

Read only

0 Likes
1,664

Hi Thanks for your reply !

The problem is I am comparing both the files ( From batch job and from manul execution in Presentation server)

I am getting 25 records from Batch file , but for the same program and same variant in manuel execution I'm getting 35 records ( Presentation server).

This application server and presentation server is separating only after End-of-selection. I mean the final Internal table is same for both the file.

If the application server radio button is check means it will download in application server or else in presentation server.

So upto end-of-selecion the logic is same for fetching the data, but why I'm getting the difference between between this 2 files.

The batch job executed at 5.30 am and the manuel execution is at 10.30 a.m, mean to say today I am checking the both for the same variant, no change in varient also only thing is for local I'm uncheking the radiobutton of application server.

Thanks and regards,

Magesh.S

Read only

0 Likes
1,664

Hi

I think nobody can have the answer, we need to know your abap code where the download is managed, if you say the internal table is the same for both situation, we can only say the files have to be the same: that's all.

Max

Read only

0 Likes
1,664

Hi herewith I'm attaching my coding - T_store is the final internal table

IF NOT P_DOWN IS INITIAL.

PERFORM F_DOWNLOAD_DATA.

ELSE.

PERFORM EXCEL_FILE.
   ENDIF.

FORM F_DOWNLOAD_DATA .

   CALL FUNCTION 'FILE_GET_NAME'
     EXPORTING
       CLIENT           = SY-MANDT
       LOGICAL_FILENAME = G_LFNAME
       OPERATING_SYSTEM = SY-OPSYS
       PARAMETER_1      = G_WEEK
       PARAMETER_2      = C_CCODE
     IMPORTING
       FILE_NAME        = G_FILENAME
     EXCEPTIONS
       FILE_NOT_FOUND   = 1
       OTHERS           = 2.
   IF SY-SUBRC <> 0.
     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
   ENDIF.

CONCATENATE G_FILENAME C_XLS INTO G_FXLS.

   CONCATENATE 'Employee Number'
               'Title'
               'Initials'
               'Surname'
               'Christian Name'
               'NI Number'
               INTO W_TEXT SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
   APPEND W_TEXT TO T_TEXT.
   CLEAR W_TEXT.

LOOP AT T_STORE.
     G_ANNSL = T_STORE-ANNSL.
     G_FTEPC = T_STORE-FTEPC.
     G_HOURS = T_STORE-HOURS.
     G_PCTEE = T_STORE-PCTEE.
     G_PCTER = T_STORE-PCTER.

     CONCATENATE T_STORE-PERNR
                 T_STORE-TITLE
                 T_STORE-INITS
                 T_STORE-SURNM
                G_ANNSL
                 T_STORE-ADDPY
                 G_FTEPC
                 G_HOURS
                 T_STORE-SCHEM
                 T_STORE-PENST
                 T_STORE-AEDTM
                 G_PCTEE
                 G_PCTER
                 T_STORE-CHRIS
                 T_STORE-PERID
               INTO W_TEXT SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
     APPEND W_TEXT TO T_TEXT.
     CLEAR W_TEXT.
   ENDLOOP.

OPEN DATASET G_FXLS FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
   LOOP AT T_TEXT INTO W_TEXT.
     TRANSFER W_TEXT TO G_FXLS.
   ENDLOOP.
   CLOSE DATASET G_FXLS.

Edited by: Rob Burbank on Oct 6, 2009 11:09 AM

Edited by: Mageshvaran S on Oct 6, 2009 5:13 PM

Read only

0 Likes
1,664

where is the code for local download?

Read only

0 Likes
1,664
FORM EXCEL_FILE.

   IF NOT T_STORE[] IS INITIAL.

     V_FILE = P_FNAME.

     IF NOT V_FILE CS '.'.
       CONCATENATE V_FILE '.xls' INTO V_FILE.
     ENDIF.

     PERFORM SET_COL_HEADERS.

     LOOP AT T_STORE.
       MOVE-CORRESPONDING T_STORE TO T_EXCEL.
       ADD 1 TO V_EMPCOUNT.
       IF  T_STORE-PENST IS INITIAL.
         MOVE SPACE TO T_EXCEL-PENST.
       ENDIF.

       APPEND T_EXCEL.
       CLEAR  T_EXCEL.
     ENDLOOP.

PERFORM FILE_WS_DOWNLOAD  TABLES T_EXCEL

                             USING V_FILE
                                  'DAT'

                             CHANGING SY-SUBRC. ENDFORM

FORM FILE_WS_DOWNLOAD  TABLES T_DATA
                        USING P_FILENAME
                              P_FILETYPE
                     CHANGING P_SUBRC.

  DATA : LV_FILENAME TYPE STRING.

  LV_FILENAME = P_FILENAME.

  CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
    EXPORTING
      FILENAME                = LV_FILENAME
      FILETYPE                = P_FILETYPE
    CHANGING
      DATA_TAB                = T_DATA[]
    EXCEPTIONS
      FILE_WRITE_ERROR        = 1
      NO_BATCH                = 2
      GUI_REFUSE_FILETRANSFER = 3
      INVALID_TYPE            = 4
      NO_AUTHORITY            = 5
      UNKNOWN_ERROR           = 6
      HEADER_NOT_ALLOWED      = 7
      SEPARATOR_NOT_ALLOWED   = 8
      FILESIZE_NOT_ALLOWED    = 9
      HEADER_TOO_LONG         = 10
      DP_ERROR_CREATE         = 11
      DP_ERROR_SEND           = 12
      DP_ERROR_WRITE          = 13
      UNKNOWN_DP_ERROR        = 14
      ACCESS_DENIED           = 15
      DP_OUT_OF_MEMORY        = 16
      DISK_FULL               = 17
      DP_TIMEOUT              = 18
      FILE_NOT_FOUND          = 19
      DATAPROVIDER_EXCEPTION  = 20
      CONTROL_FLUSH_ERROR     = 21
      NOT_SUPPORTED_BY_GUI    = 22
      ERROR_NO_GUI            = 23
      OTHERS                  = 24.
  P_SUBRC = SY-SUBRC.

ENDFORM.                    "file_ws_download

Read only

0 Likes
1,664

I don't see any problem, except that you use DAT format which is not advised any more according to GUI_DOWNLOAD documentation (use ASC instead).

Did you make sure by debug that the internal tables are the same in dialog and in background mode?

Read only

0 Likes
1,664

could you paste the contents of the 2 files?

Read only

0 Likes
1,664

Hi, <li>As Sandra told , DAT file type is no more, need to use ASC file type. <li>You can run program in fore-ground for application server.Check whats happening in debug mode. Same thing for local file. You do not need to run batch job only to send data to application server, you can also run and send data in fore-ground as well to check that in debug mode. Thanks Venkat.O

Read only

0 Likes
1,664

Hello,

maybe the problem is not the download itself, but the selection of the data. You loop at table t_store, but where do fill this table? Maybe there is something relevant to the user. Don't know if you use a special Batch User or not. Maybe you can post the source for your select.

Have you compared the two files? Has the bigger file some more data which is relevant or is there some more CR/LF in it?

bastian

Read only

0 Likes
1,664

Hello,

As you mentioned, your batch job executed at 5:30AM and manual execution is at 10:30AM.

Suppose you retrieved data from some database table and in your final table you may have 20 records. So your application server file will have 20 records (executed @ 5:30AM ). Manual execution will happen on 10:30AM, there there must be some more records created in same database table and there is a possible that your query may fetch more records and fill the same in your final internal table.

This might be the reason in difference in application server/presentation server file records.

Please check.

Thanks,

Shreekant

Read only

0 Likes
1,664

Hi Friends,

Thanks for your replies !!

Today I have debugged the batch job through SM37, I have found that the particular 7 employees are not at all triggering in GET PERNR.

But in manual run its coming, so can u please let me what could be the reason for not coming in batch run?

In batch job, while debugging after start-of-selection its immediately going to the end-of-selection, the GET PERNER event is not triggering for these 7 employees.

Please let me know what could be the possible reason, where i need to check it?

Thanks and regards,

Magesh.S

Read only

0 Likes
1,664

Hi Magesh,

I would try to perform some basic root cause analysis by some elimination process. The areas I suspect might be in play here are as follows:

Assuming the code is the same for Foreground and Background execution; then -

1. AUTHORIZATION - First check to see whether both users (Online and the Batch User - typically WF-BATCH - but if you are not sure, get with your Basis Team) have similar authorizations. Specifically check to see whether the Batch user has authorizations for Org. Objects for the 7 Pernrs in question.

A good way to do this would be to copy the Batch user to a new User and make him a dialog user. Then run any standard report with any of those 7 pernrs and see whether you run into Auth issues.

2. TIMING - Try running the Foreground Job at the same time as the Background Job or vice versa to compare data selection in debugger. There may be another process in the background which is causing this confusion

3. SQL TRACE - Run ST05 prior to executing this program in Online and Background mode and compare the results.

4. UNLIKELY WORST CASE - Debug the Logical Database to check for system anomalies.