Skip to Content

call transaction in new session (but only one)

Dear all,

as a hotspot functionality I would like to open a new transaction in a new session. For that reason, I use the FM ABAP4_CALL_TRANSACTION with the option STARTING NEW TASK.

However I would like to restrict the new tasks in a way that only one session is used (no matter how often the user clicks the hotspot. Kind of like the ABAP Help in the workbench.

I checked the class CL_IMC_MODE to see if it could work as a new internal session but the new mode dumped when I pressed the back button and according to the dump Statements that closes the internal mode unexpectedly like LEAVE are not allowed. Since I call standard transactions (like VA03) I can hardly prevent that. Did I miss something or do you have any other idea how I could solve my problem?

Thank you for any input.


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Dec 30, 2004 at 11:36 AM

    Hi Christian

    That's a very challenging issue dealing with "CL_IMC_MODE". Synchronous sessions, screen handling, etc... lots of things to understand. Moreover it uses RFC and system calls. Hope you can handle it.

    Or you can do what Subramanian suggested. Delete the session opened for the relevant transaction. However, if there are more than one instances of the same transaction it will fail since you would be just knowing the transaction code and you have no guaranteed way to distinguish a session opened by your program's trigger and manually by the user himself, either.


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 30, 2004 at 10:19 AM

    Hello Christian,

    an usage of the Enqueue techinque might solve your technique. But this require setting an accordning lock on side of the new task. As consequence this requires that you use an own (copied & extended) FuBa.

    Best Regards


    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Just a thought here, if you see <b>SM04</b> transaction, it shows a list of users. If you click on a particular user, and then click on the button <b>Sessions</b>, it shows the list of sessions available. You can end a particular session as well. There is a <b>Delete</b> button available to end a session.

      On debugging the above program, (the code is almost non-understandable), I found that it is doing some system calls and fetching the list of transactions for a given user and while displaying has a structure called <b>MODUS</b>. However I am not sure what is the internal table where it stores this data. As I said, code is a little tricky.

      Let us know if you did this in any other manner.


      Subramanian V.

  • Posted on Dec 30, 2004 at 09:03 PM

    Hi Christian,

    Here is a sample code that takes in a sales order number, displays the document number as hotspot and when the user clicks on the hotspot, it opens a new window for displaying the order. No matter how many times the user clicks on the hotspot, it will only display one window for VA03. I hope this solves your problem.

    REPORT ztest.
    PARAMETERS: p_vbeln LIKE vbak-vbeln.
    DATA: ls_vbak LIKE vbak.
    DATA: BEGIN OF i_rfc_spagpa OCCURS 0.
            INCLUDE STRUCTURE rfc_spagpa.
    DATA: END OF i_rfc_spagpa.
    DATA: v_mode LIKE sy-index.
                      INTO ls_vbak
                     WHERE vbeln = p_vbeln.
      IF sy-subrc <> 0.
    *-- error.
      WRITE:/ ls_vbak-vbeln HOTSPOT,
      CASE sy-ucomm.
        WHEN 'PICK'.
    *-- Delete the previous session and then call VA03 in a new session
                    mode = v_mode.
          CLEAR: i_rfc_spagpa, i_rfc_spagpa[].
          i_rfc_spagpa-parid = 'AUN'.
          i_rfc_spagpa-parval = p_vbeln.
          APPEND i_rfc_spagpa.
          CLEAR i_rfc_spagpa.
              tcode                         = 'VA03'
              skip_screen                   = 'X'
              mode_val                      = 'A'
              update_val                    = 'A'
    *       IMPORTING
    *         SUBRC                         =
    *         USING_TAB                     =
              spagpa_tab                    = i_rfc_spagpa
    *         MESS_TAB                      =
              call_transaction_denied       = 1
              tcode_invalid                 = 2
              OTHERS                        = 3 .
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        WHEN OTHERS.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 03, 2005 at 01:32 PM

    Hello Christian,

    what I sometimes do to prevent multiple execution on a pushbutton event is something like this:


    clear counter.

    import counter from memory id 'counter'.

    if counter eq 0.

    counter = counter + 1.

    export counter to memory id 'counter'.


    • <b>here call the function that should be called only once.</b>


    free memory id 'counter'.





    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.