Best way to concatenate with a ; in dynamic internal table

I have dynamic internal table, i need to concatenate each field with a semi colon (
The following is the code i have written , is any better approach to this
report zaRs
  no standard page heading line-size 255.
data : wa_itab      type yctcgsa_out. 
data : i_itab       type standard table of wa_itab.
data : i_details    type abap_compdescr_tab.
data : i_ref_descr  type ref to cl_abap_structdescr.
i_ref_descr ?= cl_abap_typedescr=>describe_by_data( i_itab ). " Here i_itab is dynamic int table
i_details[] = i_ref_descr->components[].
data: output(900) type c.
data: value(51) type c.
loop at i_itab into wa_itab.
  loop at i_details.
    assign component sy-tabix of structure <wa_itab> to <fs>.
    condense <fs> no-gaps.
    concatenamte <fs> ';' into value.
    condense value no-gaps.
    v_len = strlen( value ).
    move value to output+v_pos(v_len).
    v_pos = v_pos + v_len.
  endloop.
  move output to i_putput.
  append i_output.
  clear : v_pos, v_len, output, value.
endloop.

Hello,
2/other solution:
Create a dynamic structure with 2n fields where n is the number of fields i_tab. The structure of this table will be:
field 1          : Field n°1 of i_tab
field 2         : one character field  named SEP0001
field 3         : Field n°2 of i_tab
field 4         : one character field  named SEP0002
field 2n - 1: Field n°n of i_tab
field 2n         : one character field  named SEP000n
Create a dynamic structure with n fields. this structure will be defined as follow:
field 1          :one character field  named SEP0001
field 2          :one character field  named SEP0002
field n          :one character field  named SEP000n
For example, we have the below report. This report does not explain how to create dynamic structures wa_sep and wa_itab_sep.
report zaRs
  no standard page heading line-size 255.
TYPES:
  BEGIN OF ywa_itab,
     field1 type vbeln,
     field2 type vbeln,
  END   OF ywa_tab,
  BEGIN OF ywa_sep,
     sep0001 type char1,
     sep0002 type char1,
  END   OF ywa_sep,
  BEGIN OF ywa_itab_sep,
     field1  type ywa_itab-field1,
     sep0001 type ywa_sep-sep0001,
     field2  type ywa_itab-field2,
     sep0002 type ywa_sep-sep0002,
  END   OF ywa_itab_sep.
data : wa_itab      type ywa_itab. 
data : i_itab       type standard table of wa_itab.
data : wa_sep       type ywa_sep.
data : wa_itab_sep  type ywa_itab_sep.
data: output(900) type c.
data: value(51) type c.
*init all fields of wa_sep with ';'
  DO.
    assign component sy-tabix of structure wa_sep to <fs>.
    IF  sy-subrc IS INITIAL. EXIT. ENDIF.
    MOVE ';'   TO <fs>.
  EnDDo.
loop at i_itab into wa_itab.
  move-correponsding wa_itab to wa_itab_sep.
  move-correponsding wa_sep  to wa_itab_sep.
  move wa_itab_sep           to i_output.
  append  i_output             to output.
endloop.
This report does not explain how to create dynamic structures wa_sep and wa_itab_sep.
Cordialement,
Chaouki.
Edited by: Chaouki AKIR on Jun 12, 2009 1:18 AM

Similar Messages

  • What is the best way to declare field length 500 in internal table?

    Hi all,
    what is the best way to declare field length 500(constant value allways) in internal table?
    I am trying to send data from internal table to file format, and I have a field in internal table with 500 length (constant value always). So how do I can declare and append this field value to table?
    Thanks
    Murali

    Hi.  Please see the following example program, notice how I am filling the field with the constant value.
    report zrich_0001.
    *       CLASS lcl_main DEFINITION
    class lcl_main definition.
      public section.
        types: begin of ttab,
                fld1(500) type c,
               end of ttab.
        data: itab type table of ttab.
        data: xtab type ttab.
        methods: constructor,
                 write_itab.
    endclass.
    *       CLASS lcl_main IMPLEMENTATION
    class lcl_main implementation.
      method constructor.
    <b>
        xtab-fld1 =
          'This is one part of the total string which needs to be really' &
          ' long and this is a constant and we need to move it to a work' &
             ' area and then append it to the internal table which has a' &
              ' field with a length of five hundred characters'.
        append xtab to itab.</b>
      endmethod.
      method write_itab.
        loop at itab into xtab.
          write:/ xtab-fld1.
        endloop.
      endmethod.
    endclass.
    data: o_main type ref to lcl_main.
    start-of-selection.
      create object o_main.
      call method o_main->write_itab.
    Regards,
    Rich Heilman

  • Problem with creating an dynamic internal table with only one field.

    Hi,
    i create an internal table like this:
    FIELD-SYMBOLS: <GT_ITAB>      TYPE TABLE,
                   <GS_ITAB>,
                   <FS>.
    DATA: GT_DATA TYPE REF TO DATA.
    DATA: GS_DATA TYPE REF TO DATA.
    DATA: TABNAME   LIKE DD03L-TABNAME.
    DATA: FIELDNAME LIKE DD03L-FIELDNAME.
    DATA: TBFDNAM   TYPE TBFDNAM VALUE 'LFA1-NAME1'.
    SPLIT TBFDNAM AT '-' INTO TABNAME FIELDNAME.
    CREATE DATA GT_DATA TYPE TABLE OF (TABNAME).
    ASSIGN GT_DATA->* TO <GT_ITAB>.
    CREATE DATA GS_DATA  LIKE LINE OF <GT_ITAB>.
    ASSIGN GS_DATA->* TO <GS_ITAB>.
    SELECT * FROM (TABNAME) INTO CORRESPONDING FIELDS OF TABLE <GT_ITAB>.
      BREAK-POINT.
    it works OK.
    Now i want to create an internal table not like LFA1 but with LFA1-NAME1 Field TBFDNAM.
    It's not only LFA1-NAME1 it shell be the value of TBFDNAM.
    When i change
    CREATE DATA GT_DATA TYPE TABLE OF (TABNAME).
    to
    CREATE DATA GT_DATA TYPE TABLE OF ( TBFDNAM).
    i get an shortdump.
    Any idea?
    Regards, Dieter

    Hi Dieter,
    Your approach is ok, but it will create dynamic table without a structure of NAME1. Only the line type will be suitable (but field name will not exists -> hence the error in the select statement).
    In this case you need to create a dynamic table which structure consists of one field named NAME1.
    This code is the appropriate one:
    " your definitions
    DATA: tabname LIKE dd03l-tabname.
    DATA: fieldname LIKE dd03l-fieldname.
    DATA: tbfdnam TYPE tbfdnam VALUE 'LFA1-NAME1'.
    FIELD-SYMBOLS <gt_itab> TYPE table.
    "new ones
    DATA: it_fcat TYPE lvc_t_fcat WITH HEADER LINE.
    DATA: gt_itab TYPE REF TO data.
    " get table and fieldname
    SPLIT tbfdnam AT '-' INTO tabname fieldname.
    " create dynamic table with structure NAME1 (only one field)
    it_fcat-fieldname = fieldname.
    it_fcat-tabname = tabname.
    APPEND it_fcat.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog           = it_fcat[]
      IMPORTING
        ep_table                  = gt_itab
      EXCEPTIONS
        generate_subpool_dir_full = 1
        OTHERS                    = 2.
    CHECK sy-subrc = 0.
    " dereference table
    ASSIGN gt_itab->* TO <gt_itab>.
    " insert data only to NAME1 field
    SELECT * FROM (tabname) INTO CORRESPONDING FIELDS OF TABLE <gt_itab>.
    I checked, this works fine:)
    Regards
    Marcin

  • Create dynamic internal table with deep structure;cell coloring dynamic ALV

    Hi,
    My requirement is to do cell colouring for a dynamic ALV.
    So I am creating a dynamic internal table using the following method.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = i_fieldcatalog[]
        IMPORTING
          ep_table        = i_output.
    But how do I define field COLORS which should be again an internal table ?
    Is there any other way for cell colouring?
    Putting my problem in another way:
    How do I create a dynamic internal table with one field as another internal table.
    Quick replies are highly appreciated.
    Thanks,
    Nisha Vengal.

    halo Nisha
    Before building the display table . you can add the field in the feild catalog right . This display table gets generated from the field catalog right
    1 Create a global structute say ZEXTEND_FIELDCAT
    2 Have fields like STYLE type lvc_t_styl
                             COLOR type LVC_T_SCOL.
    3 Now you have to extend ur fieldcatalog
      l_fieldcat-fieldname = COLOR'.
      l_fieldcat-ref_field = 'COLOR'.
      l_fieldcat-ref_table = 'ZEXTEND_FIELDCAT'.
      APPEND l_fieldcat TO lt_field_catalog.
      CLEAR l_fieldcat.

  • What is the best way to work with Word documents in The InDesign CS4???

    I work in Microsoft Word 2007 and all my documents have *.doc format.
    What is the best way to work with Word documents in InDesign CS4???
    David Blatner says to avoid copying and pasting text from Word instead of placing it (Ctrl+D).
    How about pasting RTF or Text Document???
    I want to make book's layout in ID CS4 and its main feature is that there is the left page with text and the right - with graphics.
    So, as I understand to place the text on each page I must create for example 70 Word documents and place each item on 70 left pages???
    It loks like wasting time. I sthere another way of making such layout???  What kind????

    It's best to place any text.
    You can have all of your text in one file and use auto-flow to add threaded text frames and pages as required (Hold down the Shift key when you click the loaded text cursor), but it's a little non-standard to have the thread only on one side of the spread from the auto-flow perspective, so you'll have to set up properly.
    This is one case where a master text frame will work to your advantage. On your master page spread, add a text frame to the left page, but not to the right (or at least not threaded to one on the right -- for some other project you might actually want two independent text threads). Hold the loaded cursor over a frame on the left side of a document page and auto-flow. ID will add new spreads as necessary, but only put the text on the left side.
    Peter

  • How is the best way to deal with duplicate photos

    I am using a new retina 27" iMac 16gb ram OS X 10.10.1
    Aperture 3.6
    What is the best way to deal with duplicates that get in Aperture Vaults
    I have used Gemini and it finds duplicates, but I have no way of telling if the original are still there.
    I don't want to go through 15000 photos to try to find the duplicate.
    Thanks Charlie

    You mean - one image in a vault, one in a library?  Or duplicates in the same library?
    Photo Sweeper can scan several libraries or folders at the same time and display the duplicates side by side to let you pick which to keep.  You can define rules to mark photos for automatic deletion as well.
    http://overmacs.com/photosweeper.html

  • What's the best way to deal with floating point errors?

    What's the best way to deal with the decimal number errors in Flex?
    Lets say I have:
    var number1:Number = 1.1;
    var number2:Number = 1;
    var result:Number = number1 - number2;
    trace(result);
    I get "0.10000000000000009".
    What's the best way to deal with this so that i get the right result?
    Using the trick: result = Math.round( result * Math.pow(10,13) ) / Math.pow(10,13); is not useful as such when using big numbers.
    For example, If number1 = 100000000001.1, and number2 = 0.2, I get "100000000000.90001" as result. The previous rounding fixes rounding errors after 13th decimal, but here the first rounding errors come after 4 digits.
    The toPrecision method in Number and NumberFormatter dont seem be of use by themselves because of the same reason.
    So I'd have to check how big the number is, and then round the number based on that.
    So far I've constructed a method that does that with logarithms like this:
    public function floatFix(number:Number):Number{
          var precision:int = 14-Math.floor(Math.log(Math.abs(number))*Math.LOG10E);
          var precisionFactor:Number = Math.pow(10, precision);
          return Math.round(Number(number*precisionFactor))/precisionFactor;
    It just seems rather odd that one would have to create and use something like that to just count 1.1-1; There's a lot of calculating in that method, and i'm guessing that having to use that in a loop could slow down a program quite a bit.
    I think there really should be a pre-built method in flex for something like this, but I can't find any.
    Anyone know any better/faster ways?

    Use the application server database pooling services to create a datasource that can be access using JNDI.
    Move the database access code to a Servlet so that a JSP submits a form to the Servlet that does the database access and packages the data into a bean which is passed to another JSP to be displayed.

  • Best way to deal with Mutating table exception with Row Level Triggers

    Hello,
    It seems to be that the best way to deal with Mutating Table exception(s) is to have to put all the trigger code in a package & use it in conjunction with a Statement level trigger .
    This sounds quite cumbersome to me . I wonder is there any alternative to dealing with Mutating table exceptions ?
    With Regards

    AskTom has a good article about this,
    http://asktom.oracle.com/tkyte/Mutate/index.html

  • What is the best way to deal with memory leak issue in sql server 2008 R2

    What is the best way to deal with memory leak issue in sql server 2008 R2.

    What is the best way to deal with memory leak issue in sql server 2008 R2.
    I have heard of memory leak in OS that too because of some external application or rouge drivers SQL server 2008 R2 if patched to latest SP and CU ( may be if required) does not leaks memory.
    Are you in opinion that since SQL is taking lot of memory and then not releasing it is a memory leak.If so this is not a memory leak but default behavior .You need to set proper value for max server memory in sp_configure to limit buffer pool usage.However
    sql can take more memory from outside buffer pool if linked server ,CLR,extended stored procs XML are heavily utilized
    Any specific issue you are facing
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • What is the best way to work with AVCHD 720 24p footage in FCE4.1?

    Hi I have a Panasonic HMC-150 and I've been shooting 720 24p footage at 21 mbps transfer rate.
    I was wondering what is the best way to work with this material in FCE 4.1? I see that in the easy set up menu they only have the option of 1440X1080i at 50 or 60 fps or 1920X1080i at 50 or 60 fps.
    Also in the rates drop down menu there is only 50 or 29.97.
    So I was wondering which is the best choice for 720 24p footage and will it look alright in any of them? Also is it possible to customize these settings?
    And finally can you work with faster transfer rates (21mbps) in FCE?

    Yikes, this is going to be tricky since FCE does not support native 24p editing.
    The work around for some of us is that AVCHD material that is 24p is often recorded to disc at 60i using telecine, in which case it can be editing at 29.97 frames per second, and then detelecined afterward for final export at 23.98 fps. The problem is that I think your camera actually records real 24p - not 24p packed into 60i. When you import the material from the camera what does QuickTime report the framerate as?

  • What is the best way to work with mixed media in 1080 timeline?

    Hi there,
    I have a project shot mostly in 1080 24p but a bit of 720 24p and 4x3 30p footage.
    What is the best way to work with this mixed media?
    Thanks!
    Steven

    Hi Shane,
    Ok just to recap (thanks for being patient by the way)...I have put some questions in here...feel free to write in caps to respond and we'll put this baby to rest!
    1) I will work in a 1080p FCP sequence, correct?
    2) HD 1080p footage captured as applepro res hq I will leave as is and work with?
    3) HD 720p footage which was captured as applepro res hq. Can I just drop in 1080 timeline and let FCP do its work? Or should i run through compressor, if so what setting shall I submit it too?
    4) I dont have a budget for an external hardware to convert SD to HD...should I capture my SD Beta through Final Cut and just leave and let FCP do its work? Or should I run through compressor? If so what setting shall I submit it too?
    5) For for my master sequence in FCP am I not using an I-Frame format apple pro res if I am using my apple pro res hq 1080 footage as my formatted sequence? I am not sure what you mean by GOP?
    6) I also found some 60p footage 1080p XDCAM compressor shot with the same XDCAM camera. I put in the 1080p 24p timeline but it was pretty choppy...any ideas of this conform?
    Thanks very much for all your help it has gone along way,
    Steven
    Saying what CODECS you are working with was my question. 1080, 720, 4:3...really says nothing. There are a dozen 1080 codecs, another dozen 720 codecs, and nearly 100 4:3 formats.
    Best to capture all the footage to one uniform codec.
    Second best is to work with one format and let FCP conform the rest to that...IF and only IF that format is an I-Frame format like ProRes. GOP formats as master sequence formats cause TONS of issues.
    What I'd do is work 1080 ProRes, just add the 720p footage (Use Compressor to convert it if you didn't have a lot, but if you had a lot, just add it), but I'd capture all the SD 4:3 footage via a Kona 3 or Matrox MXO2 as 1080 ProRes. Hardware conversion of SD to HD is much better than anything FCP can do. AE might do good as well. But then use Compressor to convert 29.97 footage captured (you can't convert 29.97 to 23.98 when you capture) to get to 23.98.

  • Best way to deal with hard coded variables in a package

    There is a plsql package that reads a line from a file, parses the data, does a ton of sql operation with it (select update, inserts, calculations) and then writes the output to an output file.
    The file names and the firectories are retieved from a database table.
    Example:
    select location,file_name into loc_in,file_in from temp_tbl;
    p_File_handle := utl_file.fopen (loc_in, file_in, 'W');
    My co worker is suggesting that getting the variable values from the table is not a good practice. He suggests that the values should be hard-coded in the program. Now you might ask what would happen if the file name or directory changes. His suggestion is to have a build file and do a token substitution of those hard coded values in the program and then load in to the DB. In short the process will involve the following steps:
    -Get the package from the repostory.
    -Change the file name and directory in the token file.
    -Run the build process that will replace the values in the package .
    -Load the new file (with the updated values) in to the DB.
    Example:
    This way the program will be initially coded like this:
    p_File_handle := utl_file.fopen ('${loc_in}', '${file_in}', 'W');
    After the build file runs, it will replace the values as
    p_File_handle := utl_file.fopen ('C:/test', 'testfile.dat', 'W');
    Once the file has changed with the new updated values, compile that into the database.
    Ideas/comments?

    Re: Best way to deal with hard coded variables in a package: why have you reposted using a new profile?
    Neither post provides enough clear information on what the actual requirement is. We need more data in order to comment on your idea, your co-worker's, or to suggest alternatives.
    My co worker is suggesting that getting the variable
    values from the table is not a good practice.His reasons for this are...?
    "variable values": Why do they vary? How often do they change?
    The file names and the directories are retrieved from
    a database table.How do the values get into the table? What is the volume of the data?
    Oracle version? Operating system?

  • Best way to deal with multi-track clips?

    Hi,
    I'm editing a documentary using pre edited program masters and have been supplied the audio stems. Can anyone recommend the best way to deal with them so I can access any of the tracks within the main edit.
    I've tried creating a compound clip and adding the stems but I only access to a mono track when using the clip in my main project. I've also tried creating a multicam clip but as my stems need to be split and spaced to line up with the main Pro Res file I don't seem to be able to insert slugs into multicam clip.
    Has anyone found an elegant way to do this?
    Many thanks,
    Leigh

    Hi leiski,
    Happy New Year, and Welcome to the Support Communities!
    Compound clips are still the best way to approach this, because you have access to the stems at any time with a double-click. 
    The following resources may provide additional information:
    Audio editing overview
    http://help.apple.com/finalcutpro/mac/10.1/#verdcd1cc1
    Advanced multichannel audio editing
    Final Cut Pro automatically groups channels into audio components according to how the channels are configured for the clip. You can expand the audio portion of clips to reveal and edit audio components down to the individual channel level. This allows you to apply different effects to different components and streamlines the process for making quick sound cutouts to a single microphone input or other fine adjustments. 
    Important:  Many digital audio file formats, such as AAC and MP3, use interleaved stereo files, which do not contain separate left and right channels. These files appear as a single audio component unless you change the clip’s channel configuration. 
    Keep in mind the following when editing audio components in Final Cut Pro:You view and change the audio channel configuration of your clips in the Audio inspector. You can change audio component names, add or remove audio components, and configure channels in mono, stereo, and surround formats. See Configure audio channels.
    Configure Audio Channels
    http://help.apple.com/finalcutpro/mac/10.1/#verc1fab5f6
    Using Roles to organize clips and export audio files
    http://help.apple.com/finalcutpro/mac/10.1/#verc1faa7ce
    Cheers,
    - Judy

  • Best way to deal with same members having different parents/children

    We have a situation where some nodes need to have different parents for different application but they exist in the main hierarchy. What is the best way to deal with it? The nodes used are pretty much the same.
    Is it best to create a new hierarchy within the same version and let the nodes have different parents in it?
    -- A

    Every node has a parent in the hierarchy. You said that some nodes need different parents for different applications.
    Do these 'different parents' exist further up the tree? If they do then you can create a boolean input property that flags the nodes that exist JUST for the application. Create a new property (call it NewAppParent, let's say) with a formula that recursively climbs up the tree to find its next parent for the application, and export NewAppParent as the parent value.
    If the parent does not exist in the hierarchy then you should create an alternate hierarchy.
    If the parent exists in the hierarchy and is not an ancestor of the node then you're out of luck. Unless you create an alternate hierarchy with unique parent names.
    D

  • "Built In " battery ... what is the best way to deal with it ?

    Hi ... I just bought this laptop envy6-1100se with a built in battery and I actually heard alot of diffrent opinions about the best way to deal with the battery and charging and I don't know what to trust to make my batterylife the longest   so hope u can help me with that .. I want to know also if there is any damage to the battery if I kept it plugged to Ac Power even after it's totally charged ... ??

    You want to minimize the number of charge/discharge cycles so yes it is actually a real good idea to have it plugged in whenever you can. Just to illustrate, Samsung makes several models with integrated batteries and they actually have a setting in the BIOS where you can choose to cut off charging at 80% battery power. If it never goes above 80%, then discharging and charging below the 80% level never registers as a cycle. The battery has a smart chip that counts cycles. After a certain number, say 500, the battery will no longer work. This is to minimize the fire hazard from older Li-ion batteries. In other words, you trade runtime on a "full" charge for longevity of the battery. You might go from 5 hours to 4 on a single charge but the battery will last 4 years instead of two and a half. The battery can actually be replaced but it is a huge pain. The "Samsung" solution is not available on HP's that I have been able to determine.
    So, as I said there is not much you can do except use AC power as much as possible and treat the battery like your life savings; use it sparingly.
    And I recognize that when it comes to batteries on laptops, it is like a discussion of religion. There is more than one respectable opinion but this is mine.

Maybe you are looking for

  • Sharing contacts using AirDrop, both users are members of the same Family Sharing group.

    I'm asking this question for a friend of mine. He contacted me to help troubleshoot a problem where he was trying to share a contact with his wife using AirDrop. They both have new iPhone 5Ss running iOS 8.1. He can send a contact to his wife's iPhon

  • FTP/telnet issue on OL 5 64bit

    I am trying to enable FTP/Telnet on Oracle Linux server (64bit), i am still getting same error. I installed required RPM's [root@apps xinetd.d]# rpm -qa|grep telnet telnet-0.17-38.el5 [root@apps xinetd.d]# rpm -qa|grep ftp lftp-3.5.1-2.fc6 tftp-0.42-

  • WDS - WLCCP between WDS AP and WLSE

    We have successfully configured an AP as WDS and registered infrastructue Access Points. The WLSE has also successfully been authenticated by the WDS AP. My problem is when I move the WLSE onto a different subnet it looses the connection. I understan

  • Need help with bus ports (pre or post?)

    I have recorded my acoustic guitar on two tracks in order to save time with the drop region and cutting and I have already autonated both of the tracks so they sound like one guitar (same channel strips). However, I am trying not to use the plug ins

  • Classification in Notifications

    Hi, I am trying to add classifications to notifications. I did a test to standard PM notification type M2 in IW21. Under item details, classification section, I entered a class which I just created but an error message "Class XX does not exist" is re