2015 Jul 10 12:08 PM
Hi All,
I need to call a report in another report in background mode using job_open and job_close.
Code:
EXPORT LT_INPUT FROM input TO SHARED BUFFERindx(XY) id 'INPUT'.
* Get Print Parameters
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
no_dialog = 'X'
IMPORTING
valid = lv_valid
out_parameters = ls_params.
** JOB_OPEN
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = LV_JOBNAME
SDLSTRTDT = sy-datum
SDLSTRTTM = sy-uzeit
IMPORTING
JOBCOUNT = LV_JOBCOUNT.
**Submitreport
submitZLCL_rep
viaJOBLV_JOBNAME
NUMBER LV_JOBCOUNT
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS
LS_PARAMS AND RETURN.
** Close JOB
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = LV_JOBCOUNT
JOBNAME = LV_JOBNAME
STRTIMMED = 'X'.
***
Import inside 2nd report:
IMPORT LT_INPUT TO INPUT FROM SHARED BUFFERindx(XY) id 'INPUT'.
deletefrom shared buffer indx(xy) id 'INPUT'.
*******
Here the data are not imported in the second report.
What is the purpose of index table and do I need to create Rlid value inside a table or we can use existing area value.
While executing in backgrond mode no data in importing in second report.
There are lotof SDN links how to use shared memory to export and import using shared memory,but I didnt find which indx id.
Please suggest..,
Regads,
Lokes.
2015 Jul 10 1:53 PM
2015 Jul 10 1:42 PM
Hello Lokesh,
Yes You can use INDX table - but please make sure you use right index name and also
delete the key at right place.
Program 1::-
DATA: INDXKEY LIKE INDX-SRTFD VALUE 'ZSURESH',
WA_INDX TYPE INDX.
EXPORT p_ipay p_bill i_tttab from i_tttab
TO DATABASE INDX(ZS) FROM WA_INDX ID INDXKEY.
Program 2::-...
DATA: INDXKEY LIKE INDX-SRTFD VALUE 'ZSURESH',
WA_INDX TYPE INDX.
IMPORT p_ipay p_bill i_tttab FROM DATABASE INDX(ZS) ID INDXKEY
TO WA_INDX.
*// if we do not delete them the table will be filled and INDX table is one of the critical table - Hence take a decision to delete the entry after you imported..
DELETE FROM DATABASE INDX(ZS) ID INDXKEY.
Thanks,
Suresh K..
2015 Jul 10 1:54 PM
Hi Suresh,
Thanks for your input, but still i'm not able to export data using database indx.
Please suggest any other options.
2015 Jul 10 1:59 PM
Hope you are using same Data types and structure in both the programs and also Check after program1 execution whether u have entry in INDX table or not ?
And also comment Delete statement for a while to make sure the entries are written in that file..
2015 Jul 10 1:53 PM
2015 Jul 10 1:57 PM
Hi,
Is it not possible with indx table , without creating new custom table ?
2015 Jul 10 2:11 PM
As far as I know you need INDX table in database for cluster data.
But I think you have simple table to export and import. You have to use EXPORT/IMPORT MEMORY ID.
EXPORT input = lt_input TO MEMORY ID 'MYINPUT'.
IMPORT input = lt_input FROM MEMORY ID 'MYINPUT'.
2015 Jul 10 2:24 PM
Hi Tolga,
Here my requirement is to execute a report in background using JOB_OPEN and JOB_CLOSE and submit a report.
I have tried with Sharememory butno success.
withexport/import memory it wont work in background job.
2015 Jul 10 2:36 PM
So I will suggest you more simple way use Functions.
You need one function group and 2 function. and In function group global data declare your table. For example :
ZEXP_IMP_GROUP has two function and one data:
DATA : MY_DATA TYPE TABLE ( your table type ).
FUNCTION ZEXP_IMP_SET_DATA.
* IMPORTING
* IT_DATA TYPE TABLE ( your table type or generic )
MY_DATA = IT_DATA.
ENDFUNCTION.
FUNCTION ZEXP_IMP_GET_DATA.
* EXPORTING
* ET_DATA TYPE TABLE ( your table type or generic )
ET_DATA = MT_DATA.
ENDFUNCTION.