Application Development and Automation 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:Ā 
Read only

dinamic table creation error message

k_gjergja
Participant
0 Likes
911

Hello ,

I am trying to crate internal table dinamically , having a field cattog as a reference.

I am using the following method .

CALL METHOD cl_alv_table_create=>create_dynamic_table

When I executed above line I am getting the error message  AUVI_Base _role (00030) pos 9 auvi_base_role ( 00030)

The whole code is below .  I do not understand meaning of the error message

Please advice

Chris

   REPORT  / z_roles .

TYPE-POOLS slis.

TABLES: usr01,agr_users,usr03,usr02,uslogond,agr_define , agr_flags.

SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME.
SELECT-OPTIONS s_bname FOR usr01-bname.               " User
SELECT-OPTIONS s_ustyp FOR usr02-ustyp.               " User type
SELECT-OPTIONS s_vdat FOR  agr_users-from_dat.        " Date of validity
PARAMETERS :  p_1  AS CHECKBOX ,                      " only locked
              p_2  AS CHECKBOX.                       " only active
SELECTION-SCREEN END OF BLOCK a1.

*FIELD CATALOG and layout
DATA : i_fcat TYPE lvc_t_fcat,    "slis_t_fieldcat_alv,
       wa_fcat LIKE LINE OF  i_fcat,
       i_layout TYPE slis_layout_alv.

DATA:  v_repid LIKE sy-repid ,
       v_save  TYPE c VALUE 'X'.

FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE" Dynamic internal table name
               <fs_dyntable>,                     " Field symbol to create work area
               <fs_fldval> type any.              " Field symbol to assign values

DATA:   t_newtable TYPE REF TO data,
        t_newline  TYPE REF TO data.



*internal tables
*all roles
DATA i_agr_flags LIKE STANDARD TABLE OF agr_flags WITH HEADER LINE.

*INITIALIZATION.

  CLEAR: i_fcat, wa_fcat, i_layout , i_agr_flags, i_agr_flags[].
  perform get_roles. " select all except coll.

* field catalog

  wa_fcat-fieldname = 'KOSTL'.
  wa_fcat-datatype =  'CHAR'.
  wa_fcat-intlen = 8.
  append wa_fcat to i_fcat.

  wa_fcat-fieldname = 'ABTLG'.
  wa_fcat-datatype =  'CHAR'.
  wa_fcat-intlen = 12.
  append wa_fcat to i_fcat.

  wa_fcat-fieldname = 'USTYP'.
  wa_fcat-datatype =  'CHAR'.
  wa_fcat-intlen = 1.
  append wa_fcat to i_fcat.

   wa_fcat-fieldname = 'BNAME'.
  wa_fcat-datatype =  'CHAR'.
  wa_fcat-intlen = 12.
  append wa_fcat to i_fcat.

  wa_fcat-fieldname = 'NAME1'.
  wa_fcat-datatype =  'CHAR'.
  wa_fcat-intlen = 30.
  append wa_fcat to i_fcat.

  loop at i_agr_flags.

  wa_fcat-fieldname = i_agr_flags-agr_name.
  wa_fcat-datatype =  'CHAR'.
  wa_fcat-intlen = 30.
  append wa_fcat to i_fcat.
  endloop.


*create  new table
CALL METHOD cl_alv_table_create=>create_dynamic_table

    EXPORTING
      it_fieldcatalog = i_fcat
    IMPORTING
      ep_table        = t_newtable.

* Create a new Line with the same structure of the table.

  ASSIGN t_newtable->* TO <t_dyntable>.  " Dynamic internal table
* Create dynamic work area and assign to FS
  CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
  ASSIGN t_newline->* TO <fs_dyntable> . " This is your dynamic work area.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
878

Hi,

Can you check whether the i_agr_flags-agr_name has UPPER CASE?

If not TRANSLATE i_agr_flags-agr_name TO UPPERCASE before assigning to field catalog.

Thanks,

Shambu

8 REPLIES 8
Read only

Former Member
0 Likes
879

Hi,

Can you check whether the i_agr_flags-agr_name has UPPER CASE?

If not TRANSLATE i_agr_flags-agr_name TO UPPERCASE before assigning to field catalog.

Thanks,

Shambu

Read only

0 Likes
878

Hello

I changed the codel to

   loop at i_agr_flags.
TRANSLATE i_agr_flags-agr_name TO UPPER CASE .
  wa_fcat-fieldname = i_agr_flags-agr_name.
  wa_fcat-ref_field = 'AGR_NAME'.
  wa_fcat-ref_table = 'AGR_FLAGS'.
  append wa_fcat to i_fcat.
  endloop.

Stil i have the error message  AUVI_BASE_ROLE is not expected 9 AUVI_BASE_ROLE

when I comented this part of code the dinamic table was created

Thanks

Chris

Read only

0 Likes
878

Can you check whether any Field names are repeated?

Thanks,

Shambu

Read only

0 Likes
878

Hi ,

Apparently AVI_BASE _ROLE is one of the values in field catalog .

I add delete duplicates from field catalog at the end  but still the error message

persists.

Thanks

    loop at i_agr_flags.

TRANSLATE i_agr_flags-agr_name TO UPPER CASE.

  wa_fcat-fieldname = i_agr_flags-agr_name.
  wa_fcat-ref_field = 'AGR_NAME'.
  wa_fcat-ref_table = 'AGR_FLAGS'.
  append wa_fcat to i_fcat.
  clear wa_fcat.
  endloop.

DELETE ADJACENT DUPLICATES FROM  i_fcat COMPARING  fieldname.

Read only

0 Likes
878

Use SORT first.

SORT i_fcat BY fieldname.

DELETE ADJACENT DUPLICATES FROM  i_fcat COMPARING  fieldname.

Thanks,

Shambu

Read only

0 Likes
878

Hi

I excluded 'AUVI_BASE_ROLE'  from internal table and run the program once more ,

Again I get message but on the next ( now first value ) coming from agr_flags table

Now in the error i have  FB_BASE_ROLE .

I may be because the values comming from that table look like following

  AMP046:AUVI_BASE_ROLE

  AMP046:FB_BASE_ROLE

They all have the  prefix  'AMP046:'

Regards

Read only

0 Likes
878

Can you try to replace ':' with underscore?

Thanks,

Shambu

Read only

0 Likes
878

Solved. The names coming from rules table  have lot of different characters like - or + an they are not accepted during dynamic itab creation .

Thanks