Spools in SM37
Hi,
I have a background job which creates 2 spools. After the completion of the job, when i check the spool list in SM37, it displays only the last spool. Whereas in SP01/02, i can see the 2 spools created. Any idea how to display the 2 spools created in SM37 spool list?
Thanks in advance,
Sandeep
You might want to consider that SM37 and SP01 are not the correct choice of transactions....
Try SMX => https://service.sap.com/sap/support/notes/101146
In combination with SP02 => https://service.sap.com/sap/support/notes/119147
Please read the notes carefully: There are several misunderstandings in SM37 (caused primarily by SU53's last failed check) and the migration path from the old spool concept to the "new" one (in this case some hardcoding makes some sense as a per-user concept using authorization objects is not scalable).
Cheers,
Julius
Similar Messages
-
More than one Spool in SM37 --- Problem
Hi Friends,
I have a program creating 2 spools , both the spools are visible in SP02 but we cant view the spool content in SP02 due to authority settings in our project.So we have to see the spool contents in SM7 only.But in SM37 we are able to see only the last generated spool . Is there a way we can see both the spools in SM37.Please help its urgent.
Thanking You all,
VenkatYou could read the spool directly from table TSP01
SELECT *
INTO TABLE SPOOL_TABLE
FROM TSP01
WHERE RQIDENT IN R_SPOOL
AND RQOWNER IN R_OWNER
AND RQCRETIME IN R_DATUM.
Greetings,
Blag. -
Hi All,
I would like to know if a user can be restricted to view spool created by his/her own jobs by including S_ADMI_FCD, in auth profile. Can some one help me with this, i got an requirement where i need to restrict the user to view her own spool in SM37, but currently S_ADMI_FCD is disabled and she is getting an error,
"No authorisation to select from spool request"
Your answers are much appreciated.
Regards,
Sandhya<b>Note: Spool requests are created under the username defined in background job step and can be different from the user scheduling the job.</b>
With that in mind, I can think of two cases:
(a) Assuming the username defined in background job step is equal to the user scheduling the job, and you want the scheduling user to be able to view the spool for his/her own background jobs; then the user should have authorizations for auth. obj. 'S_ADMI_FCD' with |S_ADMI_FCD=ST0R|.
(b) Assuming the username defined in background job step is different from the user scheduling the job but you want the scheduling user to be able to view the spool anyways; then the user should have authorizations described in (a) + auth. obj. 'S_SPO_ACT' with |SPOACTION=BASE, DISP; SPOAUTH=<USERNAME>|, where <USERNAME> is the username defined in background job step.
There are other possible SPOACTION values that you might want to assign. See the object documentation for these. -
REPORT IN BACKGROUND WITH NO SPOOL ON SM37
Hello!
I have a program that shows a log after the execution in transaction SE38, using the command WRITE.
But when I execute the same program using the background mode, there is no spool in the transaction SM37.
What's the problem?
Message was edited by:
MARCO FERNANDESHi Marco,
The variant for which you run in background, might not be retrieving any data hence no output in background.
Also check for FM "RSPO_R_RDELETE_SPOOLREQ" is used in your program. This deletes the spool.
Also check whether the write statements are under IF SY-BATCH NE 'X' condition.
Best regards,
Prashant -
Spool visible in sp01 but not available in sm37
Hi group,
I am facing the following problem. There is a pgm that creates two spool requests, and they are visible when i see it in sp01, but when we see it in sm37 only the last spool request is available. Pls help.
Regards,
Divya.The job status is complete and both the requests are available in sp01. but when we display the spools in sm37 just the last spool is available.
This is the sample code
REPORT zspoolreq1 .
DATA: w_param LIKE pri_params,
w_valid,
w_text LIKE pri_params-prtxt.
PERFORM open_spool.
PERFORM open_second_spool.
FORM open_spool .
NEW-PAGE PRINT ON PARAMETERS w_param NO DIALOG.
WRITE: / 'First Spool Request'.
NEW-PAGE PRINT OFF.
ENDFORM. "open_spool
FORM open_second_spool.
NEW-PAGE PRINT ON PARAMETERS w_param NO DIALOG.
WRITE: / 'Second Spool Request'.
NEW-PAGE PRINT OFF.
ENDFORM.
null
Message was edited by:
divya rajendiran -
Hi,
I have a program which when executed in background mode doesnot show spool in sm37, but when i go into spool directory.
I am calling the back ground through functional module POPUP_TO_CONFIRM_STEP,
case xx
when 'N'.
sy-ucomm = 'SJOB'.
sscrfields-ucomm = 'SJOB'.
by this background job kicks off but doesnot create spool .. also this problem doesn't occur regularly.
Please provide me some suggestions.
Thanks
KumarSorry small correction for the above problem ..
I could see the spool through spo1 or sp02 but not in the job - overview.
Thanks
Kumar -
Spool icon not visible in SM37
Hi,
I have created one classical program using 'Write' statement to show output on screen.
Now i am running this program in background mode by choosing option SE38 -> Program -> Execute in Background
I can see my finished job in SM37. Now issue is that on same SM37 screen i can't view spool icon also when i select job and press button 'Spool', message is triggered saying 'No List available' though for same job, spool is generated and that no. i can see in Job log.
User want to view spool from SM37 screen, instead of copying no from job log and inserting into transaction SP01
Plz help...Hi,
@BreakPoint
I am not touching any print settings while running program in Background mode. Getting spool output is not my problem. Spool is generated properly for my job only problem i am facing is that i can't view that spool from SM37 transaction every time i need to go to SP01 transaction to view output.
Few addition:
Aactually my program has 2 options:-
1. Online mode: here i am generating spool request using below FM
* Read, determine, change spool print parameters and archive parameters
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
in_archive_parameters = lw_arcpar
in_parameters = lw_pripar
layout = l_lay
line_count = l_lines
line_size = l_cols
no_dialog = 'X'
IMPORTING
out_archive_parameters = lw_arcpar
out_parameters = lw_pripar
valid = l_val
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
2. Background mode: I have used sy-batch to determine background mode. If program execution is in background then above FM will never trigger. In short for Online mode i am explicitly creating spool using FM
If program executed in online mode first and then Background then i am getting above issue.
Anything i am missing?
Edited by: Amol Deshpande on Oct 19, 2010 7:25 PM -
Not getiing spool if zprogram excutes in background which calls a submit
Dear All,
I have two programs with same selection screen , one is a z one and the other a standard one .
i am calling the standard program from my z program using Submit with some restriction value in the selection screen of the standard program.
Everything is OK , now the thing is i am not getting a spool in SM37 when i execute the z report (which calls the standards program with submit) in background .
I want in the one spool like i am getting if i execute the standard program manually in background.
RegardsHi Try this way..
now it creates two spools...
**** Subroutine to get the print parameters
PERFORM get_print_parameters.
CONCATENATE 'QU'
sy-datum+4(4)
sy-uzeit INTO
wa_pri_params-plist.
* Submit report in background and creating spool
SUBMIT <Reportname> USING SELECTION-SET p_var
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS wa_pri_params AND RETURN.
COMMIT WORK AND WAIT.
* To fetch the spool number from TSP01 table
IF sy-subrc EQ 0.
SELECT rqident
FROM tsp01
INTO p_spool
* UP TO 1 ROWS
WHERE rq2name = wa_pri_params-plist.
ENDSELECT.
ENDIF.
FORM get_print_parameters .
* Function Module to get the print parameters
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = 'BC01' "'LP01'
list_name = 'TEST'
list_text = 'SUBMIT ... TO SAP-SPOOL'
immediately = ' '
line_size = '2000'
no_dialog = 'X'
IMPORTING
out_parameters = wa_pri_params
valid = w_valid
*** Begin of insert PJ051810
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc <> 0.
WRITE : 'Invalid Printer assigned'.
ENDIF.
*** End of insert PJ051810
ENDFORM. " GET_PRINT_PARAMETERS
Prabhudas -
Hello ,
I created report that should run in background job. I am not sure how to create spool containing all sales orders and items that are
selected in report.
Please could some one explain creation of the spool. Used needs to see spool in sm37 when the job is in status finished.
Thanks
ChrisHi,
did you check Post HOw to create Spool Request.
it was the first hit i got in google as i searched "sap how to create spool"
Please search befor writing new post
regards
Stefan Seeburger -
ALV grid in Spool screen limit
Hi,
I am displaying a report for bulk of order.
So we will schedule it in background .
Through the program, i am creating the output as file in appln server also i m dispklaying the report in ALV grid.
now the report is working fine and its creating a file in appln server.
Now my problem is if I see the spool in SM37,its showing the ALV grid. but some columns are missing in the right side.
I hope this is because of the screen limitation.How should I solve this.
I have to allow the user to see all the columns.Hi
I too have the same issue....Where u able to find the solution...
I have checked through this Thread, when I create a new Format 65_1000, I still get some pages missing
Re: Spool ALV LIST
Your responses will be helpful.
Thanks,
Chaithanya k -
Spool recepient issue in ECC 6.0
We have a scheduled background job ZD510_FILL_RATE_REPORT_ECC6. This produces a reports and sends to a distribution group. When the group receives the report in their inbox they open it and it only shows 16 pages of the 33 pages. The user replied that it last ran successfully on 16th and had running into issues since kernel upgrade done on 18th.
Hi Ki
Double check the code from 329537 is present in your system as it is definitely the solution. Otherwise check the spool in SM37 or SP01 and verify that the spool is not truncated before the send to SAPconnect.
Michael -
Hi,
How to see the report in the spool while executing a program in background which has fields more than 255 characters? I want to see all the columns in the spool. But it is showing upto only 255 characters.
Plz urgentI know that this is probably not what you want, but if you view the spool in SM37, click the "Raw" button, then you will see all of the columns, it wraps the columns greate than 255 to the next line. I think that this has something to do with the print format. When you submitted the job to the background, you told it a certain format to use, the biggest one in my system is 255. If you want to see all of the data in the graphical view of SM37, I believe you would have to have a format which is greater than 255. I don't know how to set this stuff up. Check with your basis people.
Regards,
Rich Heilman -
Hi
COuld you please let me know the name of the Table to find out the Spool Details ?The way Spool is shown using Transaction "SM37", same way I am interested to see the spool using Table .
Thanks
JIgarThanks a lot for your quick response.
Would like to add one more query here.
I have got 12 different jObs. And I would like to know their Spool numbers. The ideal procedure is to open up spool using SM37 and then get the spool request number.
But is there any table which contains the relationship between JOb and its spool number / details ? -
Issue in moving files from data fodler to processed folder in background
Hi All,
I am facing one issue in moving files from data fodler to processed folder in case of background execution.
When i am executing the file in the foreground, i can move the file from Data folder to processed folder. I am using SXPG_COMMAND_EXECUTE FM to move the file from data folder to processed folder. I can see the file in processed folder once the program is executed.
But in case of executing the same program in background, it is giving me the error "Failed to move the file to processed folder" in the spool of SM37 and i can see the file still laying in data folder.
I tried to check other programs which acesses the same folder as the above program, whether they are able to move. They are able to move the file to processed fodler successfully both in foreground and background mode.
Please help me in resolving this issue.
Thanks,
DeepaHi Sanu,
Please use teh following code to move the file from source to target folder.
This is a code showing how to create and use COPY command of UNIX in ABAP
PARAMETERS:
Input file path
p_input TYPE localfile,
Processed file path
p_proc TYPE localfile.
Declare the Types to file data
TYPES: BEGIN OF L_X_OUTPUT,
sys(200), " Please note, there are asterisk before and after sys (i.e.sys)
END OF L_X_OUTPUT.
* Internal table to store file data
DATA l_i_output TYPE STANDARD TABLE OF l_x_output WITH HEADER LINE.
* Variable for the UNIX command
DATA: l_v_unix_comm(255) TYPE c.
Copy command of UNIX
CONCATENATE 'mv' p_input p_proc
INTO l_v_unix_comm SEPARATED BY space.
For example the Copy command is stored as below
cp u2018/data/interfaces/input/input_fileu2019 u2018/data/interfaces/processed/processed_fileu2019
Examples of UNIX Command *u2022 mv filename1 filename2 --- moves a file (i.e. gives it a different name, or moves it into a *different directory (see below) *u2022 cp filename1 filename2 --- copies a file
Execute the UNIX Copy command.
This command will copy the file from input file path to the processed file path
CALL 'SYSTEM' ID 'COMMAND' FIELD l_v_unix_comm
ID 'TAB'
FIELD l_i_output-sys.
IF sy-subrc eq 0.
write: 'File is copied successfully using UNIX command in ABAP'.
ENDIF. -
Running the alv report in background and sending it thro email
hi,
i have to run the alv report in background and send the output through emailHi
Many a times there is a requirement to display ALV Grid (not ALV List) in the background Job. I have checked the SDN Forum for the same and it has been mentioned that ALV Grid cannot be displayed in Background, but the list output of ALV is possible. So user wont have the actual Grid interface but the List interface.
There is a workaround to display ALV Grid in Background Job. The only restriction is you cant schedule the job through SM36. You need to execute the transaction of the report program, fill in the selection screen data and hit Execute.
The job would be executed in background. User will be able to see the Job Log and Job Status after executing the program. User doesnt have to go to SM37 to view the job status/log. Once the Job Status is changed to COMPLETED, user can click on DISPLAY SPOOL to view the ALV Grid.
Limitations:
Cant schedulea background job
The session should be active until the background job is completed. If the session is closed, then user wont be able to check the output in ALV Grid. User would be able to check the output through spool or SM37
Advantages:
If the spool width is greater than 255 characters, then the entire width could be seen in the output because the output is directed to an ALV Grid and not to spool
Interface of ALV Grid is available instead of ALV List even though its a background job.
Program wont give the TIME OUT error
Steps Required:
1. Once you execute the program, the following screen would be displayed
2. Click Display Job Status to check the Status of the Background Job
3. Click on Display the Job Log to check the Log
4. Click on Display Job Status to check the Job Status
5. Click on DISPLAY SPOOL to check the spool content once the Job Status is changed to COMPLETED. Output is displayed in ALV Grid
Programs:
1. Two different programs needs to be created
ZPROGRAM_ONE: This is the 1st program, where the selection screen and all the data validations would be done. Error handling for invalid data should be done in this program.
Once the data validation is done, this program would call the 2nd program ZPROGEAM_TWO. Build the logic to display ALV Grid in this program. The logic will only display ALV in foreground and it wont be reflected in the spool.
ZPROGRAM_TWO: This program would fetch all the data and do all the processing. If you want the spool output along with ALV Grid output, then build the logic in this program to display ALV Grid.
*& Report ZPROGRAM_ONE *
REPORT zprogram_one .
PRASHANT PATIL
TABLES : mara,
tsp01.
type-pools:slis.
TYPES : BEGIN OF t_mara,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
laeda TYPE mara-laeda,
END OF t_mara.
DATA : i_mara TYPE STANDARD TABLE OF t_mara,
wa_mara TYPE t_mara,
wa_index TYPE indx, " For Index details
wa_index_key TYPE indx-srtfd VALUE 'PRG_ONE',
i_jobsteplist TYPE STANDARD TABLE OF tbtcstep, " For spool number
wa_params TYPE pri_params, " To Get Print Parameters
wa_jobhead TYPE tbtcjob, " To know the status of job
wa_jobsteplist TYPE tbtcstep, " To know the spool
w_jobname TYPE tbtco-jobname, " Job name for bckgrnd job
w_jobcount TYPE tbtco-jobcount, " Unique id for bckgrd job
w_path TYPE string, " Upload path
w_lsind TYPE sy-lsind, " Index
wa_seltab TYPE rsparams,
i_seltab TYPE STANDARD TABLE OF rsparams,
wa_index1 TYPE indx, " For Index details
wa_index_key1 TYPE indx-srtfd VALUE 'PRG_TWO',
i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF i_fieldcat.
CONSTANTS DECLARATION *
CONSTANTS :
c_a(1) TYPE c VALUE 'A',
c_m(1) TYPE c VALUE 'M',
c_l(1) TYPE c VALUE 'L',
c_c(1) TYPE c VALUE 'C',
c_zfdr(4) TYPE c VALUE 'ZFDR',
c_x(1) TYPE c VALUE 'X',
c_locl(4) TYPE c VALUE 'LOCL', " Destination is LOCAL
c_f(1) TYPE c VALUE 'F', " Job Status - Failed
c_s(1) TYPE c VALUE 'S',
c_p(1) TYPE c VALUE 'P'.
SELECTION SCREEN PARAMETERS
SELECT-OPTIONS : s_matnr FOR mara-matnr.
START-OF-SELECTION.
Before the export, fill the data fields before CLUSTR
wa_index-aedat = sy-datum.
wa_index-usera = sy-uname.
EXPORT s_matnr
TO DATABASE indx(st) FROM wa_index ID wa_index_key.
To Open the Job for background processing
PERFORM open_job.
To get the print parameters
PERFORM get_print_parameters.
Submit the job in background
PERFORM job_submit.
Close the background job
PERFORM job_close.
This is the output screen with the buttons ********
Create 3 buttons DISPLAY SPOOL, STATUS, JOBLOG
SET PF-STATUS 'ZS001'.
WRITE: / 'The program is submitted in Background'.
WRITE: / 'Press DISPLAY SPOOL to see the spool'.
WRITE: / 'Press STATUS to see the status of the background'.
AT USER-COMMAND.
If user presses the 'BACK' button
IF sy-ucomm = 'BAK'.
IF wa_jobhead-status = c_f OR
wa_jobhead-status = c_a.
LEAVE TO SCREEN 0.
ENDIF.
ENDIF.
If the user presses the 'DISPLAY SPOOL' Button
IF sy-ucomm = 'DISPLAY'.
PERFORM display_spool.
ENDIF.
If the user presses the 'JOB STATUS' Button
IF sy-ucomm = 'STATUS'.
PERFORM display_status.
ENDIF.
If the user presses the 'JOB LOG' Button
IF sy-ucomm = 'JOBLOG'.
PERFORM display_job_log.
ENDIF.
*& Form open_job
text
--> p1 text
<-- p2 text
FORM open_job .
This is to Create a new job which is to be submitted in background to
process sales order/delivery/invoice
Here we would get a unique id ( Jobcount ) which identifies our job
along with the job name which we have assigned to our job
CONCATENATE sy-uname
sy-datum
sy-uzeit
INTO w_jobname . " Assign unique jobname
CALL FUNCTION 'JOB_OPEN'
EXPORTING
DELANFREP = ' '
JOBGROUP = ' '
jobname = w_jobname
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
JOBCLASS =
IMPORTING
jobcount = w_jobcount
CHANGING
RET =
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4
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. " open_job
*& Form get_print_parameters
text
--> p1 text
<-- p2 text
FORM get_print_parameters .
DATA : l_valid TYPE c.
This is to get the Print Parameters for the job which is to be
submitted in background to process sales order/delivery/invoice
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
ARCHIVE_ID = C_CHAR_UNKNOWN
ARCHIVE_INFO = C_CHAR_UNKNOWN
ARCHIVE_MODE = C_CHAR_UNKNOWN
ARCHIVE_TEXT = C_CHAR_UNKNOWN
AR_OBJECT = C_CHAR_UNKNOWN
ARCHIVE_REPORT = C_CHAR_UNKNOWN
AUTHORITY = C_CHAR_UNKNOWN
COPIES = C_NUM3_UNKNOWN
COVER_PAGE = C_CHAR_UNKNOWN
DATA_SET = C_CHAR_UNKNOWN
DEPARTMENT = C_CHAR_UNKNOWN
destination = c_locl " LOCL
EXPIRATION = C_NUM1_UNKNOWN
immediately = space
IN_ARCHIVE_PARAMETERS = ' '
IN_PARAMETERS = ' '
LAYOUT = C_CHAR_UNKNOWN
LINE_COUNT = C_INT_UNKNOWN
LINE_SIZE = C_INT_UNKNOWN
LIST_NAME = C_CHAR_UNKNOWN
LIST_TEXT = C_CHAR_UNKNOWN
MODE = ' '
new_list_id = c_x
PROTECT_LIST = C_CHAR_UNKNOWN
no_dialog = c_x
RECEIVER = C_CHAR_UNKNOWN
RELEASE = C_CHAR_UNKNOWN
REPORT = C_CHAR_UNKNOWN
SAP_COVER_PAGE = C_CHAR_UNKNOWN
HOST_COVER_PAGE = C_CHAR_UNKNOWN
PRIORITY = C_NUM1_UNKNOWN
SAP_OBJECT = C_CHAR_UNKNOWN
TYPE = C_CHAR_UNKNOWN
user = sy-uname
USE_OLD_LAYOUT = ' '
UC_DISPLAY_MODE = C_CHAR_UNKNOWN
DRAFT = C_CHAR_UNKNOWN
ABAP_LIST = ' '
USE_ARCHIVENAME_DEF = ' '
DEFAULT_SPOOL_SIZE = C_CHAR_UNKNOWN
PO_FAX_STORE = ' '
NO_FRAMES = C_CHAR_UNKNOWN
IMPORTING
OUT_ARCHIVE_PARAMETERS =
out_parameters = wa_params
valid = l_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4
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. " get_print_parameters
*& Form job_submit
text
--> p1 text
<-- p2 text
FORM job_submit .
The job which we have created & the unique id ( jobcount ) which we
have got identifies our job. Hence those parameters are passed along
with the name of the background program "ZPROGRAM_TWO"
The job is submitted in background.
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
ARCPARAMS =
authcknam = sy-uname
COMMANDNAME = ' '
OPERATINGSYSTEM = ' '
EXTPGM_NAME = ' '
EXTPGM_PARAM = ' '
EXTPGM_SET_TRACE_ON = ' '
EXTPGM_STDERR_IN_JOBLOG = 'X'
EXTPGM_STDOUT_IN_JOBLOG = 'X'
EXTPGM_SYSTEM = ' '
EXTPGM_RFCDEST = ' '
EXTPGM_WAIT_FOR_TERMINATION = 'X'
jobcount = w_jobcount
jobname = w_jobname
LANGUAGE = SY-LANGU
priparams = wa_params
report = 'ZPROGRAM_TWO'
VARIANT = ' '
IMPORTING
STEP_NUMBER =
EXCEPTIONS
bad_priparams = 1
bad_xpgflags = 2
invalid_jobdata = 3
jobname_missing = 4
job_notex = 5
job_submit_failed = 6
lock_failed = 7
program_missing = 8
prog_abap_and_extpg_set = 9
OTHERS = 10
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. " job_submit
*& Form job_close
text
--> p1 text
<-- p2 text
FORM job_close .
Once the job is submitted in background then the job is closed
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
AT_OPMODE = ' '
AT_OPMODE_PERIODIC = ' '
CALENDAR_ID = ' '
EVENT_ID = ' '
EVENT_PARAM = ' '
EVENT_PERIODIC = ' '
jobcount = w_jobcount
jobname = w_jobname
LASTSTRTDT = NO_DATE
LASTSTRTTM = NO_TIME
PRDDAYS = 0
PRDHOURS = 0
PRDMINS = 0
PRDMONTHS = 0
PRDWEEKS = 0
PREDJOB_CHECKSTAT = ' '
PRED_JOBCOUNT = ' '
PRED_JOBNAME = ' '
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
STARTDATE_RESTRICTION = BTC_PROCESS_ALWAYS
strtimmed = c_x
TARGETSYSTEM = ' '
START_ON_WORKDAY_NOT_BEFORE = SY-DATUM
START_ON_WORKDAY_NR = 0
WORKDAY_COUNT_DIRECTION = 0
RECIPIENT_OBJ =
TARGETSERVER = ' '
DONT_RELEASE = ' '
TARGETGROUP = ' '
DIRECT_START =
IMPORTING
JOB_WAS_RELEASED =
CHANGING
RET =
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
invalid_target = 8
OTHERS = 9
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. " job_close
*& Form display_spool
text
--> p1 text
<-- p2 text
FORM display_spool .
To Read the Job to get the spool details
DATA : l_rqident TYPE tsp01-rqident, " Spool Number
l_spoolno TYPE tsp01_sp0r-rqid_char.
CLEAR : l_rqident,
w_lsind,
wa_jobsteplist.
REFRESH : i_jobsteplist.
SET PF-STATUS 'ZAR02'.
Get the Spool Number
CALL FUNCTION 'BP_JOB_READ'
EXPORTING
job_read_jobcount = w_jobcount
job_read_jobname = w_jobname
job_read_opcode = '20'
JOB_STEP_NUMBER =
IMPORTING
job_read_jobhead = wa_jobhead
TABLES
job_read_steplist = i_jobsteplist
CHANGING
RET =
EXCEPTIONS
invalid_opcode = 1
job_doesnt_exist = 2
job_doesnt_have_steps = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Read the Job Step list to get the spool number
READ TABLE i_jobsteplist INTO wa_jobsteplist INDEX 1.
CHECK wa_jobsteplist-listident <> space.
Spool Number
l_rqident = wa_jobsteplist-listident.
MOVE l_rqident TO l_spoolno.
Check the spool in TSP01
SELECT SINGLE * FROM tsp01 WHERE rqident = l_rqident.
IF sy-subrc = 0.
LEAVE TO LIST-PROCESSING.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = l_spoolno
IMPORTING
RC =
STATUS =
PERFORM show_alv.
ENDIF.
w_lsind = sy-lsind.
IF sy-lsind GE 19.
sy-lsind = 1.
ENDIF.
ENDFORM. " display_spool
*& Form show_alv
text
--> p1 text
<-- p2 text
FORM show_alv .
Before the import, fill the data fields before CLUSTR.
wa_index1-aedat = sy-datum.
wa_index1-usera = sy-uname.
To Import the selection screen data from Calling Program
IMPORT i_mara
FROM DATABASE indx(st) ID wa_index_key1 TO wa_index1.
FREE MEMORY ID wa_index_key1.
This prepares the field-catalog for ALV.
PERFORM prepare_fieldcatalog.
This displays the output in ALV format .
PERFORM display_alv.
ENDFORM. " show_alv
*& Form display_status
text
--> p1 text
<-- p2 text
FORM display_status .
To Display the STATUS of the JOB which is exectued in background
CLEAR : wa_jobsteplist.
REFRESH : i_jobsteplist.
WRITE:/ 'DISPLAYING JOB STATUS'.
CALL FUNCTION 'BP_JOB_READ'
EXPORTING
job_read_jobcount = w_jobcount
job_read_jobname = w_jobname
job_read_opcode = '20'
JOB_STEP_NUMBER =
IMPORTING
job_read_jobhead = wa_jobhead
TABLES
job_read_steplist = i_jobsteplist
CHANGING
RET =
EXCEPTIONS
invalid_opcode = 1
job_doesnt_exist = 2
job_doesnt_have_steps = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
To Display the status text as per the status type
CASE wa_jobhead-status.
WHEN 'S'. WRITE: / 'Scheduled'.
WHEN 'R'. WRITE: / 'Released'.
WHEN 'F'. WRITE: / 'Completed'.
WHEN 'A'. WRITE: / 'Cancelled'.
WHEN OTHERS.
ENDCASE.
IF sy-lsind GE 19.
sy-lsind = 1.
ENDIF.
ENDFORM. " display_status
*& Form display_job_log
text
--> p1 text
<-- p2 text
FORM display_job_log .
To display the log of the background program
LEAVE TO LIST-PROCESSING.
CALL FUNCTION 'BP_JOBLOG_SHOW_SM37B'
EXPORTING
client = sy-mandt
jobcount = w_jobcount
joblogid = ' '
jobname = w_jobname
EXCEPTIONS
error_reading_jobdata = 1
error_reading_joblog_data = 2
jobcount_missing = 3
joblog_does_not_exist = 4
joblog_is_empty = 5
joblog_show_canceled = 6
jobname_missing = 7
job_does_not_exist = 8
no_joblog_there_yet = 9
no_show_privilege_given = 10
OTHERS = 11.
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_job_log
*& Form prepare_fieldcatalog
text
--> p1 text
<-- p2 text
FORM prepare_fieldcatalog .
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-reptext_ddic = 'Material no.'.
wa_fieldcat-outputlen = '18'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ERSDA'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-reptext_ddic = 'Creation date'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ERNAM'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-reptext_ddic = 'Name of Person'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'LAEDA'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-reptext_ddic = ' Last Change'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
ENDFORM. " prepare_fieldcatalog
*& Form display_alv
text
--> p1 text
<-- p2 text
FORM display_alv .
Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = i_fieldcat
tables
t_outtab = i_mara.
ENDFORM. " display_alv
ZPROGRAM_TWO: This is the 2nd program which would be called from program ZPROGRAM_ONE.
*& Report ZPROGRAM_TWO *
REPORT zprogram_two .
PRASHANT PATIL
TABLES : mara.
TYPE-POOLS:slis.
TYPES : BEGIN OF t_mara,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
laeda TYPE mara-laeda,
END OF t_mara.
DATA : i_mara TYPE STANDARD TABLE OF t_mara,
wa_mara TYPE t_mara,
wa_index TYPE indx, " For Index details
wa_index_key TYPE indx-srtfd VALUE 'PRG_ONE',
wa_index1 TYPE indx, " For Index details
wa_index_key1 TYPE indx-srtfd VALUE 'PRG_TWO',
i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF i_fieldcat.
SELECT-OPTIONS : s_matnr FOR mara-matnr.
Before the import, fill the data fields before CLUSTR.
wa_index-aedat = sy-datum.
wa_index-usera = sy-uname.
To Import the selection screen data from Calling Program
IMPORT s_matnr
FROM DATABASE indx(st) ID wa_index_key TO wa_index.
FREE MEMORY ID wa_index_key.
SELECT matnr
ersda
ernam
laeda
FROM mara
INTO TABLE i_mara
WHERE matnr IN s_matnr.
PERFORM prepare_fieldcatalog.
PERFORM display_alv.
Before the export, fill the data fields before CLUSTR
wa_index1-aedat = sy-datum.
wa_index1-usera = sy-uname.
EXPORT i_mara
TO DATABASE indx(st) FROM wa_index1 ID wa_index_key1.
*& Form prepare_fieldcatalog
text
--> p1 text
<-- p2 text
FORM prepare_fieldcatalog .
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-outputlen = '18'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ERSDA'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ERNAM'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'LAEDA'.
wa_fieldcat-tabname = 'I_MARA'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO i_fieldcat.
ENDFORM. " prepare_fieldcatalog
*& Form display_alv
text
--> p1 text
<-- p2 text
FORM display_alv .
Call ABAP List Viewer (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = i_fieldcat
TABLES
t_outtab = i_mara.
ENDFORM. " display_alv
its possible to display ALV Grid using OO ALV. Following code can be used instead of FM.
In the PBO, add following code
SET PF-STATUS 'ZSTAT'.
If program is executed in background
CALL METHOD cl_gui_alv_grid=>offline
RECEIVING
e_offline = off.
IF off IS INITIAL.
IF container1 IS INITIAL.
CREATE OBJECT container1
EXPORTING
container_name = 'CC_ALV1' .
ENDIF.
ENDIF.
CREATE OBJECT g_grid1
EXPORTING
i_parent = container1.
CALL METHOD g_grid1->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
i_save = 'A'
i_default = ' '
is_layout =
is_print =
IT_SPECIAL_GROUPS =
it_toolbar_excluding =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
it_outtab = i_output
it_fieldcatalog = i_fieldcatalog
IT_SORT =
IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Reward points if useful
Regards
Anji
Maybe you are looking for
-
Mail crashes after 10.5.6 update, apple have no idea whatsoever.
So I updated to OS X 10.5.6 and mail started crashing shortly after. Sometimes it would take a minute, sometimes an hour but it always crashes. So, looking at support notes and discussion boards it appears that I first try updating mail (it was alrea
-
Since installing Ios7 280 music tunes out of a total of 360 will now only play when I'm within range of WiFi. The remainder now appear with the stupid Icloud logo beside them. How can I get them back on my Iphone 4s and scrap this stupid icloud tha
-
Arch does not show up in Grub when dual booting with windows 8
I just installed Arch linux, dual booting with windows 8 using the beginners guide[https://wiki.archlinux.org/index.php/Beginners'_Guide] itself. Now Grub is installed and i can only find Windows 8 and I cannot find Arch. Is there a way I can find if
-
Color doesn't recognize movie files
Hello, I'm pretty new to FCP and I've been working on a project for about a week. When I tried to send my sequence to Color, it seemed to load the sequence, but none of the files are recognized by Color. It looks like this: http://i5.photobucket.com/
-
Where do I find Maverick update?
I neglected to upgrade my iMac to Maverick and now I want to install some other updates and can't because I didn't install Maverick first. Where can I find it to install it?