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

Submit Report Issue !

Former Member
0 Likes
857

Hi Guys,

I am calling a report using submit statement with dynamic value for selection screen..

Here is my code

isels-selname = 'AUFNR'.

isels-kind = 'S'.

isels-sign = 'I'.

isels-option = 'BT'.

isels-low = internal_order.

**isels-HIGH = sy-datum .

APPEND isels.

SUBMIT y_test " using SELECTION-SCREEN

WITH SELECTION-TABLE isels

EXPORTING LIST TO MEMORY

AND RETURN.

I want this report to run in background.. but instead its showing the report on the screen and its not exporting the list to memory.

Cheers

5 REPLIES 5
Read only

0 Likes
816

Try this:

1. Create new function module and put your SUBMIT code there

2. Back to your main program to call your function module with option IN BACKGROUND TASK

Read only

Former Member
0 Likes
816

Hi,

isels-selname = 'AUFNR'.
isels-kind = 'S'.
isels-sign = 'I'.
isels-option = 'BT'.
isels-low = internal_order.
**isels-HIGH = sy-datum .
APPEND isels.

SUBMIT y_test  TO SAP-SPOOL
WITH SELECTION-TABLE isels
EXPORTING LIST TO MEMORY
AND RETURN.

Thanks,

Best regards,

Prashant

Read only

0 Likes
816

Hi.. I am getting an error message that To SAP-SPOOL can't be used with export list to memory..

I am calling the report for tcode MB25.

Is this statement work all kind of ALV output of a report.. even if its a OO ALV ?

Thanx

Read only

Former Member
0 Likes
816

Hi ,

Following code helps you run it in background,



  DATA:  lw_number  TYPE tbtcjob-jobcount.

  CONSTANTS:  lc_name  TYPE tbtcjob-jobname VALUE 'JOB_1'.

*  Calling FM to open job
  CALL FUNCTION 'JOB_OPEN'
    EXPORTING
      jobname          = lc_name
    IMPORTING
      jobcount         = lw_number
    EXCEPTIONS
      cant_create_job  = 1
      invalid_job_data = 2
      jobname_missing  = 3
      OTHERS           = 4.

  IF sy-subrc = 0.
*  Calling the background report and passing it a SELECTION-TABLE
    SUBMIT zreport1
      WITH SELECTION-TABLE int_rspar
        VIA JOB lc_name  NUMBER lw_number
                        AND RETURN.

*  Calling FM to close job
    IF sy-subrc = 0.
      CALL FUNCTION 'JOB_CLOSE'
        EXPORTING
          jobcount             = lw_number
          jobname              = lc_name
          strtimmed            = 'X'
        EXCEPTIONS
          cant_start_immediate = 1
          invalid_startdate    = 2
          jobname_missing      = 3
          job_close_failed     = 4
          job_nosteps          = 5
          job_notex            = 6
          lock_failed          = 7
          OTHERS               = 8.
      IF sy-subrc <> 0.

      ENDIF.
    ENDIF.
  ENDIF.



***This will effect running of report completely in background under the Job name that You will give, U can later go and check in T-code - 'SM37'

***For sending the output list to memory and later retrieving it : 

*Example Code (Retrieving list from memory)
*This internal table stores the value 
*	Of output listed to memory
DATA  BEGIN OF itab_list OCCURS 0.
        INCLUDE STRUCTURE abaplist.
DATA  END OF itab_list.
* To load into ascii file format
DATA: BEGIN OF vlist OCCURS 0,
   line(256),
      END OF vlist.

SUBMIT zreport1
  WITH selection-table int_rspar 
    EXPORTING LIST TO MEMORY
      AND RETURN.
* To read from the memory
CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
    listobject = itab_list
  EXCEPTIONS
    not_found  = 4
    OTHERS     = 8.

* To write it onto the output
CALL FUNCTION 'WRITE_LIST'
 EXPORTING
   WRITE_ONLY       = 'X'
  TABLES
    listobject       = itab_list
 EXCEPTIONS
   EMPTY_LIST       = 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.
* OR use following
* Display the output list on  a different screen.
CALL FUNCTION 'DISPLAY_LIST'
* EXPORTING
*   FULLSCREEN                  =
*   CALLER_HANDLES_EVENTS       =
*   STARTING_X                  = 10
*   STARTING_Y                  = 10
*   ENDING_X                    = 60
*   ENDING_Y                    = 20
* IMPORTING
*   USER_COMMAND                =
  TABLES
    listobject                  = itab_list
* EXCEPTIONS
*   EMPTY_LIST                  = 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.
* also can get into ascii file

* This can be used to write the output data to vlist in ascii format

CALL FUNCTION 'LIST_TO_ASCI'
  EXPORTING
    list_index         = -1
  TABLES
    listasci           = vlist
    listobject         = itab_list
  EXCEPTIONS
    empty_list         = 1
    list_index_invalid = 2
    OTHERS             = 3.

IF sy-subrc NE '0'.
  WRITE:/ 'LIST_TO_ASCI error !! ', sy-subrc.
ENDIF.


I hope you can use this to best suit your requirement !!

Regards,

Salil.

Read only

Former Member
0 Likes
816

If the report uses new OO ALV.. it can't export the list to memory.. its possible only with the classic ALV reports.