06-07-2011 2:49 PM
Hello Friends,
i am working on a report.
the selection screen have one selection field material.
1) if the material is not entered on ss
2) a popup appears to run program in background. this logic was done in at selection-screen event.
3) if we press ok from the popup. then need to run the program in background as it is done in f9.
i.e. i mean to say is. i need the same functionality as we get in F9.
Process in F9 :
1) A printer specification popup appears.
2) then scheduling batch job appears. where we create a batch job manually.
you could try going in t.code -- V_V2 and press F9. You could obtain the same functionality as i am trying to describe.
Note: we need to set the job manually.
Thanks!!
Rachit.
06-07-2011 3:58 PM
Try this kind of code which forces value of [SSCRFIELDS-UCOMM|http://help.sap.com/abapdocu_70/en/ABENNEWS-30-LDB.htm#&ABAP_MODIFICATION_8@8@]
REPORT ztest.
TABLES: t001,
sscrfields.
SELECT-OPTIONS bukrs FOR t001-bukrs.
AT SELECTION-SCREEN.
CASE sscrfields-ucomm.
WHEN 'ONLI' OR 'PRIN'.
IF bukrs[] IS INITIAL.
" popup here like POPUP_TO_CONFIRM
sscrfields-ucomm = 'SJOB'.
ENDIF.
ENDCASE.
START-OF-SELECTION.
WRITE 'hello'.
Regards,
Raymond
06-07-2011 3:30 PM
Hi,
Try like below.
* open job in case records are retrieved
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = d_jobname "Job name
IMPORTING
jobcount = d_jobcount. " Job number.
* add step to job
SUBMIT zprogram
VIA JOB d_jobname
NUMBER d_jobcount
TO SAP-SPOOL
WITHOUT SPOOL DYNPRO
AND RETURN.
* close and start the job
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = d_jobcount "number of job
jobname = d_jobname "name of job
strtimmed = p_run
EXCEPTIONS
invalid_startdate = 1
jobname_missing = 2.
MESSAGE i014 WITH 'Job ' d_jobname ' has been scheduled'.
06-07-2011 3:34 PM
Hello,
You can implement the background job functionality by manually calling the background job from the program.
For this you need to implement the following three steps : -
1) Call the FM "JOB_OPEN" to open the background job. Provide the job_name to the FM and get the job_count.
2) SUBMIT the same Z program which you are currently running using the below code.
SUBMIT (sy-repid)
WITH SELECTION-TABLE lt_rspar
TO SAP-SPOOL
SPOOL PARAMETERS ls_print_parameters
WITHOUT SPOOL DYNPRO
USER sy-uname VIA JOB job_name NUMBER job_count
AND RETURN.
Table lt_rspar is TYPE STANDARD TABLE OF rsparams, through which we pass the parameters entered on the selection screen to the background program.
RSPAR-SELNAME = Name of the select options/ parameters for which you want to pass the value
RSPAR-LOW = Low value in case of select options/ values in the parameters
RSPAR-HIGH = High value in case of select options.
Append all selection screen values to the internal table LT_RSPAR as per the above rule.
The printer name and the formatting options can be passed via print parameters workarea ls_print_parameters
ls_print_parameters TYPE pri_params.
After this code, we call the FM "JOB_CLOSE" to close the background job.
Regards,
Rinkesh Doshi
06-07-2011 3:58 PM
Try this kind of code which forces value of [SSCRFIELDS-UCOMM|http://help.sap.com/abapdocu_70/en/ABENNEWS-30-LDB.htm#&ABAP_MODIFICATION_8@8@]
REPORT ztest.
TABLES: t001,
sscrfields.
SELECT-OPTIONS bukrs FOR t001-bukrs.
AT SELECTION-SCREEN.
CASE sscrfields-ucomm.
WHEN 'ONLI' OR 'PRIN'.
IF bukrs[] IS INITIAL.
" popup here like POPUP_TO_CONFIRM
sscrfields-ucomm = 'SJOB'.
ENDIF.
ENDCASE.
START-OF-SELECTION.
WRITE 'hello'.
Regards,
Raymond
06-08-2011 6:35 AM