Overwriting spool parameters.
Hi all,
I have a Z program and I am setting the print parameters using the FM 'GET_PRINT_PARAMETERS'
The destination is set to LOCL.
However my program calls a standard program - RFEBKA00.
This program again uses the 'GET_PRINT_PARAMETERS' and it is not setting destination to LOCL.
The parameters I am setting is getting over written in the second call to this FM.
Thus when the job runs in back ground, I am getting the error : printer " " not found
I am not getting a way how to come out of this.
YOur valuable suggestion would be helpful and rewarded.
regards
Need to use ARCHIVE PARAMETERS also.
Below examples from the documenation might help you understand the same:
Example
* Without archiving
DATA: PARAMS LIKE PRI_PARAMS,
DAYS(1) TYPE N VALUE 2,
COUNT(3) TYPE N VALUE 1,
VALID TYPE C.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING DESTINATION = 'LT50'
COPIES = COUNT
LIST_NAME = 'TEST'
LIST_TEXT = 'SUBMIT ... TO SAP-SPOOL'
IMMEDIATELY = 'X'
RELEASE = 'X'
NEW_LIST_ID = 'X'
EXPIRATION = DAYS
LINE_SIZE = 79
LINE_COUNT = 23
LAYOUT = 'X_PAPER'
SAP_COVER_PAGE = 'X'
COVER_PAGE = 'X'
RECEIVER = 'SAP*'
DEPARTMENT = 'System'
NO_DIALOG = ' '
IMPORTING OUT_PARAMETERS = PARAMS
VALID = VALID.
IF VALID <> SPACE.
SUBMIT RSTEST00 TO SAP-SPOOL
SPOOL PARAMETERS PARAMS
WITHOUT SPOOL DYNPRO.
ENDIF.
Example
* With archiving
DATA: PARAMS LIKE PRI_PARAMS,
ARPARAMS LIKE ARC_PARAMS,
DAYS(1) TYPE N VALUE 2,
COUNT(3) TYPE N VALUE 1,
VALID TYPE C.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING DESTINATION = 'LT50'
COPIES = COUNT
LIST_NAME = 'TEST'
LIST_TEXT = 'SUBMIT ... TO SAP-SPOOL'
IMMEDIATELY = 'X'
RELEASE = 'X'
NEW_LIST_ID = 'X'
EXPIRATION = DAYS
LINE_SIZE = 79
LINE_COUNT = 23
LAYOUT = 'X_PAPER'
SAP_COVER_PAGE = 'X'
COVER_PAGE = 'X'
RECEIVER = 'SAP*'
DEPARTMENT = 'System'
SAP_OBJECT = 'RS'
AR_OBJECT = 'TEST'
ARCHIVE_ID = 'XX'
ARCHIVE_INFO = 'III'
ARCHIVE_TEXT = 'Description'
NO_DIALOG = ' '
IMPORTING OUT_PARAMETERS = PARAMS
OUT_ARCHIVE_PARAMETERS = ARPARAMS
VALID = VALID.
IF VALID <> SPACE.
SUBMIT RSTEST00 TO SAP-SPOOL
SPOOL PARAMETERS PARAMS
ARCHIVE PARAMETERS ARPARAMS
WITHOUT SPOOL DYNPRO.
ENDIF.
Regards
Eswar
Similar Messages
-
Datas from info record should not overwrite BAPI_PO_CREATE parameters
Hi,
I intend to pass the netprice value while posting PO through BAPI_PO_CREATE.
but the values from info record overwriting the parameters supplied.
Please guide me how to avoid this overwritting.
Thanks,
Vempalliand have you set a breakpoint at loop at input file and at bapi_po_create ??
perhaps there is something wrong with the amount of items passed ?
kind regards
arthur -
Subsequent SubReports overwriting earlier parameters
For some reason any subreports that I add overwrite the parameters of the earlier subreports that are added.
I have tried renaming the report name, this happens with totally different subreports... the last one is the only
one that the parameters stick. I get prompted to enter all previous parameters from all but the last subreport.
Here is a simple code snippet that just adds a subreport twice and I get prompted for the first
subreport parameters: (I normally am not running the same report more than once with the same values,
this is only for example purposes)
Try
Dim intNewSection As Integer = 0
Dim boReportDocument As ReportDocument
Dim boReportClientDocument As ISCDReportClientDocument
Dim boSubreportClientDocument As CrystalDecisions.ReportAppServer.Controllers.SubreportClientDocument
Dim boArea As CrystalDecisions.ReportAppServer.ReportDefModel.Area
Dim boSection As CrystalDecisions.ReportAppServer.ReportDefModel.Section
Dim sarSubRptFile(1) As String
Dim strSubRptFile As String
sarSubRptFile(0) = Application.StartupPath & "\Reports\Selected Checklist.rpt"
sarSubRptFile(1) = Application.StartupPath & "\Reports\Selected Checklist.rpt"
boReportDocument = New ReportDocument()
boReportDocument.Load(strReportFilespec)
boReportClientDocument = New ReportClientDocumentClass()
boReportDocument.SetDataSource(dsProject) 'Point the crystal report at the System.Data.DataSet
boReportClientDocument = boReportDocument.ReportClientDocument
For Each strSubRptFile In sarSubRptFile
'Get the detail area from the report
boArea = boReportClientDocument.ReportDefController.ReportDefinition.DetailArea
'Create the new section object
boSection = New CrystalDecisions.ReportAppServer.ReportDefModel.Section
'Set the properties for the section
boSection.Kind = CrystalDecisions.ReportAppServer.ReportDefModel.CrAreaSectionKindEnum.crAreaSectionKindDetail
boSection.Name = "CustomDetailSection" & CStr(intNewSection) 'Give it a unique name
intNewSection += 1
Dim boTestReportDocument As ReportDocument
boTestReportDocument = New ReportDocument()
boTestReportDocument.Load(strSubRptFile)
Dim intSubRptWidth As Integer = boTestReportDocument.ReportClientDocument.ReportDefController.ReportDefinition.PageHeaderArea.Sections(0).Width
boTestReportDocument.Close()
boTestReportDocument = Nothing
boSection.Width = intSubRptWidth
'Add the section to the clientdocument
boReportClientDocument.ReportDefController.ReportSectionController.Add(boSection, boArea, -1)
'Import the sub report with a unique name
boSubreportClientDocument = boReportClientDocument.SubreportController.ImportSubreport( _
Chr(intNewSection) & Path.GetFileNameWithoutExtension(strSubRptFile), strSubRptFile, boSection)
Try
Dim rasDataset As ISCRDataSet
rasDataset = DataSetConverter.Convert(dsProject)
boSubreportClientDocument.DatabaseController.SetDataSource(rasDataset)
Catch exData As Exception
MsgBox("Error setting data to " & strSubRptFile & vbLf _
& "Error: " & exData.ToString, MsgBoxStyle.Information, "Group Report Error")
End Try
boReportClientDocument.DataDefController.ParameterFieldController.SetCurrentValue( _
boSubreportClientDocument.Name, "lowerid", "1a9b-4628-87b1-3026582e0dd6")
Next
CrystalReportViewer1.ReportSource = boReportDocument
CrystalReportViewer1.Show()
Catch exTest As Exception
End Try
Does anyone have any idea what I am doing wrong - why is the subreport parameters getting blown away on all but the last subreport.. This happens even if the parameter names are different.
Thanks,
JeffThanks Trevor,
It turns out that if I remark out these lines, the parameters start working. I'm not sure what they have to do with the parameters, but it seams to do the trick... now I need to figure out how to update the DataSource without messing up the parameters.
Here is the code that is messing up the parameters:
Dim rasDataset As ISCRDataSet
rasDataset = DataSetConverter.Convert(dsProject) 'dsProject is a .net dataset that is coming into this report
boSubreportClientDocument.DatabaseController.SetDataSource(rasDataset)
This works fine if I am not using parameters on more than one subreport... but if I use parameters on more than one subreport, only the last ones work and I get prompted for all earlier subreports.
Thanks,
Jeff -
Overwrite URL parameters?
I have a stateful BSP Application that is called with some URL parameters.
https://bla.com/alias/default.htm?param1=value1
On the default.htm, i call
request->get_form_field( 'param1' )
to read value1. This value is read in every request.
My question: Can I overwrite param1 in the event handler of default.htm so that param1 has a different value in the following requests?hi,
you can declare a page attribute with same name 'param1'.
and then in event handling just change its value so it will pass the updated value next time.
if it doesn't work,then add a hidden field in your page form say
<input type=hidden name='param1'> and declare a page attribute with same name also 'param1'. this will change the value of input field in event handler and then the updated value will get passed in subsequent requests.
hope this will work for you,
Regards,
Hemendra -
Overwrite java parameters with environment variables or other mechanism???
I am using several java programs on my machine. Each of them uses some deeply nested startup script so I have no chance to modify the parameters of the java command.
I would need to change certain parameters though, e.g. the heap size or certain system properties.
Is there a way to do this by e.g. setting environment variables or modifying a user-specific configuration file?
I am using jdk 1.5.0_06 on Linux (Ubuntu).Well the ones I am dealing with do not, unfortunately.
I am also interested in a general way to tune the JVM settings without modifying each and every call statement.
Surely there must be some mechanism to achieve this?? -
SPOOL_INTERNAL_ERROR spool overflow when submitting the same program
I am submitting the same program via job with different seletion screen values after JOB_OPEN, and then SUBMIT statement and JOB_CLOSE FM. But this job get cancelled with message "ABAP/4 processor: SPOOL_INTERNAL_ERROR" . The submit is as follows:
SUBMIT (sy-repid) USER sy-uname
VIA JOB 'ZTP_SAl_REG_MONITOR_JOBS'
NUMBER l_jobcount
TO SAP-SPOOL
SPOOL PARAMETERS fp_user_print_params
NEW LIST IDENTIFICATION 'X'
WITHOUT SPOOL DYNPRO
WITH rb_monit EQ 'X'
WITH s_jobcnt IN s_jobcnt
WITH p_date EQ p_date
WITH rb_row EQ rb_row
WITH rb_col EQ rb_col
AND RETURN.
Is it possible to use the same program to be scheduled....Let me include that the submit is happening with rb_monit = X and it has separate branch...so infinite looping can not happen.Hi Sumit,
I hope that the flag is ensuring that it doesnt go into infinite loop. You may wish to check that once bcz Spool overflow seems to be bcz of infinite loop or bcz of layout issue.
Goto SP01 in the same client where you have scheduled the job.
Check the spool no. which was generated bcz of the job.
Double click on the STATUS of the spool ( it should be in red background color).
System will give a popup with status details.
Again double click on the status. System will again give a popup.
The popup will give the details of why the spool ran into errors.
Also check the layout.
Thanks,
Best regards,
Prashant -
How to create spool in an online report
Hi All,
I have a requirement where the ALV report output has customers and details related to it.For example My report output has three customers(with a check box against it) and each customer has 5 line items.The user will select first and the last customer and press a push button provided.Once he clicks this push button, I should get the customers which are selected by the users and the line items related to this customers.I am able to capture all this.Now the real problem here is that I have to create a pdf document for each customer along with line items and send it as an email.In effect, in this scenario I have to create two pdf documents since the user has selected two customers on the output screen and send it to the email of that particular customer.Is there any FM available to create spool in the background for each of these customers(along with line items data) and make use of this spool number to generate a pdf document using CONVERT_ABAPSPOOLJOB_2_PDF.Once I get this I can send the email.
Please help!
Thanks in advance
SandeepThe following steps shows how to download the output data in to PDF.
1.Provide Spool Parameters using following function module 'GET_PRINT_PARAMETERS'.
--This function module will provide the print parameters for creating the output in the spool; the required parameters are passed to the OUT_PARAMETERS import parameter.
2.Submit the report to generate the output in the spool.
SUBMIT (sy-repid) TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS wa_mstr_print_parms
WITH SELECTION-TABLE i_int_tab
AND RETURN.
--Submit the report to generate the output in the spool as i_int_table is an internal table with structure RSPARAMS. As variant allows you to set the names and contents of the parameter and selection options dynamically at runtime, we need to use the function module RS_REFRESH_FROM_SELECTOPTIONS to read the contents of the parameters and selection options of the current program into an internal table i_int_table with the structure RSPARAMS and pass that internal table in above manner.
3.To Find the spool number from the table TSP01
Data: l_rq2name LIKE tsp01-rq2name.
*Concatenate the report and User name as per the value available in the table
TSP01.
CONCATENATE f_repid+0(9)
f_uname+0(3)
INTO l_rq2name.
*Fetch the most recent spool from the TSP01 table
SELECT * FROM tsp01 WHERE rq2name = l_rq2name
ORDER BY rqcretime DESCENDING.
l_rqident = tsp01-rqident.
EXIT.
ENDSELECT.
4.Convert Spool to PDF using the FM : CONVERT_ABAPSPOOLJOB_2_PDF.
5.Download to local file by using the FM : DOWNLOAD
This function module returns an internal table data_tab contains the PDF formatted output.
Using above points your can create the output in the PDF from there you can send the email.
Hope your reqirement can met using the above five points.
Reward points please
Thanks,
Ravi Kanth -
While converting spool to PDF, no data is coming in the PDF file.
Hi All,
I am submitting a z program ZPR022_INNCOMETAX_REPORT_COPY1 (which has some output display) from Z_ITSLIP_MAIL. I am creating a job, submitting the above program via JOB to SAP-SPOOL.
In program ZPR022_INNCOMETAX_REPORT_COPY1 , I am getting the run time job information and from there I am getting the spool id. Now I am converting the spool id to a PDF. This PDF should contain the output of the program ZPR022_INNCOMETAX_REPORT_COPY1. This output is normal output using Write statement only. But once the program is executed, I could find no data in the PDF file. When I check in SM37 and SP02, both the JOB and the SPOOL are created. What I feel is the program is not picking the spool id at the run time. Could any one help me in this regard how to proceed.
Please find the code below.
Program 1.
LOOP AT pernr.
CLEAR p_job.
p_stim = p_stim + 120.
CONCATENATE'ITSlip' pernr-low p_job sy-datum INTO p_job SEPARATED BY
space.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = p_job
sdlstrtdt = p_sdat
sdlstrttm = p_stim
IMPORTING
jobcount = l_jobcount.
SUBMIT ZPR022_INNCOMETAX_REPORT_COPY1
WITH pnptimr6 = 'X'
WITH pnpbegda = period-low
WITH pnpendda = period-high
WITH pnppernr-low = pernr-low
WITH pnpabkrs-low = 'IN'
VIA JOB p_job
NUMBER l_jobcount
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS ls_params
WITH immediately = 'X'
KEEP IN SPOOL = 'X'
AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobcount
jobname = p_job
strtimmed = 'X'
PRDMINS = 2.
sdlstrtdt = p_sdat
sdlstrttm = p_stim.
ENDLOOP.
Program 2.
IF sy-batch EQ 'X'.
LOOP AT pnppernr.
SELECT SINGLE * FROM pa0105
WHERE pernr EQ pnppernr-low
AND subty EQ '0010'
AND endda EQ '99991231'.
p_email1 = pa0105-usrid_long..
PERFORM get_job_details.
PERFORM obtain_spool_id.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
IF sy-sysid = c_dev.
WAIT UP TO 5 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
ENDLOOP.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool'
'request to be created.'.
EXPORT gd_spool_nr TO MEMORY ID 'SPOOLTOPDF'.
ENDIF.
ENDFORM. " SEND_MAIL
*& Form get_job_details
text
--> p1 text
<-- p2 text
FORM get_job_details .
Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM. " get_job_details
*& Form obtain_spool_id
text
--> p1 text
<-- p2 text
FORM obtain_spool_id .
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
MESSAGE s004(zdd) WITH gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM. " obtain_spool_id
*& Form convert_spool_to_pdf
text
--> p1 text
<-- p2 text
FORM convert_spool_to_pdf .
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM. " convert_spool_to_pdf
*& Form process_email
text
--> p1 text
<-- p2 text
FORM process_email .
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
ENDFORM. "process_email
FORM send_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'IT Declaration'.
CONCATENATE 'ITSLIP' ' ' INTO gd_attachment_name.
it_mess_bod = 'IT FORM for this month'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
TABLES it_mess_bod
it_mess_att
USING p_email1
'MindTree Payroll team'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
CHANGING gd_error
gd_reciever.
ENDFORM. " process_email
*& Form send_file_as_email_attachment
text
-->P_IT_MESS_BOD text
-->P_IT_MESS_ATT text
-->P_P_EMAIL text
-->P_4422 text
-->P_4423 text
-->P_GD_ATTACHMENT_NAME text
-->P_GD_ATTACHMENT_DESC text
-->P_P_SENDER text
-->P_GD_SENDER_TYPE text
<--P_GD_ERROR text
<--P_GD_RECIEVER text
FORM send_file_as_email_attachment TABLES it_message
it_attach
USING p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
CHANGING p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM. "send_file_as_email_attachment
Points will be rewarded.
Regards,
BalajiHi,
I think you are retrieving the spool before the entire spool is generated.
Put the following logic to retrieve spool iD
CHECK WHETHER STATUS OF JOB IS COMPLETED OR CANCELLED
WHILE 1 = 1.
GET THE JOB STEPLIST WHICH HAS THE SPOOL NUMBER
CALL FUNCTION 'BP_JOB_READ'
EXPORTING
job_read_jobcount = w_jobcount
job_read_jobname = w_jobname
job_read_opcode = '35'
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.
BEGIN OF INSERTION U179942 E1BK928781
IF STATUS OF JOB IS COMPLETED(F) OR CANCELLED(A)
READ THE JOBSTEPLIST & GET THE SPOOL NUMBER
IF wa_jobhead-status = c_a OR wa_jobhead-status = c_f.
READ TABLE i_jobsteplist INTO wa_jobsteplist INDEX 1.
CHECK wa_jobsteplist-listident <> space.
w_spool_number = wa_jobsteplist-listident.
EXIT.
ENDIF.
ENDWHILE.
Best regards,
Prashant -
Wrapper program when run in background not generating SPOOL
I have created Program A which calls internally Program B or C based on the condition. When I run the program B or C independently in Background it generates the spool on completion. But When I run the program A in Background, Spool is not getting generated.
My requirement is that Spool should be generated when Program A is executed in Background.
Below is the code of program A:
PROGRAM A.
IF p_cons = 'X'.
*-->Detailed Details of Interim or Final Settlement
SUBMIT B WITH p_vtnr EQ p_vtnr
WITH p_setqty EQ p_setqty
WITH p_test EQ p_test
WITH s_abrdat IN s_abrdat
WITH r2 EQ r2
WITH r1 EQ r1
AND RETURN.
ELSE.
*-->Summary Details of Interim or Final Settlement
SUBMIT C WITH p_vtnr EQ p_vtnr
WITH p_setqty EQ p_setqty
WITH p_test EQ p_test
WITH s_abrdat IN s_abrdat
WITH r2 EQ r2
WITH r1 EQ r1
AND RETURN.
ENDIF.
Please guide me on this.
Regards,
NaveenHi Naveen,
Check this
Submit report to job
submit ztest via job l_jobname
number l_jobcount
to sap-spool without spool dynpro
spool parameters ls_params
and return. -
How to generate new spool on each run of program
Hi,
I am using FP_JOB_OPEN , CLOSE FM for generate my multiple PDFs into a single PDF form.
Rightnow when we run 1st time is genrating and storing it under a spool number 100.
Next time we run the program it is appending to same spool number 100.
How can we get rid of this? These are my spool parameters.
fp_outputparams-nodialog = 'X'. " suppress printer dialog popup
fp_outputparams-dest = 'ZADS'.
I tried REQNEW inside the loop when i do that obviusly it is seperating pdf's .
How can i get rid of this issue?
rgds
Varaclear:fp_outputparams.
resolved my issue. -
How to get spool number when using SUBMIT job
Hi All,
I am calling standard program using SUBMIT through JOB as below. Now I need spool number for this job to covert the output to PDF and send to mail. See the below code and guide me.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
data: Zscreen type table of RSPARAMS with header line.
Zscreen-selname = 'PM_AENNR'.
Zscreen-kind = 'P'.
ZSCREEN-LOW = '500000000125'.
APPEND ZSCREEN.
SUBMIT RCC00130 WITH selection-table Zscreen TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = number
jobname = name
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5Hi,
Do this way, first get print parameters by using function module 'GET_PRINT_PARAMETERS'
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = 'LP01'
list_name = 'TEST'
list_text = 'SUBMIT ... TO SAP-SPOOL'
immediately = ' '
line_size = '1023'
no_dialog = 'X'
IMPORTING
out_parameters = wa_pri_params
valid = w_valid.
If it returns success then
IF w_valid EQ 'X'.
CONCATENATE 'R'
w_tabix
sy-datum+4(4)
sy-uzeit INTO
wa_pri_params-plist.
ENDIF.
SUBMIT rprccc00
WITH firmennr = w_cid
WITH bel_clus = 'X'
WITH testlauf = ' '
WITH not_lokl = 'X'
WITH file_in = w_arc_out
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS wa_pri_params AND RETURN.
COMMIT WORK AND WAIT.
SELECT rqident
FROM tsp01
INTO w_rqident
UP TO 1 ROWS
WHERE rq2name = wa_pri_params-plist.
ENDSELECT.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = w_rqident
no_dialog = 'X'
dst_device = 'LP01'
pdf_destination = 'X'
TABLES
pdf = t_pdf.
Hope it solves your problem
Regards
Krishna -
JOB is created but SPOOL is not created - using SUBMIT stmt in WD
Hi,
I am submitting report from WD. PFB the code i used. This is cuccessfully creating the JOB in SM37 and the status is 'Finished'. But when I click for the SPOOL, it is giving me an error 'No list available'.
I used the following code for submitting the program.
* call the FM 'JOB_OPEN' and create the job.
SUBMIT ztest TO SAP-SPOOL
WITH pnppernr-low EQ pernr
WITH pnpbukrs-low EQ bukrs
SPOOL PARAMETERS lv_print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB lv_name NUMBER lv_number " job name and number created from JOB_OPEN
AND RETURN.
* call the FM 'JOB_CLOSE' and close the job.
The submit stmt is working perfectly fine when executed directly..from R/3. The spool is also being created.
I tried debugging the same. This goes to the INITIALIZITION part of the program but no goin to START-OF-SELECTION.
Pls suggest if I am missing something in the code.
Thanks,
Teja.>
teja wrote:
> Hi,
>
> I am submitting report from WD. PFB the code i used. This is cuccessfully creating the JOB in SM37 and the status is 'Finished'. But when I click for the SPOOL, it is giving me an error 'No list available'.
>
> I used the following code for submitting the program.
>
>
> * call the FM 'JOB_OPEN' and create the job.
>
> SUBMIT ztest TO SAP-SPOOL
> WITH pnppernr-low EQ pernr
> WITH pnpbukrs-low EQ bukrs
> SPOOL PARAMETERS lv_print_parameters
> WITHOUT SPOOL DYNPRO
> VIA JOB lv_name NUMBER lv_number " job name and number created from JOB_OPEN
> AND RETURN.
>
> * call the FM 'JOB_CLOSE' and close the job.
>
>
> The submit stmt is working perfectly fine when executed directly..from R/3. The spool is also being created.
>
> I tried debugging the same. This goes to the INITIALIZITION part of the program but no goin to START-OF-SELECTION.
>
> Pls suggest if I am missing something in the code.
>
> Thanks,
> Teja.
Hi,
I guess this wont work. Didnt you get any dump ?
FM's with dialog screens,conversion exits would cause the webdynpro session to disconnect. -
Hwo to get the spool number from report output
Hi,
I am displaying some output in the report using write statements and within my program I need to collect the output written by write statements and send it as an email.So for that I need to generate the spool number and I am using the below code to do that
CONSTANTS:
l_linsz TYPE sy-linsz VALUE 201, " Line size
l_paart TYPE sy-paart VALUE 'X_65_132'. " Paper Format
l_uname = sy-uname .
l_repid = sy-repid .
*-- Setup the Print Parmaters
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
authority = space
copies = '1'
cover_page = space
data_set = space
department = space
destination = space
expiration = '1'
immediately = space
new_list_id = k_x
no_dialog = k_x
user = l_uname
IMPORTING
out_parameters = l_mstr_print_parms
valid = l_mc_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
*-- Make sure that a printer destination has been set up
*-- If this is not done the PDF function module ABENDS
IF l_mstr_print_parms-pdest = space.
l_mstr_print_parms-pdest = k_lp01.
ENDIF.
*-- Explicitly set line width, and output format so that
*-- the PDF conversion comes out OK
l_mstr_print_parms-linsz = l_linsz.
l_mstr_print_parms-paart = l_paart.
l_variante = sy-slset.
* submitting the spool request
*SUBMIT (l_repid) TO SAP-SPOOL*
*SPOOL PARAMETERS l_mstr_print_parms*
*WITHOUT SPOOL DYNPRO*
*AND RETURN.*
*Calculating the lenth of report name
lv_len = STRLEN( l_repid ) .
*consutrucing the database variable rq2name to search the spool
*request
IF lv_len >= 9 .
CONCATENATE l_repid+0(9)
l_uname+0(3) INTO lc_rq2name .
ELSE.
lv_len = 9 - lv_len .
DO lv_len TIMES .
CONCATENATE lv_temp '_' INTO lv_temp .
ENDDO.
CONCATENATE l_repid lv_temp
l_uname INTO lc_rq2name .
ENDIF.
*selecting the spool request using the above consructed varibale
SELECT * FROM tsp01 INTO TABLE lt_tsp01
WHERE rq2name = lc_rq2name .
*sorting the interbla table
SORT lt_tsp01 BY rqcretime DESCENDING .
*reading the first spool request
READ TABLE lt_tsp01 INTO ls_tsp01 INDEX 1.
but the problem with the above code is I am using variants to execute the report but when the above piece of code is getting executed it is clearing all the variant values on the selection screen and it is defaulting the values on the selection screen.
Is there any way i can execute the above code without any problem in the selection screen.
Thanks
Bala DuvvuriHello Bala,
I wouldn't SUBMIT the same program to get the Spool number. You can achieve the same by [NEW-PAGE PRINT ON|http://help.sap.com/abapdocu_702/en/abapnew-page_print.htm#!ABAP_ADDITION_1@1@] command.
Check the code snippet i've provided below:
DATA: spfli_wa TYPE spfli,
print_parameters TYPE pri_params,
valid_flag TYPE c LENGTH 1.
START-OF-SELECTION.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
no_dialog = 'X'
IMPORTING
out_parameters = print_parameters
valid = valid_flag
EXCEPTIONS
invalid_print_params = 2
OTHERS = 4.
IF valid_flag = 'X' AND sy-subrc = 0.
* 1. Write the output to the output list(no spool is generated)
SELECT carrid connid
FROM spfli
INTO CORRESPONDING FIELDS OF spfli_wa.
WRITE: / spfli_wa-carrid, spfli_wa-connid.
ENDSELECT.
* 2. Write the output to SAP spool(no list is displayed)
NEW-PAGE PRINT ON PARAMETERS print_parameters NO DIALOG.
SELECT carrid connid
FROM spfli
INTO CORRESPONDING FIELDS OF spfli_wa.
WRITE: / spfli_wa-carrid, spfli_wa-connid.
ENDSELECT.
NEW-PAGE PRINT OFF.
MESSAGE i000(zibi027) WITH 'Spool' sy-spono 'is generated!!!'.
"You can use the spool number (SY-SPONO) to email the list output
ENDIF.
Hope this helps.
BR,
Suhas -
Submit...to Spool in background, ALV Grid
Hello,
I am trying to using the SUBMIT to SPOOL statement for SAP std. program RKPEP003.
Now this works well when i execute in the foreground mode but doesnt work in the background mode, it gives an error "Make an Entry in All Required fields"
RKPEP003 output is ALV Grid, so is this the probable reason or something else becoz the code works fine in the foreground mode
Thanks in advance
MinhajHello,
Following is my code:
MOVE:
'CN_PSPNR' TO I_SELTAB_WA_ANLAGE-SELNAME,
'S' TO I_SELTAB_WA_ANLAGE-KIND, " SELECT-OPTION
'I' TO I_SELTAB_WA_ANLAGE-SIGN,
'EQ' TO I_SELTAB_WA_ANLAGE-OPTION,
'W-000001-01-101' TO I_SELTAB_WA_ANLAGE-LOW,
'W-000001-01-101' TO I_SELTAB_WA_ANLAGE-HIGH.
APPEND I_SELTAB_WA_ANLAGE TO I_SELTAB_ANLAGE.
MOVE: 'R_BUDAT' TO I_SELTAB_WA_ANLAGE-SELNAME,
'S' TO I_SELTAB_WA_ANLAGE-KIND, " SELECT-OPTION
'I' TO I_SELTAB_WA_ANLAGE-SIGN,
'BT' TO I_SELTAB_WA_ANLAGE-OPTION,
S_DAT TO I_SELTAB_WA_ANLAGE-LOW,
E_DAT TO I_SELTAB_WA_ANLAGE-HIGH.
APPEND I_SELTAB_WA_ANLAGE TO I_SELTAB_A
SUBMIT RKPEP003
WITH selection-table I_SELTAB_ANLAGE
WITH P_DISVAR = '/5SAP'
TO SAP-SPOOL
SPOOL PARAMETERS PARAMS
ARCHIVE PARAMETERS ARPARAMS
WITHOUT SPOOL DYNPRO AND RETURN.
Now this works well in the foreground mode but other otherwise even with JOBNAME AND NUMBER
Thanks,
Minhaj -
SPOOL Not generated in SUBMIT background job
Hi All,
I am submiting a report program using SUBMIT keyword. I required SPOOL. But its not generating. Can anyone kindly let me know whts wrong in my code?
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
LAYOUT = 'X_65_132'
LINE_COUNT = 65
LINE_SIZE = 132
IMPORTING
OUT_PARAMETERS = print_parameters
OUT_ARCHIVE_PARAMETERS = ARCPAR
VALID = VAL
EXCEPTIONS
ARCHIVE_INFO_NOT_FOUND = 1
INVALID_PRINT_PARAMS = 2
INVALID_ARCHIVE_PARAMS = 3
OTHERS = 4.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT saprck60
TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
WITH FREE SELECTIONS texpr
VIA SELECTION-SCREEN
WITH ck_matnr = 'Z*' SIGN 'E'
WITH ck_werks = p_werks
WITH kalaid = wa_default-kalaid
WITH kaladat = sy-datum
WITH backgr = 'X'
VIA JOB name NUMBER number
AND RETURN .Hi,
Try this code
data : l_jobname TYPE tbtcjob-jobname,
l_jobcount TYPE tbtcjob-jobcount,
l_dest TYPE pri_params-pdest VALUE 'LOCL',
l_linsz TYPE pri_params-linsz VALUE '999999',
l_jobstatus TYPE tbtco-status,
l_rqident TYPE tsp01-rqident.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = l_jobname
IMPORTING
jobcount = l_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc EQ 0.
* Set default print parameters for Spool
CALL FUNCTION 'SET_PRINT_PARAMETERS'
EXPORTING
destination = l_dest
line_size = l_linsz.
SUBMIT saprck60
TO SAP-SPOOL DESTINATION l_dest
LINE-SIZE l_linsz
IMMEDIATELY 'X'
KEEP IN SPOOL 'X'
USER sy-uname VIA JOB l_jobname NUMBER l_jobcount
WITHOUT SPOOL DYNPRO
WITH SELECTION-TABLE p_sel_opts
AND RETURN.
IF sy-subrc EQ 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobcount
jobname = l_jobname
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.
ENDIF.
ENDIF.
* Check the Job status
DO.
CALL FUNCTION 'BDL_READ_JOB_STATUS'
EXPORTING
jobname = l_jobname
jobnumber = l_jobcount
IMPORTING
jobstatus = l_jobstatus
EXCEPTIONS
job_not_found = 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.
IF l_jobstatus EQ 'F'.
EXIT.
ENDIF.
ENDDO.
Regards,
Nagaraj
Maybe you are looking for
-
"Imagine we're using this class from a WAR, but that this class is also used within an EJB Jar in the same EAR. This class will have been loaded by the EJB class loader, and will be unable to load classes within the WAR. The solution is to provide th
-
Mail notification from recipient
Is there a way in 10.5.1 Mail for OS X that I can be notified when a recipient (s) has read an email that I have sent them? If not, is there a mail plugin or some kind of utility that will perform this action?
-
Make Net Value Field at item level Editable in Sales Order
Hi All pricing in our system are manual . So the client wants to change the Net Value Field in Credit and Debit Memo Request to be Editable ( Currently it is not modifiable) Plz suggest how to g about it. Do i need to use Userexit_ Field_ Modificatio
-
Subject: help! Problem is:i have to replace the biggest and the smallest element each column for inctance : 235 678 456 456 678 235 <?php $muut[0][0] = $HTTP_POST_VARS['n1']; //element value $muut[0][1] = $HTTP_POST_VARS['n2']; $muut[0][2] = $HTTP_PO
-
Using isAlive() and join(): problem
Hi, class NewThread implements Runnable { String name; Thread t; NewThread(String threadname) { name = threadname; t = new Thread(this, name); System.out.println("New Thread: " + t); t.start(); public void run() { try { for(int i = 5; i > 0; i--) { S