cancel
Showing results for 
Search instead for 
Did you mean: 

How to fetch fields from a structure?

Former Member
0 Kudos
469

Hi all,

I am trying to fetch a field from ADURI which is a structure. But I'm getting an error that "ADURI is not declared as a table, projection view, or database view in ABAP Dictionary or does not exist in an active version."

Please help me resolve this. I am adding the code line below.

SELECT SINGLE uri_screen FROM ADURI 
INTO @DATA(ls_uri) WHERE uri_screen = @lv_url.

Accepted Solutions (0)

Answers (2)

Answers (2)

Yasin
Active Participant
0 Kudos

Hi

You cannot apply SQL Query like this on structure you should use FM CATSXT_GET_DDIC_FIELDINFO

try the below code i tested, it is working fine just copy / paste

  DATA: lt_fields   TYPE ddfields,
        lt_fcat     TYPE lvc_t_fcat,
        lt_fcat_alv TYPE slis_t_fieldcat_alv.

  DATA: ls_fcat     TYPE lvc_s_fcat,
        ls_fields   LIKE LINE OF lt_fields,
        ls_fcat_alv LIKE LINE OF lt_fcat_alv.

  DATA: lv_index  TYPE i.

  CALL FUNCTION 'CATSXT_GET_DDIC_FIELDINFO'
    EXPORTING
      im_structure_name = 'ADURI'
    IMPORTING
      ex_ddic_info      = lt_fields
    EXCEPTIONS
      failed            = 1
      OTHERS            = 2.

  IF sy-subrc <> 0.
    RAISE structure_not_found.
  ENDIF.

  cl_demo_output=>display_data( lt_fields[] ).

Please mark it as solution if it works for you.

Thanks

FredericGirod
Active Contributor
0 Kudos

I don't understand how this FM will help him to find an URL ?

Yasin
Active Participant
0 Kudos

The post subject is fetch fields from a structure i was confused why she was using SQL on ADURI

however i gave the logic if she is looking for the real data yes shed need to find the transparent table as you said but in this case no need to fetch anything from the ADURI structure right?.

FredericGirod
Active Contributor
0 Kudos

A structure is just a layout, a mask, it does not contain data. So you cannot make SELECT or anything else like this.

If you don't know the real table behind this structure, you could try to make a SQL trace on the transaction using ST01