How to Execuate Dialog program in backgroud
Hi,
I am doing with dialog program which going to save values in database using bapi, there is two buttons available in my program one is save and another one is background, when the user clicks save, values will be saved in online, suppose if the user clicks background, my dialog program should be run in background to store the values in database.
I appreciate if experts provide tips to overcome this issue.
Hello,
Submit the same program in background mode and pass all the required parameters
*part for background processing
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 = 'ZPGM_NAME'. " your pgm name goes here
* used to avoid spaces in the display
DATA: lv_job_name_string TYPE string.
lv_job_name_string = lv_job_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 " parameters start here
WITH p_lines = p_lines
WITH rfc_dest = rfcdest
WITH p_selmtd = lv_selmtd
WITH px_shsim = px_shsim
WITH px_sherr = px_sherr " parameters end here
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_string , 'called successfully' NO-GAP.
WRITE: / 'You can check the job in transaction SM37'.
Similar Messages
-
How to learn dialog programming?
I'm familiar with report programming, but rarely know on how to build a dialog program.
Please tell me:
What is the procedure of dialog programming?
Where I can find the turtorials?Hi Xia liu,
DIALOG Programming
You can also check the transaction ABAPDOCU which gives you lot of sample programs.
Also you can see the below examples...
Go to se38 and give demodynpro and press F4.
YOu will get a list of demo module pool programs.
One more T-Code is ABAPDOCU.
YOu can find more examples there.
See the prgrams:
DEMO_DYNPRO_TABLE_CONTROL_1 Table Control with LOOP Statement
DEMO_DYNPRO_TABLE_CONTROL_2 Table Control with LOOP AT ITAB
Check the below link:
http://wiki.ittoolbox.com/index.php/FAQ:What_is_module_pool_program_in_abap%3F
http://help.sap.com/saphelp_46c/helpdata/en/35/26b1aaafab52b9e10000009b38f974/content.htm
http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm
http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
http://www.geocities.com/ZSAPcHAT
http://www.allsaplinks.com/files/using_table_in_screen.pdf
http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://www.sap-img.com/
http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
http://www.sapgenie.com/links/abap.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
http://help.sap.com/saphelp_47x200/helpdata/en/52/670ba2439b11d1896f0000e8322d00/frameset.htm
http://www.allsaplinks.com/dialog_programming.html
http://sap.mis.cmich.edu/sap-abap/abap09/
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
http://sap.mis.cmich.edu/abap-00/
http://www.allsaplinks.com/files/using_table_in_screen.pdf
http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
http://www.sapgenie.com/links/abap.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://help.sap.com
http://www.sapgenie.com/abap/example_code.htm
http://help.sap.com/saphelp_47x200/helpdata/en/52/670ba2439b11d1896f0000e8322d00/frameset.htm
http://www.allsaplinks.com/dialog_programming.html
http://www.sapbrain.com/TUTORIALS/default.html
http://www.sappoint.com/abap/spmp.pdf
http://sappoint.com/abap.html
http://www.sap-img.com/abap.htm
http://sap.ittoolbox.com/code/archives.asp?i=10&t=450&a=t
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://www.sap-img.com/abap/
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://www.sap-img.com/
http://www.sappoint.com/faq/faqdiapr.pdf
http://www.allsaplinks.com/dialog_programming.html
check these links.
http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
http://www.allsaplinks.com/dialog_programming.html
http://www.sapbrain.com/TUTORIALS/default.html
http://www.sappoint.com/abap/spmp.pdf
http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
http://www.sapgenie.com/abap/example_code.htm
http://www.sap-img.com/
http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
http://www.sapgenie.com/links/abap.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://www.allsaplinks.com/dialog_programming.html
http://www.allsaplinks.com/files/intro_to_dialog_prg.pdf
Other useful link:
http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
Other links:
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb2d40358411d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/10/e7dbde82ba11d295a40000e8353423/content.htm
For Screens
http://help.sap.com/saphelp_47x200/helpdata/en/e4/2adbef449911d1949c0000e8353423/content.htm
Screen elements
http://help.sap.com/saphelp_47x200/helpdata/en/47/e07f5f2b9911d2954f0000e8353423/content.htm
Processing Screens
http://help.sap.com/saphelp_47x200/helpdata/en/47/e07f682b9911d2954f0000e8353423/content.htm
Complex Screen elements
http://help.sap.com/saphelp_47x200/helpdata/en/fd/02da2a61d811d295750000e8353423/content.htm
Hope this resolves your query.
Reward all the helpful answers.
Regards -
How to set a program into backgroud job
hi experts,i want to set a program into backgroud job.
the original code like this:
...some statements...
PERFORM FRM_SEND_MAIL USING WA_YA_LX.
...some statements...
i want to set 'PERFORM FRM_SEND_MAIL USING WA_YA_LX.' into background job.
is that code like this?
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = WA_TBTCJOB-JOBNAME
JOBCLASS = 'A'
IMPORTING
JOBCOUNT = WA_TBTCJOB-JOBCOUNT.
PERFORM FRM_SEND_MAIL USING WA_YA_LX.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = WA_TBTCJOB-JOBCOUNT
JOBNAME = WA_TBTCJOB-JOBNAME
SDLSTRTDT = SY-DATUM
SDLSTRTTM = WA_TBTCJOB-SDLSTRTTM .
hunger for you advice,thanks a lot.See the following simple prog to schedule in background.
You cannot schedule the subroutine i.e perform to run in background job. Instead write the subroutine in another program.
to pass any value to that program, declare selection screen parameter and pass the value from the first one using submit.
Job open
call function 'JOB_OPEN'
exporting
delanfrep = ' '
jobgroup = ' '
jobname = jobname
*sdlstrtdt = sy-datum
*sdlstrttm = sy-uzeit
importing
jobcount = jobcount
exceptions
cant_create_job = 01
invalid_job_data = 02
jobname_missing = 03.
if sy-subrc ne 0.
write:/ 'error in opening a job'.
endif.
Insert process into job
SUBMIT ZSDQ_BCK_TEST
and return
with p_type = 'F' "Selection screen Parameter
user sy-uname
via job jobname
number jobcount.
if sy-subrc > 0.
WRITE:/ 'ERROR PROCESSING JOB'.
endif.
Close job
call function 'JOB_CLOSE'
exporting
*event_id = starttime-eventid
*event_param = starttime-eventparm
*event_periodic = starttime-periodic
jobcount = jobcount
jobname = jobname
*laststrtdt = starttime-laststrtdt
*laststrttm = starttime-laststrttm
*prddays = 1
*prdhours = 0
*prdmins = 0
*prdmonths = 0
*prdweeks = 0
*sdlstrtdt = sdlstrtdt
*sdlstrttm = sdlstrttm
strtimmed = 'X'
*targetsystem = host
RECIPIENT_OBJ = RECIPIENT_OBJ
exceptions
cant_start_immediate = 01
invalid_startdate = 02
jobname_missing = 03
job_close_failed = 04
job_nosteps = 05
job_notex = 06
lock_failed = 07
others = 99.
***This is the second program which will run in background
REPORT ZSDQ_BCK_TEST .
TYPES: BEGIN OF TY_ADRC,
HOUSE_NUM1 LIKE ADRC-HOUSE_NUM1,
NAME3 LIKE ADRC-NAME3,
NAME4 LIKE ADRC-NAME4,
LOCATION LIKE ADRC-LOCATION,
END OF TY_ADRC.
DATA: IT_ADRC TYPE STANDARD TABLE OF TY_ADRC WITH HEADER LINE.
Parameters: p_type type c.
START-OF-SELECTION.
SELECT HOUSE_NUM1
NAME3
NAME4
LOCATION
UP TO 40000 rows
FROM ADRC
INTO TABLE IT_ADRC.
WHERE ADDRNUMBER = '0000022423'.
IF SY-SUBRC = 0.
LOOP AT IT_ADRC.
WRITE:/ IT_ADRC-HOUSE_NUM1, IT_ADRC-NAME3.
ENDLOOP.
write:/ p_type.
ENDIF. -
Design dialog program using the MVC pattern
Hi,
I have to design a dialog program using the MVC pattern , with all the controllers lying inside function modules.
I have searched out on net and could find out that BSP applications are designed using the MVC concept.Please suggest how can the dialog program be designed using MVC pattern.I'm currently developing a classic Dynpro dialog program. I have a module pool, with screens. I've tightly coupled the module pool with a controller class. Anything that happens in the module pool, is handled by the controller class. All the logic of screen handling is done by the controller class.
What remains in the module pool is the capturing of the okcode. the next screen to go to (if applicable), the setting of field attributes. But the okcode is sent straight to the controller for processing, and the screen/field information is also held in the controller.
I've also rewritten the auto-generated tab handling code, so the logic is done via a class.
So, it is possible - just aim to have as LITTLE as possible in the module pool or function group.
The model, of course, is in a separate class. -
How to call a dialog program with return value in another dialog program
Dear All,
How can I call a dialog program with return value from another dialog program?
Regards,
Alok.Hi Alok,
You can you SET/GET parameters to do this.
This is some information about this.
To fill the input fields of a called transaction with data from the calling program, you can use the SPA/GPA technique. SPA/GPA parameters are values that the system stores in the global, user-specific SAP memory. SAP memory allows you to pass values between programs. A user can access the values stored in the SAP memory during one terminal session for all parallel sessions. Each SPA/GPA parameter is identified by a 20-character code. You can maintain them in the Repository Browser in the ABAP Workbench. The values in SPA/GPA parameters are user-specific.
ABAP programs can access the parameters using the SET PARAMETER and GET PARAMETERstatements.
To fill one, use:
SET PARAMETER ID pid FIELD f.
This statement saves the contents of field f under the ID pid in the SAP memory. The ID pid can be up to 20 characters long. If there was already a value stored under pid, this statement overwrites it. If you double-click pid in the ABAP Editor, parameters that do not exist can be created as a Repository object.
To read an SPA/GPA parameter, use:
GET PARAMETER ID pid FIELD f.
This statement places the value stored under the pid ID into the variable f. If the system does not find any value for pid in the SAP memory, sy-subrc is set to 4. Otherwise, it sets the value to 0.
Thanks,
SriRatna -
How to call a Dialog Program from another Dialog Program
Dear All,
How can I call a dialog program with return value from another dialog program?
Regards,
Alok.Hi Alok,
1. Insted of creating 2 different Dialog program. It's good to create as many screens as you want in same module pool program. Any way you can use the different TCODE for each screen.
2. Another and The best way is to create a function group and then inside function group use the function 2 module... In the function group define a global variable which will be present for both the function group if they are getting executed in sequence. and inside the Function Module call the screens using command " call screen <screenno>".
3. You can use set / get parameter to pass values of a field between two dynpro program. -
How to use a parameter of a report program from selection screen in a dialog program
how to use a parameter value(entered ) of a report program from a selection screen in a dialog program.
I have to fetch the value entered in the parameter of report program and display it in a dialog programHi Aasim,
Just mention like below in your ABAP report.
PARAMETERS: p_aufnr TYPE aufnr MEMORY ID ord.
and mention the same memory ID name in the module pool screen property it automatically populates the value to and fro -
How to use a parameter of a report program in a dialog program
how to use a parameter of a report program in a dialog program.
I have to fetch the value entered in the parameter of report program and display it in a dialog programHi Aasim,
Just mention like below in your ABAP report.
PARAMETERS: p_aufnr TYPE aufnr MEMORY ID ord.
and mention the same memory ID name in the module pool screen property it automatically populates the value to and fro -
How to create Background job for Dialog program
Hi Experts,
I have copied Standard tcode to Z-tcode (CS12 tcode).
Now my requirement is to create background job for this program (but program is not a 'E' type its 'I').
How we can schedule Dialog program to Background.
Pls suggest me.
Regards
SKHi do as below :
Reefer below :
Bakcground Job Creation
You will have to submit your report using Submit statement ,
then inside the submitted report write open_job.
Regards,
Uma -
How to set default values in dialog programming
hi gurus
can anyone suggest me
how to set default values in dialog programming
thanks®ards
kals.it's a bit dirty but I usually just place it in the PBO with a flag for control. It's simple and not too costly i think.
MODULE preRender OUTPUT.
DATA first_time TYPE flag VALUE 'X'.
IF first_time EQ 'X'.
* put your initialization code here
CLEAR first_time.
ENDIF.
ENDMODULE.
-MiR -
How to use custom control in Dialog Programming?
How can I call a subscreen using custom control in Dialog Programming?
The required subscreen contains a calender. Any class or something available for this purpose. Please suggest.As [vinraaj|http://forums.sdn.sap.com/profile.jspa?userID=3968041] wrote, call transaction SE51, there is a Wizard to help you generate the table control, it will create the table control and some includes with PBO/PAI modules > Read [Using the Table Control Wizard|http://help.sap.com/saphelp_bw/helpdata/en/6d/150d67da1011d3963800a0c94260a5/frameset.htm]
Also there is a tutorial in the wiki, read [Learn Making First Table Control |http://wiki.sdn.sap.com/wiki/display/ABAP/LearnMakingFirstTableControl] by [Krishna Chauhan|http://wiki.sdn.sap.com/wiki/display/~nc0euof]
Regards,
Raymond -
How to change height of Input/output field in dialog program
How to change height of Input/output field in dialog program.
I want to big message text box like e-mail message box.
so could anybody help me on this please
Thanks
BasuHi,
This is not possible directly.Place the icon button in the table field.when u click on that button a popup window will appear in that window place the text editor there u can write text and u can save it ok..
Award points if helpful.
Kiran Kumar.G.A -
Dialog programming - How to place a select-option field in a dialog screen
Hi all,
In Dialog Programming, How to place a select-option field in a dialog screen.
Kindly give me some example code...
Thanks,
Jaffer Ali.Shi Ali,
U can add select-options in ur module pool by using SELECTION-SCREEN BEGIN OF SCREEN <scrn> AS SUBSCREEN command.
check this link for reference.....
http://help.sap.com/saphelp_47x200/helpdata/en/e7/deb237b9a9a968e10000009b38f8cf/frameset.htm
Example Code :
DATA : ok_code TYPE sy-ucomm.
SELECTION-SCREEN BEGIN OF SCREEN 1010 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_rad1 RADIOBUTTON GROUP grp1 DEFAULT 'X',
p_rad2 RADIOBUTTON GROUP grp1,
p_rad3 RADIOBUTTON GROUP grp1.
SELECT-OPTIONS: s_matnr FOR mara-matnr,
s_matkl FOR mara-matkl,
s_mtart FOR mara-mtart.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN END OF SCREEN 1010.
START-OF-SELECTION.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
CALL SCREEN 1010 .
ENDMODULE. "status_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
SCREEN 100 ****************
PROCESS BEFORE OUTPUT.
MODULE status_0100.
CALL SUBSCREEN sub_1010 INCLUDING sy-repid '1010'.
<b>***** where sub_1010 is name of sub-screen area</b>
PROCESS AFTER INPUT.
CALL SUBSCREEN sub_1010.
MODULE user_command_0100.
<<< REMOVED BY MODERATOR >>>
Harimanjesh AN
Edited by: Marcelo Ramos on Dec 17, 2008 7:54 PM -
How to print the output of the screen in Dialog Programming
Hi,
Could anybody help how to print the output of a screen in the dialog programming. i can select 'Hard Copy' option in the 'Custumizing of Local Layout' Icon in the standard tool bar. but that prints the whole screen with the toolbar. i want to print only the output which is displayed on the screen. Please help..
Regards,
SwathiHi Swathi,
Ok. Do One thing. Go to menu bar and select Systems -> Own pool Request -> here you get the spool number. Select it and select the option "Print Directly" in tool bar.
Thanks. -
How to debug BDC , Dialog program and Script
Hi all,
Please let me know, how to debug BDC , Dialog program and Script
Thanks&Regards
Devi<b>SCRIPT DEBUGGING</b>
When we want to debug the SAPSCRIPT, we need to first activate the debugger, we have 2 ways to activate the Debugger.
1) Execute the program RSTXDBUG
2) Go to SE71, from the initial screen enter the form name and press Utilities --> Activate Debugger
When we are in the Debug screen,
3.1) F5 will be debug filed by field, that means if a single line is having 5 fields, if we press the F5 this will do field by field,
3.2) F6 will be line by line, that means when we press the F6, it will debug the line and it will go to the next line. F7 also do the same way
3.3) F8 will be very useful when we have any include statement in the SCRIPT, if any include is there and we press the F5 or F6 then this will go that Include (normally SO10 or any transaction text), then if we want line by line debugging then we can press the F5 or F6, or if you want to execute that in a single shot then press the F8, then the debugger will be executed that include and come back to the Script debugging.
Some times in the script, we may right lengthy lines, if we want to debug that whole line, we have an option called Left/Right, this we will find the Debug screen of the script, there is a Push button, we can make use this button to debug.
We can put the breakpoints in the SCRIPT DEBUGGER also, just press the BREAKPOINT Pushbutton from the debugging screen or press EDIT --> Breakpoint
If we want to debug the print program from the SCRIPT DEBUGGER, just press SHIFT+F7 or EDIT --> ABAP Debugging
If we want to see the Windows which are defined in the forms, just press the Go to --> Form --> Windows .if we want to see the pages go to --> Form --> pages. Here we have an option to see the page wise window also go to --> Form --> page Windows
If we want to see the paragraphs which are defined in that script, press go to --> Styles --> paragraphs.
If we want to see the Character formats which are defined in that script, press go to --> Styles --> Character Strings.
If we want to see the Page formats which are defined in that script, press go to --> OTF --> Page.
If we want to see the Elements which are used in the Script, then press go to --> Text Elements --> Form Elements.
If we want to see the commands which are used in the script, press go to --> Commands --> List
Finally, if we want to exit from the SCRIPT DEBUGING, simply press Debugger --> Exit
<b>DEBUG BDC</b>
ust go into debugging mode and do the BDC step by step, when it comes to the Call Transaction line, check the mode which will be 'N'....Now, overwrite this with 'A' and execute the BDC...It will run in All Screens Mode....
As suggested above the MODE 'A' will do the trick as it takes you to all screens.
Normally MODE N will be defaulted as it will be used for background processing,
Here is a simple tip,
This will be the call transaction part of the program,
CALL TRANSACTION 'IW32' USING BDCDATA MODE 'N'
MESSAGES INTO MESSTAB.
I would suggest you to make it like this,
DATA: V_MODE TYPE C VALUE 'N'.
*<In debug mode set V_MODE = 'A' for debugging>
CALL TRANSACTION 'IW32' USING BDCDATA MODE V_MODE
MESSAGES INTO MESSTAB.
This will be very useful because you just need to change the value of the V_MODE at runtime as A for debugging besides it has N which is the default to be used. (i.e. you need not change the code again and again).
This will be very useful when you have to debug some program in QA or PRD servers.
regards,
srinivas
<b>*reward for useful answers*</b>
Maybe you are looking for
-
Hi, Does anybody know if I am able to purchase a new c2d macbook pro 17" with one 2gig module insted of two 1gig modules? I would like to upgrade to 3gig but cannot aford it right now and would like the free slot for the future. Is this config availa
-
How to send msg from "Drafts" folder
How do i send a msg from the "Drafts" folder
-
Including a DLL in JAR file (Comm API)
Writing a little app that interfaces with serial port device using the communications API and I'd like to bundle it into an executable JAR. JBuilder will create the JAR for me fine, but the issue is with the win32com.dll file thats part of the comms
-
Custom Columns in ECM MSS Portal screen not updating IT0759
Hi, We are implementing ECM - MSS. We have enhanced IT0759 with custom fields. Some of those custom fields are display fields on Portal and some of them are input fields on portal. Display fields are working fine because we have specified custom func
-
Micro SD not detected in Z1.... What is going on
Afternoon All, First time poster here, hoping someone can help resolve my issue before I go completely crazy with my Z1 and put the thing in the bin or through an industrial shredder Got new 64gb micro sd card last week, formatted before putting in m