Problem in Submit Program in background
Hi Expert,
I have one progam which fetch the sales order data as per input selection and pass it to COOISPI T.Code.
Through the program
SUBMIT PPIO_ENTRY
USING SELECTION-SCREEN '1000'
WITH P_TCODE = 'COOISPI'
WITH P_AUTYP = '40'
USING SELECTION-SET 'SAP&COOISPI'
WITH SELECTION-TABLE rspar_tab
AND RETURN.
But when i schedule the job of program then it is not running.
Submit statement is running in background mode or not.
Is there any other way to doing this work.
HI ,
yes it works
You check the statement SY-BATCH ..
Or u can call the transaction and pass the values...
Please see the sample code :
Similar Messages
-
Handle submit program for background jobs in RFC FM to send email in ITS
Hi all
I am facing a problem in ITS, i.e. I have called a RFC Function Module on the page load event of one of the HTML template. In that FM I have used <b>submit program</b>. This RFC FM is working fine in background i.e. it is sending pdf as email to a particular email address
but in the frontend it is not responding.
I wanted to ask whether we can handle submit <program-name> in background job from ITS
<b>If you are unable to understand the problem i can share with you my code as well.</b>
Thanks
Ekta TuliHi Tobias
The Function Module <b>ZV_FUNC_CCK_EMAIL_PDF</b> is used to generate the email with pdf as attachement. it is generating email at backend but not in frontend.
thanks
ekta
please find the code below for the FM
FUNCTION zv_func_cck_email_pdf.
*"*"Local interface:
*" IMPORTING
*" VALUE(CONTRACT) LIKE VBAP-VBELN
*" VALUE(EMAIL) LIKE ADR6-SMTP_ADDR
*" EXPORTING
*" VALUE(RETURN) TYPE CHAR4
data: i_vbak like vbak .
DATA: v_cont(10) TYPE c.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = contract
IMPORTING
output = v_cont.
DATA: z_element(30) TYPE c.
DATA: gv_fb_addr_get_selection LIKE addr1_sel.
DATA: BEGIN OF mtab_contract OCCURS 0, "sap field
ordno(10), "vbeln (10)
terr(6),
vkorg LIKE vbak-vkorg,
vkgrp LIKE knvv-vkgrp,
repname(35),
repmailbox(10),
gueen(10), "expires dated -same as valid to
kunnr(10),
name1(35), "name1(35)
stras(35), "stras(35)
pstlz(10), "pstlz(10)
ort01(35), "ort01(35) city
regio(3), "regio(3)
kunnr2(10),
name2(35), "NUM?(35)
stras2(35), "stras(35)
pstlz2(10), "pstlz(10)
ort012(35), "ort01(35) city
regio2(3), "regio(3)
kit1 LIKE vbap-matnr, " currently 41315
kit1-qty(6), " like vbap-zmeng,
kit2 LIKE vbap-matnr, " currently 41316
kit2-qty(6), " like vbap-zmeng,
kit3 LIKE vbap-matnr, " currently 41317
kit3-qty(6), " like vbap-zmeng,
kit4 LIKE vbap-matnr, " currently 91869US
kit4-qty(6), " like vbap-zmeng,
med1 LIKE vbap-matnr, " currently 7408cp
med1-qty(6), " like vbap-zmeng,
med2 LIKE vbap-matnr, " currently 0211CP
med2-qty(6), " like vbap-zmeng,
med3 LIKE vbap-matnr, " currently 0578CP
med3-qty(6), " like vbap-zmeng,
med4 LIKE vbap-matnr, " currently 0068CP
med4-qty(6), " like vbap-zmeng,
med5 LIKE vbap-matnr, " currently 0069CP
med5-qty(6), " like vbap-zmeng,
med6 LIKE vbap-matnr, " currently other
dis6 LIKE makt-maktx, " currently other
med6-qty(6), " like vbap-zmeng,
med7 LIKE vbap-matnr, " currently other
dis7 LIKE makt-maktx, " currently other
med7-qty(6), " like vbap-zmeng,
med8 LIKE vbap-matnr, " currently other
dis8 LIKE makt-maktx, " currently other
med8-qty(6), " like vbap-zmeng,
med9 LIKE vbap-matnr, " currently other
dis9 LIKE makt-maktx, " currently other
med9-qty(6), " like vbap-zmeng,
med10 LIKE vbap-matnr, " currently other
dis10 LIKE makt-maktx, " currently other
med10-qty(6), " like vbap-zmeng,
END OF mtab_contract.
DATA: BEGIN OF mtab_material OCCURS 0,
ordno(10),
matnr LIKE vbap-matnr,
qty LIKE vbap-zmeng,
END OF mtab_material.
DATA: w-mm(4) VALUE ' MM '.
*SELECT-OPTIONS: s_vkorg FOR vbak-vkorg,
* s_vkgrp FOR knvv-vkgrp, "Sales Group
* s_terr FOR knvp-kunn2. "Territory Code
*PARAMETERS: p_parvw LIKE vbpa-parvw MEMORY ID par OBLIGATORY, "Partner ID
** DEFAULT 'Z1'.
* p_vbeln LIKE vbak-vbeln MEMORY ID aun,
* p_email LIKE adr6-smtp_addr MEMORY ID email. "Sales Document #
*SELECT-OPTIONS: "s_vbeln FOR vbak-vbeln MEMORY ID aun, "Sales Document #
* s_guebg FOR vbak-guebg, "Valid-From Date
* s_gueen FOR vbak-gueen, "Valid-To Date
* s_ship FOR vbpa-kunnr, "Ship-to customer
* s_bstzd FOR vbak-bstzd MEMORY ID bst ."DEFAULT 'CCK'. "P.O. # Supplement
DATA: i_otf TYPE STANDARD TABLE OF itcoo,
i_content_txt TYPE table of solisti1, "Content
i_content_bin TYPE solix_tab, "Content
i_content_bin1 TYPE solix_tab, "Content
i_objhead TYPE soli_tab,
w_pdf TYPE solisti1, "For PDF
w_res TYPE itcpp, "SAPscript output
w_otf TYPE itcoo, "For OTF
w_transfer_bin TYPE sx_boolean, "Content
prog(60).
data : t_obj_bin type standard table of solisti1.
DATA: w_arc_params LIKE arc_params,
w_pri_params LIKE pri_params.
*DATA: lcl_cls TYPE REF TO cl_gui_frontend_services.
CONSTANTS : c_x TYPE c VALUE 'X', "X
c_locl(4) TYPE c VALUE 'LOCL', "Local Printer
c_otf TYPE sx_format VALUE 'OTF', "OTF
c_pdf TYPE sx_format VALUE 'PDF', "PDF
c_printer TYPE sx_devtype VALUE 'PRINTER', "PRINTER
c_bin TYPE char10 VALUE 'BIN'. "BIN
DATA: v_name TYPE string ."Downloading File Name
DATA: v_len_in TYPE so_obj_len,
v_tempdir(50) TYPE c,
v_size TYPE i.
DATA : x_pdf_bag_tline TYPE rcl_bag_tline,
v_pdf_fsize TYPE i,
objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE,
doc_chng LIKE sodocchgi1,
tab_lines LIKE sy-tabix.
DATA : v_pnum LIKE usr21-persnumber,
v_anum LIKE usr21-addrnumber,
smtp_addr LIKE adr6-smtp_addr.
DATA: v_path TYPE string,
v_code TYPE i.
DATA : wa_obj_txt TYPE solisti1.
DATA : t_obj_txt TYPE STANDARD TABLE OF solisti1.
DATA : t_rec_list TYPE STANDARD TABLE OF somlreci1.
DATA : t_obj_pack TYPE STANDARD TABLE OF sopcklsti1.
DATA : wa_document_data TYPE sodocchgi1. "Mail data
DATA : wa_rec_list TYPE somlreci1.
DATA: reciever TYPE sadrud. "Email address of the receiver
DATA : wa_obj_pack TYPE sopcklsti1.
DATA: v_lines(10) TYPE n.
DATA: binfilesize TYPE i.
DATA : wa_obj_header TYPE solisti1.
DATA : t_obj_header TYPE STANDARD TABLE OF solisti1.
DATA : obj_id TYPE sofolenti1-object_id. "To send a file as attatchment
data: pdftab type table of tline with header line.
data : flag_sent_to_all type sonv-flag.
*START-OF-SELECTION.
* IF lcl_cls IS INITIAL.
* CREATE OBJECT lcl_cls.
* ENDIF.
CLEAR i_vbak.
SELECT * FROM vbak into i_vbak
WHERE
* guebg IN s_guebg AND "Valid-From Date
* gueen IN s_gueen AND "Valid-To Date
* vkorg IN s_vkorg AND
vbeln = v_cont AND
* AUART = 'LP ' AND "Converts to 'CO ' Scheduling A
auart = 'KM ' AND "Converts to 'CQ ' Qty contract
* VBTYP = 'E' AND "sales doc cat? JM
vbtyp = 'G' ."AND "sales doc cat "JM
* bstzd IN s_bstzd.
mtab_contract-kunnr = i_vbak-kunnr.
mtab_contract-ordno = i_vbak-vbeln.
mtab_contract-vkorg = i_vbak-vkorg.
WRITE i_vbak-gueen TO mtab_contract-gueen. "CHG014419
APPEND mtab_contract.
ENDSELECT.
LOOP AT mtab_contract.
* PERFORM get_contract. "CO sales orders line items
******Get Contract*********
* SELECT SINGLE kunnr "partner
* INTO vbpa-kunnr
* FROM vbpa
* WHERE vbeln EQ mtab_contract-ordno
* AND posnr EQ '000000'
* AND parvw EQ 'WE' "Ship-To's
* AND kunnr IN s_ship. "Ship-To ID added 04/01/99
* IF sy-subrc EQ 0 .
* MOVE vbpa-kunnr TO mtab_contract-kunnr2.
* MODIFY mtab_contract.
* ELSE.
* EXIT.
* ENDIF.
CLEAR knvp.
SELECT SINGLE kunn2 "territory
INTO knvp-kunn2
FROM knvp
WHERE kunnr EQ mtab_contract-kunnr2
AND vkorg EQ mtab_contract-vkorg
AND parvw EQ 'Z6'.
* AND kunn2 IN s_terr .
IF sy-subrc EQ 0 .
MOVE knvp-kunn2 TO mtab_contract-terr.
MODIFY mtab_contract.
ELSE.
EXIT.
ENDIF.
CLEAR kna1. "get rep name and mail box
SELECT SINGLE name2 FROM kna1 INTO (kna1-name2)
WHERE kunnr = knvp-kunn2.
IF sy-subrc EQ 0 .
SPLIT kna1-name2 AT w-mm INTO mtab_contract-repname
mtab_contract-repmailbox.
mtab_contract-repmailbox+3 = mtab_contract-repmailbox.
mtab_contract-repmailbox(3) = 'MM'.
MODIFY mtab_contract.
ENDIF.
CLEAR knvv.
SELECT SINGLE vkgrp
INTO knvv-vkgrp
FROM knvv
WHERE kunnr EQ knvp-kunn2
AND vkorg EQ mtab_contract-vkorg.
* AND vkgrp IN s_vkgrp.
IF sy-subrc EQ 0 .
MOVE knvv-vkgrp TO mtab_contract-vkgrp.
MODIFY mtab_contract.
ELSE.
EXIT.
ENDIF.
mtab_contract-med1-qty = '_______'.
mtab_contract-med2-qty = '_______'.
mtab_contract-med3-qty = '_______'.
mtab_contract-med4-qty = '_______'.
mtab_contract-med5-qty = '_______'.
mtab_contract-med6-qty = '_______'.
mtab_contract-med7-qty = '_______'.
mtab_contract-med8-qty = '_______'.
mtab_contract-med9-qty = '_______'.
mtab_contract-med10-qty = '_______'. "JM
mtab_contract-kit1-qty = '____'.
mtab_contract-kit2-qty = '____'.
mtab_contract-kit3-qty = '____'.
mtab_contract-kit4-qty = '____'.
mtab_contract-dis6 = 'OTHER _____________________'. "JM
mtab_contract-dis7 = 'OTHER _____________________'. "JM
mtab_contract-dis8 = 'OTHER _____________________'. "JM
mtab_contract-dis9 = 'OTHER _____________________'. "JM
mtab_contract-dis10 = 'OTHER _____________________'. "JM
* SELECT * FROM VBAP WHERE VBELN = MTAB_CONTRACT-ORDNO.
* IF VBAP-MATNR = '7408CP'.
* MTAB_CONTRACT-MED1 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '0211CP'.
* MTAB_CONTRACT-MED2 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '91865US'.
* MTAB_CONTRACT-MED3 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '0578CP'.
* MTAB_CONTRACT-MED4 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '0068CP'.
* MTAB_CONTRACT-MED5 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '0069CP'.
* MTAB_CONTRACT-MED6 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '92055CP'. "JM
* MTAB_CONTRACT-MED7 = VBAP-MATNR. "JM
* ELSEIF VBAP-MATNR = '90799CP'. "JM
* MTAB_CONTRACT-MED8 = VBAP-MATNR. "JM
* ELSEIF VBAP-MATNR = '41315'.
* MTAB_CONTRACT-KIT1 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '41316'.
* MTAB_CONTRACT-KIT2 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '41317'.
* MTAB_CONTRACT-KIT3 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '91869US'.
* MTAB_CONTRACT-KIT4 = VBAP-MATNR.
* ELSE.
* SELECT SINGLE MAKTX INTO MAKT-MAKTX
* FROM MAKT WHERE MATNR = VBAP-MATNR.
* ENDIF.
* MODIFY MTAB_CONTRACT.
* ENDSELECT.
MODIFY mtab_contract.
* IF.
** mtab_contract-terr IN s_terr AND
** mtab_contract-kunnr2 IN s_ship AND
** mtab_contract-vkgrp IN s_vkgrp.
** PERFORM get_address.
* ELSE.
* DELETE mtab_contract INDEX sy-tabix.
* ENDIF.
ENDLOOP.
SORT mtab_contract BY terr.
* PERFORM set_print_option.
* Print defaults should be immed and delete after print...
itcpo-tdimmed = ' '.
itcpo-tddelete = 'X'.
itcpo-tdnewid = 'X'.
itcpo-tdcopies = 1.
itcpo-tdnoprev = 'X'.
itcpo-tdgetotf = 'X'.
itcpo-tddest = 'LOCL'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = 'LOCL'
no_dialog = 'X'
IMPORTING
out_archive_parameters = w_arc_params
out_parameters = w_pri_params.
*exit if cancel chosen*
IF sy-subrc NE 0.
EXIT.
ENDIF.
sadr-regio = 'CA'.
sadr-pstlz = '92620'.
LOOP AT mtab_contract.
* PERFORM check-for-values.
IF mtab_contract-ordno = space.
mtab_contract-ordno = '___________'.
ENDIF.
IF mtab_contract-terr = space.
mtab_contract-terr = '______'.
ENDIF.
IF mtab_contract-repname = space.
mtab_contract-repname = '___________________________________'.
ENDIF.
IF mtab_contract-repmailbox = space.
mtab_contract-repmailbox = '__________'.
ENDIF.
IF mtab_contract-kunnr = space.
mtab_contract-kunnr = '__________'.
ENDIF.
IF mtab_contract-name1 = space.
mtab_contract-name1 = '___________________________________'.
ENDIF.
IF mtab_contract-stras = space.
mtab_contract-stras = '___________________________________'.
ENDIF.
IF mtab_contract-pstlz = space.
mtab_contract-pstlz = '__________'.
ENDIF.
IF mtab_contract-ort01 = space.
mtab_contract-ort01 = '___________________________________'.
ENDIF.
IF mtab_contract-regio = space.
mtab_contract-regio = '___'.
ENDIF.
IF mtab_contract-kunnr2 = space.
mtab_contract-kunnr2 = '__________'.
ENDIF.
IF mtab_contract-name2 = space.
mtab_contract-name2 = '___________________________________'.
ENDIF.
IF mtab_contract-stras2 = space.
mtab_contract-stras2 = '___________________________________'.
ENDIF.
IF mtab_contract-pstlz2 = space.
mtab_contract-pstlz2 = '__________'.
ENDIF.
IF mtab_contract-ort012 = space.
mtab_contract-ort012 = '___________________________________'.
ENDIF.
IF mtab_contract-regio2 = space.
mtab_contract-regio2 = '___'.
ENDIF.
* PERFORM open_form.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
dialog = ' '
form = 'ZREV_CCK_AGREMT'
language = sy-langu
OPTIONS = itcpo
EXCEPTIONS
canceled = 1
device = 2
form = 3
OPTIONS = 4
unclosed = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE e000(zz) WITH 'Open Form Error. ' sy-subrc.
ENDIF.
z_element = 'MAIN'.
* PERFORM write_form.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = z_element
EXCEPTIONS
element = 1
function = 2
type = 3
unopened = 4
unstarted = 5
window = 6
OTHERS = 7.
* PERFORM close_form.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = w_res
TABLES
otfdata = i_otf
EXCEPTIONS
unopened = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e000(zz) WITH 'Close Form Error. ' sy-subrc.
ENDIF.
*&---Convert OTF data to PDF data.
call function 'CONVERT_OTF'
exporting
format = 'PDF'
importing
bin_filesize = binfilesize
tables
otf = i_otf
lines = pdftab[].
data : name LIKE RLGRAP-FILENAME.
CONCATENATE 'C:Temp' mtab_contract-ordno '.pdf' INTO v_name.
*CALL FUNCTION 'DOWNLOAD'
* EXPORTING
* bin_filesize = v_size
* filename = name
* filetype = 'BIN'
* TABLES
* data_tab = pdftab[].
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = v_name
FILETYPE = 'BIN'
tables
data_tab = pdftab[].
* Downloading the PDF File
* CALL METHOD lcl_cls->gui_download
* EXPORTING
* bin_filesize = v_size
* filename = v_name
* filetype = c_bin
* CHANGING
* data_tab = pdftab[].
CALL METHOD cl_gui_cfw=>flush.
**Send PDF as Email.
* wa_obj_txt-line = 'CCK Contract Agreement'.
APPEND wa_obj_txt TO t_obj_txt.
CLEAR wa_obj_txt.
wa_obj_txt-line = 'Please find attatched PDF document for Contract'.
APPEND wa_obj_txt TO t_obj_txt.
CLEAR wa_obj_txt.
DESCRIBE TABLE t_obj_txt LINES tab_lines.
**Prepare document data
wa_document_data-obj_name = 'CCK Contract Agreement'.
wa_document_data-obj_descr = 'CCK Contract Agreement'.
wa_document_data-obj_langu = sy-langu.
wa_document_data-proc_type = 'R'.
wa_document_data-proc_name = 'CCK'.
wa_document_data-priority = c_x.
wa_document_data-obj_prio = c_x.
**Receiving list
wa_rec_list-receiver = sy-uname.
wa_rec_list-rec_type = 'B'.
wa_rec_list-com_type = 'INT'.
wa_rec_list-notif_del = c_x.
APPEND wa_rec_list TO t_rec_list.
CLEAR wa_rec_list.
wa_rec_list-receiver = '[email protected]'."p_email.
reciever = wa_rec_list-receiver.
wa_rec_list-rec_type = 'U'.
wa_rec_list-com_type = 'INT'.
wa_rec_list-notif_del = c_x.
APPEND wa_rec_list TO t_rec_list.
CLEAR wa_rec_list.
*Object packet
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
line_width_src = 134
line_width_dst = 255
TABLES
content_in = pdftab[]
content_out = t_obj_bin
EXCEPTIONS
err_line_width_src_too_long = 1
err_line_width_dst_too_long = 2
err_conv_failed = 3
OTHERS = 4
IF sy-subrc <> 0.
ENDIF.
DESCRIBE TABLE t_obj_bin LINES v_lines.
CLEAR wa_obj_pack-transf_bin .
wa_obj_pack-head_start = 1.
wa_obj_pack-head_num = 0.
wa_obj_pack-body_start = 1.
wa_obj_pack-body_num = tab_lines.
wa_obj_pack-doc_type = 'RAW'.
wa_obj_pack-doc_size = tab_lines * 255.
APPEND wa_obj_pack TO t_obj_pack.
CLEAR wa_obj_pack.
wa_obj_pack-transf_bin = 'X'.
wa_obj_pack-head_start = 1.
wa_obj_pack-head_num = 0.
wa_obj_pack-body_start = 1.
wa_obj_pack-body_num = v_lines.
wa_obj_pack-doc_type = 'PDF'.
wa_obj_pack-obj_name = 'ATTATCHMENT'.
wa_obj_pack-obj_descr = mtab_contract-ordno.
wa_obj_pack-doc_size = binfilesize.
APPEND wa_obj_pack TO t_obj_pack .
CLEAR wa_obj_pack.
**Object header
wa_obj_header-line = 'PDF'.
APPEND wa_obj_header TO t_obj_header.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_document_data
put_in_outbox = c_x
commit_work = c_x
IMPORTING
sent_to_all = flag_sent_to_all
new_object_id = obj_id
TABLES
packing_list = t_obj_pack
object_header = t_obj_header
contents_bin = t_obj_bin
contents_txt = t_obj_txt
receivers = t_rec_list
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.
IF sy-subrc <> 0.
else.
return = 'true'.
ENDIF.
ENDFUNCTION.
<b> Flow Editor</b>
<flow>
<state name="Start">
<module name="<b>ZV_FUNC_CCK_EMAIL_PDF</b>" type="RFC" stateful="1">
<inputmapping source="Contract" target="CONTRACT"/>
<inputmapping source="email" target="EMAIL"/>
</module>
<module name="ZV_FUNC_CCK_VALIDATE_SHIPTO" type="RFC" stateful="1">
<inputmapping source="SHIP_TO" target="KUNNR"/>
<inputmapping source="USERNAME" target="USER"/>
<outputmapping source="CITY" target="CITY"/>
<outputmapping source="NAME" target="NAME"/>
<outputmapping source="POSTAL" target="POSTAL"/>
<outputmapping source="REGION" target="REGION"/>
<outputmapping source="RETURN" target="RETURN"/>
<outputmapping source="SD_CITY" target="SD_CITY"/>
<outputmapping source="SD_NAME" target="SD_NAME"/>
<outputmapping source="SD_POSTAL" target="SD_POSTAL"/>
<outputmapping source="SD_REGION" target="SD_REGION"/>
<outputmapping source="SD_STREET" target="SD_STREET"/>
<outputmapping source="SOLDTO" target="SOLDTO"/>
<outputmapping source="STREET" target="STREET"/>
</module>
</state>
<event name="onLoad" next_state="Start"/>
<event name="Check2" next_template="ZV_CCO_CONFIRMED_ORDER"/>
</flow> -
Issue in submit program via background. data is not appearing in spool.
hi all,
i am submitting a program in bachground. the output data needs to be written in the spool.
when i try using my ID i am getting desired result. when others execute it it is going to printer instead of spool as they have default printers assigned to them. i tried defaulting print parameters to a dummy printer. still the problem is not solved.
please advice. the code is as follows......
print_parameters-PDEST = 'oooo'.
SUBMIT /pbs/riaufk20
WITH strno IN r_tplnr
WITH auart IN r_auart
WITH datuv EQ '19000101'
WITH datub EQ '99990101'
WITH pbs_apar EQ '3'
WITH dy_ofn EQ 'X'
WITH dy_his EQ 'X'
WITH dy_iar EQ 'X'
WITH dy_mab EQ 'X'
WITH variant EQ '/ZPM_POM_ORD'
TO SAP-SPOOL SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB v_jobname NUMBER v_number_l AND RETURN.print_parameters-PDEST = 'oooo'. dont mention the any thing related to print settings...
SUBMIT <zprg> WITH s_matnr = wmara-matnr
WITH s_werks = wmarc-werks
WITH p_diff = lv_diff
VIA JOB <Name> NUMBER lv_jcount
AND RETURN. -
Submit program in background job
Hi all.
Somehow I'm not able of using the following source code within a program executed within a scheduled job:
SUBMIT RFEBKA00 USING SELECTION-SET 'VAR1'.
The above program is the transaction FF_5.
Does any onetry to code in the below mentioned ...
use BATCH = 'X' option.
submit rfebka00 USING SELECTION-SET 'VAR1'
with batch = 'X' AND RETURN -
To run a program in BACKGROUND using SUBMIT
I need to run a program in background using the SUBMIT option. Here i have to pass an internal table form one program to another which will be used to update sales orders using BDC.
Questions
1} Can we execute a program in background using SUBMIT?
2} I am sending data to a MEMORY ID , if i run the program in background will the memory id work. As in do memory IDs work in the background.
Thanks in Advancerefer same thread.
Re: Problem with SUBMIT in Background -
Regarding SUBMIT statement - to process a program in background
Hi All,
I have issue of submitting a program in background and also i need to process the no of records come from program by splitting them by 1000(n).
First of all i have program whose code is like following:
<b>REPORT z_update_material_master.</b>
TYPES: BEGIN OF t_marc,
matnr LIKE marc-matnr, "Material Number
werks LIKE marc-werks, "Plant
beskz LIKE marc-beskz, "Procurement Type
sobsl LIKE marc-sobsl, "Special procurement type
fhori LIKE marc-fhori, "Scheduling Margin Key for Floats
dzeit LIKE marc-dzeit, "In-house production time
plifz LIKE marc-plifz, "Planned delivery time in days
webaz LIKE marc-webaz, "Goods rcpt processing time
pwwrk LIKE t460a-wrk02, "Production plant in planned order
erhor LIKE t436a-erhor, "Opening periodr
zlt TYPE p DECIMALS 3, "Total replenishment lead time
ztlt TYPE p DECIMALS 3, "Total replenishment lead time
wzeit TYPE p DECIMALS 3, "Total replenishment lead time
upd(1) TYPE c, "UPDATE INDICATER
ind TYPE c,
END OF t_marc.
DATA: i_marc TYPE SORTED TABLE OF t_marc INITIAL SIZE 0
WITH HEADER LINE
WITH NON-UNIQUE KEY matnr werks,
i_marc_rpt LIKE i_marc OCCURS 0 WITH HEADER LINE.
DATA: l_plantdata LIKE bapi_marc,
l_headdata LIKE bapimathead,
l_plantdatax LIKE bapi_marcx,
l_tabix LIKE sy-tabix.
CONSTANTS: c_s TYPE c VALUE 'S',
c_x TYPE c VALUE 'X'.
DATA i_temp_bapi_return LIKE bapi_matreturn2
OCCURS 0 WITH HEADER LINE.
DATA BEGIN OF i_temp_zppe0091_01 OCCURS 0.
INCLUDE STRUCTURE zppe0091_01.
DATA: END OF i_temp_zppe0091_01.
DATA: l_tab_nam LIKE rstable-tabname VALUE 'ZPPE0091_01'.
SELECT * FROM zppe0091_01
INTO CORRESPONDING FIELDS OF TABLE i_temp_zppe0091_01.
IF sy-subrc EQ 0.
LOOP AT i_temp_zppe0091_01 WHERE upd = c_x.
l_tabix = sy-tabix.
l_headdata-material = i_temp_zppe0091_01-matnr.
l_plantdata-plant = i_temp_zppe0091_01-werks.
l_plantdata-replentime = i_temp_zppe0091_01-wzeit.
l_plantdatax-replentime = c_x.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = l_headdata
plantdata = l_plantdata
plantdatax = l_plantdatax
TABLES
returnmessages = i_temp_bapi_return.
IF NOT i_temp_bapi_return[] IS INITIAL.
READ TABLE i_temp_bapi_return WITH KEY type = c_s.
IF sy-subrc EQ 0.
i_marc_rpt-matnr = i_temp_zppe0091_01-matnr.
i_marc_rpt-werks = i_temp_zppe0091_01-werks.
APPEND i_marc_rpt. CLEAR i_marc_rpt.
ELSE.
i_temp_zppe0091_01-upd = space.
MODIFY i_temp_zppe0091_01 INDEX l_tabix TRANSPORTING upd.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
Now i want to call this program from another program that is already exists by using <b>SUBMIT</b>
statement in background and i need to process this program by dividing records by <b>1000</b> into seperate session.
how can i do it. Can any body tell me the solution with syntax.
I might get lot of records from above program so i want to split them into diffrent sessions based on number of records(1000).
can any body give me the solution.
Thanks in advance.
Thanks & Regards,
Rayeez.Try implementing the following code. Use the code accordingly...
MOVE 100 TO c_recs_b4_split.
IF num_src_trans > c_recs_b4_split.
target_break = num_src_trans / p_thread.
ELSE.
target_break = num_src_trans + 1.
ENDIF.
wa_subbch = 1.
last_index = 1.
No batch split required if total recrods less than 100
IF num_src_trans < c_recs_b4_split.
CLEAR : range_btch.
REFRESH: range_btch.
IF wa_subbch = p_thread.
target_break = num_src_trans.
ENDIF.
MOVE 'S_SRCTRN' TO range_wa-selname.
MOVE 'S' TO range_wa-kind .
MOVE 'I' TO range_wa-sign .
MOVE 'EQ' TO range_wa-option .
LOOP AT itab_src_trans INTO st_src_trans.
MOVE st_src_trans-src_tran_id TO range_wa-low.
APPEND range_wa TO range_btch.
ENDLOOP.
Step 3 Submit the batch.
v_job_no = v_job_no + 1.
PERFORM submit_tp_jobs.
ELSE.
DO.
Step 1 Collect data for the target count
CLEAR : range_btch.
REFRESH: range_btch.
IF wa_subbch = p_thread.
target_break = num_src_trans.
ENDIF.
MOVE 'S_SRCTRN' TO range_wa-selname.
MOVE 'S' TO range_wa-kind .
MOVE 'I' TO range_wa-sign .
MOVE 'EQ' TO range_wa-option .
IF wa_subbch = p_thread.
target_break = num_src_trans - v_cnt .
ENDIF.
LOOP AT itab_src_trans INTO st_src_trans FROM last_index.
last_index = sy-tabix.
batch_total = batch_total + 1.
IF batch_total <= target_break.
MOVE st_src_trans-src_tran_id TO range_wa-low.
APPEND range_wa TO range_btch.
ELSE.
EXIT.
ENDIF.
v_cnt = v_cnt + 1.
ENDLOOP.
CLEAR batch_total.
Step 2 Submit the batch.
v_job_no = v_job_no + 1.
PERFORM submit_tp_jobs.
ADD 1 TO wa_subbch.
IF wa_subbch > p_thread.
EXIT.
ENDIF.
ENDDO.
ENDIF.
FORM submit_tp_jobs .
DATA : l_jobcount LIKE tbtcjob-jobcount,
l_jobrelease LIKE btch0000-char1,
w_job_flag VALUE 'X',
w_process_mode,
w_user_print_params LIKE pri_params.
l_jobname = p_batch.
CONCATENATE 'TP_' l_jobname '_' v_job_no INTO l_jobname.
CONDENSE l_jobname NO-GAPS.
w_process_mode = ' '.
IF NOT range_btch[] IS INITIAL.
PERFORM create_post_ctrl.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = l_jobname
IMPORTING
jobcount = l_jobcount.
SUBMIT zfi_pc_tran_proc
AND RETURN
WITH p_batch = p_batch
WITH p_jobid = p_jobid
WITH p_mode = w_process_mode
WITH p_subbch = wa_subbch
WITH p_jobq = p_jobid
WITH p_cntlmt = p_cntlmt
WITH p_tpiop = p_iop
WITH SELECTION-TABLE range_btch
USER sy-uname
VIA JOB l_jobname NUMBER l_jobcount
TO SAP-SPOOL
SPOOL PARAMETERS w_user_print_params
WITHOUT SPOOL DYNPRO.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobcount
jobname = l_jobname
strtimmed = 'X'
IMPORTING
job_was_released = l_jobrelease
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.
ENDIF.
ENDFORM. " submit_tp_jobs
Pl. add the points.... -
Using SUBMIT program command in Background
Hi,
I am submitting the program in Background using Submit<program> command.
Job is getting released but not fininishing(not executing the program) in ECC6.0.
Same program is working in fine in 4.5b.
Please let me know if any one faces this situation. Its very urgent.
Expecting the reply from you soon..
Thanks
Regards,
Raj AHi,
perhaps you or your admin have configured to less batch-workprocess or they are all configured only for A-class jobs.
Try to start the job as A-Class job. If the program is executed, then ask your administrator to configure more batch workprocess that are not reserved for A-class jobs.
Regards,
Stefan -
Problem with the selection screen in submit program
Hi Friends,
i am facing the problem wih the selection screen in submit program. in my Module pool program i am using the submit program statement, When i execute the program , The module program display the submit program selections creen.
I have implemented the code same as below.
submit ztest with tknum =p_tknum and return.
Can you pleaes help me how to avoid the submit program selection screen.
Thanks,
CharanHi Charan,
You have to give the selection screen values when you submit a job.
Press F1 on submit and you will see more details.
Here is an example from ABAP Documentation.
Program accessed
REPORT report1.
DATA text(10) TYPE c.
SELECTION-SCREEN BEGIN OF SCREEN 1100.
SELECT-OPTIONS: selcrit1 FOR text,
selcrit2 FOR text.
SELECTION-SCREEN END OF SCREEN 1100.
Calling program
REPORT report2.
DATA: text(10) TYPE c,
rspar_tab TYPE TABLE OF rsparams,
rspar_line LIKE LINE OF rspar_tab,
range_tab LIKE RANGE OF text,
range_line LIKE LINE OF range_tab.
rspar_line-selname = 'SELCRIT1'.
rspar_line-kind = 'S'.
rspar_line-sign = 'I'.
rspar_line-option = 'EQ'.
rspar_line-low = 'ABAP'.
APPEND rspar_line TO rspar_tab.
range_line-sign = 'E'.
range_line-option = 'EQ'.
range_line-low = 'H'.
APPEND range_line TO range_tab.
range_line-sign = 'E'.
range_line-option = 'EQ'.
range_line-low = 'K'.
APPEND range_line TO range_tab.
SUBMIT report1 USING SELECTION-SCREEN '1100'
WITH SELECTION-TABLE rspar_tab
WITH selcrit2 BETWEEN 'H' AND 'K'
WITH selcrit2 IN range_tab
AND RETURN.
Regards,
Jovito. -
I have a problem in processing the program in background
Hi,
We have cloned the T'code V_V2 and added some additional functionality and when we try to run the program in background the error is blocking the process
This is because, say example i am tring to process the sales order in production systen through my program ,in that time some one may chage the sales document . in trhis case my program should not blocked it should check the block before processing and then it should proceed.
is there any FM to find the blocked sales order.
Regards,
VijayTry using the FM:
ENQUE_READ2
Passing the follwing values:
GNAME --> VBAK (Sales Order header table)
GARG --> The lock argument
(This will be a combination of client number anb Sales Order No.
Eg: '3001210000054' where the first three digit i,e 300 is the client No
and 1210000054 is the sales order no.)
Regards,
Firoz. -
Call external program in background mode
Hi,
I am creating a PO using bapi BAPI_PO_CREATE1 in exit USEREXIT_SAVE_DOCUMENT_PREPARE.
I dont want to write the code in my exit. Instead I want to write the code in a Z program and call it in my exit.
My Problem.
How do I call my z program in my exit so that I can pass internal tables from my exit to the z program. Also I want to schedule the call of my external program for background processing.
I am trying with SUBMIT ZPROG AND RETURN. But not able to pass an internal table.
I tried PERFORM BAPI_PO_CREATE IN PRGRAM ZPROG, but in this case not able to schedule it in background.
Please advise.
Regards,
ShobhitHi Rich,
Im setting runtime error:
My Code in Exit: (xvbfa is the table which i wanna pass)
concatenate 'SERVICEPO' sy-datum into l_key.
export xvbfa = xvbfa
to shared buffer indx(st) id l_key.
My Code in the called program ZMM_SERVICE_PO
Runtime Errors CONNE_IMPORT_WRONG_OBJECT_TYPE
Exceptn CX_SY_IMPORT_MISMATCH_ERROR
Date and Time 05.12.2005 21:41:54
ShrtText
Error when attempting to IMPORT object "XVBFA".
What happened?
Error in ABAP application program.
The current ABAP program "ZMM_SERVICE_PO" had to be terminated because one of
the
statements could not be executed.
This is probably due to an error in the ABAP program.
When importing the object "XVBFA", the object in the
dataset had a different type from the target object in the program
"ZMM_SERVICE_PO" (object types: field, field string/structure, table).
table).
Error analysis
An exception occurred. This exception will be dealt with in more detail
below. The exception, assigned to the class 'CX_SY_IMPORT_MISMATCH_ERROR', was
not caught, which
led to a runtime error. The reason for this exception is:
The object "XVBFA" has a different object type in the dataset from
that in the target program "ZMM_SERVICE_PO". (Object types: Field, flat
structure,
deep structure, flat table, deep table).
Missing Handling of System Exception
Program ZMM_SERVICE_PO
Trigger Location of Exception
Program ZMM_SERVICE_PO
Include ZMM_SERVICE_PO
Row 43
Module Name START-OF-SELECTION
Source Code Extract
Line SourceCde
REPORT ZMM_SERVICE_PO.
DATA: l_poheader LIKE bapimepoheader.
DATA: l_poheaderx LIKE bapimepoheaderx.
DATA: l_poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE.
DATA: l_poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
DATA: l_cond LIKE BAPIMEPOCOND OCCURS 0 WITH HEADER LINE.
DATA: l_condx LIKE BAPIMEPOCONDX OCCURS 0 WITH HEADER LINE.
DATA: l_poschedule LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE.
DATA: l_poschedulex LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE.
DATA: l_purchaseorder LIKE bapimepoheader-po_number.
DATA: l_return TYPE BAPIRET2 OCCURS 0.
DATA: l_error_found TYPE c.
DATA: l_show_messages TYPE c.
DATA: l_eindt(10) TYPE c.
DATA: l_answer TYPE c.
DATA: l_VBAK TYPE STANDARD TABLE OF VBAK WITH HEADER LINE.
DATA: l_VBFA TYPE STANDARD TABLE OF VBFA WITH HEADER LINE.
DATA: xlips TYPE STANDARD TABLE OF LIPS WITH HEADER LINE.
*DATA: xvbfa TYPE STANDARD TABLE OF vbfa WITH HEADER LINE.
DATA xvbfa like vbfa.
DATA: l_key(60) type c.
concatenate 'SERVICEPO' sy-datum into l_key.
>>>>> import xvbfa = xvbfa
from shared buffer indx(st) id l_key.
delete from shared buffer indx(st) id l_key.
Could you help.
Regads,
Shobhit -
Hi all,
The following is the issue in submit program:
I am calling two programs /PBS/RIQMEL20 ( /pbs/iw59 ) and /PBS/RIAUFK20 ( /pbs/iw39 ) using submit programs in my z program.
I have created a layout /ZDEL56 for both programs. If I run submit program for /PBS/RIAUFK20 ( /pbs/iw39 ) I am getting the o/p in desired format ( As specified in the layout ).
How ever for program /PBS/RIQMEL20 ( /pbs/iw59 ) submit program is giving an error saying that layout is not found.
There is no difference b/w these two programs except that submitting program name is different.
The txn /pbs/iw59 when executed in background is giving the desired result. But when I try using submit program it is failing.
Can you please tell what mite be the problem?
Following is the sample piece of code.
submit /PBS/RIQMEL20
with pbs_apar EQ '1'
WITH VARIANT EQ '/ZDEL56'
Pointers will be highly appreciated.
Thanks,
Shiva.Hi,
In this case you need to use another internal table which is of type S_VBELN . Ex : it_vbeln.
In that you have to append the record
wa_vbeln-sign = 'I'
wa_vbeln-option = 'EQ'
wa_vbeln-low = w_inv.
append wa_vbeln to it_vbeln.
now use this
submit B VIA SELECTION-SCREEN
with P_DAYS = '4'
with P_KALSM = 'ZATCIN'
with S_VBELN = it_vbeln.
Now the new record will be appended with the values which are passing,. SO u wil have two rows in the S_VBELN.
Regards,
Venkatesh. -
How to run a program in background?
Hi abapers,
I want to run a program in background using sm36 and sm37.But i am not aware of input in that tansaction.So kindly tell me the steps ho run a program in background.
Regards
AnsumanHi Ansuman Parhi,
by useing T-codes
First go to transaction SM36 to schedule the job.
When you enter the "Start condition" for job, do as follow.
Select processing by "Date/Time".
Enter date as current date.
Let us say you are scheduling this job today then give date 08/30/2007.
Check "periodic job" checkbox.
Hit "periodic value" button and select to run "Daily"
Also have a look on below thread
Re: How to run program in background?
This is how to do it through code
data: lv_job_name like tbtco-jobname,
lv_job_nr like tbtco-jobcount,
lv_job_released type c,
lv_job_start_sofort type c,
lv_print_parameters type pri_params.
lv_job_name = 'Z_test'. " your background program name
call function 'JOB_OPEN'
exporting
jobname = lv_job_name
importing
jobcount = lv_job_nr
exceptions
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
others = 4.
if syst-subrc = 0.
*submit job with all the selection screen params...
submit (lv_job_name)
with applfile = applfile
with p_lines = p_lines
with rfc_dest = rfcdest
with p_selmtd = lv_selmtd
with px_shsim = px_shsim
with px_sherr = px_sherr
user syst-uname
via job lv_job_name number lv_job_nr and return.
if sy-subrc = 0.
call function 'JOB_CLOSE'
exporting
jobcount = lv_job_nr
jobname = lv_job_name
strtimmed = 'X'
importing
job_was_released = lv_job_released
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 syst-subrc 0.
message i162(00) with
'An error occured while closing the background job.'.
stop.
endif.
endif.
endif.
skip 1.
write: / 'Background process', lv_job_name ,
'called successfully' no-gap.
write: / 'You can check the job in transaction SM37'.
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7 -
Submitting program in Background - Very Urzent
Hi,
I am currently working in mySAPERP 2005 upgradation project.
Here i am facing a strange situation. I want to submit a SAP standard program SAPMV50S (Delivery due list creation) in my custom program in Background.
I tried below option:
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = JOBNAME
IMPORTING
JOBCOUNT = JOBNUMBER
EXCEPTIONS
CANT_CREATE_JOB = 01
INVALID_JOB_DATA = 02
JOBNAME_MISSING = 03
OTHERS = 99.
IF SY-SUBRC > 0.
<error processing>
ENDIF.
SUBMIT SAPMV50S WITH VSTEL = 'USCQ'
WITH LEDAB = SY-DATUM
TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
USER SY-UNAME
VIA JOB JOBNAME NUMBER JOBNUMBER
AND RETURN.
But program is not submitting in the background.
But same program is working in 4.5 b system, but it is not working in mySAPERP2005.
If anyone faced same kind of situation please help me on this.
Its very very very urzent.
Expecting the reply from you soooon.
Thanks,
Regards
RajRaj,
Debugg the background program .Then you will find the problem
Goto Tcode SM50--->select your process->on menubar Program/Session>program->Debugging
Don't forget to reward if useful.... -
Failed to Run OLE Excel program in background JOB (SM36)
Please help.
I have write a program to use OLE to create a Excel file.
The program can run successful in front end workstation. However, when I run the program in background job by SM36.
The statement "CREATE OBJECT EXCEL 'EXCEL.APPLICATION'" return with error "SY-SUBRC = 2".
How can I solve it ?
Can OLE Excel be run on background job ?
Thanks so much,
MarkHi Mark:
Your need is a very common one. I also was asked to generate an Excel in Background.
It is not possible to work with OLE in background mode.
The reason is: In background mode there is no presentation server. OLE is executed in presentation server.
Below I paste the code I wrote to solve my problem.
This class sends a mail with an excel attached. The Excel content will be the internal table you pass to the class. But the Excel is not binary, it is a plain text file, separated by tabulators. Anyway, when you open it with Excel, the columns are properly shown.
Sorry. Comments are in spanish, I don't have time to translate it.
I kindly ask to everybody which want to use it to keep my name in the code.
* Autor: Jordi Escoda, 30/10/2008.
* Descripción: Esta clase genera un correo electrónico destinado a
* una persona, adjuntando el contenido de una tabla interna como
* Excel (campos separados por tabuladores).
* La virtud de esta clase es su sencillez de utilización. Para lanzar
* el mail con el excel adjunto basta con declarar la tabla interna,
* llenarla, colocar el asunto del mensaje, el destinatario, el nombre
* del excel adjunto, y pasar la tabla interna.
* Ejemplo de utilización:
* DATA: lc_mail TYPE REF TO cl_mail_builder_xls_attach.
* DATA: lt_anla TYPE STANDARD TABLE OF anla.
* SELECT * INTO TABLE lt_anla FROM anla.
* CREATE OBJECT lc_mail.
* CALL METHOD lc_mail->set_subject( 'Excel adjunto' ).
* CALL METHOD lc_mail->set_recipient( 'XXX@XXXDOTCOM' ).
* CALL METHOD lc_mail->set_attach_filename( 'ANLA' ).
* APPEND 'Cuerpo del mensaje' TO lt_body.
* APPEND 'Saludos cordiales' TO lt_body.
* CALL METHOD lc_mail->set_bodytext( lt_body ).
* CALL METHOD lc_mail->set_attach_table( lt_anla ).
* CALL METHOD lc_mail->send( ).
* CLASS cl_mail_builder_xls_attach DEFINITION
CLASS cl_mail_builder_xls_attach DEFINITION.
PUBLIC SECTION.
METHODS: set_subject
IMPORTING im_subject TYPE so_obj_des,
set_bodytext
IMPORTING im_body TYPE bcsy_text,
set_recipient
IMPORTING im_recipient TYPE ad_smtpadr,
set_attach_table
IMPORTING im_table TYPE ANY TABLE,
set_attach_filename
IMPORTING im_attach_name TYPE sood-objdes,
send.
PRIVATE SECTION.
CONSTANTS:
c_tab TYPE c VALUE cl_bcs_convert=>gc_tab,
c_crlf TYPE c VALUE cl_bcs_convert=>gc_crlf,
c_singlequote TYPE c VALUE '.
DATA: l_recipient_addr TYPE ad_smtpadr.
DATA: send_request TYPE REF TO cl_bcs,
document TYPE REF TO cl_document_bcs,
recipient TYPE REF TO if_recipient_bcs,
bcs_exception TYPE REF TO cx_bcs.
DATA: binary_content TYPE solix_tab,
size TYPE so_obj_len.
DATA: l_string TYPE string,
l_body_text TYPE bcsy_text,
l_subject TYPE so_obj_des,
l_attach_name TYPE sood-objdes.
METHODS: create_binary_content,
get_dataelement_medium_text
IMPORTING im_table_name TYPE tabname
im_field_name TYPE fieldname
EXPORTING ex_medium_text TYPE scrtext_m.
ENDCLASS. "cl_mail_builder_xls_attach DEFINITION
* CLASS cl_mail_builder_xls_attach IMPLEMENTATION
CLASS cl_mail_builder_xls_attach IMPLEMENTATION.
METHOD set_bodytext.
l_body_text[] = im_body[].
ENDMETHOD. "add_bodytext
METHOD set_subject.
l_subject = im_subject.
ENDMETHOD. "add_subject
METHOD set_attach_filename.
l_attach_name = im_attach_name.
ENDMETHOD. "add_subject
METHOD set_recipient.
l_recipient_addr = im_recipient.
ENDMETHOD. "add_subject
METHOD set_attach_table.
* Rellena en un string el contenido de la tabla interna recibida
DATA: ref_to_struct TYPE REF TO cl_abap_structdescr.
DATA: my_like TYPE fieldname,
nombretabla TYPE tabname,
nombrecampo TYPE fieldname,
texto_mediano TYPE scrtext_m.
DATA: l_idx TYPE i,
l_valorcampo(16) TYPE c,
l_long TYPE i.
FIELD-SYMBOLS: <fs_linea> TYPE ANY,
<fs_campo> TYPE ANY.
FIELD-SYMBOLS: <comp_descr> TYPE abap_compdescr.
CHECK NOT im_table[] IS INITIAL.
* Línea con los nombres de las columnas.
CLEAR l_string.
LOOP AT im_table ASSIGNING <fs_linea>.
* Toma los atributos del componente
ref_to_struct =
cl_abap_structdescr=>describe_by_data( <fs_linea> ).
LOOP AT ref_to_struct->components ASSIGNING <comp_descr>.
ASSIGN COMPONENT <comp_descr>-name
OF STRUCTURE <fs_linea> TO <fs_campo>.
* Obtenemos el origen de donde proviene (like). Ej:BKPF-BUDAT
DESCRIBE FIELD <fs_campo> HELP-ID my_like.
SPLIT my_like AT '-' INTO nombretabla nombrecampo.
CALL METHOD get_dataelement_medium_text
EXPORTING
im_table_name = nombretabla
im_field_name = nombrecampo
IMPORTING
ex_medium_text = texto_mediano.
IF texto_mediano IS INITIAL.
CONCATENATE l_string <comp_descr>-name INTO l_string.
ELSE.
CONCATENATE l_string texto_mediano INTO l_string.
ENDIF.
AT LAST.
CONCATENATE l_string c_crlf INTO l_string.
EXIT.
ENDAT.
CONCATENATE l_string c_tab INTO l_string.
ENDLOOP.
EXIT.
ENDLOOP.
* Contenido de la tabla
LOOP AT im_table ASSIGNING <fs_linea>.
* Toma los atributos del componente
ref_to_struct =
cl_abap_structdescr=>describe_by_data( <fs_linea> ).
LOOP AT ref_to_struct->components ASSIGNING <comp_descr>.
* Asignamos el componente ue tratamos, para obtener
* el valor del mismo
ASSIGN COMPONENT <comp_descr>-name OF STRUCTURE <fs_linea>
TO <fs_campo>.
CASE <comp_descr>-type_kind.
WHEN 'P'. "Packed Number
* Convierte a caracter
WRITE <fs_campo> TO l_valorcampo.
CONCATENATE l_string l_valorcampo INTO l_string.
WHEN OTHERS.
l_long = STRLEN( <fs_campo> ).
IF l_long > 11 AND <fs_campo> CO ' 0123456789'.
* El Excel muestra un número tal como 190000000006
* en formato 1,9E+11.
* Para eviarlo, los números de más de 11 dígitos los
* concatenamos con comillas simples.
CONCATENATE l_string c_singlequote
<fs_campo> c_singlequote INTO l_string.
ELSE.
CONCATENATE l_string <fs_campo> INTO l_string.
ENDIF.
ENDCASE.
AT LAST.
* Añade CRLF
CONCATENATE l_string c_crlf INTO l_string.
EXIT.
ENDAT.
* Añade tabulador
CONCATENATE l_string c_tab INTO l_string.
ENDLOOP.
ENDLOOP.
create_binary_content( ).
ENDMETHOD. "set_attach_table
METHOD create_binary_content.
DATA: l_size TYPE so_obj_len.
* convert the text string into UTF-16LE binary data including
* byte-order-mark. Mircosoft Excel prefers these settings
* all this is done by new class cl_bcs_convert (see note 1151257)
TRY.
cl_bcs_convert=>string_to_solix(
EXPORTING
iv_string = l_string
iv_codepage = '4103' "suitable for MS Excel, leave empty
iv_add_bom = 'X' "for other doc types
IMPORTING
et_solix = binary_content
ev_size = size ).
CATCH cx_bcs.
MESSAGE e445(so).
ENDTRY.
ENDMETHOD. "create_binary_content
METHOD send.
DATA: l_sent_to_all TYPE os_boolean.
TRY.
* create persistent send request
send_request = cl_bcs=>create_persistent( ).
* create and set document with attachment
* create document object
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = l_body_text
i_subject = l_subject ).
* add the spread sheet as attachment to document object
document->add_attachment(
i_attachment_type = 'xls'
i_attachment_subject = l_attach_name
i_attachment_size = size
i_att_content_hex = binary_content ).
* add document object to send request
send_request->set_document( document ).
* add recipient (e-mail address)
recipient =
cl_cam_address_bcs=>create_internet_address(
l_recipient_addr ).
* add recipient object to send request
send_request->add_recipient( recipient ).
* send document
l_sent_to_all = send_request->send(
i_with_error_screen = 'X' ).
COMMIT WORK.
IF l_sent_to_all IS INITIAL.
MESSAGE i500(sbcoms) WITH l_recipient_addr.
ELSE.
MESSAGE s022(so).
ENDIF.
CATCH cx_bcs INTO bcs_exception.
MESSAGE i865(so) WITH bcs_exception->error_type.
ENDTRY.
ENDMETHOD. "lcl_mail_xls_attachment
METHOD get_dataelement_medium_text.
DATA: lt_fld_info TYPE STANDARD TABLE OF dfies,
wa_fld_info TYPE dfies.
* Busca en el diccionario los datos del campo
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = im_table_name
fieldname = im_field_name
langu = sy-langu
TABLES
dfies_tab = lt_fld_info
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
CLEAR ex_medium_text.
IF sy-subrc = 0.
READ TABLE lt_fld_info INDEX 1 INTO wa_fld_info.
* Si lo ha podido tomar del diccionario...
IF NOT wa_fld_info-scrtext_m IS INITIAL.
* Toma el nombre del nombre de campo del diccionario
ex_medium_text = wa_fld_info-scrtext_m.
ENDIF.
ENDIF.
ENDMETHOD. "get_dataelement_medium_text
ENDCLASS. "cl_mail_builder_xls_attach IMPLEMENTATION -
Whenever I connect to the iTunes store i receive an error message "iTunes has stopped working. A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available." This causes iTunes to close. I am using iTunes version 10.5.0.142 on a Windows Vista (64) PC. I have reinstalled iTunes selecting the "repair" option and also uninstalled and reinstalled iTunes. Any help will be deeply appreciated. Thank you. Below is the result of the diagnositc.
Microsoft Windows 7 x64 Home Premium Edition Service Pack 1 (Build 7601)
HP-Pavilion BN474AV-ABA HPE-150t
iTunes 10.5.0.142
QuickTime not available
FairPlay 1.13.35
Apple Application Support 2.1.5
iPod Updater Library 10.0d2
CD Driver 2.2.0.1
CD Driver DLL 2.1.1.1
Apple Mobile Device 4.0.0.96
Apple Mobile Device Driver 1.57.0.0
Bonjour 3.0.0.10 (333.10)
Gracenote SDK 1.9.3.494
Gracenote MusicID 1.9.3.106
Gracenote Submit 1.9.3.136
Gracenote DSP 1.9.3.44
iTunes Serial Number 002FAD94098CD0E0
Current user is not an administrator.
The current local date and time is 2011-11-13 22:08:54.
iTunes is not running in safe mode.
WebKit accelerated compositing is enabled.
HDCP is not supported.
Core Media is supported.
Video Display Information
NVIDIA, NVIDIA GeForce GT 220
**** External Plug-ins Information ****
No external plug-ins installed.
Genius ID: 2cb3fff3fa771d265b0f8ffdcca13b55
**** Network Connectivity Tests ****
Network Adapter Information
Adapter Name: {F4A2029C-16AA-4BDF-8DB7-9EC2A75B5991}
Description: Realtek PCIe GBE Family Controller
IP Address: 192.168.1.6
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.1.1
DHCP Enabled: Yes
DHCP Server: 192.168.1.1
Lease Obtained: Sun Nov 13 21:09:29 2011
Lease Expires: Mon Nov 14 21:09:29 2011
DNS Servers: 192.168.1.1
Active Connection: LAN Connection
Connected: Yes
Online: Yes
Using Modem: No
Using LAN: Yes
Using Proxy: No
SSL 3.0 Support: Enabled
TLS 1.0 Support: Disabled
Firewall Information
Windows Firewall is on.
iTunes is NOT enabled in Windows Firewall.
Connection attempt to Apple web site was successful.
Connection attempt to browsing iTunes Store was successful.
Connection attempt to purchasing from iTunes Store was successful.
Connection attempt to iPhone activation server was successful.
Connection attempt to firmware update server was successful.
Connection attempt to Gracenote server was successful.
Last successful iTunes Store access was 2011-11-13 22:02:08.
**** CD/DVD Drive Tests ****
LowerFilters: PxHlpa64 (2.0.0.0),
UpperFilters: GEARAspiWDM (2.2.0.1),
E: hp DVD A DH16ABLH, Rev 3HD9
Data or MP3 CD in drive.
Found 1 songs on CD, playing time 15:40 on CDROM media.
Track 1, start time 00:02:00
Get drive speed succeeded.
The drive CDR speeds are: 8 16 24 32.
The drive CDRW speeds are: 8.
The drive DVDR speeds are: 8.
The drive DVDRW speeds are: 8.
The last failed audio CD burn had error code 4251(0x0000109b). It happened on drive E: hp CDDVDW TS-H653R on CDR media at speed 24X.
**** Device Connectivity Tests ****
iPodService 10.5.0.142 (x64) is currently running.
iTunesHelper 10.5.0.142 is currently running.
Apple Mobile Device service 3.3.0.0 is currently running.
Universal Serial Bus Controllers:
Intel(R) 5 Series/3400 Series Chipset Family USB Enhanced Host Controller - 3B34. Device is working properly.
Intel(R) 5 Series/3400 Series Chipset Family USB Enhanced Host Controller - 3B3C. Device is working properly.
FireWire (IEEE 1394) Host Controllers:
VIA 1394 OHCI Compliant Host Controller. Device is working properly.
Connected Device Information:
Bruce's iTouch, iPod touch (2nd generation) running firmware version 4.2.1
Serial Number: 1C9053CC201
**** Device Sync Tests ****
Sync tests completed successfully.Same exact thing with me. And no help from apple. Just dropped nearly $600 and cannot get a decent working setup.
Apple's only suggestion was to uninstall iTunes and Quicktime, and re-install... of course (the I.T. Crowd tactic).
The crash happens only on iTunes store access.
Maybe you are looking for
-
Make a "best of" DVD from other iDVD projects
I'm archiving old family-movie VHS tapes into iMovie, and then burning them with iDVD. No fancy menus, chapters, or effects. Once I am finished and have all the iDVD's, can I get video clips from them back into iMovie to make a single movie with the
-
My iPad was stolen, how can I have it blocket and/or send to the iPad a message to get it back
-
Hi, I would like to add 'Date of Joining' in the payslip. I am using PE51. Any idea about how o do this? Thanks
-
iPad 2 unit dropping the wireless signal. A reset did not fix the issue. It does get the signal but keep dropping signal 2 or 3 times in 10 minutes. Can not connect to safari or app store.
-
Hi, I have a WSDL which has multiple messages with their individual requests and responses. Is it possible to publish this WSDL as a webservice in the service registry? I tried doing it but the publish option in the service interface is greed out eve