Debugging in back ground

Hi All,
How to debugg a program which is run in background.
Thanks,
Raju

You can do it in either of two ways, which method to use depends on problem at hand, whether you need to debug in a place where you have no developer access (for example test SAP system)
1. Put an infinite loop in the program at a point from which you want to debug, so you would need to either change/copy modify the program
DO.
IF FLAG = 'X'.
EXIT.
ENDDO.
So when you schedule that program in bg, it will run indefinitely allowing you to see its process running in SM50, you can see program name there. In the menu goto Program -> debugging. You will get into your program at the code you just entered. Change variable FLAG = 'X'. Continue debugging. Good luck.
2. If you cannot change the program with inserting a infinite loop as above, you can schedule the program and while it executes catch it in SM37, select the job line and in OK code field type JDBG and enter. It should take you into debugger

Similar Messages

  • How to debug the back ground job

    Hi All,
    I want to debug the program, but it is taking more time so iam running it in back ground, but i need to debug the program from some particular point....is there any other way to debug the program...
    Means...to run the program in background upto particular point and later i need to run it in debug mode.
    Please suggest.
    Thanks & Regards,
    Hari

    Hi,
    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 and sy-batch set to 'X'.
    Use SM37 to get list of jobs , type 'JDBG' in the command line ( no '/' ), put the cursor on the job and press ENTER
    You are in debug mode now. Step through SAP program (press F7 couple of times) until you get to code you need.
    Hope this helps u.
    Thanks.

  • Debugging of back ground job

    Hi gui's,
    How to debugg a back ground job.please any body give answer.
    Thanks,
    santhosh

    In SM37: Select the job, type JDBG in the OK-code and press enter.
    Taken from [http://searchsap.techtarget.com/tip/0,289483,sid21_gci933590,00.html]
    Greetings,
    Blag.

  • Scheduled back ground job not finishing

    hie gurus, i need your help with back ground scheduling , i have created a background schedule to run my program after every 30min .  in the job overview it shows my job released and active but its not finishing processing . the program being run picks up data from an external data base and then inserting via BDC call transaction. i have tried with a different program that inserts data into a database table and its executing and finishing well in the back ground. What could be the problem ? and how can i debug a back ground job ??

    Daniel,
    To start, BDCs are very out-dated.  I would look for a BAPI if you are calling std SAP functionality.
    Also - direct updates into std SAP tables is a HUGE "no-no"... I hope that you are updating custom tables only.
    Pass that - to debug a b/g job---> 
    1) Set a breakpoint in your program
    2) select the job in SM37
    3) enter JDBG into the SAP fastpath of the SM37 screen and press ENTER
    This will navigate you into a b/g debug - you can then press the debugger buttons to move to your breakpoint.
    Hope that helps.

  • Back ground jobe

    Hi Everybody,
    I knew the background job name , i want to know here is program name , which is running on background jobe and time.
    and let me know the way of debugging the back ground job..
    which is alredy finished.
    regards,
    vinesh.

    Go to the bagound job which has been finished and you go to the job steps.
    there select the job details you can see the program name.
    If you want to see the timings of the schudeled job you can see the sceduled jobs and go for the job details.
    You can't able to debugg the background job which is finished.
    But you can debugg the report for which the background job is running.
    For that go to SM66 and take the PID.
    go to SC04 there you have to select the SQL then give the PID over there you can find the debugging button over there in this way you can debugg.
    Regards,
    Madan.

  • Problem in scheduling job in back ground

    hi all,
    My project scenario is ,i have written a program to create WBS element.
    For 1 WBS creation ,In production it takes 20 to 30 min to create as there are many transactional bdcs.
    so i want to run that perticular code (all bdcs) in back ground.
    so i wrote another program with name 'zback_job_for_wbs_creation' and added all the required code.
    in old program,i have written some code to execute this new program in back ground . this code is below..
    FORM submit_for_job.
      TABLES:btcevtjob.
      DATA:l_jobname LIKE tbtco-jobname,
           l_jobnumber LIKE rsjobinfo-jobnumb.
      DATA: count LIKE btcevtjob-jobcount,
            jobname LIKE btcevtjob-jobname.
      DATA: job_was_released LIKE btch0000-char1.
      jobname = 'WBS_CREATION'.
      EXPORT s_scrnum TO MEMORY ID 'W_SCRNUM'.
      EXPORT iscrh TO MEMORY ID 'W_ISCRH'.
      EXPORT iscrl1 TO MEMORY ID 'W_ISCRL1'.
      EXPORT iscrl2 TO MEMORY ID 'W_ISCRL2'.
      EXPORT iscrl2b TO MEMORY ID 'W_ISCRL2B'.
      EXPORT iscrl2a  TO MEMORY ID 'W_ISCRL2A'.
      EXPORT iscrl1a  TO MEMORY ID 'W_ISCRL1A'.
      CALL FUNCTION 'JOB_OPEN'
            EXPORTING
                  jobname          = jobname
           IMPORTING
                  jobcount         = count
      SUBMIT zback_job_for_wbs_creation
      with S_SCRNNUM IN S_SCRNUM
      and return via JOB JOBNAME NUMBER COUNT TO SAP-SPOOL
      WITHOUT SPOOL  DYNPRO.
      CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
         jobcount                    = count
         jobname                     = jobname
          strtimmed                   = 'X'
        IMPORTING
             job_was_released            = job_was_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
    here i have put break-point in my submitted program..but its not going to the program and job gets closed successfully without executing my code( Submitted Program).
    in above submit statement , if i just write submit progname and return ,then it goes to program.
    but job_close function module throws exception no 5.
    so pls help me out for this..
    i want my submitted program to be run in back ground..
    thanks.

    Hi,
    Start Job Monitor SM37 and search for your job. I think you will find it.
    Jobs are not linked to GUI frontend. So you can't debug your background job in that way.
    If you want to debug you must be tricky.
    Code a never ending loop with an exit condition which you can control by debugging.
    DATA:
    stop_for_capture.
    DO.
    IF sy-uname NE 'HABICH'. "change to your account
    EXIT.
    ENDIF.
    IF NOT stop_for_capture IS INITIAL.
    EXIT.
    ENDIF.
    ENDDO.
    When your job is running, start TA SM50 and mark relevant batch work process and
    choose by menu program -> program -> debugging.
    regards
    Walter Habich

  • Call function inside of call function in back ground task

    Hi Friends,
       I am calling one function in back ground task. that is executing after save of the transaction. And inside of that transaction i am calling one more function but in debugging the cursor is not going inside of that function. What could be the reason. Please help me.
    Thanks a lot in advance.

    Hi,
        Inside of the first function any way i will come after save
    using update task debugging. Once it reach inside of firt function and if i press f5 then second function is coming and if i press f5 there then it is coming out of the function and it is not going inside. The second function is called directly not in back ground.
    Thanks..

  • Back Ground Job not showing in SM50,

    Hi Friends,
    I am running XK99 to Mass update Vendor details in Back ground, I am getting some error while running the job in back ground, I would like debugg the issue.
    But in SM50  Iam not able to see the job I sechduled using program MASSBACK or transaction XK99.
    Please let me know, what could be the problem.
    Thanks,
    Veerendra.

    Hi,
    Try this - goto SM37 select the background job and enter JDBG in the command field (similar to entering /h to debug).
    Cheers.
    ...Reward if useful

  • Hi regarding back ground jobs

    I have a report which is scheduled to run 2 times in the background.
    here i am using OO ALV when to display output when run in back ground.
    but i am getting an error when the same report is run in the back ground, stating there is a problem with the object references.
    but one of my friend tried it and is successful to run in the background but another problem, when run in foreground 10 records are displayed and when run in background only 2 records are displayed for the same criteria.in both the cases i am sending the output to the file on appl server.
    pls help me its urgent.
    pionts are assured.

    Ravi,
    I have faced the same problem when I schedule the job in background.
    When the report was run in forground, it gives expected results, and when it run in background, it will supress some fields and disply the report output.
    This problem, I have debugged it and corrected, and its application specific I can say, cant conclude it  by seeing the problem, needs to do much research and fix it up.
    Regards,
    Sujatha.

  • Report Back ground processing, error

    Hi,
    I tried to run my program in back ground. It is showing the following error. I'm just Pressing F9 and scheduling the job immediately. When i go and see the "own jobs " in SM36, it shows the "job cancelled". When i see the job log, it shows "Control Framework: Fatal error - GUI cannot be reached" and "ABAP/4 processor: RAISE_EXCEPTION". When i debug the job using JDBG transaction it runs smoothly and generates spool.
    Can you provide some solutioons?

    HI,
    Is your report having some OOPS functionalities?
    Are you making use of any container or ALV GRID object.
    In that case it will not run in background and will give you this error.
    Search in SCN. This has been discussed a lto of times.
    There are several posts on how to avoid this.
    Regards,
    Ankur Parab

  • BACK GROUND FILE CREATION

    IF SY-BATCH = ' X'
    IF NOT i_down[] IS INITIAL.
            OPEN DATASET p_pf_01 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
            LOOP AT i_down.
              v_down-co_name = i_down-co_name.
              v_down-plant   = i_down-plant.
              v_down-d_adr   = i_down-d_adr.
              v_down-matnr   = i_down-matnr.
              v_down-maktx   = i_down-maktx.
              v_down-mat_typ = i_down-mat_typ.
              v_down-str_loc = i_down-str_loc.
              v_down-d_sotxt = i_down-d_sotxt.
              v_down-lifnr   = i_down-lifnr.
              v_down-name1   = i_down-name1.
              v_down-kunnr   = i_down-kunnr.
              v_down-pspnr   = i_down-pspnr.
              v_down-vbeln   = i_down-vbeln.
              v_down-posnr   = i_down-posnr.
              v_down-d_taxid = i_down-d_taxid.
              v_down-meins   = i_down-meins.
              v_down-budat   = i_down-budat.
              v_down-xblnr   = i_down-xblnr.
              v_down-rmenge  = i_down-rmenge.
              v_down-imenge  = i_down-imenge.
              v_down-bwart   = i_down-bwart.
              v_down-bmenge  = i_down-bmenge.
              v_down-mblnr   = i_down-mblnr.
              v_down-remak   = i_down-remak.
              CONCATENATE  v_down-co_name
                           v_down-plant
                           v_down-d_adr
                           v_down-matnr
                           v_down-maktx
                           v_down-mat_typ
                           v_down-str_loc
                           v_down-d_sotxt
                           v_down-lifnr
                           v_down-name1
                           v_down-kunnr
                           v_down-pspnr
                           v_down-vbeln
                           v_down-posnr
                           v_down-d_taxid
                           v_down-meins
                           v_down-budat
                           v_down-xblnr
                           v_down-rmenge
                           v_down-imenge
                           v_down-bwart
                           v_down-bmenge
                           v_down-mblnr
                           v_down-remak
                     INTO
                         i_csv_file-csv_record
                     SEPARATED BY c_coma.
              IF p_pf_01 IS NOT INITIAL.
                TRANSFER i_csv_file-csv_record TO p_pf_01.
                IF sy-subrc = 0.
                  l_flag1 = 'X'.
                ENDIF.
              ELSE.
                MESSAGE s045(zz) WITH text-039.
              ENDIF.
            ENDLOOP.
            CLOSE DATASET p_pf_01.    
    ENDUIF.
    When i execute that Logic in Back Ground , i am not getting file in APP server
    could any one help on this pls

    Hi ,
    Are you giving any value to field  p_pf_01 or not? May this field is used for Presentation server file.
    Put a break-point at Open Dataset statement and debug.
    Hope this helps you..
    Regards,
    Ashok

  • Debugg a back ground task in production

    Hi All,
    I would like to know what are the different techniques to debugg a back ground task in production? I heard that changing WF_BATCH to dialog user and then dubugg is not a best option since we have limited authorizations in production.
    Regards
    RK

    Hi Ramakrishna,
    IN general the approach what I follow is I create a copy of the work flow  which I want to debug and transport it to the PROD system. But the difference would be that in the copied work flow I make all the steps as foreground steps. For this work flow I maintain the agent assignment to user I.e. WF_ADMIN.
    Or the person who is holding the role of WF_ADMIN.
    The second point here is how do I start the debug work flow instead of main or original work flow. while starting work flow either by using event or directly I would populate a flag into one of container elements.
    I check for this flag and if it is true then I raise an event to start test work flow.
    This kind of approach can help us in so many ways
    1. Without disturbing the original work flow you can change a the steps associated with work flow which is used just for testing and bug fixing.
    2. You don't' have to change Work flow customizations , as you mentioned that changing WF-BATCH to some dialogue user. This kind of change can be ignored.
    I would recommend that you create a separate package and create a test workflow and move the request to PROD. but make sure you don't trigger test workflow instead of original workflow.
    Regards,
    Pavan

  • How to keep break point in back ground scheduling Report

    Hi,
    how to keep break point in back ground scheduling Report?
    Regards,

    Hai ,
    One more way to debug  in the back ground is , pur some infinite loop condition and execute the job and in SM50 you can see the job which is running place the cursor on the job and go to the program in the menu and go to debugging from there .
    Example code for infinite loop .
    i=1 .
    loop at itab .
    if i > 5 .
    end loop .
    Regards,
    K.Vinaykumar

  • RMCB0300 is not working in back ground job

    Hi
      I call t-code MC.9 program (RMCB0300) in back ground by using sample code given below.
      SUBMIT RMCB0300 WITH SL_WERKS-LOW = u2018ABCDu2019
                      WITH SL_LGORT = 'W001'
                      EXPORTING LIST TO MEMORY AND RETURN.
      CALL FUNCTION 'LIST_FROM_MEMORY'
        TABLES
          LISTOBJECT = LISTOBJECT
        EXCEPTIONS
          NOT_FOUND  = 4
          OTHERS     = 8.
      IF SY-SUBRC <> 0.
      ENDIF.
    The 'LIST_FROM_MEMORYu2019 is getting correct output in four ground but
      not in back ground job.
    Kindly help.

    When you use 'LIST_FROM_MEMORY' it basically imports the memory id '%_LIST'.
    When running MC.9 in foreground the memory id '%_LIST' is saved (you can check in debugging) but in background the memory id is not saved
    This is why you are not getting the data correctly in background.
    BR,
    Suhas

  • How To Handle With Back Ground JOB From WEBUI When Click On "Appove"

    Hi
    How To Scheduled A Job Through ABAP Report In back end  Of CRM when i click on "Approve" Button in WEBUI  From result list.
    As per My requirement I have a Search View and Result View
    In Search View I have  Below Fields
    ITC Vendor ID    
    Claim Status
    User status (date status changed)
    Model
    Serial Number
    Date completed of Service Completion
    Based on Search Criteria I will get Result In Result View.(Suppose 10 Records I got In Result View)
    In the Result View I need to Add one Button As "Approve"
    When i Click On Approve button One Pop up Message Need to Open And In that popup window I need to Display Below Text
    "Approve  Claim Job Has Started In Background  
    Note: Only Claims Which are in Submitted  Status  Will be  Approved. you May Close This Window"
    In SAP CRM System  Back Ground Job Need To Start When Click On "Approve" Button In WEBUI .
    In the Back Ground ABAP Report which will validate based on Result List Records"
    In the Result List we may have all types of Claims which are status in "Submitted" "Pending" "Rejected" "Approve".
    I need to collect all records from Result list and validate Those Records who's Status in "Submitted
    1)Sort all the claims based on ITC Vendor ID.
    2)Grouped all the submitted claims against each ITC Vendor ID from the search result
    3)Change the status of the selected submitted claims to Approved.
    4)Displays information messages as mentioned whenever a claim is approved, the same message will be captured in the job log.
    ‘Claims <ClaimID 1>,…<ClaimID N> now approved for ITC Vendor ID’.
    5)Sending Email to each IRC.
    6)Capture all the approved claims in the below format (Format Attached "Screen Shot Attachment")
    7)Store the file in the Application Server AL11 in .csv format
    Please Find Attachement For Reference.
    1)ITC Claim Screen Shot
    2)Screen Shot For Attachment
    Thanks
    Raj

    Hi,
    You can add the following code in on approve method to show popup to the user,
    IF req_edit IS NOT BOUND. " gloabl attribute in impl class of the view
        REFRESH lt_buttons.
        lss_button-id  = 'btnyes'.
        lss_button-text = 'YES'.
        lss_button-on_click = 'YES'.
        APPEND lss_button TO lt_buttons.
        CLEAR lss_button.
        lss_button-id  = 'btnno'.
        lss_button-text = 'NO'.
        lss_button-on_click = 'NO'.
        APPEND lss_button TO lt_buttons.
        CLEAR lss_button.
        CALL METHOD comp_controller->window_manager->create_popup_2_confirm
          EXPORTING
            iv_title          = 'ATTENTION'
            iv_text           = 'Are you sure you want to edit this document?'
            iv_btncombination = '99'
            iv_custombuttons  = lt_buttons
          RECEIVING
            rv_result         = req_edit.
        req_edit->set_on_close_event( iv_event_name = 'EDIT' iv_view = me ). "#EC NOTEXT
        req_edit->open( ).
        RETURN.
      ELSE.
        lr_node ?= req_edit->get_context_node( 'OUTPUTNODE' ).
        lv_outbound = lr_node->get_event_name( ).
    *  CLEAR ptc_pricing_status.
    *    lv_outbound = req_edit->get_fired_outbound_plug( ).
        IF lv_outbound = 'YES'.
    you can use the submit report code here and you can al the validations here
        ELSE. " No
    if user clicks no nothing to do..
        ENDIF.
        CLEAR req_edit.
      ENDIF.
    Best Regards,
    Dharmakasi.

Maybe you are looking for

  • Recovering erased data from a back-up hard drive

    Hello, I erased a folder full of data on my back-up hard drive (Western Digital), and need to recover if it possible. I deleted it and then emptied my Trash, but have not written over it yet. How can I recover this folder? Thanks.

  • Traffic Lights in ALVgrid

    Hi, I am using 'CL_GUI_ALV_GRID' method to display data via ALV. I have a requirement of displaying the succesful records with green light and unsuccessful ones with red lights. Can somebody tell me which field to use in field catalog for that icon o

  • Authorization object  for PLANNING PLANT

    Hi all, My client has different Planning plant & Production plant. If I need to give access to GR for order (MB31), how do I know the authorization object for the Planning plant. User should be given access to MB31 to the Planning plant & NOT to the

  • Ora-00904 left outer join

    Hi, I am trying to create a materialized view and trying replace + left outer join with 'left outer join' clause. I am getting ERROR at line 68: ORA-00904: "RF"."DATA_TYPE_ID": invalid identifier Here is the sql I am using. Any help is appreciated. C

  • Add PO additional attachments links to approval Notification

    Hello, I have a requirement: when a PO approval notification is sent, I need to add another section in Notification to list URL Links of all po attachmnets. I am not talking about sending attachments in the email. My requirement is on notification it