Application Development 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: 

ALV report run via Batch & store output in Application server in .txt

Former Member
0 Kudos

Hello,

Can somebody explain :

1) How can i attach an Alv Report to run in backgroung(Batch Job)

2) And how can I store that output to store in Application server in .txt format.

FORM DISPLAY .

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM = sy-repid
*      I_GRID_TITLE       = i_title_gts
      IS_LAYOUT          = wa_layout
      IT_FIELDCAT        = lt_fieldcat
      IT_EVENTS          = it_events
    TABLES
      T_OUTTAB           = <dyn_table>
    EXCEPTIONS
      program_error      = 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.

ENDFORM.                    " DISPLAY

THis will display the out put for ALV....THey have huge amount of data to run which can only go up in future. So they are preferring it to run in background for every 3 hours... and save the output in the File 'ZDGS_MM/DD/YYYY' in Application server in a text format

Any suggestions will be apprecaited!

Regards,

Kittu

4 REPLIES 4

Former Member
0 Kudos

Hi

use the contents of the internal table itab.

  • Open the flatfile

OPEN DATASET w_file FOR OUTPUT IN TEXT MODE.

  • Transfer the lines of the internal table into the file

CLEAR t_title.

CLEAR t_file.

CLEAR s_data.

READ TABLE t_title INDEX 1.

CONDENSE : t_title-belnr ,

t_title-augbl ,

t_title-kunnr ,

t_title-budat ,

t_title-cpudt ,

t_title-dmbtr .

CONCATENATE : t_title-belnr

t_title-augbl

  • t_title-dmbtr

t_title-kunnr

t_title-budat

t_title-cpudt

t_title-dmbtr

INTO s_data SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

TRANSFER s_data TO w_file.

LOOP AT t_file.

CLEAR : s_data.

w_data_file-belnr = t_file-belnr.

w_data_file-augbl = t_file-augbl.

w_data_file-kunnr = t_file-kunnr.

w_data_file-budat = t_file-budat.

w_data_file-cpudt = t_file-cpudt .

w_data_file-dmbtr = t_file-dmbtr.

CONDENSE : w_data_file-belnr ,

w_data_file-augbl ,

w_data_file-kunnr ,

w_data_file-budat ,

w_data_file-cpudt ,

w_data_file-dmbtr .

CONCATENATE : w_data_file-belnr

w_data_file-augbl

  • w_data_file-dmbtr

w_data_file-kunnr

w_data_file-budat

w_data_file-cpudt

w_data_file-dmbtr

INTO s_data SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

TRANSFER s_data TO w_file.

endloop.

CLOSE DATASET w_file.

use the file name given ..

this will write the file to the application server.

reg

Ramya

Edited by: Ramya S on Mar 20, 2009 7:22 AM

Former Member
0 Kudos

Hi,

For Executing ALV in background refer this:

And for downloading data to application server refer this:

Hope it helps

Regards

Mansi

Former Member
0 Kudos

Hello,

Thank you soo much for your quick reply.

I am trying to understand them but i feel difficult to understand..

Can you please replicate same for my code and explain it....?

I have all my final data in a Field Symbol as I am using Dynamic Internal table...

FORM DISPLAY .
 
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM = sy-repid
*      I_GRID_TITLE       = i_title_gts
      IS_LAYOUT          = wa_layout
      IT_FIELDCAT        = lt_fieldcat
      IT_EVENTS          = it_events
    TABLES
      T_OUTTAB           = <dyn_table>
    EXCEPTIONS
      program_error      = 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.
 
ENDFORM.                    " DISPLAY

It needs to be scheduled in the Background.

Regards,

Kittu

Former Member
0 Kudos

Hi,

Thank you for your quick reposne!

Your suggestions were helpful!

Regards,

Kittu