Report in background using cl_gui_frontend_services= gui_download Method
Hello all,
I'm trying to run a report that uses the method cl_gui_frontend_services=>gui_download in background mode, to export data from an internal table to a xml file.
In foreground everything works fine, but when I try to run the report in background the execution stops when the method is called. Does anyone know how to avoid this problem and run the report in background mode?
Thanks in advance,
Nuno A.
Hi,
For background processing you need to use syntax
OPEN DATASET
ld_file = p_infile.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
ELSE.
DO.
CLEAR: wa_string, wa_uploadtxt.
READ DATASET ld_file INTO wa_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
APPEND wa_upload TO it_record.
ENDIF.
ENDDO.
CLOSE DATASET ld_file.
ENDIF.
aRs
Similar Messages
-
Hi SDN's,
Can u tell me how to get headers when we download data to excel with using (we are using DBF as file type in the following method )
CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
(We can't use GUI_DOWNLOAD)
Thanks in advance..
BRHi,
I m giving u a bdc code i hope ur prob ll be solved.
*& Report ZDTK_BDC_LT01
*& PROGRAME TITLE : LT01
*& AUTHOR : D TARUN KUMAR
*& MM CONSULTANT : Mr. MRINMOYE CHAKRABORTY
*& REQUEST NO. : RD1K901995
*& TRANSACTION ID : ZLT01
*& PACKAGE : ZTARUN
*& DESCRIPTION : BDC REPORT TO UPLOAD INITIAL STOCK POSTING AND
*& STORAGE BINS THROUGH LT01.
REPORT ZDTK_BDC_LT01
no standard page heading line-size 255.
TYPE-POOLS: TRUXS.
STRUCTURE DECLARATION
TYPES : BEGIN OF TY_UPLOAD,
LGNUM(3),
BETYP(1),
BENUM(10),
BWLVS(3),
MATNR(18),
BISMT(18),
ANFME(16),
WERKS(4),
LGORT(4),
CHARG(10),
LETYP(10),
VLTYP(3),
VLBER(3),
VLPLA(10),
VLQNR(10),
NLTYP(3),
NLBER(3),
NLPLA(10),
NLQNR(10),
END OF TY_UPLOAD.
INTERNALTABLE & WORKAREA DECLARATION
DATA : T_UPLOAD TYPE STANDARD TABLE OF TY_UPLOAD,
T_BDCDATA TYPE STANDARD TABLE OF BDCDATA,
T_BDCMSGCOLL TYPE STANDARD TABLE OF BDCMSGCOLL,
W_UPLOAD TYPE TY_UPLOAD,
W_BDCDATA TYPE BDCDATA,
W_BDCMSGCOLL TYPE BDCMSGCOLL,
GLOBLE DECLARATION
G_FLNAME TYPE STRING,
G_MESSAGE(70) TYPE C,
IT_RAW TYPE TRUXS_T_TEXT_DATA,
GLOBLE DECLARATION
WA_OPT TYPE CTU_PARAMS.
WA_OPT-UPDMODE = 'A'.
WA_OPT-DEFSIZE = 'X'.
WA_OPT-DISMODE = 'A'.
SLECTION SCREEN DECLARATION
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN SKIP 2.
PARAMETER : P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN : END OF BLOCK B1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
PERFORM GET_FILENAME.
START-OF-SELECTION.
PERFORM UPLOAD_DATA.
*PERFORM GET_FINAL.
*PERFORM GET_MIGO.
PERFORM SESSION.
*PERFORM TEST.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR W_BDCDATA.
W_BDCDATA-PROGRAM = PROGRAM.
W_BDCDATA-DYNPRO = DYNPRO.
W_BDCDATA-DYNBEGIN = 'X'.
APPEND W_BDCDATA TO T_BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> NODATA.
CLEAR W_BDCDATA.
W_BDCDATA-FNAM = FNAM.
W_BDCDATA-FVAL = FVAL.
APPEND W_BDCDATA TO T_BDCDATA.
ENDIF.
ENDFORM.
*& Form GET_FILENAME
TEXT
FORM GET_FILENAME .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE'
IMPORTING
FILE_NAME = P_FILE
ENDFORM. " GET_FILENAME
*& Form UPLOAD_DATA
text
form UPLOAD_DATA .
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER = 'X'
I_TAB_RAW_DATA = IT_RAW
I_FILENAME = P_FILE "WORK TABLE
TABLES
I_TAB_CONVERTED_DATA = T_UPLOAD[] "ACTUAL DATA
EXCEPTIONS
CONVERSION_FAILED = 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.
endform. " UPLOAD_DATA
*& Form SESSION
text
FORM SESSION .
*sort t_upload by bismt.
LOOP AT T_UPLOAD INTO W_UPLOAD.
REFRESH T_BDCDATA.
*CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = W_UPLOAD-CHARG
IMPORTING
OUTPUT = W_UPLOAD-CHARG .
*CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = W_UPLOAD-VLBER
IMPORTING
OUTPUT = W_UPLOAD-VLBER .
*CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = W_UPLOAD-NLTYP
IMPORTING
OUTPUT = W_UPLOAD-NLTYP .
*CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = W_UPLOAD-NLBER
IMPORTING
OUTPUT = W_UPLOAD-NLBER .
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = W_UPLOAD-CHARG
IMPORTING
OUTPUT = W_UPLOAD-CHARG .
DATA : BWLVS(3),
LGORT(4),
WERKS(4),
CHARG(10),
LETYP(10),
VLTYP(3),
VLBER(3),
VLPLA(10),
VLQNR(10),
NLTYP(3),
NLBER(3),
NLQNR(10).
DATA : W_MATNR(18).
*SELECT SINGLE MATNR FROM MARA INTO W_MATNR
WHERE BISMT = W_UPLOAD-BISMT.
BWLVS = '999'.
LGORT = '3500'.
WERKS = '1030'.
LETYP = 'E1'.
VLTYP = '998'.
VLBER = '001'.
VLPLA = 'AUFNAHME'.
NLTYP = '354'. "(packaging material)
*NLTYP = '353'. "(spareparts material)
NLBER = '001'.
*include bdcrecx1.
*start-of-selection.
*perform open_group.
perform bdc_dynpro using 'SAPML03T' '0101'.
perform bdc_field using 'BDC_CURSOR'
'LTAP-CHARG'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LTAK-LGNUM'
W_UPLOAD-LGNUM. "'350'.
perform bdc_field using 'LTAK-BENUM'
W_UPLOAD-BENUM. "'1000000000'.
perform bdc_field using 'LTAK-BETYP'
W_UPLOAD-BETYP. "'P'.
perform bdc_field using 'LTAK-BWLVS' BWLVS. "'999'.
perform bdc_field using 'LTAP-MATNR'
W_upload-MATNR. "'40000009'.
perform bdc_field using 'RL03T-ANFME'
W_UPLOAD-ANFME. "'1,000'.
perform bdc_field using 'LTAP-WERKS' WERKS. "'1030'.
perform bdc_field using 'LTAP-CHARG'
w_upload-charg.
perform bdc_dynpro using 'SAPML03T' '0102'.
perform bdc_field using 'BDC_CURSOR'
'LTAP-NLPLA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RL03T-ANFME'
W_UPLOAD-ANFME. "'1,000'.
*perform bdc_field using 'LTAP-ALTME'
'KG'.
perform bdc_field using 'LTAP-LETYP' LETYP. "'E1'.
*perform bdc_field using 'LTAP-CHARG' W_UPLOAD-CHARG. "'0000000101'.
perform bdc_field using 'LTAP-VLTYP' VLTYP. "'998'.
perform bdc_field using 'LTAP-VLBER' VLBER. "'001'.
perform bdc_field using 'LTAP-VLPLA' VLPLA. "'AUFNAHME'.
perform bdc_field using 'LTAP-NLTYP'
W_UPLOAD-NLTYP. "'351'.
perform bdc_field using 'LTAP-NLBER' NLBER. "'001'.
perform bdc_field using 'LTAP-NLPLA'
W_UPLOAD-NLPLA. "'01 00 01'.
*perform bdc_transaction using 'LT01'.
*perform close_group.
CALL TRANSACTION 'LT01' USING T_BDCDATA
MODE 'A'
UPDATE 'A'
OPTIONS FROM WA_OPT
MESSAGES INTO T_BDCMSGCOLL.
IF SY-SUBRC <> 0.
READ TABLE T_BDCMSGCOLL INTO W_BDCMSGCOLL INDEX 1.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = 'EN'
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = G_MESSAGE
EXCEPTIONS
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.
WRITE : / W_upload-matnr ,'-----' , G_MESSAGE.
REFRESH T_BDCMSGCOLL.
ENDIF.
ENDIF.
*clear : w_matnr, w_upload.
ENDLOOP.
ENDFORM. " SESSION -
Getting error while using cl_gui_frontend_services= gui_download
Hi Experts,
I am using class method cl_gui_frontend_services=>gui_download for downloading a file and i getting an error that of type compatible of internal table with formal parameter DATA_TAB of class cl_gui_frontend_services. My code is as follow -
DATA: filename_string TYPE string VALUE 'c:\data\testdw.txt'.
TYPES : BEGIN OF y_citibank,
data(1028) TYPE c,
END OF y_citibank.
DATA : t_citibank TYPE STANDARD TABLE OF y_citibank.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = filename_string
FILETYPE = 'ASC'
changing
data_tab = t_citibank
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
NOT_SUPPORTED_BY_GUI = 22
ERROR_NO_GUI = 23
others = 24.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Please let me know, how can i overcome this error.
Thanks in advance,
Akash SawantHi,
Pass t_citibank[] instead of t_citibank in the CALL METHOD.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = filename_string
FILETYPE = 'ASC'
changing
data_tab = <b>t_citibank[]</b>
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
NOT_SUPPORTED_BY_GUI = 22
ERROR_NO_GUI = 23
others = 24.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Sri
Message was edited by:
Sri Tayi -
Not able to Submit CJI5 report in background using Variant
Hi Experts,
Is it possible to fill the multiple screens through FM rs_create_variant.
Reagrds,
NavaHi Ramesh,
I am trying to submit the CJI5 report in back ground through variant. The varaint was created using FM RS_CREATE_VARIANT. it's throughing an error .
IF I create variant directly via selectin screen then it's working fine.
FYI.
REPORT z_co99_cji5
NO STANDARD PAGE HEADING
MESSAGE-ID 00
LINE-SIZE 290.
PROGRAM : Z_CO99_CJI5 *
TITLE : CJI5 In Background *
AUTHOR. : Raja Nesanoor *
DATE WRITTEN : 27-Feb_2007 *
REVTRAC : xxxxxx *
PROGRAM FUNCTION: *
To DISPLAY CJI5 Report in background *
PROGRAM TYPE : Executable program *
DEV. CLASS : XXXXXX *
LOGICAL DB : NA *
AUHTORIZATION CHECKS *
Object Authorization Fields ABAP Fields *
S_TCODE *
BUKRS v_BUKRS *
CHANGE HISTORY *
Date Id Name Indicator Description *
DATA : v_repid LIKE sy-repid VALUE 'ZRKPEP005' ,
v_variant LIKE varid-variant VALUE 'V_CJI5' .
DATA: BEGIN OF w_varid.
INCLUDE STRUCTURE varid.
DATA: END OF w_varid.
DATA: BEGIN OF i_rsparams OCCURS 10.
INCLUDE STRUCTURE rsparams.
DATA: END OF i_rsparams.
DATA: BEGIN OF i_rsparams1 OCCURS 10.
INCLUDE STRUCTURE rsparams.
DATA: END OF i_rsparams1.
DATA: BEGIN OF i_varit OCCURS 2.
INCLUDE STRUCTURE varit.
DATA: END OF i_varit.
DATA: BEGIN OF i_vscreens OCCURS 2.
INCLUDE STRUCTURE rsdynnr.
DATA: END OF i_vscreens.
start-of-Selection
START-OF-SELECTION.
SET PARAMETER ID 'CAC' FIELD 'GC10'.
SET PARAMETER ID 'PDB' FIELD '000000000001'.
PERFORM populate_var_table.
PERFORM create_variant.
PERFORM submit_cji5.
*& Form POPULATE_VAR_TABLE
text
--> p1 text
<-- p2 text
FORM populate_var_table .
CLEAR w_varid .
REFRESH i_varit .
REFRESH i_rsparams .
i_rsparams-selname = 'CN_NETNR'.
i_rsparams-kind = 'S'.
i_rsparams-sign = 'I'.
i_rsparams-option = 'EQ'.
i_rsparams-low = '90273536'.
i_rsparams-high = space.
APPEND i_rsparams.
CLEAR : i_rsparams .
i_rsparams-selname = 'CN_NETNR'.
i_rsparams-kind = 'S'.
i_rsparams-sign = 'I'.
i_rsparams-option = 'EQ'.
i_rsparams-low = '90274010'.
i_rsparams-high = space.
APPEND i_rsparams.
CLEAR : i_rsparams .
i_rsparams-selname = 'R_OBDAT'.
i_rsparams-kind = 'S'.
i_rsparams-sign = 'I'.
i_rsparams-option = 'BT'.
i_rsparams-low = space .
i_rsparams-high = space.
APPEND i_rsparams.
CLEAR : i_rsparams .
i_rsparams-selname = 'P_DISVAR'.
i_rsparams-kind = 'P'.
i_rsparams-sign = 'I'.
i_rsparams-option = 'EQ'.
i_rsparams-low = '1SAP' .
APPEND i_rsparams.
CLEAR : i_rsparams .
i_rsparams-selname = 'P_USEDB'.
i_rsparams-kind = 'P'.
i_rsparams-sign = 'I'.
i_rsparams-option = 'EQ'.
i_rsparams-low = SPACE.
APPEND i_rsparams.
w_varid-mandt = sy-mandt.
w_varid-report = v_repid.
w_varid-variant = v_variant.
w_varid-flag1 = space.
w_varid-flag2 = space.
w_varid-transport = space.
w_varid-environmnt = 'A'. "Variant for batch and online
w_varid-protected = space.
w_varid-secu = space.
w_varid-version = '0'.
w_varid-ename = sy-uname.
w_varid-edat = sy-datum.
w_varid-etime = sy-uzeit.
w_varid-aename = space.
w_varid-aedat = space.
w_varid-aetime = space.
w_varid-mlangu = sy-langu.
i_varit-mandt = sy-mandt.
i_varit-langu = sy-langu.
i_varit-report = w_varid-report.
i_varit-variant = w_varid-variant.
i_varit-vtext = 'CO99-OUTPUT'.
APPEND i_varit.
ENDFORM. " POPULATE_VAR_TABLE
*& Form CREATE_VARIANT
text
--> p1 text
<-- p2 text
FORM create_variant .
data: h_rc like sy-subrc.
*Check variant exists.
CALL FUNCTION 'RS_VARIANT_EXISTS'
EXPORTING
report = v_repid
variant = v_variant
IMPORTING
R_C = h_rc
EXCEPTIONS
not_authorized = 01
no_report = 02
report_not_existent = 03
report_not_supplied = 04.
IF h_rc = 0.
CALL FUNCTION 'RS_CHANGE_CREATED_VARIANT'
EXPORTING
curr_report = v_repid
curr_variant = v_variant
vari_desc = w_varid
TABLES
vari_contents = i_rsparams
vari_text = i_varit
EXCEPTIONS
illegal_report_or_variant = 01
illegal_variantname = 02
not_authorized = 03
not_executed = 04
report_not_existent = 05
report_not_supplied = 06
variant_doesnt_exist = 07
variant_locked = 08
selections_no_match = 09.
COMMIT WORK.
ELSE.
CALL FUNCTION 'RS_CREATE_VARIANT'
EXPORTING
curr_report = v_repid
curr_variant = v_variant
vari_desc = w_varid
TABLES
vari_contents = i_rsparams
vari_text = i_varit
EXCEPTIONS
illegal_report_or_variant = 1
illegal_variantname = 2
not_authorized = 3
not_executed = 4
report_not_existent = 5
report_not_supplied = 6
variant_exists = 7
variant_locked = 8
OTHERS = 9.
COMMIT WORK.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFORM. " CREATE_VARIANT
*& Form submit_cji5
text
--> p1 text
<-- p2 text
FORM submit_cji5 .
CALL FUNCTION 'SUBST_START_REPORT_IN_BATCH'
EXPORTING
iv_jobname = 'TEST_JOB'
iv_repname = v_repid
iv_varname = v_variant
iv_authcknam = sy-uname
iv_language = sy-langu
iv_varianttext = 'CO99-OUTPUT'
TABLES
tt_reportparam = i_rsparams
EXCEPTIONS
variant_exist_check_failed = 1
variant_update_failed = 2
variant_update_not_authorized = 3
variant_update_no_report = 4
variant_update_no_variant = 5
variant_update_variant_locked = 6
variant_insert_failed = 7
variant_insert_not_authorized = 8
variant_insert_no_report = 9
variant_insert_variant_exists = 10
variant_insert_variant_locked = 11
variant_write_failed = 12
no_batch_service = 13
no_server_list = 14
batch_scheduling_failed = 15
OTHERS = 16.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM.
Thanks
Nava -
Running report in background using parameters
Hi friends,
i have an abap report that needs to run in background because it runs longer than profile timeout parameter allows to. now my question is:
if this report uses dynpro with parameters, how do i have to modify it to run in background and to pass those parameters to ? ( SUBMIT ? ).
Thanks for your help!
ClemensHi,
DATA: seltab type table of rsparams,
seltab_wa like line of seltab.
seltab_wa-selname = 'PNPPERNR'.
seltab_wa-sign = 'I'.
seltab_wa-option = 'EQ'.
load each personnel number accessed from the structure into
parameters to be used in the report
loop at pnppernr.
seltab_wa-low = pnppernr-low.
append seltab_wa to seltab.
endloop.
SUBMIT zreport with selection-table seltab
via selection-screen.
Reward points if useful.... -
Run report in background using transaction launcher
Hi ,
I need to run my zreport using transaction launcher in background....
anybody please help.
RuchiHello
I agree with Andrei. Transaction Launcher is intended for front office operations with agents, not for basis tasks which must be performed by consultants with SAPGui access.
Anyway, you can launch your transaction and try to see if it works with background processing, but that is not what transaction launcher is intended for.
Regards
Joaquin -
Running the ALV report in Background using layout variant
Hello Everyone,
I am facing a problem in downloading a text file to the Application server.
My requirement is, when the user downloads a file with the layout variant, the file should have only the columns which was selected in the variant.
Can anybody give me a optimized solution for this issue.
Regards,
VasanthHi,
How are you downloading the file to the app server, using which internal table? How are you building that internal table?
What you need to do is to build a internal table dynamically with only those columns that are a part of the layout variant. Then move the data from the original internal table into this and then download the dynamica internal table to the app server.
Regards,
Ravi
Note : Please mark the helpful answers -
To run a report in background in selection screen using a new button
hi friends iam new member to this site
nice to meet u all
i want to run a report in background using the selection screen of the same report and i want to keep a button in application tool bar.
after enter the values in the selection screen by clicking that button it should move to the screen which we get generally by menu option
program-->execute in background
and by entering the output device and start condition it should be scheduled in the background.
with job_open,job_submit and job_close we need variants.
for this i tried through bp_jobvariant_schedule and
bp_jobvariant_overview but with this we can run with variants only
but the user wants to enter the values in selection screen and need a button to run background
ok friends i think u understood me
please inform soon ok bye have a nice timeHi Jagadish
There are two ways for you to handle the situation.
1. Train the users to enter the values in selection screen and manually go for backgroung scheduling.
2. Use At user command and within that basing on the option selection selected, use FM:JOB_OPEN with sy-repid get the job number, submit the program with the values on the selection screen and lastly executing FM: JOB_CLOSE with the job number from JOB_OPEN and SY-REPID.
Note that you have to set 'X' for export parameter something like startimmed while calling FM: JOB_CLOSE for immediate execution. Am not on SAP to give you the exact parameter.
Hope the above info helps you.
Kind Regards
Eswar -
Hello,
we are using cl_gui_frontend_services=>gui_download to create from an itab an excel file.
We face the issue that in this excel file german special characters like Ä, Ü, Ö, ß are not displayed correctly.
I think we need to use a different codepage. But which one?
could you please give us a short coding example how to call cl_gui_frontend_services=>gui_download.
Thanks a lot
Kind regards
ManfredHi,
Check the system is unicode or non-unicode . Codepage for Unicode system is ' 4102' and non-unicode is '1100'.
Below are the sample code for the GUI_download with Class.
DATA: l_filename TYPE string,
l_filen TYPE string,
l_path TYPE string,
l_fullpath TYPE string,
l_usr_act TYPE I.
l_filename = SPACE.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
DEFAULT_FILE_NAME = l_filename
CHANGING
FILENAME = l_filen
PATH = l_path
FULLPATH = l_fullpath
USER_ACTION = l_usr_act
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4.
IF sy-subrc = 0
AND l_usr_act <>
CL_GUI_FRONTEND_SERVICES=>ACTION_CANCEL.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = l_fullpath
FILETYPE = 'DAT'
TABLES
DATA_TAB = T_DOWNL
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
Edited by: Sumodh P on May 11, 2010 5:24 PM -
Cl_gui_frontend_services= gui_download without carriage return
Hi,
Is there a way to get download a file to PC that way, that in the end of every lines there is a carriege return character except the last one? (Special format required by az external bank application)
I tried to add carriage return to every lines, except the last one and use cl_gui_frontend_services=>gui_download.
Although the "write_lf" parameter is set to space, the # is still inserted in the end of the last lines.
Any suggestion, idea?
Thanks in advance,
PeterHi
When second time you call method just add the following
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = v_value
append = 'X' <------- Just add this line -
Message capturing while submitting a report in background
Hi All,
I am submitting a report in background using job_open and job_close fucntion modules. I want to capture all messages coming while running the report. I am able to capture messages coming in the output but not able to capture the messages coming in the below status bar(error messages). If some error message comes in the selection screen of the submitted report.
Kindly let me know the way in which i can capture those status error messages.
Thanks in advance.
Regards.
SK
Edited by: shekhar kumar on Nov 6, 2009 7:07 AMhi ,
write your code in try catch exception block
and you can store your exception in and ztable you want .
at end of report .
Regards
Deepak -
Creating spool for ALV report in background
Hi,
Can we create a spool request if we run in background/forgorund? please help me..
I am very much thankful for your quick responses.Yes we can create it. Execute the report in background using SM36 and then u can view the output using SM35 or the spool request number and tcode SP01.
I hope it helps.
Best Regards,
Vibha
*Please mark all the helpful answers -
Using fieldnames table in GUI_DOWNLOAD method
Hi Experts,
I need to download an itab data with field names as headers. I am using this but getting error 'Formal parameter "FIELDNAMES" does not exist. However, the parameter "FILENAME" has a similar name'.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = w_filenm
filetype = c_filetype
write_field_separator = c_x
CHANGING
data_tab = i_bsak[]
fieldnames = i_field[]
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
Please let me know how can i get file header using GUI_DOWNLOAD method.
Thanks in adv
AkashHi
Say for example I'm downloading a internal table with 4 fields namely field1, field2, field3 and field4.
I want these field name in the header, then this is the way to do it.
TYPES: BEGIN OF ty_head, "Structure for header
h(10) TYPE c,
END OF ty_head.
DATA: it_head TYPE TABLE OF ty_head WITH HEADER LINE.
"Adding header details
it_head-h = 'Field1'.
APPEND it_head.
it_head-h = 'Field2'.
APPEND it_head.
it_head-h = 'Field3'.
APPEND it_head.
it_head-h = 'Field4'.
APPEND it_head.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = p_file
filetype = 'ASC'
write_field_separator = 'X'
header = '00' "<= note this
TABLES
data_tab = it_tab
fieldnames = it_head[] "<= Pass your header table here
EXCEPTIONS
OTHERS = 1.
Hope this helps.
Thx and regrds
Durga.K -
ALV Report In Background.. Generating same out put using ABAP Extracts
Hi
We are running ALV reports and generating out put in background using Extracts. We are having a discussion that SAP doesnt recommend to execute ALV reports using batch and generate report output , as it heavily load for spool ... we are coming across some problem when I analyze Sm37 ... I found an error " ABAP framework unable to initialize " .
I want an input/suggestion what you guys think about it?
Thanks in Advanced...
ByeNope... Were using some batch id which use to run background job, as I am also in SAP Security, I just verify it has all the security to run the report . As this report is running fine if we ran it other then batch id ... as before it was running fine .
Thanks
Message was edited by: Saquib Khan -
Hello,
we are using the method cl_gui_frontend_services=>gui_download to store files on the presentation front end (Windows Vista with UAC).
When the user has no windows rights to the target directory and UAC is active, then the method gui_download stores the file in other directory (C:\Users\<USER_NAME>\AppData\Local\VirtualStore\Windows) and returns with sy-subrc = 0.
In our opinion this is a critical problem but SAP doesn't want to correct it.
What do you think about it?
regards,
KrisHello kpsgoutam ,
thank you for your post but it's not an answer for my question. I know how to use 'gui_dowload'. The problem is, it works wrong with UAC and target directory, where you have no rights to write the file.
Consider following code:
REPORT ztest.
DATA:
" to reproduce the problem the UAC must be active
" and you can't have write rights to the target directory
lv_filename TYPE string VALUE 'c:\windows\test.txt',
lt_data TYPE TABLE of string,
lv_data TYPE string,
lv_outlen TYPE i.
lv_data = 'Some test content'.
APPEND lv_data TO lt_data.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = lv_filename
IMPORTING
filelength = lv_outlen
changing
data_tab = lt_data
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
others = 24.
WRITE: / 'sy-subrc =', sy-subrc. " error: with active UAC the sy-subrc is 0
regards,
Kris
Maybe you are looking for
-
Songs from External Hard Drive to iPod without iTunes
So I have only a quarter or so of my songs in my iTunes library, but I have a large enough iPod where all of my songs can easily fit on it. I want to upload new songs and albums to my iPod, but without deleting all the thousands of songs that are on
-
Ongoing issue with my iPhone.
So here's the story from the beginning. Just before Christmas 2008, my phone completely locked up while I was away from home. Couldn't turn it off, couldn't do anything. I didn't freak out too much because I've had multiple issues with it locking up.
-
I purchased unlocked iphone 4s from UK, Now me in Pakistan and here phone is not working as the sim is not recongnised. what to dow...????
-
Webcast : Sun Oracle Database Machine for Data Warehousing -Sep 30 noon ET
Sun Oracle Database Machine for Data Warehousing Jean Pierre Dijcks - Data Warehousing Product Mgmt, Oracle https://conference.oracle.com/imtapp/app/cmn_jm_hub.uix?mID=158101510 On September 15 Oracle announced the second generation of its Database M
-
Error 523 Help!!!
Hi there, I recently bought a curve. I've been using it for past 3 months. I haven't installed any applications. I arrived abroad and put in a local sim It's been working fine for past 2 weeks, changing from my sim to the local sim Today I swapped si