Skip to Content
author's profile photo Former Member
Former Member

Invoking SAP transaction through program

Hi,

I have a question regarding how to invoke specific SAP transaction (e.g. SM21, SM51) through program ? Are there any APIs available to do so ?

Intention is to automate the invocation of required SAP transactions.

Thanks in advance!

Thanks,

Ashish

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 23, 2005 at 12:16 PM

    Hi Ashish,

    You cannot call transactions from your program but you can call BAPI related to this transaction if any available.

    Regards,

    Bhavik

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 24, 2005 at 08:36 AM

    Welcome to SDN.

    from where do you want to do this?

    by invoke what do you mean? just showing the transaction initial screen or processing the transaction?

    Regards

    Raja

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Ashish,

      unfortunately there is no generic mapping between transactions and API, and there is also no guarantee that such an API even exists in all cases.

      There are two ways to get that information anyway, but both require some understanding of the WAS system and the ABAP language.

      Both methods start with opening the transaction in the development workbench (SE80) (use "Workbench"->"Edit object"->"more"->"transaction").

      Method 1: find out function modules in the same package

      This requires only little knowledge of the ABAP language. After opening the transaction, navigate to the package the transaction is in, then press CTRLSHIFTF5, to make the object list appear in the tree on the left. In the tree, open the "Function Groups" folder and see whether there are any function modules which do what you want. Execute the function modules in question to find out what they are really doing. Problem here is, there are some rather large packages containing a lot of function modules, so searching them manually will take some time. There's also the chance that you won't find the right module because it is in another package. But more often than not, one can succeed with this method.

      Method 2: analyse the code

      This requires some more ABAP knowledge.

      The transaction screen also lets you navigate to the source code of the transaction (often a simple report, but may also be a function module). By looking at the source, one can analyse what modules are called (some understanding of how reports are built is very useful here).

      Using the second approach, one can find out that

      - SM28 does not call any function module (see below)

      - SM21 calls a lot of function modules

      - What DB02 does, depends on the database type

      So unfortunately it turns out that in the transactions you need, there is no easy-to-use API.

      For SM28, you could write a function module by yourself which does the appropriate syscall to SAPICC. Should not be too hard, since you can almost c&p from the report and add the information to a table instead of WRITE. Then you can call that module via RFC.

      For SM21, some deeper analysis of the reports inner workings would be necessary - sorry, but I don't have that much time right now. It may also be easier to use operating-system level functions to access that information (e.g. MMC on Windows).

      For DB02, you should check out the reports which are called from the case statement, depending on your database system.

  • author's profile photo Former Member
    Former Member
    Posted on Sep 25, 2005 at 04:40 AM

    I think you call using " CALL TRANSACTION " through a functional module and call remotely.

    Thx,

    Balki

    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.