Skip to Content
avatar image
Former Member

RFC for last 100 transactions for users

Hi,

My requirement is to interrogate SAP system from an external .Net program. I want to list last 100 transactions executed by a particular user (and also all users)? Is there any RFC or BAPI (or even report) that I could use. Is there a table that holds such data. I can get data from that table.

In SAP GUI, I can run transaction ST03 and using 'Business Transaction Analysis' get the info I want. But I need to do this from an external application. Many Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 03, 2017 at 09:46 PM

    Hi,

    Unfortunately, there is no standard BAPI for this operation. You can create your remote function module and use SWNC_STAD_READ_STATRECS FM to get this data . This is the standard function module used in the STAD tcode.

    Another method if you want to reach the final data from STAD, you can use SUBMIT.. WITH EXPORTING LIST TO MEMORY.

    In this technique, the data is taken as a string. You can parse it properly.

    Example;

    DATA : lt_listtab  TYPE STANDARD TABLE OF abaplist,
           lt_ascilist TYPE STANDARD TABLE OF text1000.
    
    SUBMIT rsstat26 EXPORTING LIST TO MEMORY AND RETURN.
    
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = lt_listtab
      EXCEPTIONS
        not_found  = 1
        OTHERS     = 2.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    
    CALL FUNCTION 'LIST_TO_ASCI'
      TABLES
        listasci           = lt_ascilist
        listobject         = lt_listtab
      EXCEPTIONS
        empty_list         = 1
        list_index_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.
    
    ENDIF.
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      Thanks for your answer. It has allowed me to move forward. When investigating your suggested FM SWNC_STAD_READ_STATRECS, I came across another one called SWNC_STATREC_READ. This is a remote enabled module. So I am looking into it. Also, RSSTAT26 does the job.

      Many thanks.

  • Mar 01, 2017 at 05:35 PM

    Why don't you just use SQL Trace (or any other analysis tool) to see what is used in ST03? I just did it and it took me less than a minute to find a lot of information. Even faster than posting a question on SCN...

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 03, 2017 at 03:42 PM

    I spent the day tracing using SQL trace but did not find the table which holds the data I want, i.e. transaction executed by users. After no success, I came across this article https://blogs.sap.com/2007/01/12/statistical-records-part-1-inside-stad/

    It seems to suggest that the statistical records are stored on disc and not in the database. What am I missing? Unfortunately I don't have access to folders containing the files so cannot verify.

    If this is indeed the case, then SQL tracing was futile in this case. I probably need some rfc to get the data. So my follow up questions,

    Can I call transaction (STAD or ST03) remotely using an RFC? If so how? Do I need to create a custom RFC using SE37?

    b) Does BDC help in my case? It appears BDC is the way to go to invoke transactions remotely but I also read that most BDC's are one way. They don't return data.

    c) Are there any existing RFC's or BAPI's that would do the job?

    Many thanks in advance.

    -Ajit

    Add comment
    10|10000 characters needed characters exceeded