Copy and Modify from one internal table to another.Please help.

Hi,
I have an internal table having a structure like below.
Account Entity Category period1value pd2value
10 A C 100 200.
where account corresponds to 10
entity A
category C
period1 value = 100
period2 value = 200.
Now I need to populate it into another table having structure like
Account Entity Category period Value
10 A C 1 100
10 A C 2 200.
If u see this carefully a new column, period is added in the database table and thus for each row there will be only 1value.
Instead of period1 value and period2 value being in the same row they will come in different rows.One row will be like the value for period1 and next for value like period2.
Pleadse help
Ankit

Hi,
u can do as follows,
LOOP AT itab1 into wa_itab1.
wa_itab2-account = wa_itab1-account.
wa_itab2-entity = wa_itab1-entity.
wa_itab2-category = wa_itab1-category.
if not wa_itab1-period1 is initial.
wa_itab2-period = wa_itab1-period1.
endif.
if not wa_itab1-period2 is intial.
wa_itab2-period = wa_itab1-period2.
endif.
wa_itab2-value = wa_itab1-value.
append wa_tab2 to itab2.
clear:wa_itab1-period1 ,
       wa_itab2-period .
endloop.

Similar Messages

  • How to scan data from one internal table to another

    Hi All,
    let me know how to scan all from one internal table to another internal table. Pls provide me the syntax and code.
    i am very thankful to you all in advance.
    Thanks & Regards,
    Nagarjuna.

    if u want to copy data from itab1 to itab2  then use
    itab2[] = itab1[].
    if u want to compare whether both itab1 and itab2 are same or not,use
    if itab1[] = itab2[].
    *--same
    else.
    *--not same
    endif.
    if u want to compare itabs based on primary key....
    loop at itab1.
    read table itab2 with key f1 = itab1-f1.
    if sy-subrc <> 0.
    *--not same....
    endif.
    endloop.
    if u want to copy only few lines(say from 1 to 3) of itab1 to itab2 then use...
    append lines of itab1 from 1 to 3 to itab2.
    if internal tables don't have same structure,
    say only fields f1 and f2 are common,then
    loop at itab1.
    itab2-f1 = itab1-f1.
    itab2-f2 = itab1-f2.
    append itab2.
    clear itab2.
    endloop.
    if there are many common fields then...
    loop at itab1.
    move-corresponding itab1 to itab2.
    append itab2.
    clear itab2.
    endloop.
    Please don't forget to reward points....!!!
    Regards
    vasu

  • How to insert select columns from one internal table to another

    Hi,
    How to insert select columns from one internal table to another based on condition as we do from a standart table to internal table.
    regards,
    Sriram

    Hi,
    If your question is for copying data from 1 int table to other ;
    we can use
    APPEND LINES OF it_1 TO it_2.
    or if they have different columns then:
    loop at it_1 into wa_it1.
    move wa_it1-data to wa_it2-d1.
    apped wa_it2 to it_2.
    clear wa_it2.
    endloop.
    thnxz

  • When I copy and paste from one source material to another  within adobe reader, all the words are in one sentence. I have to take extra time to separate  the words using the space bar. Can this be fix?

    When I copy and paste from one source material to another  within adobe reader, all the words are in one sentence. I have to take extra time to separate  the words using the space bar. Can this be fix?

    Hi Bernie,
    Are you trying to copy and paste from a pdf to another pdf?
    Regards,
    Rave

  • Moving data from one internal table to another

    Hi,
    I have one internal table populated with a list of material codes and another with all the material numbers.
    ITAB1: MCODE KSCHL KNUMH MATNR
    ITAB2:  MCODE MATNR
    The matnr field in itab1 is blank initially. It needs to be populated with all the material numbers from itab2. How can I achieve this?
    Thanks,
    ap

    Hi
    Lets say that there is only one record in itab1 and for that there is correspondingly 10 records in itab2.
    that means that the one record in itab1 should be changed to the first material number in itab2 and there should be nine more records created in itab1 according to the values in itab2.
    Hope this is what you mean.
    If this is the logic then the following code should work
    then lets have a third internal table the same type as itab1
    Loop at itab1 into wa_itab1
    *readt table itab2 into wa_itab2 with key mcode = wa_itab1-mcode.
    *IF sy-subrc eq 0.
    loop at itab2 into wa_itab2 where mcode = wa_itab1-mcode.
    wa_itab1-matnr = wa_itab2-matnr
    append wa_itab1 to itab3.
    endloop.
    *ENDIF.
    *modify itab1 from wa_itab1.
    endloop.
    itab3 will contain all the values that you require

  • How  to copy data from one internal table to another

    i am using some function module to get some data for my function module
    and the retrieved data is not getting populated in mu fumctional module
    i am sucessful in getting the data to an internal table in my function module but dont know how to pass it to my table parameter
    thanks in advance

    Hi Naval,
    Declare an internal table of type table parameter structure and pass it the table parameters of the Function module.
    Check the code for this function module.
    DATA IT_MARA LIKE MARA OCCURS 0 WITH HEADER LINE.
    SELECT * FROM MARA UP TO 10 ROWS INTO TABLE IT_MARA.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME                = 'C:\TEST.TXT'.      FILETYPE                = 'ASC'
          WRITE_FIELD_SEPARATOR   = 'X'
    <b>    TABLES
          DATA_TAB                = IT_MARA</b>
        EXCEPTIONS
          FILE_WRITE_ERROR        = 1
          NO_BATCH                = 2
          GUI_REFUSE_FILETRANSFER = 3
          INVALID_TYPE            = 4
          NO_AUTHORITY            = 5
          UNKNOWN_ERROR           = 6
          HEADER_NOT_ALLOWED      = 7
          SEPARATOR_NOT_ALLOWED   = 8
          FILESIZE_NOT_ALLOWED    = 9
          HEADER_TOO_LONG         = 10
          DP_ERROR_CREATE         = 11
          DP_ERROR_SEND           = 12
          DP_ERROR_WRITE          = 13
          UNKNOWN_DP_ERROR        = 14
          ACCESS_DENIED           = 15
          DP_OUT_OF_MEMORY        = 16
          DISK_FULL               = 17
          DP_TIMEOUT              = 18
          FILE_NOT_FOUND          = 19
          DATAPROVIDER_EXCEPTION  = 20
          CONTROL_FLUSH_ERROR     = 21
          OTHERS                  = 22.
      IF SY-SUBRC <> 0.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Thanks,
    Vinay

  • Transferring data from one internal table to another

    Hi,
    I have two internal tables it_acct and it_acct1 as below.
    data: begin of it_acct occurs 0,
          belnr like bkpf-belnr,
          bldat like bkpf-bldat,
          augcp like bseg-augcp,
          vbeln like bseg-vbeln,
          end of it_acct.
    data: begin of it_acct1 occurs 0,
          belnr like bkpf-belnr,
          cpudt like bsad-cpudt,
          vbeln like bseg-vbeln,
          end of it_acct1.
    select belnr cpudt vbeln into corresponding fields of table it_acct1
                  from bsad where cpudt in s_cpudt.
    Now I want to move the data from it_acct1 to it_acct . I have no data in it_acct now.
    i want to move it_acct1-belnr to it_acct-belnr,
              move it_acct1-cpudt to it_acct-augcp,
              move it_acct1-vbeln to it_acct-vbeln.
    Can someone help me how to code to move the data from it_acct1 to it_acct.
    Regards,
    D

    Hi Dev,
    Just add an additional line in Naren's code to get proper results at any time.
    LOOP AT IT_ACCT1.
    IT_ACCT-BELNR = IT_ACCT1-BELNR.
    IT_ACCT-VBELN = IT_ACCT1-VBELN.
    it_acct-augcp = it_acct1-cpudt.
    APPEND IT_ACCT.
    <b>CLEAR IT_ACCT.</b>
    ENDLOOP.
    If you didnt include CLEAR statement, even if IT_ACCT1 doesnt have any values for all fields or few fields in the next record, it will take values of previous one and it may lead to improper results.So it is a good practise to have CLEAR statement after APPEND statement in LOOP...ENDLOOP.
    Thanks,
    Vinay

  • HOW TO TRANSFER DATA FROM ONE INTERNAL TABLE TO ANOTHER

    FOR PERTICULAR OBJECT ID ONE INT TABLE JTAB CONTAINS ONE RECORD(ROW) AND ANOTHER INT TABLE KTAB CONTAINS 3 RECORDS(ROWS). THEN HOW I SHOULD TRANSFER DATA FROM KTAB TO JTAB? WHAT R THE VARIOUS WAYS TO DO THAT. PLS HELP ME OUT. THANKS IN ADVANCE

    Try something like
    If you want one record per ktab :
    LOOP AT jtab.
      MOVE-CORRESPONDING jtab TO itab.
      LOOP AT ktab WHERE id = jtab-id.
        MOVE-CORRESPONDING ktab TO itab.
        APPEND itab.
      ENDLOOP.
    ENDLOOP.
    or
    LOOP AT ktab.
      READ TABLE jtab WITH KEY id = ktab-id. " binary implicit if sorted type
      MOVE-CORRESPONDING jtab TO itab.
      MOVE-CORRESPONDING ktab TO itab.
      APPEND itab.
    ENDLOOP. 
    If you want to sum ktab ratio into itab for each jtab
    LOOP AT jtab.
      MOVE-CORRESPONDING jtab TO itab.
      LOOP AT ktab WHERE id = jtab-id.
        ADD-CORRESPONDING ktab TO itab.
        APPEND itab.
      ENDLOOP.
    ENDLOOP.
    Use sorted type table when LOOP AT WHERE, else SORT table is enough.
    Regards

  • Microsoft excel cannot copy and paste from one excel doc to another one

    I have a user that is on a Windows 7 64-bit machine and he has to different instances of excel open and coping information from one excel file to the other one. He can do it once and then when he tries to do it again excel says, "Microsoft cannot Copy and
    Paste." 
    I have tried to repair the install, that worked for a few days.
    Tried uninstalling Office suite and then re-installing Office suite.
    I reformatted the computer and did a fresh install of windows 7 and Office suite and today it started again.
    I need to get a fix for this as soon as possible.

    Hi,
    As far as I know, if you have Skype installed in your computer, the clipboard will be influenced.
    Refer to the link:
    http://support.microsoft.com/kb/2697462
    And this issue has been resolved in an update version.
    http://www.skype.com/intl/en-us/get-skype/on-your-computer/click-to-call/windows/
    Jaynet Zhang
    TechNet Community Support

  • Why do objects get bigger when I copy and paste from one Keynote document to another?

    I have 2 keynote presentation files open. I select some objects on one slide, apple-C to copy, go over to a blank slide in another file, and apple-V to paste. The item(s) get pasted but are much bigger - they take up way more of the new slide than they did for the old one.  What am I missing? Why can't I copy it with the same relative size it used to have?

    Chances are that small file used to be a PowerPoint file - PowerPoint deals in inches instead of pixels (which blows my mind).
    I would first convert the smaller file to a larger resolution - that should keep most of the scaling intact - and then copy and paste. In my opinion you'll probably have to re-polish your presentation once you've changed the resolution as some things will probably be a bit wonky.

  • I can not copy and paste from My E-Bay adds. Please help

    I need to copy and paste add's from and to E-Bay. Firefox wont let me and says I need to go into profile directory. then user.js. ect ect. I can not figure out how to gt to Profile directory, much less user.js Please help me do this. Diana

    Hi lori2616,
    Thank you for your question. It sounds like there might be an issue with the clipboard, but I do not know exactly what might be preventing this. Did you make any recent changes to the Firefox configuration?
    If not please consider a Firefox Refresh. [[Recovering important data from an old profile]]
    The Refresh feature (called "Reset" in older Firefox versions) can fix many issues by restoring Firefox to its factory default state while saving your bookmarks, history, passwords, cookies, and other essential information.
    '''''Note:''' When you use this feature, you will lose any extensions, toolbar customizations, and some preferences.'' See the [[Refresh Firefox - reset add-ons and settings]] article for more information.
    To Refresh Firefox:
    # Open the Troubleshooting Information page using one of these methods:
    #*Click the menu button [[Image:New Fx Menu]], click help [[Image:Help-29]] and select ''Troubleshooting Information''. A new tab containing your troubleshooting information should open.
    #*If you're unable to access the Help menu, type '''about:support''' in your address bar to bring up the Troubleshooting Information page.
    #At the top right corner of the page, you should see a button that says "Refresh Firefox" ("Reset Firefox" in older Firefox versions). Click on it.
    #Firefox will close. After the refresh process is completed, Firefox will show a window with the information that is imported.
    #Click Finish and Firefox will reopen.
    Did this fix the problem? Please report back to us!
    Thank you.

  • How can i copy and paste from one spreadsheet to another?

    Trying to shuffle around the rows as part of an everchanging schedule.  When i copy and paste from one spreadsheet to the other, the images overlay each other as if i were litterally cutting them out of paper and then sloppily pasting to another. Is there a way to set them up so crosscutting is more seamless in appearance?

    jrc1971 wrote:
    ...When i copy and paste from one spreadsheet to the other, the images overlay each other as if i were litterally cutting them out of paper and then sloppily pasting to another.
    JRC,
    The reason you get that result is that you are pasting the rows to the canvas of your second document instead of into an existing table.
    Instead, make a large blank table in your receiving document and paste into that table only after clicking on the cell where you want the first cell of the copied data to be positioned.
    Jerry

  • How do I copy and paste from one page or file to another page or file - on the same screen?

    How do I copy and paste from one page or file to another - on the same screen?

      Open both of your images in the Editor. Click on the image you want to copy and press Ctrtl+A (select all) followed by Ctrl+C (copy) then click the tab for your other image and press Ctrl+V (paste)
    Alternatively click on your background image then simply drag the second image from the photo/project bin and drop it into the main editor workspace on top of the background image. Use the move tool to position and the corner handles of the bounding box to scale.

  • (v 5.5) I can no longer copy and paste from one layer to another.

    I can no longer copy and paste from one layer to another in Illustrator (5.5). This started happening a few days ago. Restarting Illustrator and also my computer (Mac) didn't help. Any ideas?

    To clarify: If I select an object in layer 1 using command/c or command/x then select layer 2 and press command/v the object gets pasted back into layer 1 instead of layer 2. I've tried everything I can think of and can't correct the problem.
    Now the only way I can get an object from one layer to another is to drag it into another layer in the layers window.

  • How do i transfer data from one internal tabe to another.

    Hi All,
             How do i transfer data from one internal tabe to another.
             Can i do it ebven if he tables are different in structure.
    Please Advice.
    Thanks in advance.

    Hi Saket Tiwari,
    I hope the earlier post by kashyap is good enough an answer. anywas in addition to it let me give a detailed
    explanation of how you can populate an internal table.
    1) Append data line by line.
         Syntax :  APPEND [<wa> TO / INITIAL LINE TO] <itab>.
    this appends new line to internal table <itab>.
    2) Using COLLECT statement.
                 COLLECT is another form of statement used for populating the internal tables.  Generally COLLECT is used while inserting lines into an internal table with unique standard key. The syntax for COLLECT statement is as shown
         Syntax : COLLECT [<wa> INTO] <itab>.
    3) Using INSERT statement
         Syntax  INSERT [<wa> INTO / INITIAL LINE INTO] <itab> [index <idx>].
    INSERT statement adds a line/work area to the internal table. You can specify the position at which the new line is to be added by using the INDEX clause with the INSERT statement.
    Now coming to your request..
    To append part or all of an internal table
         Syntax
                  APPEND LINES OF <itab1> [FROM <n1>] [TO <n2>] TO <itab2>.
    *     Note:
    Without the FROM and TO options, this statement appends the entire table <itab1> to <itab2>.*
    b) To insert part or all of an internal table into another internal table
         Syntax
              INSERT LINES OF <itab1> [FROM <n1>] [TO <n2>]
              INTO <itab2> [INDEX <idx>].
    c) Using Move statement.
    To copy entire contents of one table into another in one execution
         Syntax MOVE  <itab1> To <itab2>.
                   OR
              <itab1> = <itab2>.
    but u hav to be careful because he contents of itab2 will eb overwritten on the execution of this statement.
    These copy the contents of ITAB1 to ITAB2. Incase of internal tables with header line we have to use [] inorder to distinguish from work area. So, to copy contents of internal tables with header line  the syntax becomes,
    ITAB1[] = ITAB2[].
    Coming to the letter part of your question, Yes, we can copy values between tables having different structures.
    for this we use    
                                MOVE-CORRESPONDING <itab1> TO <itab2>
        this executes the statement for their header lines. Searches for the sub-fields which occur both in itab1 and itab2 and then generates, for all relevant field pairs which correspond to the
            sub-fields ni , statements of the form MOVE itab1-ni TO itab2-ni. The other fields remain unchanged.
    I hope the information provided has been of your help.
    Reward if useful.
    Regards,
    Jose

Maybe you are looking for

  • SSO between BW and Sharepoint

    Hi, We have a situation where we want to establish SSO between SAP BW (3.5 with out java stack running on UNIX machine) and MS Sharepoint server. Can you kindly let me know what could be the best solution and any documentation? I've looked at various

  • Where is the Enterprise Manager in Oracle 8.1.5

    Hi, After installing Oracle 8i (8.1.5), I can't find the Oracle Enterprise Manager. Where is it? In Oracle 8.0.5 on NT, you can access it from the START button. In the Oracle 8.1.5 documentation, it talks about the Microsoft Management Console where

  • Printer Que Stuck - Please Help!!

    Hi, I have a networked printer thats been working fine every day until I did a restart. I open the que and see it gets stuck, it says: "printing page 1, 8% complete...." But will never go beyond that. When I open system prefs then printer and fax I s

  • Illustrator CC 17.1 running slow on windows 8.1

    I have bought a new machine to speed things up. But it is running very slow, I have increased the virtula memory, allocated a scratch disk on a separate SSD. The machine is a top spec, i7 4th generation processor, 16GB RAM, NVIDIA GeForce GT 750M wit

  • My I pod touch 32 G has a totally white screen, no matter what I do to reset it. I've only had it maybe a month.

    My I pod touch 32 G has a totally white screen, no matter what I do to reset it. I've only had it maybe a month. What do I do?