Run ALV in Background JOB (DUMP)
HI Experts,
Before post i have already look at this forum and tried many solutions , im on SAPGUI 7.20 and already creatde a doc container... so nothing has work yet...
Im trying to run a alv report in a scheduled JOB...!!
Below the Dump Description and My source code...!
Many Thanks for any help..!!!!
DUMP.
Short text
Exception condition "CNTL_ERROR" raised.
What happened?
The current ABAP/4 program encountered an unexpected
situation.
What can you do?
Note down which actions and inputs caused the error.
To process the problem further, contact you SAP system
administrator.
Using Transaction ST22 for ABAP Dump Analysis, you can look
at and manage termination messages, and you can also
keep them for a long time.
Error analysis
A RAISE statement in the program "CL_GUI_CONTROL================CP" raised the
exception
condition "CNTL_ERROR".
Since the exception was not intercepted by a superior
program, processing was terminated.
Short description of exception condition:
For detailed documentation of the exception condition, use
Transaction SE37 (Function Library). You can take the called
function module from the display of active calls.
How to correct the error
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
SOURCE CODE:
DATA: gro_doc_container TYPE REF TO cl_gui_docking_container,
w_off TYPE INT4.
IF w_1c_container IS INITIAL.
CALL METHOD cl_gui_alv_grid=>offline
RECEIVING e_offline = w_off.
IF NOT w_off is initial.
CREATE OBJECT w_1obj_alv
EXPORTING i_parent = gro_doc_container .
else.
CREATE OBJECT w_1c_container
EXPORTING
container_name = c_1alv.
CREATE OBJECT w_1obj_alv
EXPORTING
i_parent = w_1c_container.
ENDIF.
CREATE OBJECT w_event_receiver.
SET HANDLER: w_event_receiver->handle_data_changed FOR w_1obj_alv,
w_event_receiver->handle_toolbar FOR w_1obj_alv,
w_event_receiver->handle_user_command FOR w_1obj_alv.
CALL METHOD w_1obj_alv->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
CALL METHOD w_1obj_alv->set_table_for_first_display
EXPORTING
i_save = c_a
is_layout = e_1layout
is_variant = e_1variant
it_toolbar_excluding = is_1func
i_structure_name = c_1strucs1
CHANGING
it_outtab = is_1pant
it_fieldcatalog = is_1fcat[].
HI ,
The ALV grid will not work in background. You need to check sy-batch (for background processing ) and write a seperate code .
The better way of doing is to use SALV factory methods - It works both in background and foreground modes.
Remember It will work on ECC and it doesnot support editable ALV directly.
For Demo program SALV_DEMO* and F4
Hope this brings clarity and neccassary help to you.
Similar Messages
-
Can the standard program RFBIBL00 be run as a background job ?
Hi all,
Can the standard program RFBIBL00 be run as a background job for the call transaction mode.
As I tried I got the job cancelled with message"Job RFBIBL00: Data does not match the job definition; job terminated".
As i run it in foreground it executes properly.
Why is it failing in background? Please help.
Thanks ,
StockHi,
You need to copy the program RFBIBL00 & modify the program to build the logic to upload through application server. Then schedule the modified program in background & it wl work.
Best regards,
Prashatn -
Run RFEBKA00 as background job
Hello,
I want to run program RFEBKA00 as background job. On selection screen, there is parameter "Execute as background job", but even if I tick this checkbox, report is ran on foreground.
How can I run this program as background job?
Thanks®ards,
JirkaHi,
You can run the program in background by selecting 'Execute in background' option in 'Program' menu. -
Error when running SWN_SELSEN as background job.
Hello Gurus,
I am facing a typical problem these days.
The background job for program SWN_SELSEN is scheduled in every 5 mins. It has started to fail intermittently with the error message 'An instance of the report SWN_SELSEN is still active'. But the stange thing is that the program completes its execution in approx. 12 - 15 secs then why this kind of error it is throwing.
This error message should not come as the program completes itself in 12- 15 secs and it has more than 4 mins as free time.
Please help as this kind of failure is happenning quite frequently i.e. once in nearly every three times it executes. In a day around 100 times.
Please help.
Thanks in advance.
NehaHello,
I assume you've checked in SM37 to see how often it actually runs and whether perhaps two instances have been scheduled?
Also check the log in SLG1 to see if there is any clue there.
regards
Rick Bakker
Hanabi Technology -
Dunning run as periodic background job - TA F150
Hi Gurus,
do you know a functionality how to set up the dunning run (selection + printing) as as a periodic background job.
The issue is, that the parameters have to be changed with each run. For example we would like to run the dunning programm all 2 weeks in background. Is there a possibility to create a new dunning run and ID automatically. The date parameters should be also changed (+2 weeks). We do not want to change the proposal, we would like to print out the letters automatically.
Thanks for your response!
XmchXUse Program RF150SMS
-
Hi Experts,
I am fresher and I have been given with an object which throws dump in backgroud execution when I raise error message in foreground. What would I do for handling errors in background. Should I remove Error message? or what should I do?
Thanks and regards.
Venkat, IBMwrite this coding ..
if sy-batch = 'X'. <-- if the program is executed in background.
write : 'Error message'.
else. <-- if the program is executed in fore ground
message E000 with 'Error message'.
endif. -
How to get the Status code of rwclient when run as a background job
Hi all,
i have to get the return code(status code) of the rwclient.exe while running as a batch script. is it possible to get the return code to check whether the report generated succefully or not?
please help me if anyone has the solution.
Thanks in advance
DeenaHi Andi,
Please see my Blog : /people/dhanabal.thangavel2/blog/2009/12/16/getting-daily-failed-message-list-in-xi-and-sending-an-alert-mail-with-attachementcsv-file-of-that-list
I think it 'll help you on this.
Cheer,
Dhanabal -
ALV list display in a Background job - Spool output
Hi,
We are currently working on a report scheduled to be run in the background job, and the ALV list is displayed in the spool output.
ALV list in the spool does not look the same as front run job, the column headers are all crowded together, and there is no grid in-between different columns or rows. It's hard to read.
Is there a way to add grid for this kind of output?
Thanks!Hi Deepak:
I expanded your report into two rows display, and the grid in the spool display simply gone!
report zzscratch line-size 120 no standard page heading.
type-pools slis.
tables pa0001.
data : li_field type standard table of slis_fieldcat_alv,
gi_events type standard table of slis_alv_event,
gr_layout_bck type slis_layout_alv,
gr_save like disvariant,
gr_events type slis_alv_event.
types : begin of gtt_emp,
pernr type persno,
ename like pa0001-ename,
uname like pa0001-UNAME,
end of gtt_emp.
data : lr_field type slis_fieldcat_alv.
data : lc_rep like syst-repid.
data : li_emp type standard table of gtt_emp,
lr_emp type gtt_emp.
data : gv_ref_table type lvc_rtname.
gv_ref_table = 'CATSDB'.
lr_field-fieldname = 'PERNR'.
lr_field-ref_tabname = gv_ref_table.
lr_field-inttype = 'N'.
lr_field-outputlen = 8.
lr_field-seltext_l = 'EMPLOYEE Number'.
append lr_field to li_field.
lr_field-fieldname = 'ENAME'.
lr_field-ref_tabname = 'PA0001'.
lr_field-inttype = 'C'.
lr_field-outputlen = 40.
lr_field-seltext_l = 'EMPLOYEE Name'.
append lr_field to li_field.
lr_field-fieldname = 'UNAME'.
lr_field-ref_tabname = 'PA0001'.
lr_field-inttype = 'C'.
lr_field-outputlen = 12.
lr_field-seltext_l = 'User Name'.
lr_field-row_pos = 2.
lr_field-col_pos = 1.
append lr_field to li_field.
lc_rep = sy-repid.
gr_layout_bck-edit_mode = 'D'.
gr_save-report = sy-repid.
lr_emp-pernr = '00000001'.
lr_emp-ename = 'abc'.
lr_emp-uname = 'testus'.
append lr_emp to li_emp.
lr_emp-pernr = '00000002'.
lr_emp-ename = 'def'.
append lr_emp to li_emp.
lr_emp-pernr = '00000003'.
append lr_emp to li_emp.
lr_emp-pernr = '00000004'.
append lr_emp to li_emp.
lr_emp-pernr = '00000005'.
append lr_emp to li_emp.
lr_emp-pernr = '00000006'.
append lr_emp to li_emp.
lr_emp-pernr = '00000007'.
append lr_emp to li_emp.
lr_emp-pernr = '00000008'.
append lr_emp to li_emp.
end-of-selection.
Function module for ALV grid display
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = lc_rep
is_layout = gr_layout_bck
it_fieldcat = li_field
i_save = 'A'
is_variant = gr_save
it_events = gi_events
TABLES
t_outtab = li_emp[]
EXCEPTIONS
program_error = 1
others = 2.
if sy-subrc <> 0.
clear gr_messages.
message e023 into gr_messages.
append gr_messages to gi_messages.
endif. -
How to Prevent the Executing a Program but Allow to Run as Background Job?
Hi All,
I have an ABAB List Program. I need to restrict this program from executing. This has to always run as a Background Job. How do I check this condition in the program?
Thanks,
KishanCheck for the system variable SY-BATCH. If this field is 'X', then allow the execution of the program. If not then exit. Do this coding in the initialization event or start of selection.
INITIALIZATION.
IF sy-batch IS INITIAL.
STOP.
ENDIF.
Manoj -
Regarding the output of background job in spool
Hi Friends:
I have a report.When I run it in foreground, it displays an alv output.
I want to see the output when I run it in background. When I select the job & press on spool, it shows a message that no list available. Please help with the settings to see the output in spool.
Suitable points will be rewarded.
Regards:
GauravHi,
have a look at this thread:
Re: OO ALV in background job
Best regards. -
Will BDC work in Background job
I have written the BDC program and i want to scheduled the program in Background job in the late night and see the result of processed records as a ALV report.Is it possible to run BDC as Background job..........
TYPE-POOLS: SLIS.
DATA : PRDAT(8).
DATA : WF_ORG(30).
DATA PERNR TYPE STANDARD TABLE OF KOMV_INDEX
WITH HEADER LINE INITIAL SIZE 50.
DATA MOD VALUE 'N'. "E
DATA: MASK(64) VALUE
',Tab Delimited Text Files(.txt),.txt,All Files(.),..'.
DATA: WF_DATE1(10) TYPE C,
WF_TIME(10) TYPE C.
DATA: AUART LIKE VBAK-AUART . "VALUE 'ZQT'.
DATA: WF_SNO TYPE I .
DATA XTP LIKE TEXTPOOL OCCURS 0 WITH HEADER LINE.
Internal table for reading file
DATA: BEGIN OF XFILE OCCURS 0,
RESWK LIKE EKKO-RESWK,
EKORG LIKE EKKO-EKORG,
EKGRP LIKE EKKO-EKGRP,
BUKRS LIKE EKKO-BUKRS,
MATNR LIKE EKPO-MATNR,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
RECPLT LIKE EKPO-WERKS,
BWTAR LIKE EKPO-BWTAR,
END OF XFILE.
Invalid customers listing file
*data: xout_err like xout occurs 0 with header line.
DATA: BEGIN OF XOUT_ERR OCCURS 0,
KUNNR LIKE KNA1-KUNNR,
WERKS LIKE VBAP-WERKS, "Plant
END OF XOUT_ERR.
Internal Table for Error in file
DATA: BEGIN OF XERR OCCURS 0,
INDEX LIKE SY-TABIX,
MSG(132),
END OF XERR.
DATA: BEGIN OF BDCDATA OCCURS 0.
INCLUDE STRUCTURE BDCDATA.
DATA: END OF BDCDATA.
DATA BEGIN OF MSGCOLL OCCURS 10.
INCLUDE STRUCTURE BDCMSGCOLL.
DATA END OF MSGCOLL.
Internal table for writing final report
DATA: BEGIN OF XOUT OCCURS 0,
SERIAL_NO TYPE I,
RECPLT LIKE EKPO-WERKS,
MATNR LIKE EKPO-MATNR,
KBETR LIKE KOMV-KBETR,
KPEIN LIKE KOMV-KPEIN,
KMEIN LIKE KOMV-KMEIN,
MAKTX LIKE MAKT-MAKTX,
REMARKS(30),
DATE(10) TYPE C,
END OF XOUT.
*****Structures For ALV**********************************************
DATA : L_VARIANT LIKE DISVARIANT,
WF_VARIANT LIKE DISVARIANT.
DATA: WF_REPORT LIKE SY-REPID.
DATA: WF_EVENTS TYPE SLIS_T_EVENT .
DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: GT_FIELDCATALL TYPE SLIS_T_FIELDCAT_ALV.
DATA: LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA: G_REPID LIKE SY-REPID.
DATA: IT_SORT TYPE SLIS_T_SORTINFO_ALV .
DATA: GS_LAYOUTALL TYPE SLIS_LAYOUT_ALV.
DATA: GT_EVENTS TYPE SLIS_T_EVENT.
DATA: GT_EVENTSALL TYPE SLIS_T_EVENT.
DATA: GS_KEYINFO TYPE SLIS_KEYINFO_ALV.
DATA: G_TABNAME_HEADER TYPE SLIS_TABNAME.
DATA: G_TABNAME_ITEM TYPE SLIS_TABNAME.
DATA ST_SORT TYPE SLIS_SORTINFO_ALV .
DATA: S_LIST_TOPOFPAGE TYPE SLIS_LISTHEADER.
DATA: IST_LIST_TOPOFPAGE TYPE SLIS_T_LISTHEADER .
DATA: WF_EVENT TYPE SLIS_ALV_EVENT.
CONSTANTS: FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
*****Selection Screen************************************************
***Selection Screen
SELECTION-SCREEN SKIP 3.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: FILENAME LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
*******Initialization Events******************************************
INITIALIZATION.
Read the column heading from textpool
REFRESH XTP.
READ TEXTPOOL SY-REPID INTO XTP LANGUAGE SY-LANGU.
*******AT SELECTION SCREEN Events*************************************
AT SELECTION-SCREEN .
WF_REPORT = SY-REPID.
L_VARIANT = WF_REPORT.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILENAME.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = FILENAME.
*******Start Of Selection Events**************************************
START-OF-SELECTION.
WF_SNO = 1.
WF_REPORT = SY-REPID.
WRITE SY-DATUM TO WF_DATE1.
WRITE SY-UZEIT TO WF_TIME.
Upload the file into XFILE
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FILENAME
FILETYPE = 'DAT'
TABLES
DATA_TAB = XFILE
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
GUI_REFUSE_FILETRANSFER = 8
OTHERS = 9.
LOOP AT XFILE.
REFRESH PERNR.
CLEAR PERNR.
PERFORM CALL_ME21N.
IMPORT PERNR FROM MEMORY ID 'PERNR'.
FREE MEMORY ID 'PERNR'.
READ TABLE PERNR WITH KEY KSCHL = 'ZASV'.
IF SY-SUBRC = 0.
XOUT-KBETR = PERNR-KBETR.
XOUT-KPEIN = PERNR-KPEIN.
XOUT-KMEIN = PERNR-KMEIN.
XOUT-RECPLT = XFILE-RECPLT.
XOUT-MATNR = XFILE-MATNR.
XOUT-SERIAL_NO = WF_SNO.
XOUT-DATE = WF_DATE1.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = XOUT-MATNR
IMPORTING
OUTPUT = XOUT-MATNR
SELECT SINGLE MAKTX INTO XOUT-MAKTX FROM MAKT
WHERE MATNR = XOUT-MATNR.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
*INPUT = XOUT-MATNR
IMPORTING
OUTPUT = XOUT-MATNR .
CLEAR PERNR.
APPEND XOUT.
ELSE.
XOUT-KBETR = ''.
XOUT-KPEIN = ''.
XOUT-KMEIN = ''.
XOUT-RECPLT = XFILE-RECPLT.
XOUT-MATNR = XFILE-MATNR.
XOUT-SERIAL_NO = WF_SNO.
XOUT-REMARKS = 'ERROR'.
XOUT-DATE = WF_DATE1.
APPEND XOUT.
ENDIF.
CLEAR XFILE.
WF_SNO = WF_SNO + 1.
ENDLOOP.
DELETE XOUT WHERE MATNR = ''.
PERFORM WRITE_OUTPUT.
*& Form CALL_ME21N
FORM CALL_ME21N.
DATA : DATE(10).
REFRESH BDCDATA.
CLEAR BDCDATA.
CLEAR DATE.
CONCATENATE SY-DATUM6(2) SY-DATUM4(2)
SY-DATUM+0(4) INTO PRDAT.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=MEDOCTYPE'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MEPO_TOPLINE-BSART'.
PERFORM BDC_FIELD USING 'MEPO_TOPLINE-BSART'
'UB'.
PERFORM BDC_FIELD USING 'MEPO_TOPLINE-BEDAT'
'25.07.2007'.
PRDAT.
PERFORM BDC_FIELD USING 'DYN_6000-LIST'
' 1'.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MEPO_TOPLINE-SUPERFIELD'.
PERFORM BDC_FIELD USING 'MEPO_TOPLINE-BSART'
'UB'.
PERFORM BDC_FIELD USING 'MEPO_TOPLINE-SUPERFIELD'
XFILE-RESWK.
PERFORM BDC_FIELD USING 'MEPO_TOPLINE-BEDAT'
PRDAT.
PERFORM BDC_FIELD USING 'MEPO1222-EKORG'
'1000'.
XFILE-EKORG.
PERFORM BDC_FIELD USING 'MEPO1222-EKGRP'
'STO'.
PERFORM BDC_FIELD USING 'MEPO1222-BUKRS'
'1000'.
XFILE-BUKRS.
PERFORM BDC_FIELD USING 'DYN_6000-LIST'
' 1'
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=MEV4001BUTTON'.
*perform bdc_field using 'BDC_CURSOR'
'MEPO_TOPLINE-SUPERFIELD'.
*perform bdc_field using 'MEPO_TOPLINE-BSART'
'UB'.
*perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'
'2100 EOL RMT'.
*perform bdc_field using 'MEPO_TOPLINE-BEDAT'
'25.07.2007'.
*perform bdc_field using 'MEPO1222-EKORG'
'1000'.
*perform bdc_field using 'MEPO1222-EKGRP'
'STO'.
*perform bdc_field using 'MEPO1222-BUKRS'
'1000'.
*perform bdc_field using 'DYN_6000-LIST'
' 1'
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'MEPO_TOPLINE-BSART'
'UB'.
*perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'
'2100 EOL RMT'.
*perform bdc_field using 'MEPO_TOPLINE-BEDAT'
'25.07.2007'.
*perform bdc_field using 'MEPO1222-EKORG'
'1000'.
*perform bdc_field using 'MEPO1222-EKGRP'
'STO'.
*perform bdc_field using 'MEPO1222-BUKRS'
'1000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MEPO1211-MEINS(01)'.
PERFORM BDC_FIELD USING 'MEPO1211-EMATN(01)'
'3000'.
XFILE-MATNR.
WF_ORG = XFILE-MENGE.
CONDENSE WF_ORG .
PERFORM BDC_FIELD USING 'MEPO1211-MENGE(01)'
WF_ORG.
PERFORM BDC_FIELD USING 'MEPO1211-MEINS(01)'
'l'.
XFILE-MEINS.
PERFORM BDC_FIELD USING 'MEPO1211-NAME1(01)'
'4102'.
XFILE-RECPLT.
*perform bdc_field using 'DYN_6000-LIST'
' 1'
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'MEPO_TOPLINE-BSART'
'UB'.
*perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'
'2100 EOL RMT'.
*perform bdc_field using 'MEPO_TOPLINE-BEDAT'
'25.07.2007'.
*perform bdc_field using 'MEPO1222-EKORG'
'1000'.
*perform bdc_field using 'MEPO1222-EKGRP'
'STO'.
*perform bdc_field using 'MEPO1222-BUKRS'
'1000'.
*perform bdc_field using 'BDC_CURSOR'
'MEPO1211-NAME1(01)'.
*perform bdc_field using 'MEPO1211-NAME1(01)'
'4102'.
*perform bdc_field using 'DYN_6000-LIST'
' 1'
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'MEPO_TOPLINE-BSART'
'UB'.
*perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'
'2100 EOL RMT'.
*perform bdc_field using 'MEPO_TOPLINE-BEDAT'
'25.07.2007'.
*perform bdc_field using 'MEPO1222-EKORG'
'1000'.
*perform bdc_field using 'MEPO1222-EKGRP'
'STO'.
*perform bdc_field using 'MEPO1222-BUKRS'
'1000'.
*perform bdc_field using 'DYN_6000-LIST'
' 1'
*perform bdc_field using 'BDC_CURSOR'
'MEPO1313-BWTAR'.
*perform bdc_field using 'MEPO1313-UEBTO'
'10.0'.
*perform bdc_field using 'MEPO1313-MAHN1'
'10'.
*perform bdc_field using 'MEPO1313-MAHN2'
'20'.
*perform bdc_field using 'MEPO1313-MAHN3'
'30'.
PERFORM BDC_FIELD USING 'MEPO1313-BWTAR'
'OWN_D'.
XFILE-BWTAR.
*perform bdc_field using 'MEPO1313-IPRKZ'
'D'.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=TABIDT8'.
*perform bdc_field using 'MEPO_TOPLINE-BSART'
'UB'.
*perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'
'2100 EOL RMT'.
*perform bdc_field using 'MEPO_TOPLINE-BEDAT'
'25.07.2007'.
*perform bdc_field using 'MEPO1222-EKORG'
'1000'.
*perform bdc_field using 'MEPO1222-EKGRP'
'STO'.
*perform bdc_field using 'MEPO1222-BUKRS'
'1000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MEPO1211-EEIND(01)'.
*perform bdc_field using 'DYN_6000-LIST'
' 1'.
*perform bdc_field using 'MEPO1313-UEBTO'
'10.0'.
*perform bdc_field using 'MEPO1313-MAHN1'
'10'.
*perform bdc_field using 'MEPO1313-MAHN2'
'20'.
*perform bdc_field using 'MEPO1313-MAHN3'
'30'.
PERFORM BDC_FIELD USING 'MEPO1313-BWTAR'
'OWN_D'.
XFILE-BWTAR.
*perform bdc_field using 'MEPO1313-IPRKZ'
'D'.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=V69A_KONY'.
*perform bdc_field using 'MEPO_TOPLINE-BSART'
'UB'.
*perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'
'2100 EOL RMT'.
*perform bdc_field using 'MEPO_TOPLINE-BEDAT'
'25.07.2007'.
*perform bdc_field using 'DYN_6000-LIST'
' 1'.
*perform bdc_field using 'BDC_CURSOR'
'KOMV-KSCHL(01)'.
PERFORM BDC_DYNPRO USING 'SAPMSSY0' '0120'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'05/04'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=PICK'.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=MESAVE'.
*perform bdc_field using 'MEPO_TOPLINE-BSART'
'UB'.
*perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'
'2100 EOL RMT'.
*perform bdc_field using 'MEPO_TOPLINE-BEDAT'
'25.07.2007'.
PERFORM BDC_FIELD USING 'DYN_6000-LIST'
' 1'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(01)'.
PERFORM BDC_DYNPRO USING 'SAPLSPO2' '0101'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=CANC'.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=MELEAV'.
*perform bdc_field using 'MEPO_TOPLINE-BSART'
'UB'.
*perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'
'2100 EOL RMT'.
*perform bdc_field using 'MEPO_TOPLINE-BEDAT'
'25.07.2007'.
PERFORM BDC_FIELD USING 'DYN_6000-LIST'
' 1'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(01)'.
PERFORM BDC_DYNPRO USING 'SAPLSPO1' '0100'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=NO'.
CALL TRANSACTION 'ME21N' USING BDCDATA MODE MOD
MESSAGES INTO MSGCOLL.
ENDFORM. " CALL_VA21
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM. " BDC_DYNPRO
FORM BDC_FIELD USING FNAM FVAL.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDFORM. " BDC_FIELD
FORM FIELDCAT_INIT USING LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA POS TYPE I VALUE 0.
POS = POS + 1.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COL_POS = POS.
LS_FIELDCAT-TABNAME = 'XOUT'.
LS_FIELDCAT-FIELDNAME = 'SERIAL_NO'.
LS_FIELDCAT-SELTEXT_M = 'Sr No'.
LS_FIELDCAT-EMPHASIZE = 'C410'.
LS_FIELDCAT-OUTPUTLEN = '4'.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
POS = POS + 1.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COL_POS = POS.
LS_FIELDCAT-TABNAME = 'XOUT'.
LS_FIELDCAT-FIELDNAME = ' RECPLT'.
LS_FIELDCAT-SELTEXT_M = 'RECEVIENG PLANT'.
LS_FIELDCAT-HOTSPOT = 'X'.
LS_FIELDCAT-EMPHASIZE = 'C410'.
LS_FIELDCAT-OUTPUTLEN = '15'.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
POS = POS + 1.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COL_POS = POS.
LS_FIELDCAT-TABNAME = 'XOUT'.
LS_FIELDCAT-FIELDNAME = 'MATNR'.
LS_FIELDCAT-SELTEXT_M = 'Material Code'.
LS_FIELDCAT-HOTSPOT = 'X'.
LS_FIELDCAT-EMPHASIZE = 'C410'.
LS_FIELDCAT-OUTPUTLEN = '15'.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
POS = POS + 1.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COL_POS = POS.
LS_FIELDCAT-TABNAME = 'XOUT'.
LS_FIELDCAT-FIELDNAME = 'MAKTX'.
LS_FIELDCAT-SELTEXT_M = 'Mat Description'.
LS_FIELDCAT-EMPHASIZE = 'C410'.
LS_FIELDCAT-OUTPUTLEN = '15'.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
POS = POS + 1.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COL_POS = POS.
LS_FIELDCAT-TABNAME = 'XOUT'.
LS_FIELDCAT-FIELDNAME = 'KBETR'.
LS_FIELDCAT-SELTEXT_M = 'GAQ'.
LS_FIELDCAT-EMPHASIZE = 'C410'.
LS_FIELDCAT-OUTPUTLEN = '15'.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
POS = POS + 1.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COL_POS = POS.
LS_FIELDCAT-TABNAME = 'XOUT'.
LS_FIELDCAT-FIELDNAME = 'KPEIN'.
LS_FIELDCAT-SELTEXT_M = 'Per'.
LS_FIELDCAT-EMPHASIZE = 'C410'.
LS_FIELDCAT-OUTPUTLEN = '15'.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
POS = POS + 1.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COL_POS = POS.
LS_FIELDCAT-TABNAME = 'XOUT'.
LS_FIELDCAT-FIELDNAME = 'KMEIN'.
LS_FIELDCAT-SELTEXT_M = 'UNit'.
LS_FIELDCAT-EMPHASIZE = 'C410'.
LS_FIELDCAT-OUTPUTLEN = '15'.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
POS = POS + 1.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COL_POS = POS.
LS_FIELDCAT-TABNAME = 'XOUT'.
LS_FIELDCAT-FIELDNAME = 'DATE'.
LS_FIELDCAT-SELTEXT_M = 'DATE'.
LS_FIELDCAT-EMPHASIZE = 'C410'.
LS_FIELDCAT-OUTPUTLEN = '15'.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
POS = POS + 1.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COL_POS = POS.
LS_FIELDCAT-TABNAME = 'XOUT'.
LS_FIELDCAT-FIELDNAME = 'REMARKS'.
LS_FIELDCAT-SELTEXT_M = 'REMARKS'.
LS_FIELDCAT-EMPHASIZE = 'C410'.
LS_FIELDCAT-OUTPUTLEN = '15'.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
ENDFORM. " fieldcat_init
*& Form layout
FORM LAYOUT .
LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
LAYOUT-ZEBRA = 'X'.
ENDFORM. "layout
**& Form write_alv_grid
FORM WRITE_ALV_GRID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = WF_REPORT
I_BACKGROUND_ID = 'ESSARLOGO'
IS_LAYOUT = LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
IT_SORT = IT_SORT
I_SAVE = 'A'
IS_VARIANT = WF_VARIANT
IT_EVENTS = WF_EVENTS
TABLES
T_OUTTAB = XOUT
EXCEPTIONS
PROGRAM_ERROR = 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. " write_alv_grid
*& Form top-of-page
FORM TOP_OF_PAGE.
***This function for heading
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IST_LIST_TOPOFPAGE.
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM. "heading
**& Form write_output
FORM WRITE_OUTPUT .
***To get the events
PERFORM CREATE_EVENT USING WF_EVENTS.
***Heading for grid
PERFORM WRITE_TOPOFPAGE USING IST_LIST_TOPOFPAGE .
PERFORM FIELDCAT_INIT USING GT_FIELDCAT[].
PERFORM LAYOUT.
***Display the ALV
PERFORM WRITE_ALV_GRID.
ENDFORM. " write_output
*& Form write_topofpage
FORM WRITE_TOPOFPAGE USING L_IT_LIST_TOPOFPAGE
TYPE SLIS_T_LISTHEADER.
CLEAR S_LIST_TOPOFPAGE.
S_LIST_TOPOFPAGE-TYP = 'H'.
S_LIST_TOPOFPAGE-INFO = TEXT-012 .
APPEND S_LIST_TOPOFPAGE TO L_IT_LIST_TOPOFPAGE.
CLEAR S_LIST_TOPOFPAGE.
S_LIST_TOPOFPAGE-TYP = 'S'.
S_LIST_TOPOFPAGE-KEY = TEXT-013 .
S_LIST_TOPOFPAGE-INFO = SY-UNAME.
APPEND S_LIST_TOPOFPAGE TO L_IT_LIST_TOPOFPAGE.
S_LIST_TOPOFPAGE-KEY = TEXT-014 .
S_LIST_TOPOFPAGE-INFO = WF_DATE1 .
APPEND S_LIST_TOPOFPAGE TO L_IT_LIST_TOPOFPAGE.
S_LIST_TOPOFPAGE-KEY = TEXT-015 .
S_LIST_TOPOFPAGE-INFO = WF_TIME .
APPEND S_LIST_TOPOFPAGE TO L_IT_LIST_TOPOFPAGE.
ENDFORM. " write_topofpage
*& Form CREATE_EVENT
FORM CREATE_EVENT USING L_EVENTS TYPE SLIS_T_EVENT.
*This Function is to get the events
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = WF_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2.
READ TABLE WF_EVENTS INTO WF_EVENT WITH KEY NAME =
SLIS_EV_TOP_OF_PAGE.
IF SY-SUBRC = 0.
MOVE FORMNAME_TOP_OF_PAGE TO WF_EVENT-FORM.
APPEND WF_EVENT TO WF_EVENTS.
ENDIF.
ENDFORM. " eventsENDFORM. " events .
iam manually scheduled program in the Background
through menu -
> program -
> F9. -
After writing a report, I used this Function Module LIST_TO_ASCI to copy my report to an internal table (DOWNTAB) because Ill use that internal table to download a text file on the server using dataset.
Here is my code:
FORM DL_REP_SERVER.
DATA: ABAP_LIST LIKE ABAPLIST OCCURS 1,
MV_FILE2 LIKE RLGRAP-FILENAME.
DATA: BEGIN OF DOWNTAB OCCURS 1,
LINE(150),
END OF DOWNTAB.
CLEAR: MV_FILE2.
MV_FILE2 = J:/Downloads/Report.txt.
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
LIST_INDEX = SY-LSIND
TABLES
LISTASCI = DOWNTAB
LISTOBJECT = ABAP_LIST
EXCEPTIONS
LIST_INDEX_INVALID = 1
OTHERS = 2.
OPEN DATASET MV_FILE2 FOR OUTPUT IN TEXT MODE.
IF SY-SUBRC <> 0.
IF SY-SUBRC = 8.
MESSAGE E037 WITH 'File could not be opened'.
ELSE.
MESSAGE E037 WITH 'Error occurs in downloading the file'.
ENDIF.
ENDIF.
LOOP AT DOWNTAB.
TRANSFER DOWNTAB TO MV_FILE2.
ENDLOOP.
CLOSE DATASET MV_FILE2.
ENDFORM. " DL_REP_SERVER
My big problem is this, when Im running my program ordinarily (not as background job), Im getting all the pages downloaded correctly but when I run it as background job (using SM36), Im only getting the last page of my report being downloaded. Definitely, I cant debug it because its in background. I cant figure out why. Hope that I stated my problem clearly. Any help would be greatly appreciated. Thanks.You can debug batch jobs by going to 'SM37', type in 'JDBG' in the
command line ( no '/' ), put the cursor on the job and press enter - will
take you to the job in debug mode.
You can do this only after the job has finished execution. This will simulate the exact background scenario with the same selection screen values as used in the job also sy-batch will set to 'X'.
So type in the transaction code 'JDBG' and place your cursor on the job after It has finished. It will take you to a SAP program in debug mode. Step through this program which is about 10 lines, after this your program will be executed in the debug mode.
Steps
1. Create variant called BACKGROUND for program to be debugged.
2. Execute ZDEBUGBG (pgm code below) in background for immediate processing.
3. Execute transaction SM50.
4. Select process that runs ZDEBUGBG.
5. Goto 'Program/Session' 'Program' 'Debugging'.
A se80 debug session will open.
6. Change variable W_EXIT to 'E'.
7. Step thru (F6) until ZWBTEST comes up.
1. Go to Transaction SM66 and find your work porocess.
Select the line work process is on and click on the Debugging button.
If this is a custom program, you can put a wait statement in the code to buy yourself sometime.
2. Go to Transaction SM50. From the tool bar "Program/session"->Program->Debugging.
goto SM37 and from Program menu(not sure.. try other menu's)
-->Catchjob . it will goto the active job in debugging mode. -
How to Execute WebDynpro Applications as Background Job ?
Hi Gurus,
We have developed a lot of WDJ applications with component reusage; ie,
quite a lot of business logic are wrapped in WDJ Components which are
re-used by other WD UIs.
Now we'd like to automate some of the processes with background jobs
and faced with a few problems :
#1. How can we write a background WD application which can be
triggered by external mechanism and without presenting any UI?
#2. If we write the background program in a Java DC, how can we
invoke existing methods in WD components ?
Anyone got a clue ??
Ying-Jie ChenHello Amit,
> Well I can think of a workaround in this case.If you are aware
> of the suspend-resume functionality of the WD application then
> its possible to run the WD application virtually in background.
[ stuffs deleted ...]
It sounds like a possible alternative to our requirement, I'll
spend some time to investigate on the WD suspend-resume mechanism !
> Also let me know why are you preffering the WD if you dont
> require its UI
Our application requires the process to be performed with UI interaction;
with some instances it should be run as a background job. Either case involves
RFC calls to backend SAP R/3 and it's easy for RFC access with WD
Component. Though it's also possible to use CAF application service for
RFC access; due to some technical constrains, we did not use CAF
framework. Therefore it ends up where we are now ...
Thanks for your tip!
Ying-Jie Chen -
Hello All,
I am running a report in background that creates data in IT0105. This table has a field "UNAME". When I run it in
foreground this field takes up the id from which I am logged in. The program doesn't complete in background because
it has a BDC which we complete forcefully in foreground due to some data issue.
So I need to know what will be the "UNAME" in IT0105 when the report runs in background?
Thanks,
Ritika MathurHello Neal,
Actually I don't need to check any authority. The issue is that I need to track and give a proof that it is not the program putting in inconsistent data into the database. So in foreground I can run and test that the user name is the id I was logged into from. But in background I assume that the user name is set to "BATCH". (I see the data previously created in IT0105 and the username is either the ids of logged in users or "BATCH" as the report is actually meant to run as a background job).
Now I cannot test in background and hence need to know if the username is set to "BATCH" if a program runs in background.
Thanks,
Ritika -
Write the Error log from background Job to the Spool request
Hi ,
I have a situation where in i need to capture the error log of a Z program which runs as a background job and write that log into the spool request. My Z program calls runs RSEINB00 program using the SUBMIT statement. When this Job fails the error log can be seen in SM37. But i need this error log to be sent in to a spool.
I can read the error log using the BP_JOBLOG_READ FM and can also create a spool using the RSPO_SPOOL_OPEN FM.
The problem is, when the Submit statement executes, due to internal valdation in the RSEINB00 program the program terminates. Due to this it is not able to perform the SY-SUBRC Check and thus doesn't read the log.
Can anybody suggest me how to overcome this problem. I am attaching the code for your refernece.
SUBMIT RSEINB00
USING SELECTION-SET 'TEST2'
TO SAP-SPOOL
LIST NAME 'LOCL'
IMMEDIATELY space
KEEP IN SPOOL 'X'
AND RETURN.
<b>If sy-subrc <> 0.</b>
CALL FUNCTION 'BP_JOBLOG_READ'
EXPORTING
CLIENT = SY-MANDT
JOBCOUNT = i_tbtco-jobcount
JOBLOG = i_tbtco-joblog
JOBNAME = i_tbtco-jobname
TABLES
JOBLOGTBL = l_joblog
IF SY-SUBRC <> 0.
else.
message i002 with l_joblog-msgv1.
ENDIF.
<b>
ENDIF.</b>
Rgds,
Kewal
P.S. : any other approach to solve this problem will be appreciated too and the points will be rewarded suitably.If I select a job in SM37 and I click on "spool" I get a list with separate spool entries for each of the steps, e. g.
Programmname/Kommand Programmtyp Spoolliste
Z_MM_STAT_UPDATE_WERK ABAP 1707445
ZSLEEP Ext. Kommando
Z_MM_STAT_UPDATE_WERK ABAP 1707459
ZSLEEP Ext. Kommando
Z_MM_STAT_UPDATE_MARA ABAP 1721423
ZSLEEP Ext. Kommando
Z_MM_STAT_UPDATE_WERK ABAP 1721437
Z_MM_STAT_UPDATE_MARA ABAP 1721446
Z_MM_STAT_UPDATE_WERK ABAP 1721447
Z_MM_STAT_UPDATE_VKORG ABAP 1721471
ZSLEEP Ext. Kommando
Z_MM_STAT_UPDATE_VKORG ABAP 1721521
ZSLEEP Ext. Kommando
Z_MM_STAT_UPDATE_VKORG ABAP 1721816
It's in German but I'm sure you get the idea. For each Z_MM_STAT_UPDATE and variant I have a separate spool list that I can display.
Markus
Maybe you are looking for
-
Can't import HDV 720p from my Sony HDR HC1 camcorder to my FCP 5.0.1 help
I have footage that was shot on a contractors JVC HDV camera at 720p. I play it in my Sony HDR HC1 and i can view it and it plays awesome. It even recognizes its 720p. But i try to import it into Final Cut Pro on my IMac G5 or powerbook G4 17inch and
-
Material stock for a determined period
Good afternoon my friends, I need some information about stock of materials in a determined period. Here in the project, they need to know the information about the material stocks of May, and I've found some tables that have information (like the on
-
I'm trying export a Keynote presentation to PDF, or other format, to use on Windows PC, iPad and other devices. The file Keynote create is way too large at 30mb+. So cant email or share it very easily If I print it and to Adobe PDF I can get it to 3m
-
Installing Oracle 10g Express Edition on x86_64
Hi, I tried installing Oracle 10g express edition on Arch Linux X86_64 but could not get it running. I followed guide here http://alodib.com/?q=node/32. Installation went well. Then I configured it, apparently went well. But could not get it running.
-
Standby database SWITCHOVER_STATUS field is always NOT ALLOWED
standby database: SQL> select switchover_status from v$database; SWITCHOVER_STATUS NOT ALLOWED select db_unique_name,database_role,open_mode,log_mode,protection_mode from v$database; DB_UNIQUE_NAME DATABASE_ROLE OPEN_MODE LOG_MODE PR