Skip to Content

ME23N, ME22N, SY-TCODE in exit and Overview Button

Hi to all,

I have a little question for all of u.

During the program, i'd like to reconstruct the stack of all programs/methods/functions called until it.(like "Overview" debug button).This because i have this problem (probably someone of u had the same in past).

I'm in a exit of a purchase order enjoy transaction - Status "display purchase order" (ME23N).

If i press "display->modify" button (the little pen), the transaction (field sy-tcode) should changed from ME23N (display) to ME22N (modify), but in the exit if i answer the sy-tcode value ( if sy-tcode = 'ME22N' ) it's always the same (ME23N) also if I in modify mode. I must execute different code if i in modify mode (ME22N) or in display mode (ME23N). But if the value of sy-tcode is always the same, i cannot do it.

So, with the overview button in debug mode i saw that 2 different methods are called : CHANGE_TO_DISPLAY and DISPLAY_TO_CHANGE. If i know during the exit which method was called before reach the exit, i could set the right tcode value. Is it right ?

So, someone of u know how to :

1. Create with instructions (probably methods) the stack of the overview programs/methods/functions called until the program run

2. Solve the problem in different manner

Thx a lot in advice


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 21, 2005 at 10:05 AM


    Another way could be to find an exit to export the value of sy-tcode to ABAP/SAP Memory and then import this value in your desired exit.


    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Andrea Galluccio

      Hello Andrea,

      Now that you have been able to solve your problem, I shall try to get into some theory.

      In general, all the transactions of the type xxn1(create), xxn2(change), xxn3(display) [here, xx denotes letters and n denotes a number] will have the same main program.

      Examples: VA01 - VA02 - VA03
      MM01 - MM02 - MM03
      XD01 - XD02 - XD03
      ME21 - ME22 - ME23

      and several others.

      In fact, if you look at the program SAPMV45A, it has got several create-change-display transactions associated with it. Doesn't that make a lot of sense ?

      A transaction is just a technical way of presenting a complete unit of some functionality. We only need to have different transactions when we have totally different screens and totally different functionalities.

      Sales Order , Inquiy , Quotation , Contract etc., are all different types of Sales Documents. So the major differentiator is the TYPE. But they all have the same main program, because most of the technical presentation is the same.

      I shall not elaborate further on this point. But just ask your self one question: If you were to design these transactions, would you write totally different programs and design all the (same) screens multiple times for each of the program? If that is what you choose to do, then where is the concpet of re-usability?...


      Now consider the transactions like VA05, ME5A, ME2M, ME2L etc., the objective of these transactions is to display all the documents which satisfy a particular set of conditions. so all they need is a selection-screen. But when the user sees the list of the documents, then he might want to visit a particular document. In that case, the corresponding display transaction <u>is called.</u>. The user finishes his checking and comes back to the list from where he can choose to display some other document.


      Now what I wanted to say to you is that even if you had found that the transaction code in the above case is ME28 instead of ME23N (which is obviously not a possibility , for reasons explained above) the main program for the particular screen can not change. So I would have asked yo to try out checking the values of <b>sy-cprog</b> and <b>sy-repid</b>.

      Hope this explanation has helped you understand some of the basic principles of SAP's way of reusability and that it would enable you to do a better diagnosis in case of such situations in the future.


      Anand Mandalika.

  • Posted on Feb 21, 2005 at 10:17 AM


    the right debug button that show the program calls (methods/functios/programs/Forms)is "Calls" and not "Overview" like wrote in before post.

    Thx a lot


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.