Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8620

Re: At Selection-screen query

$
0
0

Hi Gita,

 

I think you need something like this:

 

PARAMETERS p_tabnam TYPE string.

 

AT SELECTION-SCREEN ON p_tabnam.

* All this can be replaced by the select from table DD02L. I just think it's nicer this way.

   DATA ddic_table TYPE REF TO cl_abap_structdescr.

   TRY.

       ddic_table ?= cl_abap_tabledescr=>describe_by_name( p_tabnam ).

     CATCH cx_root. "if there's an exception, table does not exist

       MESSAGE 'Table does not exist' TYPE 'E'.

   ENDTRY.

 

   FIELD-SYMBOLS <fs> TYPE any.

   DATA ref_table TYPE REF TO data.

   CREATE DATA ref_table TYPE (p_tabnam).

   ASSIGN ref_table->* TO <fs>.

 

   SELECT SINGLE * FROM (p_tabnam) INTO <fs>.

   IF sy-subrc EQ 0. "there's data

     MESSAGE 'OK' TYPE 'I'.

   ELSE. "there's no data

     MESSAGE 'NG' TYPE 'I'.

   ENDIF.



Regards,

Custodio


Viewing all articles
Browse latest Browse all 8620

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>