Concatenating non-character fields

Hi,
I have a nested structure which I am trying to convert into a flat structure so that I can output this to a flat file.
I am trying to concatenate all the fields within my nested structure into a text field but the concatenate command does not automatically convert numerics/quantities.
An extract of my code is as follows:-
loop at itab-rec2 into wa2.
      concatenate wa2-ntgew wa2-gewei wa2-volum
                  wa2-ean11 into text.
      tlines-line = text.
      append tlines.
      clear text.
endloop.
Can anyone advise me on how I can convert the numeric/qty fields into a character string so I can the concatenate all the fields into a string.
Thanks,
Ruby

Hi Ruby,
mybe this could help:
<pre>
data:
  lv_separator type c,
  lv_offset type syfdpos,
  lv_len    type sytleng,
  lv_chars  type tab512.
field-symbols:
  <any> type any.
lv_separator = abap_char_utilities=>horizontal_tab.
loop at itab.
  do.
    assign component sy-index of structure itab to <any>.
    if sy-subrc <> 0.
      exit."loop
    endif.
    describe field <any> output length lv_len.
    write <any> to lv_chars+lv_offset(lv_len).
    add lv_len to lv_offset.
if field separator is needed add these lines
    write lv_separator to lv_chars+lv_offset(1).   
    add 1 to lv_offset.
  enddo.
  transfer lv_chars to file.
  clear lv_chars.
endloop." at itab.
</pre>
This will write a formatted output file but it will use the output formatting options defined for the actual user/language/system. This will determine the representation of numeric and date fields and all other fields with output conversion. That means that in the file you will have what you see on a list or grogram screen, not what you see in debugger. Fields are separated by tabulator. As all fields always are output in the same length, you may omit this part.
Regards,
Clemens

Similar Messages

  • At new- command - making non-numeric fields as ******* how to correct this

    Hi,
    I am using the following code.
    Tables : vbap.
    DATA: t_vbap TYPE STANDARD TABLE OF vbap,
          x_vbap TYPE vbap.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
    SELECT-OPTIONS: s_vbeln FOR vbap-vbeln.
    SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
      SELECT * FROM vbap
        INTO TABLE t_vbap
        WHERE vbeln IN s_vbeln.
      LOOP AT t_vbap INTO x_vbap.
        at new vbeln.
          write:'new vbeln'.
          ENDAT.
      ENDLOOP.
    In debugging mode, the non-numeric fields on x_vbap becomes ****
    I want to know whether this can be done using oops.. any methods available for at new
    Moderator message: please search for available information/documentation before asking (as you can tell from some of the replies so far)
    locked by: Thomas Zloch on Oct 1, 2010 3:25 PM

    see documentation:
    "If the INTO addition is used in the LOOP statement to assign the content of the current line to a work area wa, its content is changed upon entry into the AT-ENDAT control structure as follows:
    The components of the current control key remain unchanged.
    All components with a character-type, flat data type to the right of the current control key are set to character "*" in every position.
    All the other components to the right of the current control key are set to their initial value.
    When the AT-ENDAT control structure is exited, the content of the current table line is assigned to the entire work area wa. "

  • Sql injection character fields

    Is it true that with MSSQL in the background, character fields can't be used for sql injection?
    A)   One source says that in MSSQL single quotes are escaped into double quotes.
    B)   Another source says that " SQL injection (within ColdFusion apps) is really only an issue with non textual fields. If a text value is tampered with you'll end up with tampered text, but that text will all be part of the core string (within quotes) passed as a value, and will therefore not be executed as separate statements. Numbers, on the other hand, are not enclosed within quotes, and so extraneous text can be tampered "
    Questions about A):   How does escaping 's with "s help, by making string literals in MSSQL not valid?
                                    How could A) above be true when names like O'Mally are being stored with a single quote ?
    Questions about B)    Does it mean code like DELETE * FROM atable would just be stored as a string and not execute ?
                                    If so, is that accurate ?

    To actually answer your question's.
    A) A single quote in SQL is a comment.  To store a single quote as DATA one has to escape it by doubling it.  So to store O'Mally it would be passed as o''Mally.
    The simple SQL injection attack is to end a number value with a random value, that is followed with a ; to end the SQL statment and then another statement can be run, this is then followed by a single quote to comment out any other SQL in the original statement.  ColdFusion automatically escapes single quotes in text fields in most situations, so this is harder to do with text fields, but not impossible.

  • ANY FUNCTION MODULE TO ADD LEADING ZEROS FOR A CHARACTER FIELD

    THE CHARACTER FIELD IS OF LENGTH 40 AND IT HAS 5 NON NUMERIC CHARACTERS

    Hi ,
    Try this
    DATA : c4(40).
    data : P_FIELD(40) TYPE N.
    UNPACK P_FIELD to c40.
    <b>Reward Points if useful</b>
    Regards
    Saket Sharma

  • How to sort a character field with numbers and letters on the end

    I have an internal table with character field which has data like this after I sort it.  This is not what I expect from the sort.:
    13A
    15A
    29A
    30A
    31A
    33A
    123A
    125
    62 
    76 
    94A
    I expect this, which is sorted number first, then alpha.  Any ideas how to get this sort?:
    13A
    15A
    29A
    30A
    31A
    33A
    62 
    76 
    94A
    123A
    125

    Thanks for the suggestions.  After reading the suggestions and reviewing some other post threads, here's what I did to get the sort to work:
    Add a dash - to the end of any record that did not have an alphabet character at the end.  This way, all records have at least one non-numeric character at the end.  Then I overlayed zeros  '0000000'  over each record.  Then I sorted the table.  Afterwards, I removed the dashes and zeros.
    The long way around, but it worked for me.  Since the internal table is processed in memory, it doesn't add much overhead to the run time.

  • Problem with character field

    hi experts,
    i have two character fields with legth 18 each..values are 123 and 126.
    i have to display in smartfrom as 123 to 126.
    bcoz of 18 characters leght i am facing some place adjutment problem in smartfrom
    so it is displaying as
    '   somespace             123to
        126.
    can any body plz help me how to acheive this?
    Edited by: s veena on Jan 31, 2011 12:17 PM

    gv_sernr = 123 to 126 ( it should be one line).
    but it is coming like
    somespace 123to
    126.
    >
    Abhinab Mishra wrote:
    > I think you should search the forum or google about concatenation.
    > Or do F1 on CONCATENATE.
    I'm not sure how CONCATENATE will serve here,but CONDENCE might do.
    @ S veena: Can you please check the space on the window if this is sufficient to accommodate the whole value in one line.
    Cheers,
    Amit

  • Key fields and non-key field of condition table

    Hello Gurus,
          what is key fields and non-key field of condition table?
    thanks very much!

    Key field
    Each condition table contains keys that can be used for creating dependent condition records.
    for example let take condition type PR00.
    PR00 uses access sequence PR02 .
    Access sequence PR02 has following tables associated with it namely 304, 305 & 306
    When you create a conditon record for PR00 with transaction VK11 or VK31, you have a button 'key combination' which is nothing but fields associated with tables 304, 305 & 306.
    In brief, Condition records are always created using specific keys. Condition tables are used to define the structure of the keys of a condition record.
    Non key field
    For example take condition table 144 - sales deal basic data.
    Table 144 is associated with access sequence PBUD.
    If you check the fields associated with this table (click technical view button), there are three fields at bottom which do not have 'key' check mark -KDATU, PLTYP, KSTAF
    So, when you create a condition record for PBUD, system does not propose these 3 fields in 'key combination' and hence are non key fields.
    Please reward points for good answers as this would help increase the total donation that SAP will make to the United Nations World Food Programme.

  • Problem with Non-English Fields Output to PDF by JASPER in JDev10.1.3

    I am using jsprx files(designed in i-report) to generate pdf reports out of an oracle database.
    The non-English fields are shown correctly when I output the report into an HTML or when I view it with JasperView.
    If I try making PDF files (JasperExportManager.exportReportToPdfFile) the static fields containing e.g.Arabic/Chineese characters won't be displayed and dynamic fields from the database with non-English contents will be shown as ??? or null.
    I received some suggestions about using PARAMETERS to feed the report instead of FIELDS, which I think can not be helpful in this case and in general.
    I think this should be a common problem. These are the components I am using:
    itext-1.4.7. jar
    commons-digester- 1.7.zip
    jasperreports- 1.2.8.jar
    Any comment or help is appreciated.
    Thanks
    Farbod

    I am using jsprx files(designed in i-report) to generate pdf reports out of an oracle database.
    The non-English fields are shown correctly when I output the report into an HTML or when I view it with JasperView.
    If I try making PDF files (JasperExportManager.exportReportToPdfFile) the static fields containing e.g.Arabic/Chineese characters won't be displayed and dynamic fields from the database with non-English contents will be shown as ??? or null.
    I received some suggestions about using PARAMETERS to feed the report instead of FIELDS, which I think can not be helpful in this case and in general.
    I think this should be a common problem. These are the components I am using:
    itext-1.4.7. jar
    commons-digester- 1.7.zip
    jasperreports- 1.2.8.jar
    Any comment or help is appreciated.
    Thanks
    Farbod

  • How can we protect the  ztable non key fields data in sm30 display.

    Hi experts,
         I have created tablemaintenence generator for one z table, in sm30 user has access to enter the data.
    in that maintenence i have to protect the non key field values data  like once the user saves his data.than in the edit mode it has to show the nonkey fields data  but  dont access to edit some nonkey fields... please help

    Hi
    U need to change the screen flow generated by maintenance view generator: here go to Enviroments->Modifications->Screen; doubleclick on your screen and the system take you to screen painter.
    Here go to screen flow and in PBO add new module in order to protect the field for the old records: u can use the statament LOOP AT SCREEN./ENDLOOP to do it.
    LOOP AT SCREEN.
       IF .....
         SCREEN-INPUT = 0.
         MODIFY SCREEN.
       ENDIF.
    ENDLOOP.
    Max

  • Error: "a summary has been specified on a non recurring field"

    Hi,
          I have a formula which calculates a quantity amount based on different quantity types & finally sums all the quantity to give a
    result, tis result i want to show in crystal report, This field is put in report footer, when i try to run the report i get the following error for that field 'a summary has been specified on a non recurring field' below i put my formula:
    //sum for qty type Fuel
    numberVar qtyFuel;
    if
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-THEO_ACT_IND]} = 'A' and
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-MEDIUM]} = 'GAS' and {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-QTY_TYPE]-[22O0GHO_C06-QTY_TYPE]} = '01'
    then
    qtyFuel := Sum ({2O0GHO_C06_0GHO_T06_Q0002.[Measures]-[DWQWE23XXYJCROQ978M8NX3J5]});
    //sum for qty type Inventory
    numberVar qtyInventory;
    if
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-THEO_ACT_IND]} = 'A' and
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-MEDIUM]} = 'GAS' and {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-QTY_TYPE]-[22O0GHO_C06-QTY_TYPE]} = '03'
    then
    qtyInventory := Sum ({2O0GHO_C06_0GHO_T06_Q0002.[Measures]-[DWQWE23XXYJCROQ978M8NX3J5]});
    //sum for qty type Non Sales
    numberVar qtyNonSales;
    if
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-THEO_ACT_IND]} = 'A' and
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-MEDIUM]} = 'GAS' and {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-QTY_TYPE]-[22O0GHO_C06-QTY_TYPE]} = '04'
    then
    qtyNonSales := Sum ({2O0GHO_C06_0GHO_T06_Q0002.[Measures]-[DWQWE23XXYJCROQ978M8NX3J5]});
    //sum for qty type Sales
    numberVar qtySales;
    if
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-THEO_ACT_IND]} = 'A' and
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-MEDIUM]} = 'GAS' and {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-QTY_TYPE]-[22O0GHO_C06-QTY_TYPE]} = '05'
    then
    qtySales := Sum ({2O0GHO_C06_0GHO_T06_Q0002.[Measures]-[DWQWE23XXYJCROQ978M8NX3J5]});
    //sum for qty type Enhanced Recovery
    numberVar qtyEnhancedRecovery;
    if
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-THEO_ACT_IND]} = 'A' and
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-MEDIUM]} = 'GAS' and {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-QTY_TYPE]-[22O0GHO_C06-QTY_TYPE]} = '14'
    then
    qtyEnhancedRecovery := Sum ({2O0GHO_C06_0GHO_T06_Q0002.[Measures]-[DWQWE23XXYJCROQ978M8NX3J5]});
    //sum for qty type Load Oil Sales
    numberVar qtyLdOilSales;
    if
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-THEO_ACT_IND]} = 'A' and
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-MEDIUM]} = 'GAS' and {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-QTY_TYPE]-[22O0GHO_C06-QTY_TYPE]} = '08'
    then
    qtyLdOilSales := Sum ({2O0GHO_C06_0GHO_T06_Q0002.[Measures]-[DWQWE23XXYJCROQ978M8NX3J5]});
    //sum for qty type receipt
    numberVar qtyReceipt;
    if
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-THEO_ACT_IND]} = 'A' and
    {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-MEDIUM]} = 'GAS' and {2O0GHO_C06_0GHO_T06_Q0002.[2O0GHO_C06-QTY_TYPE]-[22O0GHO_C06-QTY_TYPE]} = '13'
    then
    qtyReceipt := Sum ({2O0GHO_C06_0GHO_T06_Q0002.[Measures]-[DWQWE23XXYJCROQ978M8NX3J5]});
    numberVar Total_Production;
    //summing all quantity types
    Total_Production := qtyFuel + qtyInventory + qtyNonSales + qtySales + qtyEnhancedRecovery + qtyLdOilSales - qtyReceipt;
    I want to display the Total_Production in the report.
    The formula name is: Total_Gas_Production.
    kindly help me in this issue.
    Regards,
    Deepak

    is this one formula?
    have you tried to run each formula seperatly to check which is the culprit. if you search the web there are some reasons why this could be happening.
    generally you should use evaluation times on formulas
    are you using manual running totals or this is the entire formula?
    try
    MANUAL RUNNING TOTALS
    RESET
    The reset formula is placed in a group header report header to reset the summary to zero for each unique record it groups by.
    whileprintingrecords;
    Numbervar  X := 0;
    CALCULATION
    The calculation is placed adjacent to the field or formula that is being calculated.
    (if there are duplicate values; create a group on the field that is being calculated on. If there are not duplicate records, the detail section is used.
    whileprintingrecords;
    Numbervar  X := x + ; ( or formula)
    DISPLAY
    The display is the sum of what is being calculated. This is placed in a group, page or report footer. (generally placed in the group footer of the group header where the reset is placed.)
    whileprintingrecords;
    Numbervar  X;
    X

  • Error:Could not load type from assembly Culture=neutral, PublicKeyToken=null' because it contains an object field at offset 75 that is incorrectly aligned or overlapped by a non-object field.

    I got an error while I creating a structure.
    [FieldOffset(72)]
    [MarshalAs(UnmanagedType.ByValArray,SizeConst= 3)]
    public int[] DC;
    [FieldOffset(75)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
    public float[] WIN;
    [FieldOffset(83)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
    public byte[] name;
    [FieldOffset(103)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
    public byte[] SET;
    [FieldOffset(106)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)]
    public byte[] ID;
    Error as like this-->object field at offset 75 that is incorrectly aligned or overlapped by a non-object field. But here size constant is 3 so I think after 72 offset will be 75..If I change the offset to 76 it will works fine. I think reason is that
    size of int is 4. After changing that code will be like this.
    [FieldOffset(72)]
    [MarshalAs(UnmanagedType.ByValArray,SizeConst= 3)]
    public int[] DC;
    [FieldOffset(76)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
    public float[] WIN;
    [FieldOffset(84)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
    public byte[] name;
    [FieldOffset(104)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
    public byte[] SET;
    [FieldOffset(107)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)]
    public byte[] ID;
    But at that time I got the  error as object field at offset 107 that is incorrectly aligned or overlapped by a non-object field..Can anyone tell me what is the main reason behind this..
    Thanks..

    Hi,
    Please firstly take a look at this documentation:
    MarshalAsAttribute.SizeConst Field
    Indicates the number of   elements in the fixed-length array or the number of characters (not bytes) in   a string to import
    Change your code like this should work:
    [FieldOffset(72)]
    [MarshalAs(UnmanagedType.ByValArray,SizeConst= 3)]
    public int[] DC;
    [FieldOffset(84)]//72+4*3
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
    public float[] WIN;
    [FieldOffset(116)]//84+4*8
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
    public byte[] name;
    [FieldOffset(136)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
    public byte[] SET;
    [FieldOffset(139)]
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)]
    public byte[] ID;
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to move the value from a character field to numeric or packed decimal

    Hi,
    can anyone explain me on how to move the value from a character field to numeric or packed decimal.
    Please help me on this. Thanks...
    Regards,
    Rose.

    Hi ,
    if you use keyword MOVE u may loose the decimal and thoussan separator and if u don't want to loose them just call the FM ..HRCM_STRING_AMOUNT_CONVERT.
    i doubt wherther it is HRCM or HCRM just try using *
    this will suit ur requirement.
    Regards,
    KK

  • Free Good Qty as non modifiable field in the Sales Order Level

    Dear Friends,
    I have successfully done the config change for the Free Goods, But now i want make the free good line item qty as a non modifiable field in the Sales Order Level.
    How can i do this.. Please advice.
    Thank U,
    Uwanthi

    Hi
    This is a standard behaviour in the system
    kindly use the below program and user exitexit
    MV45AFZZ and use "Userexit_filed_modification"
    Regfards
    Damu

  • Changing Non key field to Key field in a custom table

    Hello Abap gurus:
    I have a requirement in which i need to change a non key field in my custom table(Z TABLE) to key field.
    For example; i have field sequence as
    field 1  key field
    field 2 key field
    field 3 key field
    field 4 non-key field
    field 5 non-key field
    field 6 non-key field
    field 7 non-key field.
    i want to change field 7 as key field.
    Can i do perform operation??
    when i am tryingto perform bove operation it is taking long time to get the table activated.
    Could any one please help me in getting this resolved.
    regards,
    Sravanthi.

    Use DB Utility (se14) to perform alter table or conversion. The latter is used when atemps to perform first operation fails. Which one is used, really depends on system and current DB table state (i.e. if has any content and what is being adjusted).
    The way Max suggested is similar to [conversion process|http://help.sap.com/saphelp_nw04/helpdata/EN/cf/21f1b8446011d189700000e8322d00/content.htm] which system takes care of itself.
    Refer [Adjusting Database Structures|http://help.sap.com/saphelp_nw04/helpdata/EN/cf/21f1ab446011d189700000e8322d00/content.htm] and already given link to conversion.
    Please also consider potential errors while doing conversion . This can lead to data loss, so you should think of some backup to prevent that.
    Regards
    Marcin

  • How to get a currency format for a character field

    for some specifix reason, we have a requirement to show character field (which results in value 633948) in the format $633,948
    how do i do this?
    if i do SELECT to_char(:c_1,'$999,999')) from dual;
    it gives me ora: 01722: invalid number error
    c_1 is a user parameter of data type character

    Try using TO_NUMBER first, as in something like:
    SQL> VARIABLE c_1 VARCHAR2(6)
    SQL> EXECUTE :c_1 := '633948';
    PL/SQL procedure successfully completed.
    SQL> SELECT TO_CHAR(TO_NUMBER(:c_1), '$999,999') FROM DUAL;
    TO_CHAR(T
    $633,948Hope this helps.

Maybe you are looking for

  • Takeover values coming with grey mode

    Hi!!! Please help me somebody.... I hve a problem... I create asset on AS91 but when i put a Asset capitalization date in XX.XX.2009 the Takeover values coming with grey mode but if i put Asset capitalization date in XX.XX.2008 I can fill the takeove

  • How to create a material master with referrence to exsisting material maste

    hi experts how to create the material master with reference to an existing material master ? please explain in steps regards jai

  • NSU 1.3.20en - ? Application Still Running

    Hi All On two occasions after using NSU to check for updates (there were none) I exited application, it indicates phone connected to PC Suite by usb (ok so far) and then I disconnect phone. However when I come to close down PC there is something stil

  • How to make an exception to RDS session Idle Time Limit?

    A little bit of background: We are running WYSE Thin Clients to connect to a RDS server farm at our company. We have set the Idle Session Time Limit to 12 hours, in Remote Desktop Session Host Configuration (in Connection --> Properties --> Sessions

  • Dynamic Layout on Edit Customer page

        Hi, I need to customize Edit Customer page so that when the value of Line Of Business is "A", some fields should hide and some others should show, and when the value of Line Of Business is "B", those hidden fields should appear and some fields sh