Sum of  fileds to be stored in the same internal table

Hi SDNners,
i hav an internal table with fileds f1,f2 ,f3,f4,f5 of which f1,f2 are key fields
for each of the key combination i want to hav the sum of the field f4 into the field
f5.
ex.
f1   f2     f3      f4    f5
k1  k2    d1    10
k1  k2    d2    20
k1  k2    d3    30
i want the sum of k1 & k2 combination i.e 102030 into f5
plz give me sample code
Thanks in advance
Ganesh M

Hi,
say your internal table is declared as
data: t_f1f2f3f4f5 ...
and you fill it in somw way.
declare
data: t_f1f2f3f4f5_coll like table of t_f1f2f3f4f5 with header line.
loop at t_f1f2f3f4f5.
  collect t_f1f2f3f4f5 into t_f1f2f3f4f5_coll.
endloop.
* now all key combinations (char fields K1 and K2) are summed up.
sort t_f1f2f3f4f5_coll.
* should already be sorted but this is not guaranteed!
loop at t_f1f2f3f4f5.
  read table t_f1f2f3f4f5_coll
    with key k1 = f1f2f3f4f5-k1
                 k2 = f1f2f3f4f5-k2
                 binary search.
* put sum of f4 for key kombination k1 k2 into f5
  t_f1f2f3f4f5-f4 = t_f1f2f3f4f5_coll-f5.
  modify t_f1f2f3f4f5.
endloop.
Now, for for each of the key combination you hav the sum of the field f4 in the field
f5.
Regards,
Clemens

Similar Messages

  • SUM two fileds from different rows from the same table

    I would like to SUM two fileds from different rows from the same table but I don't know how to do that.
    E.g.
    BillingTransactionsIndex      CreateDate      UserType      UserIndex      TransType      Reference      Total      Balance
    2      6/5/2008 15:02      1      51      1      150      -288.2      -288.2
    5      6/8/2008 11:55      1      51      1      157      -1.58674      -289.787
    In the table above I want SUM fields Total and Balance for the first row and the the next row SUM 2nd row Total with 1st row Balance
    Please help
    Thanks

    SQL> with tbl as
      2  (select 1 as ID,  90 as total from dual
      3          union all
      4  select 2 as ID,  23 as total  from dual
      5          union all
      6  select 3 as ID,  15 as total  from dual
      7          union all
      8  select 4 as ID,  20 as total  from dual)
      9  select id , total, sum(total) over (order by ID) as balance from tbl
    10  /
            ID      TOTAL    BALANCE
             1         90         90
             2         23        113
             3         15        128
             4         20        148
    SQL>

  • With in the internal table can I READ the same internal table for a record?

    With in the internal table can I READ the same internal table?
    For Suppose
    LOOP AT itab.
    can I do as below
    READ TABLE itab with key bukrs = itab-bukrs
                       belnr = itab-belnr.
    *and I have to compare
    IF itab-shkzg = itab-shkzg_ia.
    ENDIF.
    ENDLOOP.

    Hi,
    Yes..But use work area to differentiate..
    EX.
    DATA: WA LIKE ITAB.
    DATA: WA_READ LIKE ITAB.
    LOOP AT itab <b>INTO WA</b>.
    can I do as below
    READ TABLE itab <b>INTO WA_READ</b>
               with key bukrs = itab-bukrs
    belnr = itab-belnr.
    *and I have to compare
    IF <b>WA</b>-shkzg = <b>WA_READ</b>-shkzg_ia.
    ENDIF.
    ENDLOOP.
    Please reward for helpful answers.
    Thanks,
    Naren

  • Can it be possible to use SUM twice for the same internal table

    Hi Guru,
    my requirement is follewing.
    I need to use a SUM for the same internal twice. 
    itab.
    first : like SUM  will sum up all the value
    and second like
    if  wa_tab-field = ' S'
    sum.
    ...some logic
    else  if wa_tab-field = h
    some logic
    endif.
    can i use  SUM in above way.
    Many thanks,
    Anuj.

    Hi,
    yes it could be use multiple time.
    Here example.
    sort GT_COLLECTHI by atnam ATWRT.
      loop at GT_COLLECTHI into gs_collecth.
        at end of ATWRT.
          sum.
          append gs_collecth to gt_collecth.
          clear:gs_collecth.
          sum.
        endat.
        at end of ATNAM.
          sum.
          append gs_collecth to gt_collecth.
          clear:gs_collecth.
          sum.
        endat.
      endloop.
    Thank you
    Jan

  • How to compare two entries in the same internal table

    Hi
    I hav e an internal table. I want to compare the entries in the internal table and delete the entries which is duplicates from the internal table. for ex. if plant 1000 is repeated two times. Then both the record of plant 1000 should be removed .
    Please suggest some idea.
    Thanks
    Subha

    Hi,
    Apply this code.
    include one more field in itab & jtab as delete_flag(1) type c.
    move itab to jtab.
    Loop at itab into wa_itab.
    lv_tabix = sy-tabix.
    Loop at jtab into wa_jtab where plant = wa_itab-plant.
    if sy-tabix ne lv_tabix.
    wa_itab-delete_flag = 'X'.
    endif.
    Endloop.
    modify itab from wa_itab transporting delete_flag.
    clear: wa_itab,wa_jtab.
    endloop.
    delete itab where delete_flag = 'X'.
    Now you have filtered ITAB with your desired results.
    It will surely help.
    Edited by: Adarsh Jain on Aug 18, 2010 7:57 AM
    Edited by: Adarsh Jain on Aug 18, 2010 7:58 AM

  • Include structure and extra fields in the same Internal Table

    Hi developers,
    im trying to declare an internal table with include structure and extra fields,
    something like this:
    data: BEGIN OF it_loans occurs 0,
          include structure zthrca006,   
          status(10),
          pernr   like pa0001-pernr,
          sname   like pa0001-pernr,
          tipomov(20),
          monto   like zthrca006-monto,
    data: END of it_loans.
    zthrca006 is huge so i dont want to type everithing.

    What is the issue?
    data: BEGIN OF it_loans occurs 0.
                 include structure zthrca006.
    data :     status(10),
    data :     pernr like pa0001-pernr.
    data :     sname like pa0001-pernr.
    data :     tipomov(20).
    data :     monto like zthrca006-monto,.
    data:  END of it_loans.
    Regards,
    Ravi
    Note - Please mark all the helpful answers

  • Which is the suitable Internal table.

    Hi,
    I want to know which type of internal table would be suitable for the below mentioned process.
    There is some initial set of data in a internal table. The table is looped and i do operation on the data available in that line and get another data which has to be added to the same internal table. So that when the control is done with the intial set of data in the table, it starts reading the newly added line and do the same operations mentioned below.
    Warm Regards,
    Aruna G

    Hi,
    The loop wont be infinite, cos at  one point the above mentioned processiing of data wont happen since it wont meet some of the criteria. Its just i want to use a table sequentially and append data to it at the end.
    Warm Regards,
    Aruna G

  • Find text and replace with a pdf stored in the same folder

    Hello,
    I have a catalog that is updated every so often.  I have written a script to find/replace the text from a .txt file.  but i have a pdf that i want to insert that is part of it as well.  Inside the .txt file i have the name of the document.  and the pdf is stored inside the same folder as the original .indd and the .txt file.
    can someone point me at some examples on how this could be done. 
    Thanks

    I use this script: it puts a txt in a text frame, check the overflow and find/replace some words with a pdf. Hope this is helpful.
    Paolo
    /************************FLOW************************************************
    * This function looks for Overflows in the story and either resizes the           *
    * frame to the size of the margins (if necesary) or adds a new page and     *
    * a new frame, which is then linked to the previous frame.esizes the           *
    function flow(){
        for(var i = 0; i < app.activeDocument.pages.count(); i++)
            for(var b = 0; b < app.activeDocument.pages[i].textFrames.count(); b++)
                if(app.activeDocument.pages[i].textFrames[b].overflows == true )
                    var currentPage = myDocument.pages[i];
                    var myPageNo = currentPage.name;
                    var currentFrame=currentPage.textFrames[b];
                    var e =currentFrame.geometricBounds[0];
                    var f =currentFrame.geometricBounds[1];
                    var g =currentFrame.geometricBounds[2];
                    var h =currentFrame.geometricBounds[3];
                    if(myPageNo %2==0){
                        var myMargins =currentPage.marginPreferences;
                        var a = currentPage.bounds[0]+myMargins.top;
                        var b = currentPage.bounds[1]+myMargins.right;
                        var c = currentPage.bounds[2]-myMargins.bottom;
                        var d = currentPage.bounds[3]-myMargins.left;
                    else{
                        var myMargins =currentPage.marginPreferences;
                        var a = currentPage.bounds[0]+myMargins.top;
                        var b = currentPage.bounds[1]+myMargins.left;
                        var c = currentPage.bounds[2]-myMargins.bottom;
                        var d = currentPage.bounds[3]-myMargins.right;
                    if (g < c)
                        currentFrame.geometricBounds = [a,b,c,d];
                    else if (g==c){
                    var newPage = myDocument.pages.add(LocationOptions.AFTER, currentPage);
                    currentPage = newPage;
                    myPageNo = currentPage.name;
                    if(myPageNo %2==0){
                        var myMargins =currentPage.marginPreferences;
                        var a = currentPage.bounds[0]+myMargins.top;
                        var b = currentPage.bounds[1]+myMargins.right;
                        var c = currentPage.bounds[2]-myMargins.bottom;
                        var d = currentPage.bounds[3]-myMargins.left;
                        var newFrame = currentPage.textFrames.add({geometricBounds:[a,b,c,d]});
                        newFrame.textFramePreferences.textColumnCount = 7;
                        newFrame.previousTextFrame = currentFrame;
                    else{
                        var myMargins =currentPage.marginPreferences;
                        var a = currentPage.bounds[0]+myMargins.top;
                        var b = currentPage.bounds[1]+myMargins.left;
                        var c = currentPage.bounds[2]-myMargins.bottom;
                        var d = currentPage.bounds[3]-myMargins.right;
                        var newFrame = currentPage.textFrames.add({geometricBounds:[a,b,c,d]});
                        newFrame.textFramePreferences.textColumnCount = 7;
                        newFrame.previousTextFrame = currentFrame;
    //************************************END FLOW FUNCTION*********************************************
    /*******************TextPlacer***************************
        this script will add a text file in an existing text frame
        Questo file deve essere copiato nella cartella Script di InDesign
    function myGetBounds(myDocument, myPage){
    var myPageWidth = myDocument.documentPreferences.pageWidth;
    var myPageHeight = myDocument.documentPreferences.pageHeight
    if(myPage.side == PageSideOptions.leftHand){
    var myX2 = myPage.marginPreferences.left;
    var myX1 = myPage.marginPreferences.right;
    else{
    var myX1 = myPage.marginPreferences.left;
    var myX2 = myPage.marginPreferences.right;
    var myY1 = myPage.marginPreferences.top;
    var myX2 = myPageWidth - myX2;
    var myY2 = myPageHeight - myPage.marginPreferences.bottom;
    return [myY1, myX1, myY2, myX2];
    /*******************ImagePlacer***************************
        this script will addimages to the document by
        substituting them with the name of the image file
        between @s (file format included[@mypic.bmp@]),
        selecting them from a specified file (see below)
        and applying object styles to them, as well as
        applying the right tab i necesary.
        It then looks for overflows in the document. If an
        overset is found, it will resize to margin size the
        text frame and if overset continues, it will add a
        new page and frame, which then will be linked
        to the previous frame, allowing the story flow.
        Questo file deve essere copiato nella cartella Script di InDesign
    //Creates a new document using the specified document preset.
    //Replace "myDocumentPreset" in the following line with the name
    //of the document preset you want to use.
    var myDocument = app.documents.add(true,app.documentPresets.item("Preset"));
    //If the active document has not been saved (ever), save it.
    if(app.activeDocument.saved == false){
    //If you do not provide a file name, InDesign displays the Save dialog box.
    app.activeDocument.save(new File("/Users/Paolo/Desktop/Documento.indd"));
    function main()
    var myDocument = app.documents.item(0);
    var myPage = myDocument.pages.item(0);
    var myTextFrame = myPage.textFrames.add({geometricBounds:myGetBounds(myDocument,myPage)});
    myTextFrame.textFramePreferences.textColumnCount = 7;
    myTextFrame.place(File("/Users/Paolo/Desktop/text.txt"));
    //Place a text file in the text frame.
    //Parameters for TextFrame.place():
    //File as File object,
    //[ShowingOptions as Boolean = False]
    //You'll have to fill in your own file path.
    //Define GREP search
    var grepFind ="@@@.+@@@";
    //Folders name where there are pdf, must be in the same place of the file
    var myFiguresFolder = "testatine";
    // Applied paragraph style
    var myPStyle = myDocument.paragraphStyles.item("Paragraphstyle");
    var NextPStyleCS = myDocument.paragraphStyles.item("Par_Style");
    var NextPStyleEN = myDocument.paragraphStyles.item("Par_Style_en");
    var NextPStyleDE = myDocument.paragraphStyles.item("Par_Style_de");
    // Applied text style
    var myCStyle = myDocument.characterStyles.item("text");
    //Applied object style
    var myOStyle = "";
    var oStyle_1 = myDocument.objectStyles.item("Pictures");
    var oStyle_2 = myDocument.objectStyles.item("Pictures");
    var oStyle_3 = myDocument.objectStyles.item("Pictures");
    //MEASUREMENTS
    var maxWidth = 467; //Maximum width of an image
    var maxHeight = 666; //Maximum Height of an image
    var colWidth = 468; //Width of the main columb (340pt) + maximum Tab (128pt)
    var maxTab = 0;
    var xTab;
    var xtTab;
    var minTWidth = 340; //any image with a width below this will have the maximum Tab (maxTab) applied.
    var PWidth; //Width of the Picture
    var PHeight;//Picture Height
    var myTotal;
    //---------------------------------ALERTS---------------------------------\\
    var notSaved = "Documento non salvato; devi prima salvare il documento";
    var noFolder = "No such folder exists; "+myFiguresFolder;
    var noImageMessage = "No Images were found";
    var finished = " immagini sostituite"
    //---------------------------------ALERTS---------------------------------\\
    /************************END OF STORY*****************************************
    *  The object of this bit of programming is to add an empty paragraph break *
    *  at the end of the story, in order to make the actual script work in the case   *
    *  that the LAST paragraph were a TABLE                                                              *
    var findEnd_of_Story = "\\r(?=\\z)" //GREP for End of Story                        //
    app.findGrepPreferences = NothingEnum.nothing;                              //
    app.changeGrepPreferences = NothingEnum.nothing;                         //
    app.findGrepPreferences.appliedParagraphStyle = myPStyle;              //
    app.findGrepPreferences.findWhat = findEnd_of_Story;                      //
    var fItems = myDocument.findGrep();                                              //
    var myC = fItems.length-1;                                                             //
    if (fItems =!0){                                                                              //
        do{                                                                                             //
            if (fItems.appliedParagraphStyle = myPStyle){                          //
                cItem = fItems[myC]                                                          //
                app.changeGrepPreferences.changeTo = "$0\\r";                  //
        myDocument.changeGrep();                                                       //
    myC--;                                                                                           //
    while (myC >= 0);                                                                       //
    try{
    var myDocPath = myDocument.filePath; //Complete Path to the Current Document
    catch (myError){
    alert (notSaved);
    //throw("");
    return;
    var myFFldr =Folder(myDocPath+"/"+myFiguresFolder); //Complete Path in which the figures to be placed should be found
    if(myFFldr.exists){
        flow();
        app.findGrepPreferences = app.changeGrepPreferences = null;
        app.findGrepPreferences.findWhat = grepFind;
        var myFoundItems = app.activeDocument.findGrep();
        var myCounter = myFoundItems.length-1
        myTotal = myCounter+1;
        for (i = myCounter; i >=0; i--) {
            var myName = myFoundItems[i].contents.replace (/@/g, "");
            app.selection = myFoundItems[i];
            var fFig=app.selection[0];//Found text for
            var cPStyle= fFig.appliedParagraphStyle;
            var myFile = new File( myFFldr + "/" + myName);
            if (myFile.exists) {
                var cFig = fFig.place(myFile);
                var sFig = cFig[0].parent;
              switch (cPStyle){
                  case (myPStyle):
                  myOStyle =oStyle_1;
                  PWidth = sFig.geometricBounds[3] - sFig.geometricBounds[1];
                  PHeight = sFig.geometricBounds[2] - sFig.geometricBounds[0];
                  if (PWidth >= minTWidth){
                      xTab = (colWidth-PWidth);
                  else{
                      xTab =maxTab;
                  var currentPar = sFig.parent.paragraphs.item(0);
                  currentPar.leftIndent = xTab;
                  var nextPar= currentPar.insertionPoints[-1].paragraphs[0];
                  var nextParStyle = nextPar.appliedParagraphStyle;
                  if (nextParStyle == NextPStyleCS||nextParStyle ==NextPStyleEN||nextParStyle == NextPStyleDE){
                      xtTab = xTab
                  else {
                      xtTab = nextPar.leftIndent;
                  nextPar.leftIndent =xtTab;
                  sFig.appliedObjectStyle = myOStyle;
                  cPStyle = "";
                  break;
                  case (myPStyle):
                  myOStyle = oStyle_3;
                  sFig.appliedObjectStyle = myOStyle;
                  cPStyle = "";
                  break;
                  default:
                  myOStyle = oStyle_2;
                  sFig.appliedObjectStyle = myOStyle;
                  cPStyle = "";
                  break;
              var oFig = sFig;
              sFig = ""
    flow();
      //alert(myTotal + finished);
    else{
        alert(noFolder);
    var myDocument = app.documents.item(0);
    //Clear the find/change grep preferences.
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences = NothingEnum.nothing;
    //Set the find options.
    app.findChangeGrepOptions.includeFootnotes = false;
    app.findChangeGrepOptions.includeHiddenLayers = false;
    app.findChangeGrepOptions.includeLockedLayersForFind = false;
    app.findChangeGrepOptions.includeLockedStoriesForFind = false;
    app.findChangeGrepOptions.includeMasterPages = false;
    //Regular expression to use
    app.findGrepPreferences.findWhat = "<(.+?)>";
    //Apply the change to 24-point text only.
    //app.findGrepPreferences.pointSize = 24;
    //app.changeGrepPreferences.underline = true;
        var myFoundItems = app.activeDocument.findGrep();
        var myCounter = myFoundItems.length-1
        myTotal = myCounter+1;
        //alert("occorrenze" + myTotal);
        app.changeGrepPreferences.changeTo= "$1";
        app.changeGrepPreferences.appliedCharacterStyle= myDocument.characterStyles.item("head");
       myDocument.changeGrep();
      for (i = myCounter; i >=0; i--) {
            var myName = myFoundItems[i].contents.replace ("/</g", "");
            var myName = myFoundItems[i].contents.replace ("/>/g", "");
            app.selection = myFoundItems[i];
            var fFig=app.selection[0];//Found text for
            var myCStyle = myDocument.characterStyles.item("head");
            app.selection[0].applyCharacterStyle(myCStyle, true);
    //Clear the find/change preferences after the search.
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences = NothingEnum.nothing;
    main();

  • Problem in filling the final internal table

    Hi,
    I am working on a code in which i have to fill up the final internal table which will store the values coming form different internal tables.Here's the code which i am trying to do but it is not giving the execat functionality.In this code ITOUTPUT is the final itab which is storing the values of all other internal tables.
    Here's the code:-
    loop at itab1.
      select single maktx into v_item from makt where matnr = itab1-matnr.
          ITOUTPUT-banfn = ITab1-banfn.
          ITOUTPUT-badat = ITab1-badat.
          ITOUTPUT-meins = ITab1-meins.
          ITOUTPUT-menge = ITab1-menge.
          ITOUTPUT-lfdat = ITab1-lfdat.
      IF ITAB1-MEINS = 'KG'.
        V_TOTREQ = V_TOTREQ + ITAB1-MENGE.
      ELSEIF ITAB1-MEINS = 'TO'.
        V_TOTREQ = V_TOTREQ + ( ITAB1-MENGE * 1000 ).
      ELSEIF ITAB1-MEINS = 'G'.
        V_TOTREQ = V_TOTREQ + ( ITAB1-MENGE / 1000 ).
      ENDIF.
      v_tpo = 0.
      v_por = 0.
      LOOP AT ITPO WHERE BANFN = ITAB1-BANFN AND bnfpo = ITAB1-bnfpo.
        if v_por <> '0'.
          write : / '  '.
        endif.
          ITOUTPUT-ebeln = ITPO-ebeln.
          ITOUTPUT-aedat = ITPO-aedat.
          ITOUTPUT-lifnr = ITPO-lifnr.
          ITOUTPUT-menge = ITPO-menge.
          ITOUTPUT-EINDT = ITPO-EINDT.
        IF ITAB1-MEINS = 'KG'.
          V_TOTPO = V_TOTPO + ITPO-MENGE.
        ELSEIF ITPO-MEINS = 'TO'.
          V_TOTPO = V_TOTPO + ( ITPO-MENGE * 1000 ).
        ELSEIF ITPO-MEINS = 'G'.
          V_TOTPO = V_TOTPO + ( ITPO-MENGE / 1000 ).
        ENDIF.
        v_tpo = v_tpo + itpo-menge.
        v_tgr = 0.
        v_por = 1.
        v_grr = 0.
        loop at itmrn where ebeln = itpo-ebeln and ebelp = itpo-ebelp.
          if v_grr <> '0'.
            write : / '  '.
          endif.
          select single budat from mkpf into v_grdate where MBLNR = itmrn-MBLNR.
          write: 143 Itmrn-menge,v_grdate .
            itoutput-PMENGE = itmrn-menge.
          v_tgr = v_tgr + itmrn-menge.
          v_grr = 1.
        endloop.
        p_po = itpo-menge - v_tgr.
       write: 173 p_po.
      ENDLOOP.
      p_req = itab1-menge - v_tpo.
      write :  195 p_req.
    endloop.
    loop at itoutput.
      write:/ itoutput-banfn,12 itoutput-badat,24 v_item,50 itoutput-meins,53 itoutput-menge,itoutput-lfdat,
              89 ITPO-ebeln,100 ITPO-aedat,111 ITPO-lifnr,(10) itpo-menge, ITPO-eindt.
      MODIFY itoutput.
    endloop.

    Hi,
    Ok,i ha d checked my code by using your logic and giving the run time error ......
    i had debugged my code (orignal onementioned in above thread with little modification) in which  i am able to see that finaloutput (intrenal table) is getting filled properly and the  problem arises when  the cursor comes to the write statement ... it is repeating some of the values when output is displayed where as before displaying output this iternal table is having the correct data. i am using the following code :-
    append itoutput.
      ENDLOOP.
      p_req = itab1-menge - v_tpo.
      write :  195 p_req.
      append itoutput.          ,<---  added this
      clear itoutput.               <--- added this
    endloop.
    loop at itoutput.
      write:/ itoutput-banfn,12 itoutput-badat,24 v_item,50 itoutput-meins,53 itoutput-menge,itoutput-lfdat,
              89 ITPO-ebeln,100 ITPO-aedat,111 ITPO-lifnr,(10) itpo-menge, ITPO-eindt.
      MODIFY itoutput.         <------ not removed
    endloop.

  • Mix source data with different granularity into the same fact table?

    I have two transaction tables "Incident (157 columns)" and "Unit (70 Colums)". For every "Incident" that happens there could be one or more records in the "Unit" table.
    As part of my data mart design, I have merged both the tables into a single Fact "Incident Fact (227 Columns)" and inserted the records from both the tables with a join condition between them [incident.IN_NUM = Unit.IN_NUM].
    Is this correct, is my question? or am I mixing source data with different granularity in the same fact table. Appreciate your help.
    Best Regards
    Bees

    Bees,
    Are the measures from 'Incident' , repeated for a given incident where it has more than one record in the Unit table ? If so, then the sum(indicent.measure) will give an incorrect result, no ?
    What requirement is there to physically merge the tables together outside of OBIEE? With OBIEE you could have one logical 'fact' table to present to report users, which sourced from seperate Incidents and Units tables and would stop the incorrect aggregations occuring. A common modelling piece in the same way would be Order Headers and Order Lines, quite common in OBIEE to have a logical 'Orders' fact which contained both Order header measures and Order line measures, this translates to your Incidents -> Units relationship.
    To do what I've mentioned, is relatively straight forward, you need a 'Dim - Incident' with two levels, Incident and Unit, mapp the unique identifiers in as the level keys and then use these levels to set the content levels correctly in your 2 logical tables sources for logical 'Fact' , ie Incidents LTS at incident level, Units LTS as units level.
    Hope this helps, let us know if you get stuck.
    Cheers
    Alastair

  • Add field value to the existing internal table.

    how to add a field value to the existing internal table.
    DATA: BEGIN OF ITAB occurs 0,
                 EBELN TYPE EKPO-EBELN,
                 EBELP TYPE EKPO-EBELP,
                 AEDAT TYPE EKPO-AEDAT,
                 amount(10) type c,
               END OF ITAB.
    select * from ekpo
           into corresponding fields of table itab.
    itab-amount = '2400'.
    loop at itab where ebeln eq 70 .
           write : / sy-tabix,itab-ebeln,itab-ebelp,itab-aedat,itab-amount.
             endloop.
    here output is not showing the amount field value.
    please tell me how to solve this problem urgent
    thanks in advance.

    Hi Sekhar,
        First let me know wheather you are assigning some value to the amount field externally to all records? if this is wright means check the below code.
    DATA: BEGIN OF ITAB occurs 0,
    EBELN TYPE EKPO-EBELN,
    EBELP TYPE EKPO-EBELP,
    AEDAT TYPE EKPO-AEDAT,
    END OF ITAB.
    select * from ekpo
    into corresponding fields of table itab.
    v_amount = '2400'.
    loop at itab where ebeln eq 70 .
    write : / sy-tabix,itab-ebeln,itab-ebelp,itab-aedat,v_amount.
    endloop.
    or if you want to modify perticular records in itab  then use below code.
    DATA: BEGIN OF ITAB occurs 0,
    EBELN TYPE EKPO-EBELN,
    EBELP TYPE EKPO-EBELP,
    AEDAT TYPE EKPO-AEDAT,
    amount(10) type c,
    END OF ITAB.
    select * from ekpo
    into corresponding fields of table itab.
    loop at itab.
    itab-amount = '2400'.
    modify itab index sy-tabix (or perticular line number).
    endloop.
    loop at itab where ebeln eq 70 .
    write : / sy-tabix,itab-ebeln,itab-ebelp,itab-aedat,itab-amount.
    endloop.
    Thanks,
    Suma.

  • Copy a certain row of data into the next row in a same internal table ??

    HI, guys.
    May i know how to copy a certain row of data into the next row in a same internal table ?? Bcz I plan to update a certain colum of data in the row just now into another value..
    For example:-
    *at first...
    ebeln1   ebelp1   xblnr1
    ebeln2   ebelp2   xblnr2
    ebeln3   ebelp3   xblnr3
    *after that, become...
    ebeln1   ebelp1   xblnr1
    ebeln2   ebelp2   xblnr2
    ebeln2   ebelp2   xblnr4
    ebeln2   ebelp2   xblnr5
    ebeln3   ebelp3   xblnr3
    Thanks in advance.

    hi,
    If you have this kind of requirement then you must be having 2 internal tables ,one existing data and 2nd from which you have to insert the records into 1st table.
    so in this case,
    loop at itab1.
      v_index = sy-tabix.
      loop at itab2 into wa where pri_key = itab1-pri_key.
      v_index = v_index + 1.
      insert  wa into itab index v_index.
      endloop.
    endloop.
    Using this code ,your data records similar to your 1st tables primary key records will get inserted into table.

  • Want to use the same #TEMP table for multiple datasets in SSRS 2005

    I am using Visual Studio 2005 to create SSRS 2005 reports. The report will consist of two different matrix from two different dataset that will gather data from the same data source. The first dataset is a procedure that inserts data from a query into
    a #temp table and outputs it in the first matrix. I want the second dataset to be a different procedure that references the same #temp table. When the report is pulled then can the #temp table be dropped.

    Try in the Dataset properties.  In the Query tab, under and to the right of "Data source:" click the box with the elipses (...).  In the General tab, toward the bottom, there is a check box beside "Use single transaction".
    Rakesh M J | MCTS,MCITP ( SQL SERVER 2008 )
    Dont forget to mark it as Answered if found useful |
    myspeakonbi

  • Reg : Joining the all internal table records into a single internal table

    Hi all
    I am having 5 internal tables and i want to put all these entries in a single intrnal table and my requirement is for each and every record it has to go through all the internal tables and if an entry is missing meand.it has to go through the other internal tables and for missing entries i should leave it as blank and rest of the contents i have to display can any please gimme some logic how to do this??
    Thanks in advance

    Don't have time or will to deliver turnkey solutions, but here is a frame:
    LOOP AT itab1...
      READ TABLE itab2 WITH TABLE KEY... (fields linking itab1 and itab2)
      READ TABLE itab3 WITH TABLE KEY... (fields linking itab1 and itab3)
      LOOP AT itab4 WHERE... (fields linking itab1 and itab4)
        READ TABLE itab5 WITH TABLE KEY... (fields linking itab4 and itab5)
        MOVE-CORRESPONDING... (all five work areas to target work area)
        APPEND itabtarget...
      ENDLOOP.
    ENDLOOP.
    so use READ when there is a 1:1 relationship (e.g. check table entry), and LOOP when there is a 1:N relationship (e.g. items for a header)
    Thomas

  • Filter on the same logical table source on two logical tables is not working properly

    Hi,
    In the RPD, assume that I have a physical table named Employee_fact, created an Alias called D0 Employee Fact
    In the BMM I've two logical tables called Employee_fact_Type1 and Employee_fact_Type2
    Each of these logical tables has the same Logical table source - D0 Employee
    But in each logical table source, I've a filter in where clause
    such as, for Employee_fact_Type1  employee_type = 'XXX'
                 for Employee_fact_Type2 employee_type='YYY'
    These two facts are present in the same BMM and each of them are connected to two dimensions
    such as
    Dept_type1 <- Employee_fact_type_1 -> Tenure_type1
    Dept_type2 <- Employee_fact_type_2 -> Tenure_type2
    In analysis, When I query the columns from Dept_type1 and Tenure_type1, the database query generated shows the condition employee_type='YYY' instead of employee_type='XXX' .
    But, adding the columns from Dept_Type1, Employee_fact_type_1, Tenure_type1 it shows proper filter.
    I checked the relationships, presentation layer for the sources of presentation tables and everything looks good.
    Can anybody tell me what goes wrong here?

    did you set the content level as well?

Maybe you are looking for

  • Browser freezes only on MacBook

    I have a unique problem.  Recently (possibly during a power-loss) my wife's MacBook started freezing while browsing.  My Macbook Pro and Mini can sit right beside her MacBook and work perfectly -- log in through the airport express and router and bro

  • RE: (forte-users) Changing replication options in Fscript? -Tric k

    There was one attribute of a service object you couldn't change in fscript.. I think it was whether the service was replicated at all or not (not the same as setting rep count to 1!). As Clint would say, "improvise.." We exported the project containi

  • How far back does the safari history go

    I need to go back to some sites I was working on over a year ago as I have lost my filofax with all my information in.  would it possible to find them as I can only seem to view up to 1 year ago

  • UTL_HTTP working in SQL Query, error when used in procedure

    Hi, We are trying to call web service from stored procedure . When we run the utl_http.request independently in a query its working fine but when we put that in a stored procedure we are unable to connect. Getting HTTP request failed error. select ut

  • Back up & Sync

    OMG! its now 16 minutes into backup and am thinking I should go for dinner and perhaps it will be done... This happens ALL the time is is why I don't bother to backup. When I owned my blackberry it was done in less than a minute. I mean really what t