Dump at cl_abap_typedescr= describe_by_data

Hi ,
My code is as follows:
  l_descr_ref ?= cl_abap_typedescr=>describe_by_data( gt_fldname ).
  BREAK-POINT.
  CLEAR : l_counter.
  LOOP AT l_descr_ref->components[] ASSIGNING <lfs_comp_wa>.
    l_counter = l_counter + 1.
    ASSIGN COMPONENT l_counter OF STRUCTURE gt_fldname TO <lfs_comp>.
    <lfs_comp> = <lfs_comp_wa>-name.
  ENDLOOP.
But it goes for dump at   l_descr_ref ?= cl_abap_typedescr=>describe_by_data( gt_fldname ).Can anyone tell why?

Hi My code is as follows:
  DATA : l_descr_ref TYPE REF TO cl_abap_structdescr,
         l_counter TYPE sytabix.
  FIELD-SYMBOLS:
         <lfs_comp_wa> TYPE abap_compdescr,
         <lfs_comp>     TYPE ANY.
  l_descr_ref ?= cl_abap_typedescr=>describe_by_data( gt_fldname ).
  CLEAR : l_counter.
  LOOP AT l_descr_ref->components[] ASSIGNING <lfs_comp_wa>.
    l_counter = l_counter + 1.
    ASSIGN COMPONENT l_counter OF STRUCTURE gt_fldname TO <lfs_comp>.
    <lfs_comp> = <lfs_comp_wa>-name.
  ENDLOOP.
And if I change the type, then it says there is no components[].
Edited by: Jjammy on Jul 14, 2009 3:24 PM

Similar Messages

  • L_descr_ref ?=cl_abap_typedescr= describe_by_data( gt_tab ).

    Hi,
    I have written the code as follows to get the components of the file uploaded.But it goes for dump at the statement written at subject line: And it says " However, the current content of the source variable does not fit into
    the target variable." please help!!!
    TYPES: BEGIN OF ttab_type,
             rec(1000) TYPE c,
           END OF ttab_type.
      DATA:gt_tab  TYPE TABLE OF ttab_type.
      DATA: l_descr_ref       TYPE REF TO cl_abap_structdescr,
             g_line TYPE string,
             gt_field                 TYPE crmt_mktimex_field_tab.
    DATA: lt_table TYPE REF TO data,
          lt_line  TYPE REF TO data,
          ls_xfc TYPE lvc_s_fcat,
          ls_ifc TYPE lvc_t_fcat,
          lt_details TYPE abap_compdescr_tab,
          lw_details TYPE abap_compdescr.
      FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                   <dyn_wa>,
                   <dyn_field>.
    CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = pfile1
          filetype                = 'ASC'
          has_field_separator     = 'X'
        TABLES
          data_tab                = gt_tab
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
        l_descr_ref ?=
          cl_abap_typedescr=>describe_by_data( gt_tab ).
          lt_details[] = l_descr_ref->components[].
    Edited by: Ginger on Jul 3, 2009 1:18 AM

    Ya...as rightly said by Vamsi...
    change your declaration as
    l_descr_ref  TYPE REF TO cl_abap_tabledescr,
    It will work....and for your information you can also use the below codes for getting components..
    DATA:  lv_ref_table        TYPE REF TO cl_abap_tabledescr,
           lv_ref_struct       TYPE REF TO cl_abap_structdescr,
      lv_ref_table  ?= cl_abap_tabledescr=>describe_by_data( et_data ).
      lv_ref_struct ?= lv_ref_table->get_table_line_type( ).
      lt_details[]   = lv_ref_struct->components.

  • Cl_abap_typedescr= describe_by_data( gt_table )

    Afternoon all
    I am using cl_abap_typedescr=>describe_by_data( <gt_table> ) to retrieve the fieldlist of my dynamically created ALV fieldcatalog.  However, I have just switched to using some fields that are of type INT and now the method ignores them.  Is this correct???  Is there another method that I should be using?  I am on 46B.
    Cheers
    Ian

    Here is a sample program which has 10 INT4 fields, works good for me.
    report zrich_0002
           no standard page heading.
    type-pools: slis.
    type-pools: abap.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>,
                   <dyn_field>.
    data: alv_fldcat type slis_t_fieldcat_alv,
          it_fldcat type lvc_t_fcat.
    selection-screen begin of block b1 with frame title text-001.
    parameters: p_check type c.
    selection-screen end of block b1.
    start-of-selection.
      perform build_dyn_itab.
      perform build_report.
      data : it_details type abap_compdescr_tab.
      data : ref_descr type ref to cl_abap_structdescr.
      ref_descr ?= cl_abap_typedescr=>describe_by_data( <dyn_wa> ).
      it_details[] = ref_descr->components[].
    * Write out data from table.
      loop at <dyn_table> into <dyn_wa>.
        do.
          assign component  sy-index  of structure <dyn_wa> to <dyn_field>.
          if sy-subrc <> 0.
            exit.
          endif.
          if sy-index = 1.
            write:/ <dyn_field>.
          else.
            write: <dyn_field>.
          endif.
        enddo.
      endloop.
    *  Build_dyn_itab
    form build_dyn_itab.
      data: index(3) type c.
      data: new_table type ref to data,
            new_line  type ref to data,
            wa_it_fldcat type lvc_s_fcat.
    * Create fields
      clear index.
      do 10 times.
        index = sy-index.
        clear wa_it_fldcat.
        concatenate 'Field' index into
                 wa_it_fldcat-fieldname .
        condense  wa_it_fldcat-fieldname no-gaps.
        wa_it_fldcat-datatype = 'INT4'.
        wa_it_fldcat-intlen = 5.
        append wa_it_fldcat to it_fldcat .
      enddo.
    * Create dynamic internal table and assign to FS
      call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = it_fldcat
                   importing
                      ep_table        = new_table.
      assign new_table->* to <dyn_table>.
    * Create dynamic work area and assign to FS
      create data new_line like line of <dyn_table>.
      assign new_line->* to <dyn_wa>.
    endform.
    *      Form  build_report
    form build_report.
      data: fieldname(20) type c.
      data: fieldvalue(5) type c.
      data: index(3) type c.
      field-symbols: <fs1>.
      do 10 times.
        index = sy-index.
    * Set up fieldname
        concatenate 'FIELD' index into
                 fieldname .
        condense   fieldname  no-gaps.
    * Set up fieldvalue
        fieldvalue = index.
        condense   fieldvalue no-gaps.
        assign component  fieldname  of structure <dyn_wa> to <fs1>.
        <fs1> =  fieldvalue.
      enddo.
    * Append to the dynamic internal table
      append <dyn_wa> to <dyn_table>.
    endform.
    Regards,
    Rich Heilman

  • CL_ABAP_TYPEDESCR - DESCRIBE_BY_DATA  field length is doubled

    I have a custom program developed on Non Unicode system, that is using CL_ABAP_TYPEDESCR -> DESCRIBE_BY_DATA  to get field lengths of the fields in a structure. The code works perfectly file on Non Unicode system where it is developed, However when the same code is imported on a UNICODE system the field lengths of the fields in the same structure are exactly doubled. Anybody has any idea, why this may be happening?

    > However when the same code is imported on a UNICODE system the field lengths of the fields in the same structure are exactly doubled. Anybody has any idea, why this may be happening?
    Yes - because Unicode uses two bytes to represent ONE character.
    Markus

  • Cl_abap_typedescr= describe_by_data

    We've just upgraded from 4.6 to ECC 6.0 and found that the result from cl_abap_typedescr=>describe_by_data differs.
    In 4.6 the result in field ABSOLUTE_NAME referes to the definition in the main program. In 6.0 we get the definition from the type-pool in which the type is created. Does anyone know of a way to get the 4.6 type of result in ECC 6.0
    Thanks in advance,
    Arthur

    We've just upgraded from 4.6 to ECC 6.0 and found that the result from cl_abap_typedescr=>describe_by_data differs.
    In 4.6 the result in field ABSOLUTE_NAME referes to the definition in the main program. In 6.0 we get the definition from the type-pool in which the type is created. Does anyone know of a way to get the 4.6 type of result in ECC 6.0
    Thanks in advance,
    Arthur

  • Class CL_ABAP_TYPEDESCR's method DESCRIBE_BY_DATA

    Hello!
    How can I call CL_ABAP_TYPEDESCR's Method DESCRIBE_BY_DATA
    with the CALL command ?
    Many thanks in advance for your kindly efforts.
    Reagards
    Ilhan

    Hi Ilhan,
    In the abap editor, place the cursor where you want to put the CALL.
    1->click the "Pattern" button (CTRL F6)
    2->choose the radio button "ABAP Object patterns", Click Enter
    3->in then next popup, choose the first radio button "Call Method"
    4->Enter "CL_ABAP_TYPEDESCR" in the class name field
    5->Enter "DESCRIBE_BY_DATA" in the method field, click Enter
    you have the pattern in the editor
    OR
    you may copy the following code, and pass the parameters
    data: l_describe TYPE REF TO cl_abap_typedescr.
    field-symbols: <field>.
    data: field_name(15).
    ASSIGN TABLE FIELD (field_name) TO <field>
    call method cl_abap_typedescr=>describe_by_data
      exporting
        p_data      = <field>
      receiving
        p_descr_ref = l_describe
    Or Simply
      ASSIGN TABLE FIELD (field_name) TO <field>.                 
    l_describe = cl_abap_typedescr=>describe_by_data( <field> ).
    Hope this helps,
    Sajan Joseph.

  • Dynamic types with CL_ABAP_TYPEDESCR

    Hi,
    I have a problem. I want to read out the output_length of dynamic types to evaluate inputs. I do something like the code below.
    DATA type_ref      TYPE REF TO cl_abap_typedescr.
    DATA elem_descr TYPE REF TO cl_abap_elemdescr.
    DATA struc_descr TYPE REF TO cl_abap_structdescr.
    type_ref = cl_abap_typedescr=>describe_by_data( <fs_lsinto> ).
    elem_descr ?= type_ref.
    elem_descr->output_length
    But sometimes type_ref give back a CL_ABAP_STRUCTDESCR and I get a dump at '?='.
    How I can solve my Problem?
    Sinan

    How about something like this.
    report  zrich_0001.
    data type_ref type ref to cl_abap_typedescr.
    data elem_descr type ref to cl_abap_elemdescr.
    data struc_descr type ref to cl_abap_structdescr.
    data comp_tab type abap_compdescr_tab.
    data comp_wa like line of comp_tab.
    parameters: p_name(30) type c.
    type_ref = cl_abap_typedescr=>describe_by_name( p_name ).
    if type_ref->type_kind = 'u'.            " <- Structure
      struc_descr ?= type_ref.
      loop at struc_descr->components into comp_wa.
        catch system-exceptions move_cast_error = 1.
          data: tab_component type string.
         concatenate p_name comp_wa-name into comp_wa-name separated by '-'.
          elem_descr ?= cl_abap_typedescr=>describe_by_name( comp_wa-name ).
        endcatch.
        write:/ comp_wa-name, comp_wa-length, elem_descr->output_length.
      endloop.
    else.
      elem_descr ?= type_ref.
      write:/ p_name, elem_descr->output_length.
    endif.
    Regards,
    Rich Heilman

  • CL_ABAP_TYPEDESCR does not return integer or decimal field

    Dear All,
    I have an internal table for which I want to get dynamically list of fields.
    I use class CL_ABAP_TYPEDESCR and method DESCRIBE_BY_DATA.
    The list of field is then placed in table CL_ABAP_TYPEDESCR->KEY. The problem
    is that fields with integer type (FIELD FACTOR) are not listed there. What do I do wrong?
    TYPES: BEGIN OF t_table,
            name(20)   TYPE C,
            period(10) TYPE C,
            factor     TYPE I,
          END OF t_table.
    DATA: it_table TYPE STANDARD TABLE OF t_table.
    DATA: wa_table TYPE t_table.
    wa_table-name = 'Brown'. wa_table-period = '2010'. wa_table-factor = 100. APPEND wa_table TO it_table.
    wa_table-name = 'Brown'. wa_table-period = '2011'. wa_table-factor = 200. APPEND wa_table TO it_table.
    wa_table-name = 'Fox'.   wa_table-period = '2010'. wa_table-factor = 50.  APPEND wa_table TO it_table.
    wa_table-name = 'Fox'.   wa_table-period = '2010'. wa_table-factor = 900. APPEND wa_table TO it_table.
    TYPE-POOLS: ABAP.
    DATA: L_REF TYPE REF TO CL_ABAP_TABLEDESCR.
    l_ref ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA( it_table ).
    * TABLE l_ref->key DOES NOT SHOW FIELD "FACTOR" (TYPE I)....
    FIELD-SYMBOLS: <KEY_COMP_WA> TYPE ABAP_KEYDESCR.
    LOOP AT l_ref->key ASSIGNING <KEY_COMP_WA>.
       WRITE:/ <KEY_COMP_WA>-NAME.
    ENDLOOP.
    Best regards,
    Mark

    Hi Mark,
    if you want the fields you should consider attribute components, compare this snippet getting the field names of any structure or table (from the times when I still used FORM routines)
    FORM getfields
      USING    px_data                        TYPE any
      CHANGING pt_fields                      TYPE table.
      DATA:
        lt_comp                               TYPE abap_compdescr_tab,
        lr_dat                                TYPE REF TO data,
    **    lv_kind                             TYPE abap_typecategory,
        lr_typedescr                          TYPE REF TO cl_abap_typedescr,
    **    lr_tabledescr                       TYPE REF TO cl_abap_tabledescr,
        lr_structdescr                        TYPE REF TO cl_abap_structdescr.
      FIELD-SYMBOLS:
        <fs>                                  TYPE ANY,
        <ft>                                  TYPE ANY TABLE,
        <comp>                                TYPE LINE OF abap_compdescr_tab.
      lr_typedescr ?= cl_abap_typedescr=>describe_by_data( px_data ).
      CASE lr_typedescr->kind.
        WHEN 'S'.
          lr_structdescr ?= lr_typedescr.
          lt_comp                             = lr_structdescr->components.
        WHEN 'T'.
          ASSIGN px_data TO <ft>.
          CREATE DATA lr_dat                  LIKE LINE OF <ft>.
          ASSIGN lr_dat->* TO <fs>.
          lr_structdescr ?= cl_abap_structdescr=>describe_by_data( <fs> ).
          lt_comp                             = lr_structdescr->components.
        WHEN OTHERS.
          MESSAGE e241(00).
    *   Function is invalid in this environment
      ENDCASE.
      CLEAR pt_fields.
      LOOP AT lt_comp ASSIGNING <comp>.
        APPEND <comp>-name TO pt_fields.
      ENDLOOP." at lt_comp assigning <comp>.
    ENDFORM.                    " getfields
    Regards,
    Clemens

  • Dynamic programming using cl_abap_typedescr

    I have created a field catalog for an ALV grid dynamically using cl_alv_table_create=>create_dynamic_table (I am on 46B and cannot use the new version).  How do I create the structure and therefore internal table to pass into the it_outtab parameter of the ALV grid set_table_for_first_display
    method?  I can create a blank table with the correct dynamic columns but now wish to populate it without much success!  I am retrieving the type using cl_abap_typedescr=>describe_by_data and can cycle through the key but how do I just obtain the structure?
    Cheers
    Ian
    cl_abap_typedescr to retrieve the column names of a dynamic table I have created for using with an ALV grid

    Hi,
    Use ASSIGN r_dyn_table->* TO <t_dyn_table> to get access to the dynamic table. To append rows to it, you should use ASSIGN COMPONENT idx/name OF STRUCTURE struc TO <fs>.
    Example:
        data: tab_fields like table of wa_fields,
             r_dyn_table  TYPE REF TO data,
             r_wa_dyn_table   TYPE REF TO data,
             f_int type i.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
          EXPORTING
            it_fieldcatalog           = F_TAB_FCAT
          IMPORTING
            ep_table                  = r_dyn_table
          EXCEPTIONS
            generate_subpool_dir_full = 1
            OTHERS                    = 2.
          ASSIGN r_dyn_table->* TO <t_dyn_table>.
          CREATE DATA r_wa_dyn_table LIKE LINE OF <t_dyn_table>.
          ASSIGN r_wa_dyn_table->* TO <wa_dyn_table>.
          DESCRIBE TABLE tab_fields lines f_int.
          do f_int times.
            READ TABLE tab_fields INDEX sy-index into wa_fields.
            ASSIGN wa_fields-field TO <w_field1>.
            check1 = sy-subrc.
            ASSIGN COMPONENT sy-index
                   OF STRUCTURE <wa_dyn_table> TO <w_field2>.
            check2 = sy-subrc.
            if check1 = 0 and check2 = 0.
              <w_field2> = <w_field1>.
            endif.
          enddo.
    Svetlin

  • Cl_abap_typedescr= describe_by_name not returning correct length value

    Hi,
    I am using cl_abap_typedescr=>describe_by_name  to get the length and field names of a table.  But it is returning incorrect values for length.    For example, all character fields and numc fields contain double the correct length
    REPORT  ZCA_BOB_CL_ABAP_STRUCTDESCR.
    PARAMETERS P_TABNAM type TABNAME OBLIGATORY.
    Data: wa_spfli type spfli,
          r_descr type REF TO cl_abap_structdescr,
          wa_comp TYPE abap_compdescr.
    ** Create references to the needed ALV Global Classes
      data: lr_events type ref to cl_salv_events_table.
      data: gr_table   type ref to cl_salv_table.
      Data: r_grid TYPE REF TO cl_salv_table.
      data: r_title_text TYPE REF TO cl_alv_variant,
            r_grid_title TYPE LVC_TITLE.
    Data:  abap_compdescr_tab TYPE STANDARD TABLE OF abap_compdescr
                         WITH KEY name.
    START-OF-SELECTION.
    **         ?=   means cast
    ** r_descr ?= cl_abap_typedescr=>describe_by_data( wa_spfli ).
    r_descr ?= cl_abap_typedescr=>describe_by_name( P_TABNAM ).
    Loop at r_descr->components into wa_comp.
    *   write:/ wa_comp-name, wa_comp-type_kind, wa_comp-length,
    *            wa_comp-decimals.
       append wa_comp to abap_compdescr_tab.
    EndLoop.

    Hello Bob
    Below is the output of your report run on a 4.6c system:
    Structure WA_SPFLI:                                   
    MANDT                          C          3           0
    CARRID                         C          3           0
    CONNID                         N          4           0
    COUNTRYFR                      C          3           0
    CITYFROM                       C         20           0
    AIRPFROM                       C          3           0
    COUNTRYTO                      C          3           0
    CITYTO                         C         20           0
    AIRPTO                         C          3           0
    FLTIME                         I          4           0
    DEPTIME                        T          6           0
    ARRTIME                        T          6           0
    DISTANCE                       P          5           4
    DISTID                         C          3           0
    FLTYPE                         C          1           0
    PERIOD                         b          1           0
    4.6c = non-Unicode
    Your system = Unicode
    Thus, the length is apprently the length in bytes.
    Simply check and RFC destination (SM59) using button "Unicode Test". You will get the following message on an Unicode system:
    Target is a unicode system (character size 2)
    Regards
      Uwe

  • CL_ABAP_TYPEDESCR

    If I create a user defined type with reference to a DDIC object I can obtain the list of fields in the user defined type and the obsolute name which contains the user defined type by calling method describe_by_data of class cl_abap_structdescr at run time.
    Does anyone know how you can find the original ddic structure at runtime of the type TY_POHEADER.
    TYPES: ty_poheader TYPE bapimepoheader.
    DATA: dref TYPE REF TO data.
    DATA: descr_ref TYPE REF TO cl_abap_structdescr.
    FIELD-SYMBOLS: <fs_line2> TYPE ty_poheader.
    Start-of-selection.
    CREATE DATA dref TYPE ty_poheader.
    ASSIGN dref->* TO <fs_line2>.
    descr_ref ?= cl_abap_typedescr=>describe_by_data( <fs_line2> ).

    i am getting all the components of the original ddic structure. check out the program below.
    REPORT  zzorgdataget                            .
    TYPES: ty_poheader TYPE bapimepoheader.
    DATA: dref TYPE REF TO data.
    DATA: descr_ref1 TYPE REF TO cl_abap_structdescr.
    DATA : l_string TYPE string.
    DATA : l_object TYPE dd_x031l_table.
    DATA : l_true TYPE abap_bool.
    DATA : l_desc TYPE REF TO cl_abap_typedescr.
    FIELD-SYMBOLS: <fs_line2> TYPE ty_poheader.
    START-OF-SELECTION.
      TYPES: my_struct TYPE mepoheader.
      DATA:
        my_data   TYPE my_struct,
        descr_ref TYPE REF TO cl_abap_structdescr.
      FIELD-SYMBOLS:
        <comp_wa> TYPE abap_compdescr.
    START-OF-SELECTION.
      descr_ref ?= cl_abap_typedescr=>describe_by_data( my_data ).
      WRITE: / 'Typename     :', descr_ref->absolute_name.
      WRITE: / 'Kind         :', descr_ref->type_kind.
      WRITE: / 'Length       :', descr_ref->length.
      WRITE: / 'Decimals     :', descr_ref->decimals.
      WRITE: / 'Struct Kind  :', descr_ref->struct_kind.
      WRITE: / 'Components'.
      WRITE: / 'Name              Kind   Length   Decimals'.
      LOOP AT descr_ref->components ASSIGNING <comp_wa>.
        WRITE: / <comp_wa>-name, <comp_wa>-type_kind,
                 <comp_wa>-length, <comp_wa>-decimals.
      ENDLOOP.

  • Problem about CL_ABAP_TYPEDESCR

    Hi Buddies,
       There was a strange problem which I encountered today.When I called the method cl_abap_typedescr=>describe_by_data to obtain the components of the table DD01T, the length of each component of this table was doubled.After I used this components table to create an internal table dynamically, the problem is occured due to doule length of the true lengh..
    Suddently I realized that the problem was caused by UNICODE.Did anyone has the idea to get the right length?
    DATA: structtype TYPE REF TO cl_abap_structdescr.
    structtype ?= cl_abap_typedescr=>describe_by_data( u2018DD01Tu2019 ).

    Hello,
    I used POSID instead of PSPNR.
    Regards,
    Pedro

  • Resolving data-reference at runtime ( cl_abap_typedescr)

    Hi all,
    At runtime, I need to find out if a data-reference of created data
    refers to a data-element or not.
    In will give you an example of what I mean:
    data: dummy         TYPE bukrs,
          descr_ref     TYPE REF TO cl_abap_typedescr,
          descr_datael  TYPE REF TO cl_abap_elemdescr,
          p_datael      type string value ''.
    descr_ref = cl_abap_typedescr=>describe_by_data( dummy ).
    MOVE descr_ref ?TO descr_datael.
    p_datael = descr_datael->help_id. "p_datael has now value BUKRS
    How is this done, if we work with a datareferences?
    I'm pretty sure it should be feasible - but I'm stuck here...
    Task: same as above - find out data-element of dummy.
    data: dummy         TYPE ref to data,
          descr_ref     TYPE REF TO cl_abap_typedescr,
          descr_datael  TYPE REF TO cl_abap_elemdescr,
          p_datael      type string value ''.
    create dummy type bukrs.
    descr_ref = cl_abap_typedescr=>describe_by_data( dummy ).
    "descr_ref->type_kind this time indicates, that we work with referenced data.
    "How to progress from here on?
    Thanks in advance. Points will be granted if issue can be solved!

    Hello Edwin
    The sample report ZUS_SDN_RTTI_DATA_ELEMENT shows how to address your question.
    *& Report  ZUS_SDN_RTTI_DATA_ELEMENT
    *& Thread: resolving data-reference at runtime ( cl_abap_typedescr)
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="770681"></a>
    REPORT  zus_sdn_rtti_data_element.
    DATA: gdo_dummy         TYPE REF TO data,
          go_typedescr      TYPE REF TO cl_abap_typedescr,
          go_elemdescr      TYPE REF TO cl_abap_elemdescr,
          p_datael      TYPE string VALUE ''.
    PARAMETERS:
      p_rolln   TYPE  rollname  DEFAULT 'BUKRS'.
    START-OF-SELECTION.
      CREATE DATA gdo_dummy TYPE (p_rolln).
      go_typedescr = cl_abap_typedescr=>describe_by_data_ref( gdo_dummy ).
      go_elemdescr ?= go_typedescr.
      IF ( go_elemdescr->kind = cl_abap_elemdescr=>kind_elem  AND
           go_elemdescr->help_id = 'BUKRS' ).
        MESSAGE 'Is of TYPE BUKRS' TYPE 'S'.
      ELSE.
        MESSAGE 'Is not of TYPE BUKRS' TYPE 'S'.
      ENDIF.
    END-OF-SELECTION.
    Regards
      Uwe

  • Check box in ALV BLOCK List

    Hi All,
    iam Using ALV BLOCK list to print the output along with check boxes, iam able to print the output along with the check boxes but when i select any of the check box and click button on application tool bar it is going to dump  and saying,
    FIELD SYMBOL HAS NOT YET BEEN ASSIGNED.
    i populated layout with following fields.
      w_layout-box_fieldname = 'BOX'.
      w_layout-box_tabname = 'T_FINAL2'.
    Plz Help me out.
    Thanks in Advance.
    Neha

    *& Report  BCALV_TEST_BLOCK_LIST
    report  bcalv_test_block_list.
    types: g_ty_t_carrid  type standard table of alv_tab,
           g_ty_t_connid  type standard table of alv_chck,
           g_ty_t_curr    type standard table of alv_cur,
           g_ty_s_sflight type alv_t_t2,
           g_ty_s_carrid  type alv_tab,
           g_ty_s_connid  type alv_chck,
           g_ty_s_curr    type alv_cur.
    constants: con_sflight type lvc_fname value 'ALV_T_T2',
               con_scarr   type lvc_fname value 'ALV_TAB',
               con_spfli   type lvc_fname value 'ALV_CHCK',
               con_scurx   type lvc_fname value 'ALV_CUR',
               con_event_01 type lvc_fname value 'PF_STATUS_SET',
               con_event_02 type lvc_fname value 'USER_COMMAND',
               con_event_03 type lvc_fname value 'CALLER_EXIT',
               con_event_04 type lvc_fname value 'LIST_MODIFY',
               con_event_05 type lvc_fname value 'BEFORE_LINE_OUTPUT',
               con_event_06 type lvc_fname value 'AFTER_LINE_OUTPUT',
               con_event_07 type lvc_fname value 'SUBTOTAL_TEXT',
               con_event_08 type lvc_fname value 'REPREP_MODIFY',
               con_event_09 type lvc_fname value 'TOP_OF_PAGE',
               con_event_10 type lvc_fname value 'END_OF_PAGE',
               con_event_11 type lvc_fname value 'TOP_OF_LIST',
               con_event_12 type lvc_fname value 'END_OF_LIST',
               con_event_13 type lvc_fname value 'TOP_OF_COVERPAGE',
               con_event_14 type lvc_fname value 'END_OF_COVERPAGE',
               con_event_15 type lvc_fname value 'TOP_OF_FOREIGN_PAGE',
               con_event_16 type lvc_fname value 'END_OF_FOREIGN_PAGE',
               con_event_17 type lvc_fname value 'GROUPLEVEL_CHANGE'.
    DATA                                                                 *
    tables: sscrfields.   " for processing the FCODEs in Selektion screens
    include <icon>.
    include <symbol>.
    type-pools: slis, kkblo.
    types: g_ty_t_icon  type standard table of icon,
           g_ty_t_icont type standard table of icont,
           begin of g_ty_s_plane,
             carrid    type g_ty_s_sflight-carrid,
             connid    type g_ty_s_sflight-connid,
             planetype type g_ty_s_sflight-planetype,
             seatsmax  type g_ty_s_sflight-seatsmax,
           end   of g_ty_s_plane,
           g_ty_t_plane type sorted table of g_ty_s_plane
                             with unique key carrid connid,
           begin of g_ty_s_fcat_curr,
             fieldname  type lvc_fname,
             cfieldname type lvc_fname,
             currency   type lvc_s_fcat-currency,
           end   of g_ty_s_fcat_curr,
           g_ty_t_fcat_curr type sorted table of g_ty_s_fcat_curr
                                 with unique key fieldname,
           begin of g_ty_s_sort.
    include type slis_sortinfo_alv.
    types: end   of g_ty_s_sort,
           g_ty_t_sort type sorted table of g_ty_s_sort
                            with unique key spos fieldname,
           begin of g_ty_s_test,
             list_amount              type num1,
             select_amount            type i,
             only_db_info             type char1,
             db_short                 type char1,
             excp_display             type char1,
             excp_condense            type char1,
             layo_title               type lvc_s_layo-grid_title,
             layo_zebra               type char1,
             layo_no_vert_lines       type char1,
             layo_no_horiz_lines      type char1,
             layo_cell_merge          type char1,
             layo_count               type char1,
             layo_box                 type char1,
             layo_no_colhead          type char1,
             layo_column_optimize     type char1,
             layo_keys_hotspot        type char1,
             layo_no_keyfix           type char1,
             layo_no_hotspot          type char1,
             layo_hotspot_rows        type i occurs 0,
             layo_hotspot_columns     type lvc_fname occurs 0,
             layo_no_scrolling        type char1,
             layo_no_authcheck        type char1,
             layo_no_min_linesize     type char1,
             layo_min_linesize        type sylinsz,
             layo_max_linesize        type sylinsz,
             layo_group_change_edit   type char1,
             layo_get_selinfo         type char1,
             layo_confirmation_prompt type char1,
             layo_f2code              type syucomm,
             layo_reprep              type char1,
             sum_before               type char1,
             sum_no_sumline           type char1,
             sum_no_sumchoice         type char1,
             sum_numc                 type char1,
             sum_no_unitsplit         type char1,
             sum_totals_only          type char1,
             sum_totals_text          type symsgli,
             sum_no_subtotals         type char1,
             sum_no_subchoice         type char1,
             sum_subtotals_text       type symsgli,
             prnt_print               type char1,
             prnt_reserve_lines       type lvc_s_prnt-reservelns,
             prnt_no_listinfo         type char1,
             prnt_no_selinfo          type char1,
             prnt_with_title          type char1,
             prnt_footline            type lvc_s_prnt-footline,
             prnt_printinfo           type char1,
             prnt_no_coverpage        type char1,
             prnt_no_new_page         type char1,
             prnt_no_change_print_params type char1,
             color_rows               type i occurs 0,
             color_fields_column      type lvc_fname occurs 0,
             color_fields_cell        type lvc_fname occurs 0,
             fcat_no_out_fields       type lvc_fname occurs 0,
             fcat_tech_fields         type lvc_fname occurs 0,
             fcat_fix_column_fields   type lvc_fname occurs 0,
             fcat_do_sum_fields       type lvc_fname occurs 0,
             fcat_no_sum_fields       type lvc_fname occurs 0,
             fcat_curr_fields         type g_ty_t_fcat_curr,
             curr_amount              type i,
             curr_space               type char1,
             t_sort                   type g_ty_t_sort,
             no_info_popup            type char1,
             info_popup_once          type char1,
             events_info_popup        type lvc_fname occurs 0,
             events                   type lvc_fname occurs 0,
             buffer_active            type char1,
             bypassing_buffer         type char1,
           end   of g_ty_s_test,
           begin of g_ty_s_outtab.
    include type g_ty_s_sflight.
    types:   list                 type num1,
             box                  type char1,
             count                type i,
             lights               type char1,
             checkbox             type char1,
             hotspot              type char1,
             color(4)             type c,
             tabcolor             type slis_t_specialcol_alv,
             price2               type g_ty_s_sflight-price,
             currency2            type g_ty_s_sflight-currency,
             char(10)             type c,
             string               type string,
             int1                 type int1,
             int2                 type int2,
             int4                 type int4,
             numc(10)             type n,
             dec(10)              type p decimals 2,
             fltp                 type f,
             dats                 type d,
             tims                 type t,
             icon                 type icon-id,
             icon_qinfo           type icon-name,
             symbol               type icon-id,
           end   of g_ty_s_outtab,
           g_ty_t_outtab type table of g_ty_s_outtab.
    constants: con_true         type char1 value 'X',
               con_ok   type sy-ucomm value 'OK',
               con_exit type sy-ucomm value 'EXIT',
               con_canc type sy-ucomm value 'CANC',
               con_back type sy-ucomm value 'BACK'.
    data: gt_outtab1 type g_ty_t_outtab,
          gt_outtab2 type g_ty_t_outtab,
          gt_outtab3 type g_ty_t_outtab,
          gt_outtab4 type g_ty_t_outtab,
          gt_outtab5 type g_ty_t_outtab,
          gt_outtab6 type g_ty_t_outtab,
          gt_outtab7 type g_ty_t_outtab,
          gt_outtab8 type g_ty_t_outtab,
          gt_outtab9 type g_ty_t_outtab.
    data: gt_outtab   type g_ty_t_outtab with header line,
          gs_test     type g_ty_s_test.
    data: g_repid     type sy-repid.
    data: g_field     type lvc_s_fcat-fieldname,
          g_int_field type i.
          CLASS random DEFINITION
    class random definition.
      public section.
        types:
          value(16) type p decimals 0,
          numcv(15) type n.
        constants:
          max type random=>value value 4294967295.
        class-methods:
      computes a random natural number from the set {0, ..., random=>max}.
          number returning value(rval) type random=>value,
      computes a random character from the set {A-Za-z0-9}
          c returning value(rval) type char01,
      computes a random string consisting of "len" random characters
          string importing len type i
                 returning value(rval) type string,
      computes a date
          dats returning value(rval) type d,
      computes a time
          time returning value(rval) type t,
      computes a random numc from the set {low, ..., high}
          numc importing low type random=>numcv high type random=>numcv
            returning value(rval) type random=>numcv,
      computes a random integer from the set {low, ..., high}
          i importing low type i high type i
            returning value(rval) type i,
      computes a random integer from the set {low, ..., high}
          int2 importing low type int2 high type int2
               returning value(rval) type int2,
      computes a random integer from the set {low, ..., high}
          int1 importing low type int1 high type int1
               returning value(rval) type int1,
      computes a random float from the interval [low ; high]
          f importing low type f high type f
            returning value(rval) type f,
      computes a random character from the set {A-F0-9}
          hex returning value(rval) type char01,
      computes a random character from the set {0-1}
          x returning value(rval) type char01,
      method "random=>class_constructor"
          class_constructor.
      private section.
        class-data:
      precomputed maximal index (= string length - 1) of "random=>chars"
      or of "random=>x_data".
          charsmax type i,
          xmax type i,
      random number seed value.
      (Used in method "random=>number".)
          seed type random=>value.
        constants:
      characters for class-method "random=>hex"
          hex_data(100) type c value 'ABCDEF' &
                                     '0123456789',
      characters for class-method "random=>x"
          x_data(100) type c value '01',
      characters for class-metshod "random=>c"
          chars(100) type c value 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' &
                                  'abcdefghijklmnopqrstuvwxyz' &
                                  '0123456789'.
    endclass.                    "random DEFINITION
          CLASS random IMPLEMENTATION
    class random implementation.
    implementation of the methods for randomizing the values
      method x.
        data: ri type i.
        ri = random=>i( low = 0  high = random=>xmax ).
        move x_data+ri(1) to rval.
      endmethod.                    "x
      method hex.
        data: ri type i.
        ri = random=>i( low = 0  high = random=>charsmax ).
        move hex_data+ri(1) to rval.
      endmethod.                    "hex
      method number.
        constants:
          a(3) type p  value 67301,        " Coefficient
          c(1) type p  value 1,            " Increment
          m(6) type p  value 4294967296.   " Modulus 2**32
        random=>seed = ( a * random=>seed + c ) mod m.
        rval = random=>seed.
      endmethod.                    "number
      method c.
        data:
          ri type i.
        ri = random=>i( low = 0  high = random=>charsmax ).
        move chars+ri(1) to rval.
      endmethod.                    "c
      method string.
        data:
          char(1) type c.
        clear rval.
        do len times.
          char = random=>c( ).
          concatenate rval char into rval.
        enddo.
      endmethod.                    "string
      method dats.
        data: l_date      type sy-datum,
              l_day(2)    type n,
              l_month(2)  type n,
              l_year(4)   type n,
              l_value     type random=>numcv,
              l_low       type random=>numcv,
              l_high      type random=>numcv.
        l_year  = sy-datum+0(4).
        l_low   = l_year - 5.
        l_high  = l_year + 5.
        l_value = random=>numc( low = l_low high = l_high ).
        l_year  = l_value+11(4).
        l_value = random=>numc( low = 1 high = 12 ).
        l_month = l_value+13(2).
        case l_month.
          when 2.
            l_high = 28.
          when 4 or 6 or 9 or 11.
            l_high = 30.
          when others.
            l_high = 31.
        endcase.
        l_value = random=>numc( low = 1 high = l_high ).
        l_day   = l_value+13(2).
        l_date+0(4) = l_year.
        l_date+4(2) = l_month.
        l_date+6(2) = l_day.
        rval = l_date.
      endmethod.                    "dats
      method time.
        data: l_time      type t,
              l_hour(2)   type n,
              l_min(2)    type n,
              l_sec(2)    type n,
              l_value     type random=>numcv.
        l_value = random=>numc( low = 0 high = 60 ).
        l_sec   = l_value+13(2).
        l_value = random=>numc( low = 0 high = 60 ).
        l_min   = l_value+13(2).
        l_value = random=>numc( low = 1 high = 24 ).
        l_hour  = l_value+13(2).
        l_time+0(2) = l_hour.
        l_time+2(2) = l_min.
        l_time+4(2) = l_sec.
        rval = l_time.
      endmethod. "time
      method numc.
      Go from {0,...,random=>max} to {low,...,high} with ABAP rounding
        data: l_dec(16)   type p,
              l_char(16)  type c.
        l_dec = ( ( high - low + 1 ) * random=>number( ) ) / random=>max
               + '0.5'.
        subtract 1 from l_dec.
        add low to l_dec.
        data: lr_type_descr  type ref to cl_abap_typedescr,
              lr_elem_descr  type ref to cl_abap_elemdescr.
        lr_type_descr =
                 cl_abap_typedescr=>describe_by_data( rval ).
        lr_elem_descr ?= lr_type_descr.
        l_char = l_dec.
        shift l_char left deleting leading space.
        rval = l_char+0(lr_elem_descr->output_length).
      endmethod.                    "i
      method i.
      Go from {0,...,random=>max} to {low,...,high} with ABAP rounding
        data: l_dec(16)   type p,
              l_char(16)  type c.
        l_dec = ( ( high - low + 1 ) * random=>number( ) ) / random=>max
               + '0.5'.
        subtract 1 from l_dec.
        add low to l_dec.
        data: lr_type_descr  type ref to cl_abap_typedescr,
              lr_elem_descr  type ref to cl_abap_elemdescr.
        lr_type_descr =
                 cl_abap_typedescr=>describe_by_data( rval ).
        lr_elem_descr ?= lr_type_descr.
        l_char = l_dec.
        shift l_char left deleting leading space.
        rval = l_char+0(lr_elem_descr->output_length).
      endmethod.                    "i
      method int2.
      Go from {0,...,random=>max} to {low,...,high} with ABAP rounding
        data: l_dec(16)   type p,
              l_char(16)  type c.
        l_dec = ( ( high - low + 1 ) * random=>number( ) ) / random=>max
               + '0.5'.
        subtract 1 from l_dec.
        add low to l_dec.
        data: lr_type_descr  type ref to cl_abap_typedescr,
              lr_elem_descr  type ref to cl_abap_elemdescr.
        lr_type_descr =
                 cl_abap_typedescr=>describe_by_data( rval ).
        lr_elem_descr ?= lr_type_descr.
        l_char = l_dec.
        shift l_char left deleting leading space.
        rval = l_char+0(lr_elem_descr->output_length).
      endmethod.                    "i
      method int1.
      Go from {0,...,random=>max} to {low,...,high} with ABAP rounding
        data: l_dec(16)   type p,
              l_char(16)  type c.
        l_dec = ( ( high - low + 1 ) * random=>number( ) ) / random=>max
               + '0.5'.
        subtract 1 from l_dec.
        add low to l_dec.
        data: lr_type_descr  type ref to cl_abap_typedescr,
              lr_elem_descr  type ref to cl_abap_elemdescr.
        lr_type_descr =
                 cl_abap_typedescr=>describe_by_data( rval ).
        lr_elem_descr ?= lr_type_descr.
        l_char = l_dec.
        shift l_char left deleting leading space.
        rval = l_char+0(lr_elem_descr->output_length).
      endmethod.                    "i
      method f.
      Go from {0,...,random=>max} to [low;high]
        rval = ( ( high - low ) * random=>number( ) ) / random=>max
               + low.
      endmethod.                    "f
      method class_constructor.
        charsmax = strlen( chars ) - 1.
        xmax = strlen( x_data ) - 1.
        seed = 1.
      endmethod.                    "class_constructor
    endclass.                    "random IMPLEMENTATION
    SELECTION-SCREEN                                                     *
    selection-screen begin of block gen with frame.
    parameters:
    p_amount type i default 30,
    p_dbinfo as checkbox,
    p_dbshrt as checkbox.
    selection-screen end of block gen.
    parameters:
    p_list type num1 default 3.
    selection-screen begin of block tit with frame title text-tit.
    parameters:
    p_tit01 type lvc_s_layo-grid_title default text-p01. "TITLE
    selection-screen end of block tit.
    selection-screen begin of block lay with frame title text-lay.
    parameters:
    p_lay01 as checkbox. "ZEBRA
    selection-screen skip.
    parameters:
    p_lay02 as checkbox, "NO HORIZONTAL LINES
    p_lay03 as checkbox. "NO VERTICAL LINES
    selection-screen skip.
    parameters:
    p_lay04 as checkbox. "NO SCROLLING
    selection-screen skip.
    parameters:
    p_lay06 type syucomm,                                       "F2CODE
    p_lay07 as checkbox. "CONFIRMATION PROMPT
    selection-screen end of block lay.
    selection-screen begin of block spa with frame title text-spa.
    parameters:
    p_spa01 as checkbox, "BOX
    p_spa02 as checkbox, "COUNT FELD
    p_spa03 as checkbox, "NO COLUMN HEADERS
    p_spa04 as checkbox. "COLUMN OPTIMIZE
    selection-screen begin of block hot with frame title text-hot.
    parameters:
    p_hot01 as checkbox. "NO HOTSPOT
    parameters:
    p_hot02 as checkbox. "Hotspot auf Zeilenebene
    select-options:
    p_hotf02 for g_int_field no intervals default 1.
    parameters:
    p_hot03 as checkbox.
    select-options:
    p_hotf03 for g_field no intervals.
    selection-screen end of block hot.
    selection-screen begin of block mrg with frame title text-mrg.
    parameters:
    p_mrg01 radiobutton group mrge, "Default
    p_mrg02 radiobutton group mrge, "kein Merge
    p_mrg03 radiobutton group mrge. "Merge
    selection-screen end of block mrg.
    selection-screen begin of block out with frame title text-out.
    parameters:
    p_out01 as checkbox.
    select-options:
    p_outf01 for g_field no intervals.
    selection-screen end of block out.
    selection-screen begin of block tec with frame title text-tec.
    parameters:
    p_tec01 as checkbox.
    select-options:
    p_tecf01 for g_field no intervals.
    selection-screen end of block tec.
    selection-screen begin of block fix with frame title text-fix.
    parameters:
    p_fix01 as checkbox.
    select-options:
    p_fixf01 for g_field no intervals.
    selection-screen end of block fix.
    selection-screen begin of block txt with frame title text-txt.
    selection-screen pushbutton /1(50) text-pb2 user-command pb02.
    selection-screen end   of block txt.
    selection-screen begin of block cur with frame title text-cur.
    parameters:
    p_curanz type i,
    p_curspc as checkbox default space.
    selection-screen skip.
    select-options:
    p_curf00 for g_field no intervals.
    parameters:
    p_cur01 radiobutton group cur default 'X',
    p_curf01 type lvc_s_fcat-fieldname.
    parameters:
    p_cur02 radiobutton group cur,
    p_curf02 type g_ty_s_sflight-currency.
    selection-screen end of block cur.
    selection-screen begin of block sort with frame title text-srt.
    selection-screen pushbutton /1(20) text-pb1 user-command pb01.
    selection-screen end   of block sort.
    selection-screen end of block spa.
    selection-screen begin of block key with frame title text-key.
    parameters:
    p_key01 as checkbox, "KEYFELDER ALS HOTSPOT
    p_key02 as checkbox. "NO KEY FIXIERUNG
    selection-screen end of block key.
    selection-screen begin of block exp with frame title text-exp.
    parameters:
    p_excp01 as checkbox, "EXCEPTION
    p_excp_c as checkbox. "EXCEPTION CONDENSE
    selection-screen end of block exp.
    selection-screen begin of block sum with frame title text-sum.
    parameters:
    p_sum01 as checkbox, "SUM BEFORE
    p_sum02 as checkbox, "NUMC
    p_sum03 as checkbox, "NO UNITSPLIT
    p_sum04 as checkbox, "TOTALS ONLY
    p_sum05 as checkbox, "NO SUMCHOICE
    p_sum06 as checkbox, "NO SUMLINE
    p_sum07 type sy-msgli, "TOTALS TEXT
    p_sum08 as checkbox, "NO SUBCHOICE
    p_sum09 as checkbox, "NO SUBTOTALS
    p_sum10 type sy-msgli. "SUBTOTALS TEXT
    selection-screen begin of block dos with frame title text-dos.
    parameters:
    p_dos01 as checkbox.
    select-options:
    p_dosf01 for g_field no intervals.
    selection-screen end of block dos.
    selection-screen begin of block nos with frame title text-nos.
    parameters:
    p_nos01 as checkbox.
    select-options:
    p_nosf01 for g_field no intervals.
    selection-screen end of block nos.
    selection-screen end of block sum.
    selection-screen begin of block col with frame title text-col.
    parameters:
    p_col01 as checkbox.
    select-options:
    p_colf01 for g_int_field no intervals default 1.
    parameters:
    p_col02 as checkbox.
    select-options:
    p_colf02 for g_field no intervals.
    parameters:
    p_col03 as checkbox.
    select-options:
    p_colf03 for g_field no intervals.
    selection-screen end of block col.
    selection-screen begin of block prn with frame title text-prn.
    parameters:
    p_lpr01 as checkbox default 'X'. "GROUP CHANGE EDIT
    selection-screen skip.
    parameters:
    p_lpr02 as checkbox. "GET SELINFO
    selection-screen skip.
    parameters:
    p_lpr03 as checkbox, "NO MIN LINESIZE
    p_lpr04 type sylinsz, "MIN LINESIZE
    p_lpr05 type sylinsz. "MAX LINESIZE
    selection-screen skip.
    parameters:
    p_prn01 as checkbox, "PRINT
    p_prn02 type lvc_s_prnt-reservelns, "RESERVE LINES
    p_prn03 as checkbox, "NO LISTINFO
    p_prn04 as checkbox, "NO SELINFO
    p_prn05 as checkbox, "TITEL
    p_prn06 type lvc_s_prnt-footline, "FOOTLINE
    p_prn07 as checkbox, "PRINT INFO
    p_prn08 as checkbox, "NO COVERPAGE
    p_prn09 as checkbox, "NO NEW PAGE
    p_prn10 as checkbox. "NO CHANGE PRINT PARAMS
    selection-screen end of block prn.
    selection-screen begin of block evt with frame.
    parameters:
    p_evt01 as checkbox, "PF_STATUS_SET
    p_evt02 as checkbox. "USER_COMMAND
    selection-screen skip.
    parameters:
    p_evt03 as checkbox, "CALLER_EXIT
    p_evt04 as checkbox, "LIST_MODIFY
    p_evt05 as checkbox, "BEFORE_LINE_OUTPUT
    p_evt06 as checkbox. "AFTER_LINE_OUTPUT
    selection-screen skip.
    parameters:
    p_evt07 as checkbox, "SUBTOTAL_TEXT
    p_evt08 as checkbox. "REPREP_SEL_MODIFY
    selection-screen skip.
    parameters:
    p_evt09 as checkbox, "TOP_OF_PAGE
    p_evt10 as checkbox, "END_OF_PAGE
    p_evt11 as checkbox, "TOP_OF_LIST
    p_evt12 as checkbox. "END_OF_LIST
    selection-screen skip.
    parameters:
    p_evt13 as checkbox, "TOP_OF_COVERPAGE
    p_evt14 as checkbox. "END_OF_COVERPAGE
    selection-screen skip.
    parameters:
    p_evt15 as checkbox, "FOREIGN_TOP_OF_PAGE
    p_evt16 as checkbox. "FOREIGN_END_OF_PAGE
    selection-screen skip.
    parameters:
    p_evt17 as checkbox. "GROUPLEVEL_CHANGE
    selection-screen end of block evt.
    INITIALIZATION                                                       *
    initialization.
      perform f01_f4_field using 'SUM' space changing p_dosf01-low.
      p_dosf01-option = 'EQ'.
      p_dosf01-sign   = 'I'.
      append p_dosf01.
      perform f01_f4_field using 'SUM' space changing p_nosf01-low.
      p_nosf01-option = 'EQ'.
      p_nosf01-sign   = 'I'.
      append p_nosf01.
      perform f01_f4_field using 'KEY' space changing p_outf01-low.
      p_outf01-option = 'EQ'.
      p_outf01-sign   = 'I'.
      append p_outf01.
      perform f01_f4_field using space space changing p_tecf01-low.
      p_tecf01-option = 'EQ'.
      p_tecf01-sign   = 'I'.
      append p_tecf01.
      perform f01_f4_field using space space changing p_fixf01-low.
      p_fixf01-option = 'EQ'.
      p_fixf01-sign   = 'I'.
      append p_fixf01.
      perform f01_f4_field using 'CURR' space changing p_curf00-low.
      p_curf00-option = 'EQ'.
      p_curf00-sign   = 'I'.
      append p_curf00.
      perform f01_f4_field using 'CUKY' space changing p_curf01.
      perform f01_f4_field using space space changing p_hotf03-low.
      p_hotf03-option = 'EQ'.
      p_hotf03-sign   = 'I'.
      append p_hotf03.
      perform f01_f4_field using space space changing p_colf02-low.
      p_colf02-option = 'EQ'.
      p_colf02-sign   = 'I'.
      append p_colf02.
      perform f01_f4_field using space space changing p_colf03-low.
      p_colf03-option = 'EQ'.
      p_colf03-sign   = 'I'.
      append p_colf03.
    AT SELECTION-SCREEN                                                  *
    at selection-screen.
      case sscrfields-ucomm.
        when 'PB01'.
          call screen 1001 starting at 1 1 ending at 80 20.
        when 'PB02'.
          call screen 1002 starting at 1 1 ending at 80 20.
      endcase.
    AT SELECTION-SCREEN ON VALUE-REQUEST                                 *
    at selection-screen on value-request for p_dosf01-low.
      perform f01_f4_field using 'SUM' 'X' changing p_dosf01-low.
    at selection-screen on value-request for p_nosf01-low.
      perform f01_f4_field using 'SUM' 'X' changing p_nosf01-low.
    at selection-screen on value-request for p_outf01-low.
      perform f01_f4_field using 'KEY' 'X' changing p_outf01-low.
    at selection-screen on value-request for p_tecf01-low.
      perform f01_f4_field using space 'X' changing p_tecf01-low.
    at selection-screen on value-request for p_fixf01-low.
      perform f01_f4_field using space 'X' changing p_fixf01-low.
    at selection-screen on value-request for p_curf00-low.
      perform f01_f4_field using 'CURR' 'X' changing p_curf00-low.
    at selection-screen on value-request for p_curf01.
      perform f01_f4_field using 'CUKY' 'X' changing p_curf01.
    at selection-screen on value-request for p_hotf03-low.
      perform f01_f4_field using space 'X' changing p_hotf03-low.
    at selection-screen on value-request for p_colf02-low.
      perform f01_f4_field using space 'X' changing p_colf02-low.
    at selection-screen on value-request for p_colf03-low.
      perform f01_f4_field using space 'X' changing p_colf03-low.
    at selection-screen on value-request for p_lay06.
      perform f01_f4_fcode using space
                                 space
                        changing p_lay06.
    START-OF-SELECTION                                                   *
    start-of-selection.
      g_repid               = sy-repid.
      gs_test-select_amount = p_amount.
      gs_test-only_db_info  = p_dbinfo.
      gs_test-db_short      = p_dbshrt.
      gs_test-list_amount = p_list.
      gs_test-layo_title               = p_tit01.
      gs_test-layo_zebra               = p_lay01.
      gs_test-layo_no_horiz_lines      = p_lay02.
      gs_test-layo_no_vert_lines       = p_lay03.
      gs_test-layo_no_scrolling        = p_lay04.
      gs_test-layo_f2code              = p_lay06.
      gs_test-layo_confirmation_prompt = p_lay07.
      gs_test-layo_box                 = p_spa01.
      gs_test-layo_count               = p_spa02.
      gs_test-layo_no_colhead          = p_spa03.
      gs_test-layo_column_optimize     = p_spa04.
      gs_test-layo_no_hotspot          = p_hot01.
      if p_hot02 eq con_true.
        loop at p_hotf02.
          if not p_hotf02-low is initial.
            append p_hotf02-low to gs_test-layo_hotspot_rows.
          endif.
        endloop.
      endif.
      if p_hot03 eq con_true.
        loop at p_hotf03.
          if not p_hotf03-low is initial.
            append p_hotf03-low to gs_test-layo_hotspot_columns.
          endif.
        endloop.
      endif.
      case con_true.
        when p_mrg01.
          gs_test-layo_cell_merge          = space.
        when p_mrg02.
          gs_test-layo_cell_merge          = 'N'.
        when p_mrg03.
          gs_test-layo_cell_merge          = 'Y'.
      endcase.
      if p_out01 eq con_true.
        loop at p_outf01.
          if not p_outf01-low is initial.
            append p_outf01-low to gs_test-fcat_no_out_fields.
          endif.
        endloop.
      endif.
      if p_tec01 eq con_true.
        loop at p_tecf01.
          if not p_tecf01-low is initial.
            append p_tecf01-low to gs_test-fcat_tech_fields.
          endif.
        endloop.
      endif.
      if p_fix01 eq con_true.
        loop at p_fixf01.
          if not p_fixf01-low is initial.
            append p_fixf01-low to gs_test-fcat_fix_column_fields.
          endif.
        endloop.
      endif.
      gs_test-curr_amount = p_curanz.
      gs_test-curr_space  = p_curspc.
      if p_cur01 eq con_true or p_cur02 eq con_true.
        data: ls_fcat_curr type g_ty_s_fcat_curr.
        loop at p_curf00.
          clear ls_fcat_curr.
          if not p_curf00-low is initial.
            ls_fcat_curr-fieldname = p_curf00-low.
            case con_true.
              when p_cur01.
                ls_fcat_curr-cfieldname = p_curf01.
              when p_cur02.
                ls_fcat_curr-currency   = p_curf02.
            endcase.
            append ls_fcat_curr to gs_test-fcat_curr_fields.
          endif.
        endloop.
      endif.
      gs_test-layo_keys_hotspot        = p_key01.
      gs_test-layo_no_keyfix           = p_key02.
      gs_test-excp_display             = p_excp01.
      gs_test-excp_condense            = p_excp_c.
      gs_test-sum_before               = p_sum01.
      gs_test-sum_numc                 = p_sum02.
      gs_test-sum_no_unitsplit         = p_sum03.
      gs_test-sum_totals_only          = p_sum04.
      gs_test-sum_no_sumchoice         = p_sum05.
      gs_test-sum_no_sumline           = p_sum06.
      gs_test-sum_totals_text          = p_sum07.
      gs_test-sum_no_subchoice         = p_sum08.
      gs_test-sum_no_subtotals         = p_sum09.
      gs_test-sum_subtotals_text       = p_sum10.
      if p_dos01 eq con_true.
        loop at p_dosf01.
          if not p_dosf01-low is initial.
            append p_dosf01-low to gs_test-fcat_do_sum_fields.
          endif.
        endloop.
      endif.
      if p_nos01 eq con_true.
        loop at p_nosf01.
          if not p_nosf01-low is initial.
            append p_nosf01-low to gs_test-fcat_no_sum_fields.
          endif.
        endloop.
      endif.
      gs_test-layo_group_change_edit   = p_lpr01.
      gs_test-layo_get_selinfo         = p_lpr02.
      gs_test-layo_no_min_linesize     = p_lpr03.
      gs_test-layo_min_linesize        = p_lpr04.
      gs_test-layo_max_linesize        = p_lpr05.
      gs_test-prnt_print                  = p_prn01.
      gs_test-prnt_reserve_lines          = p_prn02.
      gs_test-prnt_no_listinfo            = p_prn03.
      gs_test-prnt_no_selinfo             = p_prn04.
      gs_test-prnt_with_title             = p_prn05.
      gs_test-prnt_footline               = p_prn06.
      gs_test-prnt_printinfo              = p_prn07.
      gs_test-prnt_no_coverpage           = p_prn08.
      gs_test-prnt_no_new_page            = p_prn09.
      gs_test-prnt_no_change_print_params = p_prn10.
      if p_col01 eq con_true.
        loop at p_colf01.
          if not p_colf01-low is initial.
            append p_colf01-low to gs_test-color_rows.
          endif.
        endloop.
      endif.
      if p_col02 eq con_true.
        loop at p_colf02.
          if not p_colf02-low is initial.
            append p_colf02-low to gs_test-color_fields_column.
          endif.
        endloop.
      endif.
      if p_col03 eq con_true.
        loop at p_colf03.
          if not p_colf03-low is initial.
            append p_colf03-low to gs_test-color_fields_cell.
          endif.
        endloop.
      endif.
      if p_evt01 eq con_true.
        append con_event_01 to gs_test-events.
      endif.
      if p_evt02 eq con_true.
        append con_event_02 to gs_test-events.
      endif.
      if p_evt03 eq con_true.
        append con_event_03 to gs_test-events.
      endif.
      if p_evt04 eq con_true.
        append con_event_04 to gs_test-events.
      endif.
      if p_evt05 eq con_true.
        append con_event_05 to gs_test-events.
      endif.
      if p_evt06 eq con_true.
        append con_event_06 to gs_test-events.
      endif.
      if p_evt07 eq con_true.
        append con_event_07 to gs_test-events.
      endif.
      if p_evt08 eq con_true.
        append con_event_08 to gs_test-events.
      endif.
      if p_evt09 eq con_true.
        append con_event_09 to gs_test-events.
      endif.
      if p_evt10 eq con_true.
        append con_event_10 to gs_test-events.
      endif.
      if p_evt11 eq con_true.
        append con_event_11 to gs_test-events.
      endif.
      if p_evt12 eq con_true.
        append con_event_12 to gs_test-events.
      endif.
      if p_evt13 eq con_true.
        append con_event_13 to gs_test-events.
      endif.
      if p_evt14 eq con_true.
        append con_event_14 to gs_test-events.
      endif.
      if p_evt15 eq con_true.
        append con_event_15 to gs_test-events.
      endif.
      if p_evt16 eq con_true.
        append con_event_16 to gs_test-events.
      endif.
      if p_evt17 eq con_true.
        append con_event_17 to gs_test-events.
      endif.
      gs_test-buffer_active            = space.
      gs_test-bypassing_buffer         = space.
    END-OF-SELECTION                                                     *
    end-of-selection.
      perform f01_call_list.
    *&      Form  f01_call_list
          text
    form f01_call_list .
      data: ls_prnt   type slis_print_alv,
            lt_excl   type slis_t_extab,
            l_exit    type char1,
            ls_exit   type slis_exit_by_user,
            l_list    type num1.
      call function 'REUSE_ALV_BLOCK_LIST_INIT'
        exporting
          i_callback_program       = g_repid
          i_callback_pf_status_set = ' '
          i_callback_user_command  = ' '
          it_excluding             = lt_excl.
      do gs_test-list_amount times.
        add 1 to l_list.
        perform f01_append_list using l_list.
      enddo.
      perform f01_set_prnt changing ls_prnt.
      call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'
        exporting
          i_interface_check       = ' '
          is_print                = ls_prnt
          i_screen_start_column   = 0
          i_screen_start_line     = 0
          i_screen_end_column     = 0
          i_screen_end_line       = 0
        importing
          e_exit_caused_by_caller = l_exit
          es_exit_caused_by_user  = ls_exit
        exceptions
          program_error           = 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.
    endform.                    " f01_call_list
    *&      Form  f01_append_list
          text
    form f01_append_list using value(i_list) type num1.
      data: ls_layo   type slis_layout_alv,
            lt_fcat   type slis_t_fieldcat_alv,
            lt_sort   type slis_t_sortinfo_alv,
            lt_evts   type slis_t_event,
            l_tabname type slis_tabname.
      field-symbols: <l_table> type any.
      perform f01_get_outtab using i_list.
      case i_list.
        when 1.
          gt_outtab1 = gt_outtab[].
        when 2.
          gt_outtab2 = gt_outtab[].
        when 3.
          gt_outtab3 = gt_outtab[].
        when 4.
          gt_outtab4 = gt_outtab[].
        when 5.
          gt_outtab5 = gt_outtab[].
        when 6.
          gt_outtab6 = gt_outtab[].
        when 7.
          gt_outtab7 = gt_outtab[].
        when 8.
          gt_outtab8 = gt_outtab[].
        when 9.
          gt_outtab9 = gt_outtab[].
      endcase.
      perform f01_set_layo changing ls_layo.
      perform f01_set_fcat changing lt_fcat.
      perform f01_set_evts changing lt_evts.
      concatenate 'LIST_' i_list into l_tabname.
      case i_list.
        when 1.
          call function 'REUSE_ALV_BLOCK_LIST_APPEND'
            exporting
              is_layout                  = ls_layo
              it_fieldcat                = lt_fcat
              i_tabname                  = l_tabname
              it_events                  = lt_evts
              it_sort                    = lt_sort
              i_text                     = 'Hello'              "#EC NOTEXT
            tables
              t_outtab                   = gt_outtab1
            exceptions
              program_error              = 1
              maximum_of_appends_reached = 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.
        when 2.
          call function 'REUSE_ALV_BLOCK_LIST_APPEND'
            exporting
              is_layout                  = ls_layo
              it_fieldcat                = lt_fcat
              i_tabname                  = l_tabname
              it_events                  = lt_evts
              it_sort                    = lt_sort
              i_text                     = 'Hello'              "#EC NOTEXT
            tables
              t_outtab                   = gt_outtab2
            exceptions
              program_error              = 1
              maximum_of_appends_reached = 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.
        when 3.
          call function 'REUSE_ALV_BLOCK_LIST_APPEND'
            exporting
              is_layout                  = ls_layo
              it_fieldcat                = lt_fcat
              i_tabname                  = l_tabname
              it_events                  = lt_evts
              it_sort                    = lt_sort
              i_text                     = 'Hello'              "#EC NOTEXT
            tables
              t_outtab                   = gt_outtab3
            exceptions
              program_error              = 1
              maximum_of_appends_reached = 2
              others                     = 3.
          if sy-subrc <> 0.
            message id sy-msgid type sy-msgty number sy-msgno
                    with sy-ms

  • Creating table at runtime w/o knowing the structure

    Hi,
    I have searched high and far to find a solution for my needs, but have not come across anything. Hopefully, the knowledge here is greater than my searching skills
    In an ABAP called during Dynamic Actions I have the need for storing data retrieved from the Call Stack via an ASSIGN command:
    DATA: gv_ps_ref TYPE char50 VALUE '(SAPFP50P)PS[]'.
    FIELD-SYMBOLS: <gt_ps_table> TYPE STANDARD TABLE.
    ASSIGN (gv_ps_ref) TO <gt_ps_table>.
    The ASSIGN part works beautifully - in debugging I now have access to the data in the PS table. But I need to store the data locally, as PS gets refreshed by this, which then also refreshes my <GT_PS_TABLE>:
    PERFORM initialize_ps(sapfp50p).
    The thing is, I need the data for later use, so I want to separate the link and create a local copy.
    This code (most of it copied from other solutions here on SDN) works fine, but notice that the DESCRIBE_BY_DATA method is called with the GS_DATA structure. This means that the TYPE of the table that I want to create dynamically is known.
    DATA: BEGIN OF gt_data OCCURS 5,
            char   TYPE text5,
            numc   TYPE numc5,
            dec    TYPE pad_amt7s,
          END OF gt_data.
    DATA: gs_data LIKE LINE OF gt_data.
    DATA: go_struct   TYPE REF TO cl_abap_structdescr,
          go_new_type TYPE REF TO cl_abap_structdescr,
          go_new_tab  TYPE REF TO cl_abap_tabledescr,
          gt_comp     TYPE cl_abap_structdescr=>component_table,
          go_data     TYPE REF TO data.
    FIELD-SYMBOLS: <fs_any> TYPE ANY TABLE.
    go_struct  ?= cl_abap_typedescr=>describe_by_data( gs_data ).    "see alternate reference below, i.e. my need
    gt_comp     = go_struct->get_components( ).
    go_new_type = cl_abap_structdescr=>create( gt_comp ).
    go_new_tab  = cl_abap_tabledescr=>create(
                         p_line_type  = go_new_type
                         p_table_kind = cl_abap_tabledescr=>tablekind_std
                         p_unique     = abap_false ).
    CREATE DATA go_data TYPE HANDLE go_new_tab.
    ASSIGN go_data->* TO <fs_any>.
    <fs_any> = gt_data[].
    As indicated, having only a reference to the PS table (<GT_PS_TABLE>) is not enough, I want to create a copy of PS locally, without knowing how it is declared in FP50PPSB (partly via a structure, partly via separate fields), as this will make my coding insensitive to any change in the structure.
    This is my visualization of what I want to do, or the likes - I believe you get the idea. But is it possible?
    go_struct ?= cl_abap_typedescr=>describe_by_data( <gt_ps_table> ).
    The syntax checker allows for this, but it dumps at runtime

    Hi,
    besides that your posting is allmost unreadable (try preview before posting), your basic idea is correct. You just overdid it a bit.
    Just try something like this
      data: a_descr TYPE REF TO CL_ABAP_TYPEDESCR.
      FIELD-SYMBOLS: <val> type any.
         a_descr = cl_abap_datadescr=>describe_by_data( p_data =  st_val ).
        CREATE DATA me->d_ref type (a_descr->ABSOLUTE_NAME).
        assign me->d_ref->* to <val>.
        <val> = st_val.
    this should work fine with all types of data, structures or tables.
    Regards
    Jörg

Maybe you are looking for

  • How do I stop an Apple ID popping up on my iPhone?

    My phone got taken in the park a few months ago, so I was using my dad's spare iPhone, and when I came to buy a new one I got the option to restore my new phone to the one that got stolen. Any way this girls Apple ID keeps on popping up on my phone a

  • MDM PI adapter not working

    Hi All, we are on MDM 7.1 SP04 AND PI7.1 SP06 AND MDM Java API Version is 7.1.04.138 i.e. on the latest version. MDM PI adapter is not able to pick up  the files from the MDM distribution folders.. Communication channel is functioning and in Green. P

  • Can I mirror one desktop to the tv and have a different desktop running on the mac book?

    All i want to do, is to be able to play a movie on the apple tv through one desktop, and do other tasks on my laptop with the movie or video playing simultaneously. Is this possible in any way?

  • Mass check/uncheck option

    On my browser screen on itunes I have a listing of the approx 100 songs I want to uncheck so they do not synch with my player. Is there an easy way to uncheck them all at once rather than 100 clicks? I tried hilighting them all and then unchecking on

  • Wrong DATE-TIME FORMAT among REPORTS NOTIFICATION EMAILs

    Dear all, I create a report request with url https://ocixxxx2.oci.xxcl.net/reports/rwservlet?>destype=printer&desformat=PDF&server=rep_xxxxx2_orahome&userid=ixxxxxx/xxxxxxx@saas&notifysuccess=IASL&notifyfailure=IASL&report=R1000R13.rdf&jobname=R1000R