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: 

Run alv report without selection screen in background

former_member445510
Active Participant
0 Kudos

Hello Every body,

i programmed a ALV Report without selection screen, and i want to create a job for this alv report.

Any help?

Thank u.

Ouail.

18 REPLIES 18

Former Member
0 Kudos

Hi Ouail,

create program in se38 and create job using sm36 set job running information.

but one thing what is your requirement?

Regards,

Kalyan

Former Member
0 Kudos

Hi, if you need to run reportin background. use FM REUSE_ALV_LIST_DISPLAY ,

alv grid not working in backjob

0 Kudos

Hi,

I'm using this FM:

   call function 'REUSE_ALV_LIST_DISPLAY'
     exporting
       is_layout          = alv_layout
       i_bypassing_buffer = 'X'
       i_callback_program = sy-repid
       it_fieldcat        = t_alv_fieldcat[]
       it_events          = it_evt
       i_save             = 'A'
*      IS_VARIANT         =
     tables
       t_outtab           = itab. "internal table


but i still not receive any result....

arthur_alvesteixeira
Active Participant
0 Kudos

Hi Ouail,

if it's not necessary a selection screen you only have to call the report from your job. If you create a selection-screen you could call the report passing a variant name. (Check SM36 transaction)

raymond_giuseppi
Active Contributor
0 Kudos

Only Program of type 1 (even without actual selection-screen) or J can be scheduled in a background job, which kind of report did you build ?

You could also create a small executable program (type 1) that call a form/method of your report and use this wrapper to schedule the background job.

Regards,

Raymond

0 Kudos

Thank u,

I have executable program.

This program compare data and send email to my outlook.

I use the tcode sm36, but i did not receive in result, when i execute manually, i receive the right result.

 

0 Kudos

In the report tittle has 'compare file'.

If your program read a file, and works in foreground but not in background, check if in background mode the file is available in server and you are using open dataset statement.

0 Kudos

Check

  • Your parameters in header of job for "spool list recipient"
  • Spool generated and job log (SM37)
  • Attachments of the mail
  • Rules for conversion of attachments  and routing rules for mail (SCOT)
  • Log of mail transmission (SOST)
  • system Log (SM21)

Regards,

Raymond

Former Member
0 Kudos

Hi Ouail,

Please provide more details..

Is it like you are not getting any mail alert or spllo is not getting generated in sm37.

Please configure your job via SM36 for that u can use job wizard button.

Regards,

Kannan

0 Kudos

Hi,

I used with job wizard button, but i'm receiving cancelled Status.

Via ST22 i receive: Exception condition "CONTROL_FLUSH_ERROR" raised.

in my program, i upload 2 xml files to 2 internal table, and i do compare between the both file, at the end i show the compare result in ALV.

this is the code used to upload the xml file:

create object gcl_xml.

*Upload XML File
   call method gcl_xml->import_from_file
     exporting
       filename = p_filref
     receiving
       retcode  = gv_subrc.

   if gv_subrc = 0.
     call method gcl_xml->render_2_xstring
       importing
         retcode = gv_subrc
         stream  = gv_xml_string
         size    = gv_size.
     if gv_subrc = 0.

       refresh gt_xml_data[].

* Convert XML to internal table
       call function 'SMUM_XML_PARSE'
         exporting
           xml_input = gv_xml_string
         tables
           xml_table = gt_xml_data
           return    = gt_return.
     endif.
   endif.





Any idea?


0 Kudos

Hello,

In my program i do a download file(xml) to local pc.

now, i receive that error, displayed by tcode sm21:


Any idea?


i have also that error: raise control_flush_error.


0 Kudos

It's not feasible to download a file to local PC in a background job. This has been discussed many times on SCN, please use search.

0 Kudos

Thank u,

There is a way to run my program automatically without using background job ?

0 Kudos

No way for automatic execution of a program in foreground, it would be better if you use the same program in background and download the file to the Application server instead of Presentation. that should solve the problem.

0 Kudos

Hi Syed,

I deed it right now, but i still have the same error.

Using download in Application server In foreground works good, but not in Background ...

0 Kudos

Hi Syed,

When i used the application server, i receive that error: Virus scan profile /SCET/GUI_UPLOAD is not active

Do you have any idea?

Former Member
0 Kudos

you can run any custom alv in background, I have several each night.

The key thing is to ensure this bit of coding is in place with the OO grid model...

look at this example below...the bit that's important is the offline check....this prevents the framework issue with enjoi controls in background:

">>>>this bit

if cl_gui_alv_grid=>offline( ) is initial.

      create object _o_cont

        exporting

          container_name = zcl_constants=>c_cont.

    endif.

"<<<this bit

you cant save a file on the PC in background....but you can create a file on a server....which I also do in a method using open dataset.....

working example....

  if sy-batch is not initial.
    "automate file extract if run in background mode
    _extract_data_to_file( ).
  endif.

  if _o_cont is not bound.
    if cl_gui_alv_grid=>offline( ) is initial.
      create object _o_cont
        exporting
          container_name = zcl_constants=>c_cont.
    endif.

    create object _o_grid
      exporting
        i_parent = _o_cont.

    _o_grid->set_table_for_first_display(
      exporting
        i_save               = zcl_constants=>c_a
        is_variant           = gs_variant
        is_layout            = gs_layout
        it_toolbar_excluding = gt_toolbar_exc
      changing
        it_fieldcatalog = gt_fieldcat
        it_outtab       = <table> ).

etc.....

0 Kudos

Hi Steve,

Can you tell me where i have to put your code?

this is my abap code:

START-OF-SELECTION.

   p_filref = '\\SAPSERVER\f\SAFT\ivat\FI_Extract_1000_20140709_102346_910.XML'.

   PERFORM copy_from_xml_to_itab TABLES it_ref_file
                                 ref_xml_data
                                 USING p_filref.

**Begin Extraction File

   SUBMIT ZZ_FI_IVAT_EXTRACTOR

   WITH p_bukrs EQ '1000'

   WITH p_gjahr EQ '1998'

   WITH filepath EQ '\\SAPSERVER\f\SAFT\iVAT_Extractie\'


   WITH cldata eq space

   AND RETURN.


   DATA: FILE_TABLE  TYPE TABLE OF SDOKPATH,
   DIR_TABLE  TYPE TABLE OF SDOKPATH.

   CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
     EXPORTING
       DIRECTORY  = '\\SAPSERVER\f\SAFT\iVAT_Extractie\'
       FILTER     = '*.*'
     TABLES
       FILE_TABLE = FILE_TABLE
       DIR_TABLE  = DIR_TABLE
     EXCEPTIONS
       CNTL_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.

   "get file name
   LOOP AT FILE_TABLE INTO p_filref.

   ENDLOOP.

   CONCATENATE '\\SAPSERVER\f\SAFT\iVAT_Extractie\' p_filref INTO path.

   PERFORM copy_from_xml_to_itab TABLES t_ext_file
                                 ext_xml_data
                                 USING path.

   PERFORM fill_xml_tab_in .
   perform build_fieldcatalog.
   PERFORM compare_data_ref_ext.
   PERFORM send_email.
   perform display_alv_report.
   PERFORM delete_extraction_file.



in the perform copy_from_xml_to_itab TABLES it_ref_file......, i use this code:


   CREATE OBJECT gcl_xml.

*Upload XML File
   CALL METHOD gcl_xml->import_from_file
     EXPORTING
       filename = p_filref
     RECEIVING
       retcode  = gv_subrc.

   IF gv_subrc = 0.
     CALL METHOD gcl_xml->render_2_xstring
       IMPORTING
         retcode = gv_subrc
         stream  = gv_xml_string
         size    = gv_size.
     IF gv_subrc = 0.

       REFRESH gt_xml_data[].

* Convert XML to internal table
       CALL FUNCTION 'SMUM_XML_PARSE'
         EXPORTING
           xml_input = gv_xml_string
         TABLES
           xml_table = gt_xml_data
           return    = gt_return.
     ENDIF.
   ENDIF.