How to Debug SAP RFC , background job , update FM etc..

How to Debug SAP RFC , background job , update FM etc..

Check out this article to know how you can debug RFC FM,Back ground Job, Portal application and Update Function module.

Author : Raj

Author's Website | Articles from Raj

Raj is an Application Developer focusing on Custom Development - particularly in the areas of ABAP ,WD4A , JAVA , APO , Enterprise services and PI Developer/consultant . He is also certified in ABAP and PI. Facebook

How to Kill an ABAP Developer???

Simple Go and Remove F6, F7 keys from his/her keyboard and He will suffer the most painful death.

(**we used to crack this joke in our ABAP Training)

After my 3 weeks of ABAP training it was my first day in office .My so called Guruji came to my desk and gave me a standard function module and told me that this function module is called from the APO system you need to debug it.

I did not even know how to debug a normal function module and this guy wants me to debug the RFC enabled function module!!!!!

So This Article is dedicated to All my friends who is facing the issue with typical Debugging J.This article covers RFC, portal, update task and background job debugging.

Debugging a Remote enabled Function module application.

Suppose you want to debug a function module which is there in APO system from the R/3.

rfc_deb

(FYI: As you all know this RFC Destination is maintained via transaction code SM59 )

So here you can see the R/3 Program which is calling the APO Function module Z_TEST_CONNECTION_R3.

As you can see in the below image, keep the external break-point in your program before it calls the RFC enabled Function module.

step11

Now login into the APO system where you’re remote enabled function module exist and put an external break-point.

step12

Now go to Transaction code: SRDEBUG and click on the Activate Debugging Button:

It will give you a pop up which confirm your id, application server etc…. click enter which will give you another popup as shown in the below image. Keep it as it is.

step13Now go to your Report program in R/3 system and Execute it , it will open debugger , when you press F5 key to go inside the RFC Function module it  will start debugging in APO system.

How to debug a portal application

Assume that there is a Java based application which is using HTML/JSP as its user interface and intern it uses the Java code to call the ABAP RFC enabled function module. So when user click on the submit or search option it fetches or update the data inside the ABAP system.

port_deb

As compare to RFC Debugging from R/3 to APO here it’s somewhat tricky as here the user is not same, As Portal application and ABAP will not see the same user id.(***It depends but mostly it will not be same)

You need to consult with portal designer and needs to set your user id as the default user when you submit the FORM in portal. Once both the JAVA and ABAP system uses the same user id you just needs to put the external break point in your ABAP System it will stops when this RFC is called.

How to debug the background job

There are two ways to debug the background job

Option: 1. Open the running job in SM37 and select it . Enter “JDBG” in the command line and click enter. It will start the abap debugger.

bgjob_deb

Option: 2. Go to Transaction code SM50. Select your job which you want to debug as shown in the below image.

bgjob_deb2

It will give you a popup for asking whether you want to debug the program or not and in few seconds it will open the debugger screen .

How to Debug an Update Function Module:

As you know update function module is called when a commit work is happend.To Debug an update function put a break-point just above the update function module and executes the program. Go to the property of the debugger (Setting-> Display/change debugger setting) and select the flag “Update Debugging”.

When program encounter a Commit work statement it will start the debugger in new window for the update function module.

update_fm

Tips and Tricks related to Debugger.

If you want to jump to a specific line of code just put your cursor on the desired line and click on the Shift+F12 .It will start the execution of the program/code from that line (Not if you are skipping the lines ,those peace of code is not executed so that code is as equal as empty lines)



Like this post? Share it!

  • Tweet
  • Facebook
  • Diggit
  • Delicious
  • Diggit
  • Diggit
  • Diggit
  • Diggit
  • Diggit

ADVERTISE HERE


User Comments


  1. Avmukher
    February 17, 2011

    Good one … thanks!

    Reply


  2. Rajesh Gumpena
    May 16, 2011

    Good one…..

    Thanks:)

    Reply


  3. Bijaya
    May 31, 2011

    very useful …:-D

    Reply


  4. SARAVANAN
    June 18, 2011

    Very useful……………

    Reply


  5. Murali
    August 12, 2011

    Thanks you so much :)

    Reply


  6. prachi gupta
    September 14, 2011

    Hello raj,
    Thanks for this post!. This is very helpful.
    Can u tell me how to execute the userexit/function exit which i have make by the test cases which i have. I dont know how to do this as i have joined new in abap.
     

    Reply


    • Raj
      September 14, 2011

      Hello Prachi,
      user-exit and function module exits are executed in while the normal business transaction is executed.
      what you can do is.Keep a break-point inside the EXIT.
      Execute the business transaction code.If the enhancement is activated it will stop there.
      check out the functionality for which you have implemented the Exits.

      Get back if it is not clear.
      Thanks.
      SAP IGnite.
      Raj

      Reply


  7. ranjithkumar
    March 2, 2012

    hi Raj,
    very nice site for ABAP material,can u post the ABAP HR tutorial

    Reply


  8. firoz alam
    April 17, 2012

    thanks Raj
    I am appreciate your answer

    Reply


  9. Niketh
    July 23, 2012

    Thats very useful , Thanks.

    Reply


  10. divya
    August 27, 2012

    very useful answers
    Thanks raj.

    Reply


  11. prasad
    August 28, 2012

    Thanks Raj…its very helpfull 4 me.

    ur are very helpfull person 

    Reply


  12. kishore
    September 3, 2012

    Hi Raj,

    I do not find the SRDEBUG tcode in R/3
    Can you pls help.

    Kishore

    Reply


  13. din
    September 6, 2012

    Hi Kishore,

    Can you go to Transaction Code : se38 and try to execute the program : RSRDEBUG.

    thanks,
    Din

    Reply


  14. Mallu
    October 15, 2012

    Its very useful,great work………..

    Reply


  15. Sekhar
    October 26, 2012

    Respected Mr.Raj,

    If u don’t mind can u send me to my mail,,,1. How to debug ABAP/4 Smartforms and How can we update smartfoms.
    2. what r the uses of module pool programming?

    Reply


  16. Ajit
    February 13, 2013

    Hi Raj,
     
    Please post
    1) How to debug a smart from and how to update sfm.
    2) How to show a report program through mpp program ?
    Please post its urgent…..
     
    Thanks in Adv. Raj

    Reply


  17. v.prakash
    April 3, 2013

    i am very happy.

    Reply


  18. Hemant
    April 24, 2013

    Hi Raj..
    Your’s posting is very useful for who are new to abap..
    please go head..

    Reply

Leave a Reply

:wink: :-| :-x :twisted: :) 8-O :( :roll: :-P :oops: :-o :mrgreen: :lol: :idea: :-D :evil: :cry: 8) :arrow: :-? :?: :!:
  Twitter Followers Email Updates