Merging records in itab...

Hi all,
My dilemma for today is as follows. I have a record set that is keyed on matnr werks pspnr. In addition, each row contains fields for qty1 qty2 qty3 qty4 date week month quarter year. I would like to merge...or sum...those records together by week before display in my ALV grid. In JAVA this would be a complicated process...a series of loops that involved summing the qty fields. Is there a fairly concise way for me to perform this task in ABAP?
regards,
Mat

Hi Mathew,
Use COLLECT statement to mergre records. COLLECT will sum up all numeric fields in an internal table if all other non-numeric fields are same.
You can give the COLLECT statement resultant internal table to the ALV grid.
To know more about COLLECT, just browse this link
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/collect.htm
Thanks,
Vinay

Similar Messages

  • How can I save individual merged records automatically in seperate folder?

    I have several hundred records to pull in via a mailmerge.
    one record per page and one per document.
    I can do the merge fine, however at present it just keeps all of the records open until I save them which means I can only do these in batches else indesign crashes.
    Is there a way I can get indesign to automatically save each individually merged record into a seperate folder? Ideally naming the saved document after two of the fields so the naming convention would be <<id>>-<<name>>
    I've seen some stuff about scripting being available to indesign and I don't mind doing the reading and putting in the work to make this happen  - Can anyone point me in the direction of any scripting for indesign quickstart type guides or offer up any other suggestion of how the above may be achieved.
    Many Thanks

    There are a couple of ways that this could be done but it involves scripts. See the following adobe forum posts:
    http://forums.adobe.com/message/5193375#5193375
    http://forums.adobe.com/message/5159865

  • Reporting on Merged Records

    I would like to know if there is a way to report on records that have been merged through Portal?  It would be nice to be able to report which records have been merged over a time period (like within the last month), but if that is not possible, I am just looking for a way to report on merged records through other criteria. I heard that an iView is being developed to do this, but I can't find one for this functionality right now. I can display the Key Mapping info without a problem. But there is no way to search against this information.
    Thanks,
    Justin
    Edited by: Justin Fountain on Apr 22, 2009 9:24 PM

    I found the answer:
    If you see the REP table, there is a column called REP_MAX_REP_SIZE which contains the maximum report size for each report. This value has a default value of 5000 for most of the reports. You can change this value to have a higher number so that the report returns the data. But increasing the number can reduce the response time since the number of records will be large.

  • Indesign CS3 Data Merge "Merge Records" Command. Help?

    I'm looking to automate the merging of a mountain of records. I have 587 tab-delimited text files with 40 records each. I want to process these via Data Merge using a single pre-designed template with built-in placeholders and variable data fields, including a variable barcode graphic. In the end, I want to create 704 multi-page, 6-up per page, indesign files with merged data, and 704 multi-page PDFs.
    Here's where I am at. Using a combination of AppleScript, TextWrangler and InDesign CS3, I am able to set up a loop where I can open the single template, save it to a new file with a new name, change its data source to the appropriate text file, and as a test, make a PDF of the template using the correct export preset. What I cannot seem to do is get the template to perform a "Create Merged Document...".
    In InDesign CS3's AppleScript dictionary there is a command called "Merge Records" under the Data Merge section. It appears to do exactly what I am after. But when I try to use it (and the good Lord knows I have tried numerous permutations), it only returns errors like "Adobe InDesign CS3 got an error: active document doesn't understand the merge records message."
    Anyone know what I am doing wrong? I have set up a separate AppleScript for testing purposes that opens up the template, saves it under a new name, and attempts a "merge records" command. Here it is. Maybe someone smart out there can tell me what I am doing wrong.
    set templatePath to "Welch_Jobs:0_JOBS:280019_Churchill:WPC FILES:Workup:280019_6up_master template.indt" as text -- the main template file that will be modified, saved with a new name, then merged with its data to create a new merge file
    set newTemppath to "Welch_Jobs:0_JOBS:280019_Churchill:WPC FILES:Workup:goody.indd" as text
    tell application "Adobe InDesign CS3"
    open file templatePath
    tell active document
    save to newTemppath
    merge records
    end tell
    end tell
    I have this feeling that this is a command that is actually unsupported. Google searches have been fruitless except for one poor soul who can't get it to work either. I have, however, seen that a similar JavaScript command exists called "DataMerge.mergeRecords". If it is impossible to do this via AppleScript, is it possible to make a JavaScript that will do it, and access the JavaScript with a "do script" command in the main AppleScript? If so, how would I accomplish this? What whould the JavaScript look like, and where do i need to put it?
    I would greatly appreciate any help you, dear reader, can give me on this.

    Well, did you look at the dictionary?:
    merge recordsv : Merges records and produces an optional overset report.
      merge records
    data merge
        output overset report file alias or
    text] : The path to the file in which to store the overset report.
    Note also that it's part of the Preferences Suite, not the Datamerge suite. Do you see differently?
    Anyhow, you're clearly not calling it with a data merge parameter.
    I also have a suspicion that it needs to not be inside a "tell active document" but it probably doesn't matter.
    But my AppleScript is rusty.

  • Problem with merge records

    Hi All,
    My problem statement is as follows -
    I have Customer Master data coming from a single client having some duplicates (internal). I have imported the data and merged the duplicates in the Data Manager client. Now while merging the records I am ending up with only a single record corresponding to say two merged records.
    I have to send this data to BW where report has to be generated based upon the consolidated Master data.
    Now my problem is that when I am syndicating the data I am able to send only a single merged record to BW however in BW the transactios are running on both the records (i.e both duplicate records).
    Is there any way through which I can let both records be passed to BW (even after a merge operation in MDM)?
    P.S. I have to retain the different Customer IDs after de-duplication (consolidation) as transactions have taken place over them.
    Regards,
    Pooja

    Hi
    I had same problem.  Here to solve this you need to have right XSD defined with Root Element for syndication.  Usually while extracting of xml you dont get the source id and key by default.  You have to map the Roots for this then only the Source id and key will be exported.  Also while syndicating the XML is generated for all the sources that you contiain in your repository but only the orginal source pointing to the record will contain the referece to that respective system.  so in XI you need to export only the recrod entry from XML which contains the Source system id and key into BI.
    Hope this answers you.
    Regards
    Veera

  • Syndication of merged records to multiple backend systems (MDM 7.1)

    Hi all,
    I have setup an MDM scenario with >1 ECC systems connected to MDM via PI. Everything works fine in terms of end-to-end process from ECC to MDM or MDM to ECC (creation, update, syndication). I have also merged records in MDM from the same backend system and am able to see the remote key information under 'edit key mappings' and when I update the merged records in mdm the data is olso updated in ECC.
    BUT the update in ECC does not work for merged records where the keys are from different backend systems.
    Example:
    Remote system: RS1 and RS2
    I have merged two records, one from RS1 and the other from RS2. The newly created record has two key mappings (RS1/RS2). Also the newly created record shows - let's say - RS1 in MDM and the the RS2 informaion is attached as remote system information. When modifying the record in MDM, only RS1 is updated but not RS2.
    Remote Systems RS1 and RS2 are set up in the Cosole. Also I have setup a port for each remote system. Syndication in general works perfectly without any problem. I know that I have to trigger syndication for each port but still does not work. Any ideas?
    Thanks!!!
    BR,
    Erdal
    P.S. I am using MDM 7.1

    Hi Erdal,
    OK, I assumed a setup like this.
    > in 5.5 there was "Output Remote Systems" whereas in 7.1 we don't have
    You have this one in 7.1, too. "Output Remote Systems" was renamed to "Remote Key Override". I don't know why, but the functionality is exactly the same.
    > "Supress Unchange Records" is checked
    This explains the behaviour that you are facing. "Supress Unchanged Records" is used to distribute only these records that have been changed. What happens inside MDM is the following.
    MDM Server creates kind of a change pointer for the changed record AND for each remote system that record belongs to:
    Imagine you have a record A with a key for RS1 and RS2 each. You change this record. MDS creates two change pointers A-RS1 and A-RS2.
    Now you switch to Syndicator and distribute the records with the port for RS1, but with "Remote Key Override" for both RS1 and RS2. Syndicator creates a single message and includes both the remote keys for RS1 and RS2. Furthermore it deletes BOTH change pointers A-RS1 and A-RS2 as the record was distributed for BOTH systems!
    If you then connect with Syndicator to the port for RS2 and start the syndication, Syndicator cannot find any change pointers and thus won't create a message.
    If you want to send the golden record to different systems, I'd suggest to add each system to MDM Console. Create a syndication map & port FOR EACH system. Within the map use the target system only as "Remote Key Override". Use "Supress Records without key" to exclude those records, that do not have a remote key for the target system. Use "Supress unchanged records" if you want to distribute only the changed records.
    If you need a message having all keys of all systems (e.g. to update a BI system with grouping information), create a specific remote system for this purpose. Create a map & port, the map shall now use the "Remote Key Override" for all systems. The "Supress" settings can be made as above, but especially for BI we're recommending to syndicate always all records (do not "Supress unchanged records").
    Best regards
    Michael

  • Sum group records in itab

    How can I sum up into one record the records in itab.
    ex.
    group amount
    0001    50
    0001    60
    0003    10
    0004    10
    0004    20
    should be:
    group amount
    0001   110
    0003    10
    0004    30

    Hi Adrian,
    Take another internal table <b>ITAB1</b> and use following code:
    <b>LOOP AT ITAB INTO ITAB1.
    COLLECT ITAB1.
    ENDLOOP.</b>
    Here at the end ITAB1 will be having your desired result.
    This will definitely help you.
    Regards,
    Pragya

  • Merge records

    I have a need to merge records received from two different services in BPEL. Here's the requirement - A BPEL process invokes two different services. One of the services places a fixed-length flat file in the file system. The other service responds with a set of XML records. The XML records need to transformed and merged with those in the flat file and eliminate duplicate records (in terms of an ID field) while doing so. What could be an efficient way to do this? The XML file is at least 80MB in size. Will XSLT be memory intensive?

    Not ideal use case for SOA Suite but achieveable.
    If they are licensed for SOA Suite they can use OSB, this may be a better tool for this use case.
    your xquery can look something like this:
                            let $Runners := $runners
                            let $Odds := $odds
                            return
                                <Runners>
                                        for $Runner in $Runners/ns1:Runner
                                          for $Odd in $Odds/ns0:RunnerOdds/ns0:RunnerOdd
                                           where $Odd/ns0:Runner_Num = $Runner/ns1:Runner_Num
                                        return
                                            <Runner>
                                                <WIN_Odd>{ data($Odd/ns0:WIN_Odd) }</WIN_Odd>
                                                <Runner_Num>{ data($Runner/ns1:Runner_Num) }</Runner_Num>
                                                <PLC_Odd>{ data($Odd/ns0:PLC_Odd) }</PLC_Odd>
                                                <Runner_Name>{ data($Runner/ns1:Runner_Name) }</Runner_Name>
                                                <Jockey_Name>{ data($Runner/ns1:Jockey_Name) }</Jockey_Name>
                                                <Runner_Status>{ data($Runner/ns1:Runner_Status) }</Runner_Status>
                                            </Runner>
                                </Runners>
                        } what this code does is merges 2 payloads, 1 payload has the name of horses, the other payload has the odds of the horse. You can merge using the where clause and linking via the key of Runner_num
    cheers
    James

  • ADF BC merge records of 2 view objects into third

    jdev 11.1.1.4
    Hi,
    1) how to merge records of 2 view objects into third view object?
    2) how to search inside view object whether the record already exists?
    I want to do this in AMImpl programmatically.

    hi I find that I can use something as below but it will check for each row at a time.
    String exp = "student_id=" + "'" + studentId.getValue() + "'" + " and " +
    "pass_word=" + "'" + password.getValue() + "'";
    vo.setWhereClause(exp);
    so if there are 10 records(to compare) i have to loop it 10 times(with company id and order id in exp) which i will be getting from some view.
    and have to execute query 10 times so i don't think this is a efficient approach.

  • Merge records of one column in ALV?

    Hi friends,
    i am creating alv grid report(with out oops). i am calculating value for one field that value is common for all the records . so i want to display that as common value instead of displaying number of lines .
    is there any possibility to merge records of one column. using it_sort i tried . but it is not coming. since it is a currency field and i need to do display in the subtotal field.
    please let me know if u have the solution.
    regards,
    kani.
    Edited by: Julius Bussche on Sep 8, 2008 7:31 AM

    kani,
    refwer sample code.
    DATA: gt_sort TYPE slis_t_sortinfo_alv,
    gs_sort TYPE slis_sortinfo_alv.
    CLEAR gs_sort.
    gs_sort-fieldname = 'LDDAT'.
    gs_sort-spos = 1.
    gs_sort-up = 'X'.
    gs_sort-subtot = 'X'.
    APPEND gs_sort TO gt_sort.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = v_repid
    i_callback_user_command = 'PROCESS_USER_COMMANDS'
    is_layout = w_layout
    it_fieldcat = i_fieldcat[]
    it_sort = gt_sort[]
    i_default = 'X'
    i_save = 'A'
    it_events = v_events
    is_print = w_print
    TABLES
    t_outtab = i_final1

  • To create a table control in se51 to display 1000 records from ITAB toscr

    Hi Sapall.
    here i have got a requirement just to display the records from itab to table created in se51.
    can any body help me in this.
    regards.
    Vrma.

    Hi,
    There is no problem with 1000 records you can use table control.
    please follow this link to get idea about the table control.
    saptechnical dot com/Tutorials/ABAP/TableControl/Demo.htm
    Regards
    Bikas

  • Different options to merge records automatically?

    Hi All,
    Can any one please do let me know what are the different options/ways we can automatically merge a record?
    Regards,
    Rajeev

    Hi Rajeev,
    In addition to what I already mentioned,let me jot down my 2 cents here:
    If in any case you are going for automatic merging of records,then you have to assumption/decions to make.
    I mean you will either have to assume that your repository data is in very good shape and final merged record will take all the field data in MDM OR the source is in better shape and final field value should be picked from incoming record.
    Now if you assume the former,that implies data is in good shape,then question comes how come duplicates are still there?
    In case you use later assumption,you would have to ensure that data is in best shape through Validations/Assignments/Approvals and also take a call that MDM is storing data only for reporting purpose or hormonization also.
    The following blog can give  a fair idea regarding the code :
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b080b97d-8194-2c10-fa97-dd5940195384?quicklink=index&overridelayout=true
    In all its a risky venture when you are going ahead with assumption with critical master data as it can cost big to business.
    Thanks,
    Ravi

  • Datatable, grouping, merging records

    Hi everyone,
    I am working on the urgent project and a bit stuck and would really appreciate your help. I need to figure out how using VB I can turn table 1 into table 2 below. Need to merge records
    to eliminate dups. Thanks!!
    Table 1
    $0 - 49,999
    1.16%
    $50,000 - 74,999
    1.16%
    $75,000 - 99,999
    1.16%
    $100,000 - 249,999
    .86%
    $250,000 - 499,999
    .81%
    $500,000 - 749,999
    .51%
    $750,000 - 999,999
    .31%
    $1,000,000 - 1,999,999
    .11%
    $2,000,000 - 2,999,999
    .06%
    $3,000,000 - 3,999,999
    .01%
    $4,000,000 - 5,999,999
    .00%
    $6,000,000 - 7,999,999
    .00%
    $8,000,000 - 9,999,999
    .00%
    $10,000,000 - 14,999,999
    .00%
    $15,000,000 - 19,999,999
    .00%
    $20,000,000 - 29,999,999
    .00%
    $30,000,000 - 39,999,999
    .00%
    $40,000,000 - 49,999,999
    .00%
    $50,000,000 - 99,999,999
    .00%
    $100,000,000 +
    .00%
    Table 2
    $0 - 99,999
    1.16%
    $100,000 - 249,999
    .86%
    $250,000 - 499,999
    .81%
    $500,000 - 749,999
    .51%
    $750,000 - 999,999
    .31%
    $1,000,000 - 1,999,999
    .11%
    $2,000,000 - 2,999,999
    .06%
    $3,000,000 - 3,999,999
    .01%
    $4,000,000 +
    .00%

    Your question is perfectly valid. Initially, I have the Start and End integer values that I can use to perform the math function prior to concatenating them. Thank you!
    In case it's of any value to you at all:
    Public Structure StepFunction
    Private _greaterThanOrEqualTo As Double
    Private _butLessThan As Double
    Public Sub New(ByVal greaterThanOrEqualTo As Double, _
    ByVal butLessThan As Double)
    _greaterThanOrEqualTo = greaterThanOrEqualTo
    _butLessThan = butLessThan
    End Sub
    Public ReadOnly Property GreaterThanOrEqualTo() As Double
    Get
    Return _greaterThanOrEqualTo
    End Get
    End Property
    Public ReadOnly Property ButLessThan() As Double
    Get
    Return _butLessThan
    End Get
    End Property
    Public Shared Function CoverageOverlaps(ByVal sfList As List(Of StepFunction)) As Boolean
    Dim retVal As Boolean = False
    Try
    Dim butLessThanQry = From sf As StepFunction In sfList Order By sf.ButLessThan
    For i As Integer = 0 To butLessThanQry.Count - 1
    Dim thisInstance As StepFunction = butLessThanQry(i)
    If i > 0 Then
    If thisInstance.GreaterThanOrEqualTo < butLessThanQry(i - 1).ButLessThan Then
    retVal = True
    Exit For
    End If
    End If
    Next
    Catch ex As Exception
    Throw
    End Try
    Return retVal
    End Function
    Public Shared Function CoverageHasGaps(ByVal sfList As List(Of StepFunction)) As Boolean
    Dim retVal As Boolean = False
    Try
    Dim greaterThanOrEqualToQry = From sf As StepFunction In sfList Order By sf.GreaterThanOrEqualTo
    For i As Integer = 0 To greaterThanOrEqualToQry.Count - 1
    Dim thisInstance As StepFunction = greaterThanOrEqualToQry(i)
    If i > 0 Then
    If thisInstance.GreaterThanOrEqualTo > greaterThanOrEqualToQry(i - 1).ButLessThan Then
    retVal = True
    Exit For
    End If
    End If
    Next
    Catch ex As Exception
    Throw
    End Try
    Return retVal
    End Function
    End Structure
    Still lost in code, just at a little higher level.

  • How to remove records in itab where its HKONT does not end in '0'...

    Hello Experts,
    I am getting records from BSIS and BSAS and I want to remove those records with
    their HKONT(GL account) does not end in '0'(zero). I do now want to do it via a loop.
    I tried using DELETE FROM ITAB statement but it seems it does not work.
    Here is what I did:
    IF NOT gt_bsis_bsas[] IS INITIAL.
       DELETE gt_bsis_bsas WHERE hkont+10(0) <> '0'.
    ENDIF.
    Hope you can help me guys. Thank you and take care!

    Hi Viray,
    '+' is a wildcard char which is used to represent one char
    where as '*' represents any number of char's.
    In this case  +++++++++0
    <b>means that the length of the field is 10 chars and first 9 can be anything</b>
    he didn't use '*0' since it could mean that the length of the data entered can be anything .
    Hope this clarifies
    Regards
    Nishant

  • Merging Records with same or NULL values

    Hi,
    create table AS_ITM (id_itm NUMBER, diff_1 VARCHAR2(20), diff_2 VARCHAR2(20));
    insert into as_itm values (22188212, 'J068', 'C001');
    select id_itm, diff_1, diff_2 from as_itm;
    output:
    22188212     J068     C001
    create table RK_DIFF_DESC (diff_id VARCHAR2(20), diff_type VARCHAR2(20), diff_desc VARCHAR2(20));
    insert into RK_DIFF_DESC values ('C001', 'C', 'Red');
    insert into RK_DIFF_DESC values ('J068', 'S', '6.8gm');
    select diff_id, diff_type, diff_desc from RK_DIFF_DESC;
    output:
    C001 C     Red
    J068     S     6.8gm
    Now I am writting a query to get the out put ::
    SELECT i.id_itm,
    i.dept_id,
    CASE WHEN (DIFF.DIFF_TYPE = 'S') THEN diff.DIFF_DESC ELSE NULL END
    AS SIZE1,
    CASE WHEN (DIFF.DIFF_TYPE = 'C') THEN diff.DIFF_DESC ELSE NULL END
    AS COLOR
    FROM as_itm i
    LEFT OUTER JOIN
    RK_DIFF_DESC diff
    ON (i.diff_1 = diff.DIFF_ID OR i.diff_2 = diff.DIFF_ID);
    output:
    ID_ITM     DEPT_ID     SIZE1     COLOR
    22188212     4103      6.8gm     
    22188212     4103          Red
    My requirement is to get a single record like this:
    ID_ITM     DEPT_ID     SIZE1     COLOR
    22188212     4103      6.8gm     Red
    I can do this joining RK_DIFF_DESC two times with AS_ITM using below query.
    SELECT a.id_itm,
    a.dept_id,
    b.diff_desc size1,
    c.diff_desc COLOR
    FROM as_itm a
    LEFT OUTER JOIN RK_DIFF_DESC b
    ON (a.diff_1 = b.DIFF_ID AND b.diff_type = 'S')
    LEFT OUTER JOIN RK_DIFF_DESC c
    ON (a.diff_2 = c.DIFF_ID AND c.diff_type = 'C')
    Is there any other way to merge the above two lines into one joining RK_DIFF_DESC only 1 time ?
    ..............................

    select id_itm, max(SIZE1) SIZE1,  max(COLOR) COLOR
    from
    select id_itm,
            case diff_type when 'S' then diff_desc end SIZE1,
            case diff_type when 'C' then diff_desc end COLOR
    from AS_ITM a, RK_DIFF_DESC r
    where diff_1 = diff_id or diff_2 = diff_id
    group by id_itm;
        ID_ITM SIZE1                COLOR              
      22188212 6.8gm                Red                
    1 row selected.

Maybe you are looking for

  • BBC License problem on N8

    Hi. When I download video from BBC iplayer to my phone to watch later, my phone is always unable to view them as I'm unable to get a license. I don't know why this happens but I've tried the workaround to extract to PC, play in WM Player for license

  • How to dispaly the ABAP reports in SUS

    Hi Experts, Please tell me the detailed steps to dispaly the ABAP reports developed in SRM in SUS. Please elt me know the entiire steps. Thanks in Advance, Manu

  • I can't install any adobe product the AdobeHelp gets stuck at 26%

    Hi, I can't install any adobe products it just symply will not go past 26% when it is installing AdobeHelp. I have disabled firewall and my antivirus(AVG), the operating system I am using is windows 7 ultimate 64-bit and my spec is I7-3770k, ATI Hd 7

  • Gray Screen of DEATH?

    i just got a GRAY screen of DEATH for my iphone today. i was wondering what can i do to fix it other than restoring? have anybody got this before? tyvm for your help!

  • GarageBand won't start

    I'm trying to open GarageBand, but as long as I'm trying to open a previous project, it crashes while initializing. Can someone help me, please? I really need to get it to work so I can fix something before a deadline of sorts. I would try to open it