Output length problem

Hi,
I have created a dynamic structure and a dynamic internal table and I have populated the dynamic internal table with values.
For the above operations, I have used RTTS(Runtime Type Services).
Please see my code below,
DATA : BEGIN OF xx,
  char(100) TYPE c,
  END OF xx.
DATA : wa_xx LIKE xx.
DATA : int LIKE STANDARD TABLE OF xx.
" The internal table 'int" contains all of the "data elements", upon which structure and table needs to be created
DATA:l_elem_descr  TYPE REF TO cl_abap_elemdescr,
l_struct_descr TYPE REF TO cl_abap_structdescr,
l_table_descr TYPE REF TO cl_abap_tabledescr,
l_comp TYPE cl_abap_structdescr=>component,
lt_comp TYPE cl_abap_structdescr=>component_table.
FIELD-SYMBOLS : <wa> TYPE ANY, <itab> TYPE STANDARD TABLE, <comp_trg> TYPE ANY,<comp_trg> type any.
" looping through each value of internal table and creating a element of that type
LOOP AT int INTO wa_xx.
  l_elem_descr ?= cl_abap_elemdescr=>describe_by_name( wa_xx-char ). u201Cwa-char contains data elements
  l_comp-type = l_elem_descr.
  l_comp-name = wa_xx-char.
  WRITE : / l_elem_descr->output_length.
  APPEND l_comp TO lt_comp.
ENDLOOP.
" Creating a structure from the list of elements available in the table lt_comp
u201C We have element name and its data type with size
u201C But we do not have its output length
IF  lt_comp IS NOT INITIAL.
  TRY.
      l_struct_descr  = cl_abap_structdescr=>create( lt_comp ).
      CREATE DATA dref TYPE HANDLE l_struct_descr.
      ASSIGN dref->* TO <wa>.
    CATCH cx_sy_struct_creation INTO gcx_sy_struct_creation.
      gv_msg_txt = gcx_sy_struct_creation->get_text( ).
      MESSAGE gv_msg_txt TYPE 'E'.
  ENDTRY.
ENDIF.
" ETK_ROW is a table which contains values for the dynamically created table
u201CThese values must be supplied to <wa> and later <wa> must be inserted to <itab>
LOOP AT etk_row INTO etk_wa.
    ASSIGN COMPONENT count OF STRUCTURE <wa> TO <comp_trg>.
    <comp_trg> = etk_wa-chavlext.
   UNASSIGN <comp_trg>.
  ENDLOOP.
The problem I face is the "data elements" size is obtained in <wa> but not its output length.
For example, I have supplied a data element u201CABCu201D to the internal table "int".
The data element ABC contains domain DATUM, its size is 8 and output  length is 10.
The data contained in the etk_wa-chavlext is 03/03/2011.
Which is assigned to <wa>.
But what is see in my <wa> is 03/03/20 (because size is only 8, not 10).
That is,  "l_comp" is of type  cl_abap_structdescr=>component.
when I checked its structure ( cl_abap_structdescr=>component), it contains,
Component Technical type
NAME      CString* Name of the component 
TYPE               Reference   * its type (data element)
AS_INCLUDE C(1)            *  Boolean type
SUFFIX          CString  * String
The above structure does not contain output length. It contains only name and data type.
I am filling only the name and type as per the structure via the lines
  l_comp-type = l_elem_descr.
  l_comp-name = wa_xx-char. u201Cdata element
Now this structure is appended to the  lt_comp and which is of type cl_abap_structdescr=>component_table.
Now a structure is created based on the componenet table lt_comp,
l_struct_descr  = cl_abap_structdescr=>create( lt_comp ).
CREATE DATA dref TYPE HANDLE l_struct_descr.
ASSIGN dref->* TO <wa>.
The field-symbol <wa> is of type any and its structure is same as that of cl_abap_structdescr=>component.
I have seen that the there is a element u201Coutput_lengthu201D in the class  cl_abap_elemdescr.
When I checked it it contains the correct output length and this output length must be supplied to <wa> so that it accepts 03/03/2011.
Is there any way of doing it? I need my <wa>  to accept the incoming data, as per the output length mentioned in the domain of that data element.
Please help.

Hi,
Actually i have taken the approach of  give up using D type and use C type, now the code works very much fine.
Thanks a lot for your suggestions,
Below is my code, where i have implemented C instead of D.
LOOP AT int INTO wa_xx.
  TRY.
      descr_ref = cl_abap_elemdescr=>describe_by_name( wa_xx-char ). " Element description
      WRITE: / 'Typename:', descr_ref->absolute_name.
      WRITE: / 'Length  :', descr_ref->length.
      WRITE: / 'Decimals:', descr_ref->decimals.
      abap_typekind_l = descr_ref->type_kind.
    CATCH cx_dynamic_check INTO exc_obj.
      abap_typekind_l = 'C'.
  ENDTRY.
  l_elem_descr ?= cl_abap_elemdescr=>describe_by_name( wa_xx-char ).
  output_len = l_elem_descr->output_length.  " output length
  IF  abap_typekind_l  IS NOT INITIAL.
    IF abap_typekind_l EQ 'C'.
      l_elemtype =  cl_abap_elemdescr=>get_c( p_length = output_len ).
    ENDIF.
    IF abap_typekind_l EQ 'N'.
      l_elemtype =  cl_abap_elemdescr=>get_n( p_length = output_len ).
    ENDIF.
    IF abap_typekind_l EQ 'D'.
      l_elemtype =  cl_abap_elemdescr=>get_c( p_length = output_len ).
    ENDIF.
    IF abap_typekind_l EQ 'T'.
      l_elemtype =  cl_abap_elemdescr=>get_c( p_length = output_len ).
    ENDIF.
  ENDIF.
  l_comp-name = wa_xx-char.
  l_comp-type ?= l_elemtype.
  APPEND l_comp TO lt_comp.
ENDLOOP.
Now i face a peculiar problem. See in SAP BI a characteristic info object can be with data type (c,n,d,t,UNIT, CUKY).
Now my code works well for the data types c,n,d,t, but if the data type is either UNIT or CUKY then my code throws exception "type_not_found.". This is because the method "describe_by_name" does not create the data type. Also i cannot use try...end try, as the exception is not propagated to the code. otherwise i could catch the same and convert the type to 'C'.
Further investigation i have found the method "CREATE_ELEMDESCR_OBJECT" but i am not aware of how to use the same to attain my goal. Any help is much appreciated. Thanks.

Similar Messages

  • ALV Grid output length not working

    I have a problem I have not come across in the user forum before.   I added 2 text fields to a structure with 94 fields to display in ALV.   I have defaulted the following 3 output length controls to 25(ddic_outputlen, outputlen, intlen) but it is still displaying 80 characters.   Can someone help?

    Probably should have done that previously to eliminate confusion.  Here it is.  Pretty simple.
    FORM modify_catalog .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
        i_program_name               = g_repid
                       I_INTERNAL_TABNAME           =
       i_buffer_active         = 'X'
        i_bypassing_buffer      = 'X'
        i_structure_name             = 'ZWM_CARTON_COUNT_ALV_01'
                       I_CLIENT_NEVER_DISPLAY       = 'X'
                       I_INCLNAME                   =
                       I_BYPASSING_BUFFER           =
                       I_BUFFER_ACTIVE              =
      CHANGING
        ct_fieldcat                  = gt_fc[]
      EXCEPTIONS
        inconsistent_interface       = 1
        program_error                = 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.
      LOOP AT gt_fc INTO gs_fc.
        CASE gs_fc-fieldname.
          WHEN 'LGMNG'.
            gs_fc-seltext_l = 'Units'.
            gs_fc-seltext_m = 'Units'.
            gs_fc-reptext_ddic = 'Units'.
            gs_fc-seltext_s = 'Units'.
            gs_fc-ref_tabname = ' '.
          WHEN 'CTN_COUNT'.
            gs_fc-seltext_l = 'Cartons'.
            gs_fc-seltext_m = 'Cartons'.
            gs_fc-reptext_ddic = 'Cartons'.
            gs_fc-seltext_s = 'Cartons'.
            gs_fc-ref_tabname = ' '.
          WHEN 'ABLAD'.
            gs_fc-seltext_l = 'Telephone'.
            gs_fc-seltext_m = 'Telephone'.
            gs_fc-reptext_ddic = 'Telephone'.
            gs_fc-seltext_s = 'Telephone'.
            gs_fc-ref_tabname = ' '.
            gs_fc-outputlen = 15.
            gs_fc-ddic_outputlen = 15.
            gs_fc-intlen = 15.
          WHEN 'ADDRESS_NAME'.
            gs_fc-seltext_l = 'Shipto Address'.
            gs_fc-seltext_m = 'Shipto Address'.
            gs_fc-reptext_ddic = 'Shipto Address'.
            gs_fc-seltext_s = 'Shipto Address'.
            gs_fc-ref_tabname = ' '.
          WHEN 'ADDRESS'.
            gs_fc-seltext_l = 'Final Dest Address'.
            gs_fc-seltext_m = 'Final Dest Address'.
            gs_fc-reptext_ddic = 'Final Dest Address'.
            gs_fc-seltext_s = 'Final Dest Address'.
            gs_fc-ref_tabname = ' '.
          WHEN 'REF_TDLINE'.
            gs_fc-seltext_l = 'EDI-Customer Reference Number'.
            gs_fc-seltext_m = 'EDI-Cust Ref Number'.
            gs_fc-reptext_ddic = 'EDI-Customer Reference Number'.
            gs_fc-seltext_s = 'Cust Ref#'.
            gs_fc-ddic_outputlen = 30.
            gs_fc-outputlen = 30.
            gs_fc-intlen = 30.
            IF sy-tcode <> 'ZROUTETEXT'.
              gs_fc-tech = 'X'.
            Else.
              gs_fc-no_out = ' '.
            ENDIF.
          WHEN 'RTE_TDLINE'.
            gs_fc-seltext_l = 'EDI-Routing Code from EDI'.
            gs_fc-seltext_m = 'Route Text from EDI'.
            gs_fc-reptext_ddic = 'EDI-Routing Code from EDI'.
            gs_fc-seltext_s = 'Route Text'.
            gs_fc-ddic_outputlen = 25.
            gs_fc-outputlen = 25.
            gs_fc-intlen = 25.
            IF sy-tcode <> 'ZROUTETEXT'.
              gs_fc-tech = 'X'.
            Else.
              gs_fc-no_out = ' '.
            ENDIF.
          WHEN 'ZSEQ'.
            IF sy-tcode = 'ZROUTETEXT'.
              gs_fc-no_out = 'X'.
            ENDIF.
          WHEN 'ZSPECIAL'.
            IF sy-tcode = 'ZROUTETEXT'.
              gs_fc-no_out = 'X'.
            ENDIF.
          WHEN 'ZSAMPLE'.
            IF sy-tcode = 'ZROUTETEXT'.
              gs_fc-no_out = 'X'.
            ENDIF.
          WHEN 'KNFAK'.
            IF sy-tcode = 'ZROUTETEXT'.
              gs_fc-no_out = 'X'.
            ENDIF.
        ENDCASE.
        MODIFY gt_fc FROM gs_fc.
        CLEAR : gs_fc.
      ENDLOOP.
    ENDFORM.                    " Modify_catalog

  • ALV (Factory class)  field length problem

    Hi experts!
    I build an ALV report using the Factory method. But I can't set the field length.
    When I set the field length in a column attributes it doesn't change nothing
    What is the problem?
    My column  attributes are like that:
    TRY.
          lr_column ?=  lr_columns->get_column( 'NAME1' ).
          lv_text_s = text-103.
          lv_text_m = text-103.
          lv_text_l = text-103.
          lr_column->set_long_text( text-103 ).
          lr_column->set_short_text( lv_text_s ).
          lr_column->set_medium_text( lv_text_m ).
       <b>   lr_column->set_output_length( 30 ) .</b>
          lr_column->set_active_for_rep_interface( gc_default ).
        CATCH cx_salv_not_found.              
      ENDTRY.
    Thanks forehead,
    Dani

    Hi,
    In ur fieldcat populate the output length field.
      CLEAR x_fieldcat.
      x_fieldcat-fieldname = 'FLAG'.
      x_fieldcat-seltext_l = 'Text' .
    <b>  x_fieldcat-outputlen = 30.</b>
      x_fieldcat-col_pos   = 1.
      APPEND x_fieldcat TO it_fieldcat.

  • List output length

    Hi all,
    We all know that the predefined elementary abap types's lenght. For example the data type ' I ', which lenght is 4.
    But  the Lists output length is 11. The same as data type ' F ', ' P ' and so on.
    I want to ask, why it is designed to output 11 rather than 8 or 9?
    Thanks and Best regards,
    Yinyan Lu

    Nils Buerckel,
    Actually I knew and tried that. I got 50 characters to display. If I directly export the list display, it will display 3x characters for me.
    If I follow your steps, go to System -> List -> Unicode Display -> Dynamic Display / Full Display, then it will display 4x characters for me. But it does not completely solved my problem. Weird.
    Regards,
    Cato

  • Setting output length of desired values for a Field in Smartforms.

    Hi,
       I'm working right now on 4.6c system and I have a field declared as "String" in the Global Definition, on viewing the output in the print preview i find that it is printing only 255 characters while the actual field value is more than that (somewhere around 600+).
             Could you please help me out in as to how to declare this particular field in Smartforms.
    Thanks in Advance,
    Regards,
    Divaker

    check this
    Re: Output length restricted to 255 when running ALV report in background
    in that case u have to create a new Print Format which can give u complete data in while prining.
    format will  be like this
    65*512.
    Regards
    Prabhu

  • RFC export variable with different output length.

    I have an RFC returning language from R/3 with Datatype SY-LANGU. When I run RFC from R/3, I see language being  returned in two chars. But  I get only one char when I run  the same from Web Dynpro.
    When  I look at Web Dynpro model dictionary,  It is imported  with fixed length '1" and external length as "2".
    From ABAP Dictionary it is of  one char, But output length is two chars with some conversion routine.
    Is it possible to get language output in web Dynpro with two chars with out changing the signature of the RFC?

    Hi,
    I think you can achive this.
    You can involve value attribute context for this tranformation.
    Ashutosh

  • Output having problem in PO

    Hi,
    Don't know whether you come across this problem but I hope you can shed some light as to why my PO documents are unable to trigger and to retrieve the output condition despite that I have enter the condition record in MN04?
    I checked NAST table, and I notice that many PO documents with this output type were able to retrieve this output previously.
    Some extra input:
    1 - This is stock transport order purchasing with item category of U
    2 - it is a Z report with copy version of NEU.
    Please help.
    thanks
    Tuff

    Hi,
    If you have done all customizing setting for PO output type & maintain condition record for message type in t.code : MN04. Now Just fine tune the output (message) type in following path:
    SPRO>MM>Purchasing>Message>Output control>Message tyoes> Define message type for Purchase Order-->Fine-Tuned Control: Purchase Order
    Now here select the check box corresponding to your output(message) type  to have print output for this message type is automatically displayed & save.
    Now try creating PO/STO & you will have default PO out put message type.
    Regards,
    Biju K

  • Report Name Length Problem

    Hies
    Guys I've a problem in oracle report calling from Oracle FORMS. I am using reports and forms 6i. When the report name length is more than 30 characters the report engine runs first time correctly but on the second call of report the system gives an error :
    " RWRBE60.exe has generated errors and will be closed by windows.You will need to restart the program ".
    After this error the report engine closes and i have to call the report again.
    Is there a length fixed for reports name in Oracle 6i.
    Is any possible solution available.
    Remember i dont want to shorten my report names.
    Kindly help me with this.
    Thanx.

    There may be a limit, but I'm not aware of any. I never ran accross a limit. You may try the latest patch to see if it helps. What is your exact Developer version?
    But I really have never seen report names of more than 10 characters or so. Almost every application has some short program coding, like xyz_0010.rep, r_emp.rep etc.
    Do you mean the the name including the full path is more than 30 characters? If you put the path in the REPORTS60_PATH variable, your report names don't have to include the path.

  • How to fix the output length of a field

    Hi!
    I want to 'allocate' the full length of the field while smartform printing even if it is initial.
    How can I do this? I tried the &field(*)& &field(F<' '>)& output format, but nothing.
    Thanks

    Hi!
    I have only one text element, and in that I have two variables separated only with one space. In the printed form the starting place of the second variable depends on the length of value in the first variable.
    like this:
    The first variable has the dictionay type 'VBELN', despite this fact, the &FIELD(*)& does not work.
    The template doesn't work here too. because I have only one text element.
    Or can I print two text element in one row? It could be a solution probably.

  • Report Output Saving Problem

    I am using Oracle Developer6.0 . I am facing problem with reports. I am invoking reports from form using run_product.
    1. I could not able to save the report in text file . Whenever i try to save the report output in a text file.It gives dump and application get closed.
    2. In RTF format , it execute the query which i have given at the design time while creating a report . But while running i am passing query either through lexical parameter or passing value of where criteria user parameters. It display the output for the specified value. But when i save this report output in rtf file . It execute design time query and save that in a rtf file.
    If any body is having any idea about it . Please let me ASAP . It is very urgent for me.
    Thanks in advance
    null

    Hi ,
    Why don't you try the output in PDF. Its been working for us. We don't have any problems
    Good Luck
    Rao

  • 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

  • Error Message through Dynamic Configuration length problem

    HI All,
    We are trying to raise an error message with the help of Dynamic configuration in the Message mapping.
    The need is to populate the message with certain variables.
    However we are facing the problem that the message is getting truncated beyond a certain length.(Around 60 characters)
    Similar custom messages in other interfaces are working fine for messages up to 100 characters.
    Question:
    1. What could be the maximum length for an error message in case of mapping failure?
    2. What could be limiting the length of the message in our case?
    Thank you for looking into this.
    Regards,
    Ankesh

    hi Ankesh,
    yes, there is limit length, see this oss [Note 974481 - XI Adapter Framework DynamicConfiguration Module|https://service.sap.com/sap/support/notes/974481]
    regards.
    Mickale

  • XSLT HTML output escaping problem

    I am having problems with JAXP XSLT output escaping in HTML. I have an XML document which correctly escapes &, <, > etc (eg: &amp). However, when I transform the document the XSLT processor is escaping these values again. This means that the HTML output contains &amp; where the XML document contains & (for example). Surely correctly escaped characters in the XML should be left alone? Or should the XML document not contain escaped characters? In my understanding special characters in text nodes of XML documents should be escaped. Obviously a work around is to disable output escaping on these nodes but that is a real pain to have to do each time you pull a value through from the XML document. I'm confused as to what format the XSLT processor expects the XML to be in in relation to escaping of elements. Any information gratefully accepted!
    Thanks.

    Sorry! I was getting confused - the special characters were being escaped twice before they reached the XSLT processor. It looks like the processor will leave alone escape sequences that are already in the XML when it transforms to HTML.

  • Output Preview Problems

    Hi All,
    I have recently been having problems with the Output Preview in Acrobat 11 and it's driving me crazy.
    The output preview is not reliably showing the correct CMYK Colour values - see below
    I have created a sign in Illustrator CC 2014 and printed to PDF using the 'Press Quality' settings. I have ensured that all Adobe software is using the same profile (North American General Purpose 2) by setting it Bridge.
    I import the PDF into Photoshop and get a yellow value of 100%
    I then open Acrobat and check the same area and get a yellow value of 97%
    In Acrobat I open Preferences > Colour Management and change the colour profile from North American General Purpose 2 to something else and then back to North American General Purpose 2. I check the yellow again and get 100%
    Has anyone else had this issue? If so, how did you fix it? Many thanks in advance.
    Kind regards,
    Christian.

    I think you are measuring the image preview from Photoshop when you open your rastered Photoshop file in Acrobat. You should probably save your original Illustrator file as a PDF (not print to PDF). When you open the PDF in Photoshop, you are converting your vector file to an Image, which I think also creates a low-res preview of the actual image (which has various uses). If you check your Photoshop preferences, you might be able to turn the preview creation off, but I really wouldn't worry about it. As a test, save your original Illustrator file as a .tiff and see how that works. Unless you are adding something in Photoshop that can't be added in Illustrator or InDesign, it's usually better to keep everything vector, as much as possible.

  • Output Preview Problem

    There is a new issue that came with the 11.0.99 upgrade.  In the Output Preview window, when the Total Area Coverage is check and the values in the art are over the percent value requested the position of the highlighted values does not match the position of the image. Also, the position and image area highlighted change with any change of the zoom view . This problem occurs only in the Macintosh platform but not in the Windows platform.

    Na výběr máš vlastně ze dvou používaných. Buď starší, univerzální a odskoušený PDF/X1a nebo nejnovější PDF/X4.
    Co použít záleží na tom, co příjemce PDF podporuje. S PDF/X1a si poradí každý, PDF/X4 pouze u moderních Ripů.
    Rozdíl mezi nima ve stručnosti je především ten, že u PDFX/1a nemá průhlednost a všechny soubory musí být CMYK, tudíž, pokud budeš z Indesignu ukládat do PDF/X1a a budeš mít někde v grafice průhlednost,
    průhledné objekty se sloučí. Pokud budeš mít použita RGB data, převedou se ti do CMYKu.
    U PDF/X4 je podpora průhlednosti a RGB data zůstávají.
    Aleš
    PS:
    Musíš se holt smířit s tím, že CMYK hodnoty v souborech, které nejsou ve standardu PDF/X, se v Acrobatu XI zobrazují špatně. Viz založení tohoto vlákna. Sám vidíš, že o této chybě vědí,
    a někdy v budoucnu to bude opraveno, viz 10 odpověď od Irosentha.

Maybe you are looking for

  • Video upload size to MoblieMe?

    I got a new iPhone 4G. I use iPhoto '09 to download my videos. I want to publish them to a Mobile Me Gallery, but they take for ever to upload because they are HD. Is there a way to upload the videos from iPhoto in a smaller format to Mobile me? Kevi

  • Issue with Hierarchy Navigator

    Hi there, we have some problem with Hierarchy Navigator (EP 3.6). We installed and configured Hierarchy Navigator (EP 3.6) as explained in Oracle documentation. We created a Trade Spec "A" >  We run Hierarchy Nav > System shows us one only row with t

  • Graphcis Buffers

    Hi, I have 'private Image buffer', 'private Graphics2D ng2d' and 'private Extended2D e2d' [Extended2D is a wrapper for Graphics2D with my own graphics methods] declared global (In DPanel() class). I need to have a seperate and global graphics buffer

  • New fields in a report

    Hi, I have a report created and I when I delete all objects in the Workspace Panel and I insert others BO doesn't allow me to insert them as a table, only allows me to insert them as a table. Before inserting objects I have the Workspace Panel empty.

  • Converted a pdf to Word.rtf.

    First time user:  I just converted a pdf to Word.rtf.  The lines are all off.  e.g. If it says Address: ________________, then the lines are appearing in the middle or above the word and it throws everything off.  Can this be fixed??  Help please