N:1 multimapping for multiple records in every file

Hi ,
I am merging 2 files into a single file. First file has employee personal data and second file has employee salary data.I have created BPM and used correlation on EmpNumber to merge both the files. In BPM I am using fork step to recieve two files then use Transform step to merge the files and finally send dtep to send the output file.
If both the input files have single employee record my scenario works fine. However my requirenment is file one will have 10 employee records . File two will have salary details of the same 10 employees . I have to  merge both the files and create 10 final records of employees .
Here i am not able to use correlation as i dont have unique key in the file.
Can any one tell me how to achive this?
Regards,
Shabari

Please check the below blog
http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/10526
Refer the blog for the BPM design. You can make changes such that you include a fork(with two branches)inside the loop.  But without correlation how will you merge similar employee records.

Similar Messages

  • Creation of multiple Records in the file as per multiple segments in IDOC

    Hi SapAll.
    i have got a requirement to create a multiple records in a file based on multiple segments at sending Idoc in a File To Idoc Interface.
    the Scenario  is the reciever message type is mapped with fields of 3 segments in sending IDOC.
    SEG01   1.....1(PARENT SEGMENT)
      SEG02  0...999999(CHILD SEGMENT)
      SEG03 0...9999999(CHILD SEGMENT)
    in an instance where if the SEG01 exists for one time and SEG02 exists for 2 times and Seg03 Exists for 2 times PI is creating the file with 2 records in it but
    when if the SEG01 exists for one time and SEG02 exists for 2 times and Seg03 Exists for 1 time it is raising the error in message mapping where it is supposed to create 2 records in a file with empty values in the fields (mapping with seg03) segment.
    can anybody help me in this.
    regards.
    Varma

    you can create a UDF after you validate if the count match. if match you create the message if not, call de UDF.
    this UDF should receive two parameters -->Queue SEG2 and queue of SEG3.
    then you should loop by the count of SEG2. if you find a Supress Value in the queue of SEG3 add a "" to result. for example.
    for(i=0;i<=SEG2.count;i++){
    If SEG3<i>.equals(ResultList.SUPPRESS) {
           result.addValue(" ");
    }else{result.addValue(SEG3<i>);
    the result of UDF is a queue which should map to target field directly coz it has context changes
    I think that is what you are needing. if no let me know.
    RP
    Edited by: Rodrigo Alejandro Pertierra on Jun 17, 2010 11:56 AM

  • Help needed in PL/SQL for updating the column for multiple records

    Hi,
    I am new to PL/SQL and need some help. What is the most effiecient way to update some field in a table as I may need to update thousands of records. I have a coulmn groupid can have multiple records tied to it. All the records attached to some groupid have a priority field also.
    How can I update the prorityfield value for all the groupids in a profiecient way. Here is a sample data
    GroupId     Priority
    1            1
    1            2
    1            3
    1            4
    1            5
    2            1
    2            2
    2            3
    3            1Here I have three groups 1, 2, 3. Now if any group contains only one record the priority remains same e.g. groupid=3 on top. If any group contains more than one record e.g. groupid=1 & 2 I want to re-arrange the priority fields e.g. If I want to update groupid=1 now if I change the priority of 2 to 5 (make it the last) I want to rearrange the remaing records priority i.e. if 2 becomes 5 as I have 5 rows for groupid=1 then 5 becomes 4, 4 becomes 3, 3 becomes 2 and 1 remains the same.
    Same wya if I want to make the priority 1 to 3 for groupid=2 then need 2 to become 1 and 3 to become 2 etc....
    Any help is appreciated.
    Thanks

    Hi,
    You don't need PL/SQL to do this (though you can put the following in PL/SQL if you want to):
    UPDATE     table_x
    SET     priority = CASE
                   WHEN  groupid     = 1
                   AND   priority = 2
                        THEN  5
                   WHEN  groupod     = 1
                   AND   priority     BETWEEN 3 AND 5
                        THEN  priority - 1
                   WHEN  groupid = 2
                   THEN
                        CASE
                             WHEN  prioity = 1
                             THEN  3
                             ELSE  priority - 1
                        END
                 END
    WHERE     groupId          IN (1, 2)
    AND     (     priority     BETWEEN 2 AND 5
         OR     groupid          = 2
         );There are lots of different techniques that can reduce your coidng: for example, the nested CASE statement used for groupid=2 above.
    You could do several smaller UPDATEs (for example, one just for groupid=1). Execution will be slower, but coding and testing will be faster.
    You could make the "magic numbers" 2 (for groupid=1) and 1 (for groupid=2) variables, even outside of PL/SQL.
    If you need more help, post the information that Satyaki requested.

  • Alv report for multiple record insertion

    hi,
    i'm new to abap. i'm using alv report for record display and insertion. how can i insert multiple records from alv to my table??

    well that can be achieved only by running BDC inside alv report to enter the entries.and in that too you can append or edit single entries only
    reward if useful
    regards
    vivek

  • TcDataSet for Multiple Records

    Hi,
    I am trying to write one custom adapter to fetch some values from OIM database using sql query
    That sql query returns multiple records.
    I am using tcdataset APIs to get values. However I am able to write the code when it returns 1 value
    What is the method of tcDataSet can be used when it returns multiple rows.
    Pls suggest.It would be great if you could send some used code snippet.
    Thanks!!

    JRS wrote:
    Hi,
    I am trying to write one custom adapter to fetch some values from OIM database using sql query
    That sql query returns multiple records.
    I am using tcdataset APIs to get values. However I am able to write the code when it returns 1 value
    What is the method of tcDataSet can be used when it returns multiple rows.
    Pls suggest.It would be great if you could send some used code snippet.
    Thanks!!
    tcDataSet dataSet = new tcDataSet();
    dataSet.setQuery(this.oDataProvider, strCheckQuery);
    dataSet.executeQuery();
    for(int i=0;dataSet.getRowCount() i++){
         dataset.gotoRow(i);
    }

  • Use of LIKE in where clause of select statement for multiple records

    Hi Experts,
    I have a account number field which is uploaded from a file. Now this account numbers uploaded does not match fully with sap table account numbers but it contains all of the numbers provided in the file mostly in the upright positions.
    For example in file we have account number as 2ARS1 while in sap table the value is 002ARS1.
    And i want to fetch data from sap table based on account number uploaded. So, i am trying to use LIKE with for all entries but its not working as mentioned below but LIKE is not working with FOR ALL ENTRIES.
    data : begin of t_dda occurs 0,
            dda(19) type c,
           end of t_dda.
    data : begin of t_bukrs occurs 0,
            bukrs type t012k-bukrs,
           end of t_bukrs.
    data : dda type t012k-bankn,
           w_dda type t012k-bankn.
    CONCATENATE '%'
                             '2ARS1'
                     INTO  W_DDA.
    MOVE W_DDA TO T_DDA-DDA.
    APPEND T_DDA.
    CLEAR T_DDA.
    free t_bukrs.
    SELECT BUKRS
      FROM T012K
      into TABLE t_bukrs
        for all entries in t_dda
    WHERE BANKN like t_dda-dda.
    Can anybody suggest what should i use to get the data for multiple account numbers using one select statement only instead on using SELECT UP TO 1 ROWS in LOOP....ENDLOOP ?
    Thanks in advance,
    Akash

    Hi,
    yes, For All entries won't work for LIKE with '%  '.
    I think the other alternative is go for Native SQL by writing sub-query
    sample code is here:
    data: begin of i_mara occurs 0,
              matnr like mara-matnr,
              matkl like mara-matkl,
           end of i_mara.
    exec sql.
    select matnr, matkl from mara where matnr in (select matnr from marc) and matnr like '%ma' into :i_mara
    endexec.
    loop at i_mara.
    write:/ i_mara-matnr, i_mara-matkl.
    endloop.
    hope u got it.
    regards
    Mahesh
    Edited by: Mahesh Reddy on Jan 21, 2009 2:32 PM

  • Bapi_po_create is not creating Purchase Orders for multiple records in file

    Hi All.
    iam trying to create contracts and Purchase Orders  In me21n,me31k .
    here iam using bdc for contract creation against services and using bapi_po_create for PO Creations.
    in this process i could create contracts and POs for the first record in the file but for second record bapi_po_create couldnt create POs and the return table in bapi says
    1.document contains no items.
    2.no services or limits have been maintained.
    wil be waiitng for  r great answer.
    bye.
    regards.
    seeta.

    Hi Seeta Ram,
    Did you pass the table PO_ITEM_SCHEDULES to BAPI_PO_CREATE with the coresponding Item numbers for each item in the table PO_ITEMS?
    Regards,
    Vitz.

  • Header line missing for multiple records in the Receiver Email.

    I have a file to email scenario
    I see the content in mapping has proper output with all the HDRs and ITMS. but when it comes throught the receiver it is missing the HDRs.
    Source
    HDR1***   ITM1***  ITM2****
    HDR2***   ITM1***  ITM2***ITM3**
    The email Body looks like the following:
    HDR1***   ITM1***  ITM2***ITM1**  ITM2***ITM3*
    I am missing the HDR for the subsequent recodrs and the subsequent items are shown as if they are the items of the first HDR1. I checked the Mapping the mapping output and it looks good, but when i actually get the email i see it missing susequent HDRs.

    When I was at a client on 11.5.10, I ended up creating a personalization on the Requisitions screen.
    If someone created a requisition with 2 ship to orgs, it raised an error.
    It was not full proof but it was deemed satisfactory by the client.
    You can consider personalization or you can modify the requisition approval workflow to include the check for multiple ship-to condition.
    Hope this helps
    Sandeep Gandhi
    Independent Techno-functional Consultant

  • Bdc session is not working for multiple records

    Hello Experts
    we have written abdc for f-27 using the session method.it is working fine for one record but if we supply mulite records it
    is giving the error, like bseg-wbter( ie amount which comes in the second screen) is not found in screen 1.
    ie the first screen.The bdc is working fine for one record in notepad.after completing the first record it goes to
    second record and in the first screen itself it says amount field not found in screen 1. But
    actually this field comes in second screen.
    my flat file is like this..
    10.10.2008     DA     9641     10.10.2008     1     IND     TEST          31     10001     320.21     10.10.2008     01     120021     345.94
    10.10.2008     DA     9641     10.10.2008     1     IND     TEST          31     10001     560.22     10.10.2008     01     120021     231.94

    please kindly see my program..
    LOOP AT itab.
        REFRESH itabbdc.
        PERFORM bdc_dynpro      USING 'SAPMF05A' '0100' 'X'.
        PERFORM bdc_field       USING 'BDC_CURSOR' 'RF05A-NEWKO'.
        PERFORM bdc_field       USING 'BDC_OKCODE' '/00'.
        PERFORM bdc_field       USING 'BKPF-BLDAT'  itab-bldat.
        PERFORM bdc_field       USING 'BKPF-BLART'  itab-blart.
        PERFORM bdc_field       USING 'BKPF-BUKRS'  itab-bukrs.
        PERFORM bdc_field       USING 'BKPF-BUDAT'  itab-budat.
        PERFORM bdc_field       USING 'BKPF-MONAT'  itab-monat.
        PERFORM bdc_field       USING 'BKPF-WAERS'  litab-waers.
        PERFORM bdc_field       USING 'BKPF-XBLNR'  itab-xblnr.
        PERFORM bdc_field       USING 'FS006-DOCID' itab-docid.
        PERFORM bdc_field       USING 'RF05A-NEWBS' itab-newbs.
        PERFORM bdc_field       USING 'RF05A-NEWKO' itab-newko.
        PERFORM bdc_dynpro      USING 'SAPMF05A' '0302' 'X'.
        PERFORM bdc_field       USING 'BDC_CURSOR' 'RF05A-NEWKO'.
        PERFORM bdc_field       USING 'BDC_OKCODE' '/00'.
        PERFORM bdc_field       USING 'BSEG-WRBTR'  itab-wrbtr.
        PERFORM bdc_field       USING 'BSEG-ZFBDT'  itab-zfbdt.
        PERFORM bdc_field       USING 'RF05A-NEWBS' itab-newbs2.
        PERFORM bdc_field       USING 'RF05A-NEWKO' itab-newko2.
        PERFORM bdc_dynpro      USING 'SAPMF05A' '0301' 'X'.
        PERFORM bdc_field       USING 'BDC_CURSOR' 'BSEG-WRBTR'.
        PERFORM bdc_field       USING 'BDC_OKCODE'  '=BU'.
        PERFORM bdc_field       USING 'BSEG-WRBTR'  itab-wrbtr2.
       PERFORM bdc_load USING 'F-27' itabbdc.
      ENDLOOP.
    *&      Form  open_session
          text
    -->  p1        text
    <--  p2        text
    FORM session_start .
      CALL FUNCTION 'BDC_OPEN_GROUP'
        EXPORTING
          client = sy-mandt
          group  = 'F-27DA'
          keep   = 'X'
          user   = sy-uname.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    "session_start
    FORM bdc_load USING tcode TYPE sytcode
                           bdcdata LIKE itabbdc.
      CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          tcode     = tcode
        TABLES
          dynprotab = itabbdc.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.

  • ADI not working for multiple records

    Hi,
    We currently have an issue with ADI. The ADI we have produces an MS Word letter based on a custom view and custom integrator.
    On the person form, when I query for an employee and the resultset is 1 our ADI is working fine and the letter/word document is generated.
    When the query returns more than one employee, the Web ADI errors. It does not download any records into the excel file and then when it tries to open the word document it asks for Header Record Delimiters?
    In the excel document I get a Run-Time error '5922' Method 'Run' of object '_Application' failed.
    Is there a setting that only restricts ADI to return one row from this form?
    Any help would be greatly appreciated.
    Many thanks
    Martin

    Hi,
    We currently have an issue with ADI. The ADI we have produces an MS Word letter based on a custom view and custom integrator.
    On the person form, when I query for an employee and the resultset is 1 our ADI is working fine and the letter/word document is generated.
    When the query returns more than one employee, the Web ADI errors. It does not download any records into the excel file and then when it tries to open the word document it asks for Header Record Delimiters?
    In the excel document I get a Run-Time error '5922' Method 'Run' of object '_Application' failed.
    Is there a setting that only restricts ADI to return one row from this form?
    Any help would be greatly appreciated.
    Many thanks
    Martin

  • How to produce xsd for  multiple record with header

    Hi
    I tried with native format builder but that's of no use for me
    I have a flat file like this
    0+022+
    1+012+
    2+022+
    2+032+
    1+021+
    2+025+
    5+036+
    I need a schema for repeating records. My record starts for each 0 and ends for 5
    0=header 1=page 2=word 5=end
    Can somebody help me please.
    for now I have this schema but I get more number of xml elements than the data when I transform in bpel
    Also When i parse, as my records end with + {eol}, I get + at the end of the last element, how to get rid of that
    <?xml version="1.0" encoding="US-ASCII"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
    xmlns:tns="http://www.oracle.com/ias/processconnect"
    targetNamespace="http://www.oracle.com/ias/processconnect"
    elementFormDefault="qualified" attributeFormDefault="unqualified"
    nxsd:stream="chars" nxsd:version="NXSD" nxsd:validateNxsd="true">
    <element name="PFW16">
    <complexType>
    <sequence>
    <element ref="tns:Header" nxsd:conditionValue="0"/>
    <element ref="tns:Pager" nxsd:conditionValue="1" maxOccurs="unbounded"/>
    <element ref="tns:Tail" nxsd:conditionValue="5" />
    </sequence>
    </complexType>
    </element>
    <!--Header Record -->
    <element name="Header" type="tns:HeaderType"/>
    <complexType name="HeaderType">
    <sequence>
    <element name="RecordTypeIndicator" type="string"
    nxsd:style="terminated" nxsd:terminatedBy="+"/>
    <element name="VersionNumber" type="string"
    nxsd:style="terminated" nxsd:terminatedBy="${eol}"/>
    </sequence>
    </complexType>
    <!-- Pager Record -->
    <element name="Pager" type="tns:PagerRecordType"/>
    <complexType name="PagerRecordType">
    <sequence>
    <element name="RecordTypeIndicator" type="int"
    nxsd:style="terminated" nxsd:terminatedBy="+"/>
    <element name="VersionNumber" type="string"
    nxsd:style="terminated" nxsd:terminatedBy="${eol}"/>
    <element name="words">
    <complexType>
    <sequence>
    <element name="Detail-Item" minOccurs="1"
    maxOccurs="unbounded">
    <complexType>
    <group ref="tns:WordsRecord"
    nxsd:conditionValue="2"/>
    </complexType>
    </element>
    </sequence>
    </complexType>
    </element>
    </sequence>
    </complexType>
    <group name="WordsRecord">
    <sequence>
    <element name="RecordTypeIndicator" type="int"
    nxsd:style="terminated" nxsd:terminatedBy="+"/>
    <element name="VersionNumber" type="string"
    nxsd:style="terminated" nxsd:terminatedBy="${eol}"/>
    </sequence>
    </group>
         <element name="Tail" type="tns:EndType"/>
    <complexType name="EndType">
    <sequence>
    <element name="RecordTypeIndicator" type="string"
    nxsd:style="terminated" nxsd:terminatedBy="+"/>
    <element name="VersionNumber" type="string"
    nxsd:style="terminated" nxsd:terminatedBy="${eol}"/>
    </sequence>
    </complexType>
    </schema>

    You can get value into variable using a simple select sql line.
    Create a variable -> go to refreshing tab -> add sql code there with proper schema.
    Use variable in package in refresh variable mode.
    You are done . Enjoy.

  • Need help to solve update querry for multiple records.

    Could any of you please provide update querry for the following scenario.
    Requiremnt:
    1. Update the UNIQUE_ID of record ( same Identifier and Identifier_code
    where END_Date is not null) with the UNIQUE_ID of the record (( same  Identifier and Identifier_code
    where END_Date  is null).
    2. If More than one NULL in END_date then update UNIQUE_ID with max(EFFective_Date) of UNIQUE_ID
    Source  data
    UNIQUE_ID
    Identifier
    Identifier_code
    EFFective_Date
    END_Date
    1
    777
    abc
    2/14/2014 11:15
    2/28/2014 9:00
    1
    777
    abc
    2/21/2014 9:00
    3/7/2014 9:02
    2
    777
    abc
    2/28/2014 9:00
    3/14/2014 9:02
    2
    777
    abc
    3/7/2014 9:02
    3/14/2014 9:02
    2
    777
    abc
    3/14/2014 9:02
    NULL
    5
    888
    xyz
    2/14/2014 11:15
    2/28/2014 9:00
    5
    888
    xyz
    2/21/2014 9:00
    3/7/2014 9:02
    5
    888
    xyz
    2/28/2014 9:00
    3/14/2014 9:02
    6
    888
    xyz
    3/7/2014 9:02
    NULL
    7
    888
    xyz
    3/14/2014 9:02
    NULL
    OutPUT .
    UNIQUE_ID
    Identifier
    Identifier_code
    EFFective_Date
    END_Date
    2
    777
    abc
    2/14/2014 11:15
    2/28/2014 9:00
    2
    777
    abc
    2/21/2014 9:00
    3/7/2014 9:02
    2
    777
    abc
    2/28/2014 9:00
    3/14/2014 9:02
    2
    777
    abc
    3/7/2014 9:02
    3/14/2014 9:02
    2
    777
    abc
    3/14/2014 9:02
    NULL
    7
    888
    xyz
    2/14/2014 11:15
    2/28/2014 9:00
    7
    888
    xyz
    2/21/2014 9:00
    3/7/2014 9:02
    7
    888
    xyz
    2/28/2014 9:00
    3/14/2014 9:02
    7
    888
    xyz
    3/7/2014 9:02
    NULL
    7
    888
    xyz
    3/14/2014 9:02
    NULL
    Thanks in advance.

    Hi Vikash,
    This query will not produce results as per requirement:
    Try it with following data
    Insert into @TempTABLE values (1,777,'abc','2/14/2014 11:15','3/14/2014 9:02')
    Insert into @TempTABLE values (1,777,'abc','2/21/2014 9:00','3/14/2014 9:02')
    Insert into @TempTABLE values (2,777,'abc','2/28/2014 9:00','3/14/2014 9:02')
    Insert into @TempTABLE values (2,777,'abc','3/7/2014 9:02','3/14/2014 9:02')
    Insert into @TempTABLE values (2,777,'abc','3/14/2014 9:02',NULL)
    Insert into @TempTABLE values (5,888,'xyz','2/14/2014 11:15','3/14/2014 9:02')
    Insert into @TempTABLE values (5,888,'xyz','2/21/2014 9:00','3/14/2014 9:02')
    Insert into @TempTABLE values (5,888,'xyz','2/28/2014 9:00','3/14/2014 9:02')
    Insert into @TempTABLE values (7,888,'xyz','3/7/2014 9:02',NULL)
    Insert into @TempTABLE values (6,888,'xyz','3/14/2014 9:02',NULL)
    as per the problem statement, all records having 888,'xyz' should be updated with 6 not 7 as max effective date is associated with 6 not 7.
    Ashutosh
    Nope.
    can you check the original post first. It clearly states output as having 7 as id for all the records with 888,xyz
    also your above posted sample data is different from original sample data as you've dates jumpled up for the records with ids 6 and 7
    Please see the illustration for original sample data
    --sample table for illustration
    declare @t table
    (UNIQUE_ID int,Identifier int,Identifier_code varchar(100),EFFective_Date datetime ,END_Date datetime)
    --populate original sample data
    INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (1, 777, N'abc', CAST(0x0000A2D200B964F0 AS DateTime), CAST(0x0000A2E0009450C0 AS DateTime))
    INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (1, 777, N'abc', CAST(0x0000A2D9009450C0 AS DateTime), CAST(0x0000A2E70094DD60 AS DateTime))
    INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (2, 777, N'abc', CAST(0x0000A2E0009450C0 AS DateTime), CAST(0x0000A2EE0094DD60 AS DateTime))
    INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (2, 777, N'abc', CAST(0x0000A2E70094DD60 AS DateTime), CAST(0x0000A2EE0094DD60 AS DateTime))
    INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (2, 777, N'abc', CAST(0x0000A2EE0094DD60 AS DateTime), NULL)
    INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (5, 888, N'xyz', CAST(0x0000A2D200B964F0 AS DateTime), CAST(0x0000A2E0009450C0 AS DateTime))
    INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (5, 888, N'xyz', CAST(0x0000A2D9009450C0 AS DateTime), CAST(0x0000A2E70094DD60 AS DateTime))
    INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (5, 888, N'xyz', CAST(0x0000A2E0009450C0 AS DateTime), CAST(0x0000A2EE0094DD60 AS DateTime))
    INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (6, 888, N'xyz', CAST(0x0000A2E70094DD60 AS DateTime), NULL)
    INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (7, 888, N'xyz', CAST(0x0000A2EE0094DD60 AS DateTime), NULL)
    --do the update
    UPDATE t
    SET UNIQUE_ID = MaxID
    FROM
    SELECT MAX(CASE WHEN END_DATE IS NULL THEN UNIQUE_ID END) OVER (PARTITION BY Identifier,Identifier_code) AS MaxID,UNIQUE_ID
    FROM @t
    )t
    WHERE UNIQUE_ID <> MaxID
    AND MaxID IS NOT NULL
    --now check the output
    SELECT * FROM @t
    The output is as below
    UNIQUE_ID Identifier Identifier_code EFFective_Date END_Date
    2 777 abc 2014-02-14 11:15:00.000 2014-02-28 09:00:00.000
    2 777 abc 2014-02-21 09:00:00.000 2014-03-07 09:02:00.000
    2 777 abc 2014-02-28 09:00:00.000 2014-03-14 09:02:00.000
    2 777 abc 2014-03-07 09:02:00.000 2014-03-14 09:02:00.000
    2 777 abc 2014-03-14 09:02:00.000 NULL
    7 888 xyz 2014-02-14 11:15:00.000 2014-02-28 09:00:00.000
    7 888 xyz 2014-02-21 09:00:00.000 2014-03-07 09:02:00.000
    7 888 xyz 2014-02-28 09:00:00.000 2014-03-14 09:02:00.000
    7 888 xyz 2014-03-07 09:02:00.000 NULL
    7 888 xyz 2014-03-14 09:02:00.000 NULL
    Now compare it with original output and you'll find they're the same
    UNIQUE_ID Identifier Identifier_code EFFective_Date END_Date
    2 777 abc 2/14/2014 11:15 2/28/2014 9:00
    2 777 abc 2/21/2014 9:00 3/7/2014 9:02
    2 777 abc 2/28/2014 9:00 3/14/2014 9:02
    2 777 abc 3/7/2014 9:02 3/14/2014 9:02
    2 777 abc 3/14/2014 9:02 NULL
    7 888 xyz 2/14/2014 11:15 2/28/2014 9:00
    7 888 xyz 2/21/2014 9:00 3/7/2014 9:02
    7 888 xyz 2/28/2014 9:00 3/14/2014 9:02
    7 888 xyz 3/7/2014 9:02 NULL
    7 888 xyz 3/14/2014 9:02 NULL
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Creation of multiple records in reciever file as per occurance of 1 segment

    Hi SapAll.
    i have a got a requirement in an IDOC To File Interface
    the Requirement is under sending IDOC there will be multiple segments whose fields will me mapped to reciever file,so here i got a business requirement as
    IDOC -
    Segment 1-occur for 1 time
    segment 2- occurs  for 1 time
    segment 3-occurs for 3 times so here PI Need to create a file with 3 records as segment 3 repeats for 3 times, here segment 1 and segment 2  field  values repeats for all the 3 records int the file and segment 3 fields values will have to be mapped respectively for each record of all the 3 records from each segment 3.
    i dont know on how i can acheive this.
    can any of sap group provide me the solution.
    regards.
    Varma

    > segment 3-occurs for 3 times so here PI Need to create a file with 3 records as segment 3 repeats for 3 times, here segment 1 and segment 2  field  values repeats for all the 3 records int the file and segment 3 fields values will have to be mapped respectively for each record of all the 3 records from each segment 3.
    Create your target structure as mentioned and do the mapping as shown below.
    <Records> 0..unbounded
         <segment1_Fields> </segment1_Fields>
         <segment2_Fields> </segment2_Fields>
         <segment3_Fields> </segment3_Fields>
    </Records>
    Now do the mapping like this..
            segment3 -
    >RemoveContext---> Records (parent node mapping)
             segment1----->CopyValue(0) ---> segment_field1
             segment2----->CopyValue(0) ---> segment_field2
             segment3----->SplitByValue ---> segment_field3
    Note: You can also use "UseOneAsMany" instead of "CopyValue" function to repeat the segment1 & segment2 values in each record.

  • Saving multiple records into text file

    Can I save multiple records into a text file at one go?
    My application has a list of data displayed there and when the user clicks on the save button it will save all the records on the screen.
    It works but it only saves the last record.
    Here are my codes
    // this is to display the list of data
    private JLabel[] subjects=new JLabel[20];
    private JLabel[] subTotal=new JLabel[20];
    private JLabel[] codes=new JLabel[20];
    private JLabel[] getTotal=new JLabel[20];
    String moduleCodes;
    String getPrice;
    double price;
    int noOfNotes;
    public testapp(Subjects[] subList)
    int j=0;
                double CalTotal=0;
              for (int i=0; i<subList.length; i++)
                   subjects[i] = new JLabel();
                   subTotal[i] = new JLabel();
                   codes=new JLabel();
                   getTotal[i]=new JLabel();
                   if (subList[i].isSelected)
                        System.out.println(i+"is selected");
                        subjects[i].setText(subList[i].title);
                        subjects[i].setBounds(30, 140 + (j*30), 400, 40);
                        subTotal[i].setText("$"+subList[i].price);
                        subTotal[i].setBounds(430,140+(j*30),100,40);
                        codes[i].setText(subList[i].code);
                        getTotal[i].setText(subList[i].price+"");
                        CalTotal+=subList[i].price;
                        contain.add(subjects[i]);
                        contain.add(subTotal[i]);
                        j++;
                        moduleCodes=codes[i].getText();                              
                        getPrice=getTotal[i].getText();
                        noOfNotes=1;
    // this is where the records are saved
         public void readRecords(String moduleCodes,String getPrice,int notes)throws IOException
              price=Double.parseDouble(getPrice);
              String outputFile = "testing.txt";
              FileOutputStream out = new FileOutputStream(outputFile, true);      
         PrintStream fileOutput = new PrintStream(out);
              SalesData[] sales=new SalesData[7];
              for(int i=0;i<sales.length ;i++)
                   sales[i]=new SalesData(moduleCodes,price,notes);
                   fileOutput.println(sales[i].getRecord());
              out.close();

    I suggest writing a method that takes a SalesData[]
    parameter and a filename. Example:
    public void writeRecords(SalesData[] data,
    String filename) throws IOException
    BufferedWriter out = new BufferedWriter(new
    FileWriter(filename, true));
    for (int i = 0; i < data.length; i++)
    out.write(data.getRecord());
    out.newLine();
    out.close();
    And it's good to get in the habit of doing things like closing resources in finally blocks.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Handling Multiple Records in a file adapter

    Hi All,
    My source file message :
    <Source_MT>
        <Records>....<b>0-Unbound</b>
                 <Country>THAILAND</country>
        </Records>
       <Records>....<b>0-Unbound</b>
                 <Country>ANGOLA</country>
        </Records>
    </Source_MT>
    Target Message:
    <Target_MT>
        <Employees>....<b>0-Unbound</b>
                 <Country>THAILAND</country>
        </Employees>
    </Traget_MT>
    Now in my scenario ,source message will have multiple records with different countries........
    I want to send these records to different receivers on the basis of this coutry field,means after target message mapping....all the records corresponding to THAILAND must be sent to THA_RECVR system..all the records corresponding to ANGOLA must be sent to Angola recvr systems...
    Please help me to club target message records on the basis of country field and then send it to correspodning receiver systems ......
    Should I use BPM?

    Shweta,
    You need to do enhanced receiver determination. You can handle this by determining them during runtime.
    Check this out : Re: Condition In Receiver Determination Not Working [Page 3 : My reply]
    raj.

Maybe you are looking for