Executing a program in background is failed
Hi Experts,
i am having a program while executing it in foreground its executing perfectly but while executing it in background, it is failed in job log its showing: this error:-Control Framework: Fatal error - GUI cannot be reached
ABAP/4 processor: RAISE_EXCEPTION.
While debugging i found the job is getting canceled at the statement
SUBMIT rs_display_variant WITH SELECTION-TABLE i_params
EXPORTING LIST TO MEMORY
AND RETURN.
RS_DISPLAY_VARIANT is not executimg while executing it in background. So if anybody knows how to resolve this or what i need to use instead of RS_DISPLAY_VARIANT . Please let me know.
Thanks
Hi,
Use Offline method of CL_GUI_ALV_GRID
Refer following documentation of the method.
http://help.sap.com/saphelp_nw70/helpdata/EN/bf/3bd1369f2d280ee10000009b38f889/frameset.htm
Regards,
Mohaiyuddin
Similar Messages
-
Executing the program in Background
Hi experts i'm trying to Execute the Program in background.
Given the Input and output file locations and Press F9 for process the program in background from SE38. cause i want to run my program as a batch(Background)
but its not accepting. can you please help me how to resolve this issue.
i'm providing the code can you please verify that.
Many Thanks
SELECTION-SCREEN *
selection-screen begin of block b1 with frame title text-001.
*.. Filename
PARAMETERS: f_name TYPE char100, "Upload filename
d_name TYPE char100. " Download filename
selection-screen end of block b1 .
SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: p_serv radiobutton group RAD1,
p_frnt radiobutton group RAD1 default 'X'.
SELECTION-SCREEN: END OF BLOCK b2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR f_name.
*.. Data Declaration
DATA: lt_file TYPE filetable,
lv_file TYPE LINE OF filetable,
rc_i TYPE i,
cl_gui TYPE REF TO cl_gui_frontend_services,
w_path LIKE dxfields-longpath.
*.. Check if from server or frontend
IF p_frnt = 'X'.
*.. Create objects for method
CREATE OBJECT cl_gui.
*.. Clear the filename
CLEAR f_name.
*.. Call method to search for file
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Choose Input File'
CHANGING
file_table = lt_file
rc = rc_i
EXCEPTIONS
OTHERS = 4.
*.. Check if file found
IF sy-subrc EQ 0.
*.. Check that file path not empty
CHECK NOT lt_file[] IS INITIAL.
LOOP AT lt_file INTO lv_file.
*.. Set parameter to filename
f_name = lv_file-filename.
ENDLOOP.
ENDIF.
*.. Free object
FREE cl_gui.
*.. Upload from Server
ELSE.
Retrieve filename
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
i_location_flag = 'A'
i_server = ' '
i_path = '/sap_ftp/'
filemask = '**'
fileoperation = 'R'
IMPORTING
O_LOCATION_FLAG =
O_SERVER =
o_path = w_path
ABEND_FLAG =
EXCEPTIONS
rfc_error = 1
error_with_gui = 2
OTHERS = 3.
Set file path
f_name = w_path.
ENDIF.
*.. File selection for output file
AT SELECTION-SCREEN ON VALUE-REQUEST FOR d_name.
*.. Only allow search for front-end
IF p_frnt = 'X'.
*.. Data Declaration
DATA: lt_file TYPE filetable,
lv_file TYPE LINE OF filetable,
rc_i TYPE i,
cl_gui TYPE REF TO cl_gui_frontend_services.
*.. Create objects for method
CREATE OBJECT cl_gui.
*.. Clear the filename
CLEAR d_name.
*.. Call method to search for file
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Choose Input File'
CHANGING
file_table = lt_file
rc = rc_i
EXCEPTIONS
OTHERS = 4.
*.. Check if file found
IF sy-subrc EQ 0.
*.. Check that file path not empty
CHECK NOT lt_file[] IS INITIAL.
LOOP AT lt_file INTO lv_file.
*.. Set parameter to filename
d_name = lv_file-filename.
ENDLOOP.
ENDIF.
*.. Free object
FREE cl_gui.
ENDIF.
*.. General Checks for Selection screen
AT SELECTION-SCREEN.
*.. Check if program run in batch mode and ping directory
IF sy-batch = 'X'.
*.. Move filename to file_name
file_name = d_name.
*.. Check if path can be reached
OPEN DATASET file_name FOR INPUT IN TEXT MODE.
IF sy-subrc NE 0.
MESSAGE e082(zsomerfield).
ENDIF.
ENDIF.
NITIALIZATION.
*.. ALV Variables
variant_save = 'A'.
w_repid = sy-repid.
w_variant_handle = c_handl.
START-OF-SELECTION *
START-OF-SELECTION.
*.. Check if batch program running in batch mode or not
IF sy-batch = 'X'.
*.. Open file on application server for reading
OPEN DATASET file_name FOR INPUT IN TEXT MODE.
DO.
*.. Upload entries
READ DATASET file_name INTO zpernr.
*.. IF end of file reached then exit DO statement
IF sy-subrc = '4'.
EXIT.
ELSE.
*.. IF entry found then add to employee table
in_file-empnum = zpernr.
*.. Add entries to table
APPEND: in_file.
*.. Clear header lines
CLEAR: in_file, zpernr.
ENDIF.
ENDDO.
*.. Close dataset
CLOSE DATASET file_name.
*.. Get file from frontend and run in foreground
ELSE.
*.. Upload from local machine.
DATA: file_name TYPE string. "LIKE rlgrap-filename,
*.. Set filename to filename from screen
file_name = f_name.
*.. Upload the information from the file into the table in_file
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
TABLES
data_tab = in_file
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
*.. Make sure file uploaded correctly
IF sy-subrc <> 0.
MESSAGE E018(ZHR_MESSAGES).
ELSE.
MESSAGE i017(ZHR_MESSAGES).
ENDIF.
ENDIF.Hi Vamsi,
<b>First Check in the Foreground your program is working for the application server file or not</b>
When you will Execute your program in Background internal table "ZPERNR" will be populated from the file that is there on the application server.
After that what you want to do with the internal table.I think you have not sent the whole code.
In background FM GUI_UPLOAD willl not work.
If you want to debug your code put wait for 100 seconds at the place where you want to dubug your code.Go to transaction code SM50 your job will be running there.
Select Your job
Go to Menu Bar Program/Mode - > program - > Debugging.
In this way you can debug your code.
First Check in the Foreground your program is working for the application server file or not -
BDC is not working in when executing the program in background
Hi gurus,
I have a problem that in BDC is not working when i'm executing the upload program in background thru scheduling(SM36) , while it works fine when i execute directly with NO screen display modeMany transactions behave differently when executed in foreground and background. The fields on the screen may be different.
In transaction SHBD when starting a recording there is a checkbox where you can select 'Simulate Background Mode'. If you do your recording using this option you will get the code suitable for background mode. If you do not select this option you will get a code for foreground mode.
By compairing the two codes you will know the changes required for background mode.
Hope this helps you -
Error in executing a program in background?
Hi all,
I have one report , which is alv grid display using Oops.
it is going to be executed in online but when we are try to execute this in background through path
Program->Execute in background.
the job is going to be canceled with error "Control Framework: Fatal error - GUI cannot be reached" and also i am getting one popup message like " format set to x_65_132"
how can we rectify this error , what we have to code in program to overcome this problem.....
thanks in advanceHi,
1)Goto SM36,
2)Enter all the options
3)Click step,
4)If the job is being scheduled to run an ABAP program, follow the directions mentioned below. Else, jump to Step 5.
Fill the User field . This is very important, Put the program name in the NAME field,Put the variant name in the VARIANT field and save.
5)If the job executes an external command, then follow the steps below:Click on External Command and fill the fields and click save.
Reward if useful -
Need to execute a program in background
Hello,
I have a report program that has a checkbox option to 'Execute in background'. This should also generate a spool file in SAP. I would just like to ask for options on how to do about this.
I have thought of using the SUBMIT command and I read that this command can also generate a spool file. So it is like calling the program itself. Is this possible? Or do I need to make a cloned program and call submit the parameters to the cloned program?
Is there a function module that does this?
I'd appreciate your help on this. Thanks in advance!
Regards,
KristineHello,
To create a Job Step, the FM 'JOB_OPEN' could be used.
To add a JOBSTEP, In your case an ABAP program, "SUBMIT" could be used.
To close the job step, use FM "JOB_CLOSE".
SAMPLE Code:
CALL FUNCTION 'JOB_OPEN'
EXPORTING
DELANFREP = ' '
JOBGROUP = ' '
jobname = 'XYZ'
sdlstrtdt = sy-datum "Current date
sdlstrttm = sy-uzeit
IMPORTING
jobcount = g_jobcount
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.
SUBMIT z_PROGRAM AND RETURN
USER sy-uname " User for runtime authorizations
WITH p_para EQ p_para
"..... Selection screen parameters
VIA JOB g_jobname NUMBER g_jobcount
" Job name and job number
" from JOB_OPEN
TO SAP-SPOOL " Print and archiving options from
" GET_PRINT_PARAMETERS
" Both sets of options come from
" GET_PRINT_PARAMETERS
SPOOL PARAMETERS g_s_user_print_params
ARCHIVE PARAMETERS g_s_user_arc_params
WITHOUT SPOOL DYNPRO.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
AT_OPMODE = ' '
AT_OPMODE_PERIODIC = ' '
CALENDAR_ID = ' '
EVENT_ID = ' '
EVENT_PARAM = ' '
EVENT_PERIODIC = ' '
jobcount = g_jobcount
jobname = g_jobname
LASTSTRTDT = NO_DATE
LASTSTRTTM = NO_TIME
PRDDAYS = 0
PRDHOURS = 0
PRDMINS = 0
PRDMONTHS = 0
PRDWEEKS = 0
PREDJOB_CHECKSTAT = ' '
PRED_JOBCOUNT = ' '
PRED_JOBNAME = ' '
sdlstrtdt = g_datum
sdlstrttm = g_uzeit
STARTDATE_RESTRICTION = BTC_PROCESS_ALWAYS
STRTIMMED = ' '
TARGETSYSTEM = ' '
START_ON_WORKDAY_NOT_BEFORE = SY-DATUM
START_ON_WORKDAY_NR = 0
WORKDAY_COUNT_DIRECTION = 0
RECIPIENT_OBJ =
TARGETSERVER = ' '
IMPORTING
job_was_released = g_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
You can get the Print Parameters from FM: 'GET_PRINT_PARAMETERS'.
All the above FMs have detailed documentation which will help you.
Hope this helps you.
Regards, Murugesh AS -
Program in background mode failed
I have developed an customized report which basically uploads a file from server and perform computation against the data in SAP.
Tested ok when executed normally. But it fails to upload file when its set to background job.
Used 'Open Dataset'
Please advice.CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = ZFNAME
FILETYPE = 'ASC'
IMPORTING
FILELENGTH = RC
TABLES
DATA_TAB = ITAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0 .
DATA: LEN TYPE I.
CLEAR ZLINE.
OPEN DATASET ZFNAME IN TEXT MODE.
IF SY-SUBRC = 0.
DO.
READ DATASET ZFNAME INTO ZLINE LENGTH LEN.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
ITAB-LINE = ZLINE.
APPEND ITAB. CLEAR ITAB.
ENDDO.
ENDIF.
CLOSE DATASET ZFNAME.
ENDIF.
IF ITAB[] IS INITIAL .
ERR-FDATE = SDATE.
ERR-REMARKS = "unable to find file".
APPEND ERR.
ENDIF.
This is the portion for uploading the file.
Anyway to debug when in backgroud? -
Executing a program in background is not creating spool
Hi all,
I am facing a small problem with one of the program. Below are the details.
Its a simple program of uploading file from local machine and displaying the output. when I am running in foreground, the contents of file are copied into internal table and getting displayed in List.
Where as when I run background, No spool is getting created. Also I found that, the internal table is getting cleared. I have put an IF NOT INITIAL check and found that, Internal table is getting cleared and error message is written in the spool .
There is no problem with file upload in background or foreground.
Please advise.Hi
What you means with "uploading file from local machine":
- Presentation Server or Application Server?
If u're using the fm as GUI_UPLOAD or WS_UPLOAD in order to upload the data from a file of Presentation Server u should consider those fms work foreground only.
So how do u upload the file?
Max -
How to create a variant and execute a Z-program in background
Hello,
I have created a specific transaction to update relationships between partners (BP).
For this i have create a screen painter, but as the run time is long i want to execute the program in background.
How to save a variant and to execute the report in background ?
Thanks in advance
ChristopheHi,
Please go to your z-transaction.
Enter your selection criteria. & click on save button to save your your selection criteria as a variant.
Now go to tcode SM36 to shedule your program with saved variant.
Regards,
Narendra -
Executing 4 programs parallely via main program in background
I am executing a program in background and that program internally calls 4 other programs. I want to execute those 4 programs at the same time (concurrently).
Please suggest.
Regards,
Rajendra DhakaRefer:
http://help.sap.com/saphelp_nw04/helpdata/en/fa/096e92543b11d1898e0000e8322d00/content.htm
http://help.sap.com/saphelp_nw70/helpdata/EN/c4/3a7f1f505211d189550000e829fbbd/content.htm
Edited by: AJAY TIWARI on Nov 15, 2008 7:33 AM -
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 -
Require Job name in SM37 while executing call transaction in background
Hi all,
I am executing a report program, which contains Call transaction.
I have recorded properly. The recording contains background job screen also ( means a separate popup came and i gave the job name and i gave immediately )
When i execute in this program in foreground its creating job,its showing the job in sm37.
But when i execute this program in background, it does not showing the job name in sm37.
Anyone kindly help this out?
AnandhabHi,
The job will be created by the step level user.
Try searching again with jobname and * for username.
Regards,
Jovito -
Running BDC program in background for the transaction VL02N
Hi All,
I have coded a BDC program (call transaction method) for the transaction code VL02N. I can able to run the program manually & successfully. But if I execute the program in background(SM36), it is going to dump giving CNTL_ERROR.
Note: I am not using any of the GUI_UPLOAD, GUI_DOWNLOAD funciton modules in the program. But I am using the FTP command funtion modules like( FTP_COMMAND, FTP_CONNECT, FTP_DISCONNECT and FTP_SERVER_TO_R/3).
<removed_by_moderator>
Thanks in advance.
Ramesh.
Edited by: Julius Bussche on Jul 8, 2008 5:55 PMVL02N is an enjoy transaction. You cant run it in background. Please try VL02.
Thanks
Romit -
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 -
Executing a report program in background from another program
Hi Experts,
I developed a report to display material change history based on change date range. Report is taking much time (around 15-20 mins) as I'm hitting CDPOS and CDHDR tables. User wants to execute the report in foreground because he/she can give selection criteria that is required everytime.
So, my requirment is now to create another program with same selection screen elements which will execute the original program in background. In the new program, we will be just capturing the selection elements and will pass them to original program to run in background and display a message to user without wait for the background job to complete. Original program should send an email to an fixed email id with the report output as attachment (for example excel file).
Please suggest.
Thanks in Advance,
Siva SankarHi Siva,
Please see the link
http://help.sap.com/saphelp_nw04/helpdata/EN/2a/fa01dd493111d182b70000e829fbfe/content.htm
Regarding a Change Document Function Module ----- VERY VERY Urgent
When using function modules , I dont think you can directly get data based on material and plant . these function modules usualy works with object class and creation date .
Once you retrieve the data using the function modules you have to filter out the unncecessary data based on your selection screen conditions .
Regards,
Ratheesh BS
Edited by: Ratheesh Bhaskarapillai Suseeladev on Mar 8, 2012 5:19 AM
Regarding a Change Document Function Module ----- VERY VERY Urgent -
Error while executing program in background
We have a program to upload data to the presentation server in the xml file format.
It is working fine in foreground.But whenever we are trying to execute it in the background it gives error:
'Error in control framework'.Prem,
Looking at the error that you have shown, looks like its a different error. Is there a control/GRID that is being used in the program.
If you are using a CUSTOM CONTAINER and a GRID to display the data, whenever you executing the program, you should not create the container. Something like this ..
if cl_gui_alv_grid=>offline( ) is initial.
create object CUSTOM_CONTAINER
exporting container_name = CUSTOM_CONTROL
endif.
Regards,
Ravi
note : Please reward the helpful posts.
Maybe you are looking for
-
since I updated my software to the IOS 7.0.4 I am unable to use any WIFI network i cannot connect to my home wifi network I am unable to do any backups. I have backed up my phone onto my Itunes account on my computer and I reset my phone...this did
-
What is better to use- Financial Plan Vs. Budget
Hi, We are on 12.1.3 and using Project Costing & Billing. Now the requirement is to capture expenditure estimates at lowest task level and later compare it with actuals. I'm having few doubts, pls help throwing some light on these: 1. How do we decid
-
Hellp needed to resolve this Error
Hi all Inside my pakage i have some procedures and funtions, will executing its saying the error as : PLS-00707: unsupported construct or internal error [2603] i have higlighted the line in the below code, Can some help me to correct this error. than
-
Hi We are trying to view the list of Parked documents using FBV0/FBV1. But it gives just the list of parked documents. To view the details, a document should be selected and double clicked. Is there any transaction where we can get list of parked doc
-
How to Move iTunes Library FILE not the folder
The FileVault space recovery process mangled my email archives and iTunes library for the second time in two weeks. If it weren't company policy (to protect local copies of source code), I'd turn the **** thing off. As it is, I have to live with it,