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

Similar Messages

  • Length report double

    Hi,
    I have the code below and i am not sure why the length of the attribute are reported double
    Code:
    FIELD-SYMBOLS:
        <fs_comp_wa> TYPE abap_compdescr.
    DATA: lr_desc_table    type ref to CL_ABAP_TYPEDESCR,
            lr_desc_struc    type ref to cl_abap_structdescr.
    lr_desc_table ?= cl_abap_typedescr=>describe_by_data( ZTEST).
    if lr_desc_table->type_kind = 'u'.            " <- Structure
        lr_desc_struc ?= lr_desc_table.
    loop at lr_desc_struc->components ASSIGNING <fs_comp_wa>.
    "check the length of the field at run time '<fs_comp_wa>-length'
    ENDLOOP.
    endif.
    Regards,
    Sanju

    lr_desc_table ?= cl_abap_typedescr=>describe_by_name( 'BUT000' ).
    Descibe by data does not work for me, so I used statement above.
    And that works just fine for me. No double entries.

  • Field lengths in unicode system.

    Hi gurus,
    I am creating a dynamic internal table. To get the structure of DDIC table at run time i use the following code to create field catalog:
    DATA : idetails TYPE abap_compdescr_tab,
             xdetails TYPE abap_compdescr.
    DATA : xfc TYPE lvc_s_fcat,
             ifc TYPE lvc_t_fcat.
    ref_table_des ?=
            cl_abap_typedescr=>describe_by_name( p_ztab_name ).
        idetails[] = ref_table_des->components[].
        LOOP AT idetails INTO xdetails.
          CLEAR xfc.
          xfc-fieldname = xdetails-name .
          xfc-datatype = xdetails-type_kind.
          xfc-inttype = xdetails-type_kind.
          xfc-intlen = xdetails-length.
          xfc-decimals = xdetails-decimals.
          APPEND xfc TO ifc.
        ENDLOOP.
    The xdetails-length is doubled in a unicode system.
    However it is correct as field length of table in non-unicode system.
    I am then writing the data from internall table to file using
    OPEN DATASET ld_fullpath FOR OUTPUT IN TEXT MODE ENCODING UTF-8
    For ex. a numeric field in the file are written as 00 when its actual value in table is 0.
    Please suggest how to solve this problem?
    Should i build field catalog in some other way.
    Assured points for helpful answers.
    Regards,
    Abhishek

    Hi,
    use this function module to get the filed info.
    DATA:lta_dfies type dfies occurs 0 with header line.
    CALL FUNCTION 'DDIF_FIELDINFO_GET'
        EXPORTING
          TABNAME              = TABLE
        TABLES
          DFIES_TAB            = lta_dfies.
    loop at lta_dfies.
    if (condition to get required).
    perform build_fcat.
    endif.
    endloop.
    form build_fcat.
    CLEAR xfc.
    xfc-fieldname = lta_dfies-FIELDNAME .
    xfc-datatype = lta_dfies-DATATYPE.
    xfc-inttype = lta_dfies-inttype.
    xfc-intlen = lta_dfies-INTLEN.
    xfc-decimals = lta_dfies-decimals.
    APPEND xfc TO ifc.
    endform.
    rgds,
    bharat.
    Message was edited by:
            Bharat Kalagara

  • 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

  • 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.

  • 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

  • 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

  • Field length change in Web Dynpro Components iView

    Hi,
    We are using SAP MDM Web Dynpro Components - Configuration Manager (NW7.3) to develop the UI. One of the issue while disply field is, Though field maintained in MDM has only 2 charaters UI that displays a full-screen-width field.
    I would like to display actual field length maintained in reposiroy for each field. Is it possible??
    Cheers,
    Rc

    This is closed.
    By mistake Raised Twice....I guess I need break

  • Changing field length of a standard field in standard table VBEP

    Hi,
    Please advice the possibility and the possible repercussions of changing field lengths in a standard table. Table in concern is VBEP.
    Thanks & Rgds,
    Pradeep

    No you cannot change the field length
    thanks
    G. Lakshmipathi

  • Type conflict when calling a function module (field length)

    Dear All,
                I am getting this following error while executing:  Type conflict when calling a function module (field length)
    This is piece of coding i have writern in my action button.
    method SEARCH_MATERIAL .
      data:
            node_mat_input TYPE REF TO  if_wd_context_node,
            node_mat_output TYPE REF TO if_wd_context_node,
            material TYPE BAPIMATDET-MATERIAL,
            itab TYPE TABLE OF BAPIMATDOA.
      node_mat_input = wd_context->get_child_node( 'NODE_MAT_INPUT' ).
      node_mat_output = wd_context->get_child_node( 'NODE_MAT_OUTPUT' ).
      node_mat_input->get_attribute( EXPORTING name = 'MATERIAL'
                                     IMPORTING value = material ).
      CALL FUNCTION 'BAPI_MATERIAL_GET_DETAIL'
        EXPORTING
          material                    = material
        PLANT                       = plant
        VALUATIONAREA               =
        VALUATIONTYPE               =
        MATERIAL_EVG                =
       IMPORTING
         MATERIAL_GENERAL_DATA       = itab
        RETURN                      =
        MATERIALPLANTDATA           =
        MATERIALVALUATIONDATA       =
      node_mat_output->bind_table( itab ).
    endmethod.
    Attributes are:
    Node name = INPUT its structure is BAPIMATDET
    INPUT attributes = MATERIAL of type BAPIMATDET-MATERIAL
    Thanks,
    Gopi.

    Hi Amit,
               I have used service call to fetch records from that bapi..
    The following is the code generated by service call:-
    METHOD execute_bapi_material_get_deta .
    declarations for context navigation
      DATA:
        node_bapi_material_get_de   TYPE REF TO if_wd_context_node,
         node_exporting   TYPE REF TO if_wd_context_node,
         node_material_general_dat   TYPE REF TO if_wd_context_node,
         node_importing   TYPE REF TO if_wd_context_node,
          lri_element    TYPE REF TO if_wd_context_element.
    declarations for fuba parameters
      data:
        stru_c_material_general_dat    TYPE if_componentcontroller=>element_material_general_dat.
      DATA:
        attr_material    TYPE bapimatdet-material,
        attr_plant    TYPE bapimatall-plant.
    get all involved child nodes
      node_bapi_material_get_de = wd_context->get_child_node( `BAPI_MATERIAL_GET_DE` ).
      node_exporting = node_bapi_material_get_de->get_child_node( `EXPORTING` ).
      node_material_general_dat = node_exporting->get_child_node( `MATERIAL_GENERAL_DAT` ).
      node_importing = node_bapi_material_get_de->get_child_node( `IMPORTING` ).
    get input from context
      node_importing->get_attribute(    EXPORTING      name = `MATERIAL`
                                                         IMPORTING      value = attr_material ).
      node_importing->get_attribute(  EXPORTING       name = `PLANT`
                                                              IMPORTING       value = attr_plant ).
    the invocation - errors are always fatal !!!
      CALL FUNCTION 'BAPI_MATERIAL_GET_DETAIL'
        EXPORTING
          material =                        attr_material
          plant =                           attr_plant
    "      valuationarea =                   wd_This->Valuationarea
    "      valuationtype =                   wd_This->Valuationtype
    "      material_Evg =                    wd_This->Material_Evg
        IMPORTING
          material_general_data =           stru_c_material_general_dat
    "      return =                          wd_This->Return
    "      materialplantdata =               wd_This->Materialplantdata
    "      materialvaluationdata =           wd_This->Materialvaluationdat
      node_material_general_dat->bind_structure( stru_c_material_general_dat[] ).
    ENDMETHOD.
                                 but the problem is I  am getting the following error while compiling...
    " stru_c_materialplantdata " is not an internal table - the " OCCOURS n"  specification is missing.
    Thanks,
    Gopi.
    Edited by: Yegalaivan on Nov 18, 2009 8:30 AM

  • How to create an infotype with one of its field length eq 1000.??

    hi ,
    i need to create a infotype where one of the field length is 1000 characters how do i achieve this. if i give more than 255 in the PS structure it will not allow. then how do i get a text field of 1000 chars in the screen ( which is an input field)

    You can use those function calls even inside a PA Infotype.. they just invoke the text ediotr table control.. I gave you the reference of the PD infotype 1002 just for an idea. I don't think you will able to meet your 1000 char reqt without using the text editor.
    ~Suresh

  • R/3 Field length 80, BW field max allowed 60

    Hi all,
    Field ABC is in R/3 production system.
    Its length is 80(CHAR).
    This field data is now to be extracted to BW.
    It is used in extract program and updated to an extract table(R/3), then this has be loaded into a master load(BW).
    But in BW the field length allowed is 60(Max).
    So how to get in this 80 char data into BW??
    Please let me know in detail.
    Also please share links pertaining to this if possible.
    Thanks,
    Sowrabh

    Hi Sowrabh,
    Create two Infoobjects one with length 60 and one with length 20.
    Now in transfer rules write routines for both.
    IOB1 = <r/3 field>+0(60)
    IOB2 = <r/3 field>+60(20)
    Regards,
    Mansi
    Edited by: mansi dandavate on Apr 23, 2009 6:23 PM

  • CATT - vendor/customer master address field length over

    Dear all,
       when use CATT to record vendor/customer master,the address some fields length are over recorded field length(ex. ADDR1_DATA-NAME4,ADDR1_DATA-STR_SUPPL3...etc)
    is there any config in CATT to solve this kind of problem?

    When you are doing your LSMW batch input recording, on selection screen (where you specify the sales org, distribution channel, division, account group, etc) please put a flag on "Use central address management" checkbox (SAPMF02D 0100 >  USE_ZAV).
    In this case you should be able to see and fill the desired fields.

  • I am trying to generate purchase order and i create a BAPI also which is active. But when i call the BAPI from SYbase Mobile Object RFC then after calling it gives an Error "Conflict when calling a Function Module (Field Length)".

    i am trying to generate purchase order and i create a BAPI also which is active.
    But when i call the BAPI from SYbase Mobile Object RFC then after calling it gives an Error "Conflict when calling a Function Module (Field Length)".

    Hi,
    Yeah i tried my Z_BAPI in R3 and then giving some ERROR.
    This is my CODE-
    FUNCTION ZBAPIPOTV2.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(POHD) TYPE  ZPOHD OPTIONAL
    *"     VALUE(POITEM) TYPE  ZPOITEM OPTIONAL
    *"  TABLES
    *"      RETURN STRUCTURE  BAPIRET1 OPTIONAL
    data: ls_pohd type bapimepoheader,
             ls_pohdx TYPE bapimepoheaderx,
             lt_poit TYPE TABLE OF bapimepoitem,
             lt_poitx TYPE TABLE OF bapimepoitemx,
             ls_poit TYPE bapimepoitem,
             ls_poitx TYPE bapimepoitemx.
       MOVE-CORRESPONDING pohd to ls_pohd.
       MOVE-CORRESPONDING poitem to ls_poit.
       ls_pohdx-comp_code = 'x'.
       ls_pohdx-doc_type = 'x'.
       ls_pohdx-vendor = 'x'.
       ls_pohdx-purch_org = 'x'.
       ls_pohdx-pur_group = 'x'.
       ls_poit-po_item = '00010'.
       APPEND ls_poit to lt_poit.
       ls_poitx-po_item = '00010'.
       ls_poitx-po_itemx = 'x'.
       ls_poitx-material = 'x'.
       ls_poitx-plant = 'x'.
       ls_poitx-quantity = 'x'.
       APPEND ls_poitx to lt_poitx.
    CALL FUNCTION 'BAPI_PO_CREATE1'
       EXPORTING
         POHEADER                     = ls_pohd
        POHEADERX                    =  ls_pohdx
    *   POADDRVENDOR                 =
    *   TESTRUN                      =
    *   MEMORY_UNCOMPLETE            =
    *   MEMORY_COMPLETE              =
    *   POEXPIMPHEADER               =
    *   POEXPIMPHEADERX              =
    *   VERSIONS                     =
    *   NO_MESSAGING                 =
    *   NO_MESSAGE_REQ               =
    *   NO_AUTHORITY                 =
    *   NO_PRICE_FROM_PO             =
    *   PARK_COMPLETE                =
    *   PARK_UNCOMPLETE              =
    * IMPORTING
    *   EXPPURCHASEORDER             =
    *   EXPHEADER                    =
    *   EXPPOEXPIMPHEADER            =
      TABLES
        RETURN                       = return
        POITEM                       = lt_poit
        POITEMX                      = lt_poitx
    *   POADDRDELIVERY               =
    *   POSCHEDULE                   =
    *   POSCHEDULEX                  =
    *   POACCOUNT                    =
    *   POACCOUNTPROFITSEGMENT       =
    *   POACCOUNTX                   =
    *   POCONDHEADER                 =
    *   POCONDHEADERX                =
    *   POCOND                       =
    *   POCONDX                      =
    *   POLIMITS                     =
    *   POCONTRACTLIMITS             =
    *   POSERVICES                   =
    *   POSRVACCESSVALUES            =
    *   POSERVICESTEXT               =
    *   EXTENSIONIN                  =
    *   EXTENSIONOUT                 =
    *   POEXPIMPITEM                 =
    *   POEXPIMPITEMX                =
    *   POTEXTHEADER                 =
    *   POTEXTITEM                   =
    *   ALLVERSIONS                  =
    *   POPARTNER                    =
    *   POCOMPONENTS                 =
    *   POCOMPONENTSX                =
    *   POSHIPPING                   =
    *   POSHIPPINGX                  =
    *   POSHIPPINGEXP                =
    *   SERIALNUMBER                 =
    *   SERIALNUMBERX                =
    *   INVPLANHEADER                =
    *   INVPLANHEADERX               =
    *   INVPLANITEM                  =
    *   INVPLANITEMX                 =
    ENDFUNCTION.
    i am trying to generate purchase order and i create a BAPI also which is active. But when i call the BAPI from SYbase Mobile Object RFC then after calling it gives an Error "Conflict when calling a Function Module (Field Length)". 

  • Table field length problem

    Hi Team,
    We r tring to create table with field length 250 and 'CHAR' type and one more field 'STRING 'for unlimited length.While creating table entries ,it is tsking only 130 length for all fields.it is not taking 250 characters for 250 length field.and it is not taking unlimited length for String field.Plz let me know.

    Hello Mohan,
    CHAR 250 is right. i am not facing any problem.
    can you please explain in detail what you have done and what error you are getting.
    Regards,
    Sujeet
    Edited by: Sujeet Mishra on Dec 2, 2009 4:42 AM

Maybe you are looking for

  • How to install the OS with out putting in all of your personnel info?

    I am ready to sell my MDD Mac. I want it to have a fresh load of 10.5 and 9.2. How do you stop the installation before you enter your name, IP, email address etc? When I first received my Mac 10.2 was installed and waiting for me to enter my personne

  • Anyone Here want a Data Guard Certification?

    There is a Oracle RAC Certfied Expert Certification . . . Why not one for Data Guard? It would be nice for those of us who have spent time with Data Guard Post a comment and let's see if they will make one.

  • Why does my airport continuously flash amber

    My airport continuously flashes amber and i cant connect to the wifi. how do i fix this?

  • Access to biw from r3 via abap

    hi folks, we are using ecc 6.0 and biw 7.0 , and have a lot of abaps that have to directly show data from biw in e.g. an alv, in former days we had EIS and just selected the cf7xx tables to do this, but does anybody know how we can achive this easily

  • Looking for a scanner to digitalize 35mm films and photos

    Hi! I have Photoshop CS2 and would like to buy a scaner to digitalize old photos. Can anyone recommend me one, please? Are there any small scanners, just for films and photos? Thanks a million! Monica