Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing the output of transaction SCU3 in a z program

mgross1
Participant
0 Kudos
1,971

I want to access the change logs of a table in my z program. The DBTABLOG table doesn't have all the data I need but the transaction SCU3 outputs what I want.


I couldn't find if this data is in a table so instead I tried to submit the program that SCU3 runs (rsvtprot) and get the data from there (code shown below). But this doesn't give me the data. Can anyone help?


TYPES: BEGIN OF ty_abap_list.
         INCLUDE STRUCTURE abaplist.
TYPES: END OF ty_abap_list.

DATA: gt_abap_list  TYPE STANDARD TABLE OF ty_abap_list.


SUBMIT rsvtprot AND RETURN
     EXPORTING LIST TO MEMORY  USING SELECTION-SCREEN 1010
                               WITH cusobj   EQ tabname "Table Name
                               WITH dbeg     EQ ''
                               WITH tbeg     EQ '000000'
                               WITH dend     EQ ''
                               WITH tend     EQ '235959'
                               WITH objfirst EQ ''
                               WITH tabfirst EQ 'X'.

    CALL FUNCTION 'LIST_FROM_MEMORY'
        TABLES
             listobject = gt_abap_list
        EXCEPTIONS
             not_found  = 1
             OTHERS     = 2.

1 ACCEPTED SOLUTION

former_member210770
Active Participant
0 Kudos
495

Hi Mike,

please refer below code.

*&---------------------------------------------------------------------*

*& Report  ZTEMP_SCU3

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT  ztemp_scu3.

DATA: lr_pay_conf_data TYPE REF TO data,

       lr_pay_conf_data1 TYPE REF TO data.

FIELD-SYMBOLS: <gtab>  TYPE table.

FIELD-SYMBOLS: <lt_pay_conf_data> TYPE STANDARD TABLE,

                <ls_pay_conf_data> TYPE ANY,

                <lv_field>         TYPE ANY.

CLEAR : lr_pay_conf_data.

cl_salv_bs_runtime_info=>set( EXPORTING display  = abap_false

                                         metadata = abap_false

                                         data     = abap_true ).

SUBMIT rsvtprot  USING SELECTION-SCREEN 1010

        WITH cusobj   EQ 'ZFTP_CONN' "Table Name

        WITH dbeg     EQ ''

        WITH tbeg     EQ '000000'

        WITH dend     EQ ''

        WITH tend     EQ '235959'

        WITH objfirst EQ ''

        WITH tabfirst EQ 'X'

        WITH alv_grid = 'X' AND RETURN.

cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = lr_pay_conf_data ).

ASSIGN lr_pay_conf_data->* TO <lt_pay_conf_data>.

IF sy-subrc <> 0.

   CLEAR : sy-ucomm.

   MESSAGE i009(zhundi) WITH 'NO data found'.

ELSE.

   LOOP AT <lt_pay_conf_data> ASSIGNING <ls_pay_conf_data>.

     DO.

       ASSIGN COMPONENT sy-index OF STRUCTURE <ls_pay_conf_data> TO

       <lv_field>.

       IF sy-subrc <> 0.

         EXIT.

       ELSE.

          "Do some validation

       ENDIF.

     ENDDO.

   ENDLOOP.

"Through this line you can transfer content from  <lt_pay_conf_data> TO  GIT_DATA. 

*  APPEND LINES OF <lt_pay_conf_data> TO  GIT_DATA.

ENDIF.

cl_salv_bs_runtime_info=>clear_all( ).

You will get your data in <lt_pay_conf_data>  table .

please reward if this is useful.

Regards,

Sagar Pambhar.

2 REPLIES 2

former_member210770
Active Participant
0 Kudos
496

Hi Mike,

please refer below code.

*&---------------------------------------------------------------------*

*& Report  ZTEMP_SCU3

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT  ztemp_scu3.

DATA: lr_pay_conf_data TYPE REF TO data,

       lr_pay_conf_data1 TYPE REF TO data.

FIELD-SYMBOLS: <gtab>  TYPE table.

FIELD-SYMBOLS: <lt_pay_conf_data> TYPE STANDARD TABLE,

                <ls_pay_conf_data> TYPE ANY,

                <lv_field>         TYPE ANY.

CLEAR : lr_pay_conf_data.

cl_salv_bs_runtime_info=>set( EXPORTING display  = abap_false

                                         metadata = abap_false

                                         data     = abap_true ).

SUBMIT rsvtprot  USING SELECTION-SCREEN 1010

        WITH cusobj   EQ 'ZFTP_CONN' "Table Name

        WITH dbeg     EQ ''

        WITH tbeg     EQ '000000'

        WITH dend     EQ ''

        WITH tend     EQ '235959'

        WITH objfirst EQ ''

        WITH tabfirst EQ 'X'

        WITH alv_grid = 'X' AND RETURN.

cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = lr_pay_conf_data ).

ASSIGN lr_pay_conf_data->* TO <lt_pay_conf_data>.

IF sy-subrc <> 0.

   CLEAR : sy-ucomm.

   MESSAGE i009(zhundi) WITH 'NO data found'.

ELSE.

   LOOP AT <lt_pay_conf_data> ASSIGNING <ls_pay_conf_data>.

     DO.

       ASSIGN COMPONENT sy-index OF STRUCTURE <ls_pay_conf_data> TO

       <lv_field>.

       IF sy-subrc <> 0.

         EXIT.

       ELSE.

          "Do some validation

       ENDIF.

     ENDDO.

   ENDLOOP.

"Through this line you can transfer content from  <lt_pay_conf_data> TO  GIT_DATA. 

*  APPEND LINES OF <lt_pay_conf_data> TO  GIT_DATA.

ENDIF.

cl_salv_bs_runtime_info=>clear_all( ).

You will get your data in <lt_pay_conf_data>  table .

please reward if this is useful.

Regards,

Sagar Pambhar.

0 Kudos
495

That was very helpful - thanks.

What's the best way to access the data of <td_pay_conf_data>? Your comment says I should use APPEND but I don't know the structure of GIT_DATA until runtime.

I'm very new to ABAP and haven't worked with dynamic tables before.