Message Mapping-Generating Headers and corresponding Line items in 1 file

Hi,
I am working on JDBC to File scenario.
There is a staging table in SQL Server. XI polls the table every 20 secs and picks up all the data with flag = 0. After fetching the records it sets the flag to 1 so that the same data do not get fetched the next time.
The record have one Bill No and there can be more than 1 line items associated with that bill no.
The target structure is as follows:
Record          1
   Bill No          0...unbounded
   Line item     1
        Line items    0...unbounded
Now the requirement is to generate a file with header and all the corresponding line items below it.  That is one file can have many headers but all the line items should succeed its corresponding header.
I have written a UDF to generate the same.
For Bill No.:
Bill No -> RemoveContext -> Sort - > UDF -> SplitBy Value -> CollapseContext
UDF just removes the duplicate Bill No and generates the list.
Now the issue is if Bill No as per source is 8,4,1,3 then the ones getting generated in the target str is in the same order as it is in source that is 8,4,1,3. But  I want this in the sorted order ie. 1,3,4,8. Althoug I have used Sort func, its not getting generated.
Please help.

chk this:
BillNo-removeContext--sort--splitByValue(valuechange)---collapse Context---Record
BillNo-removeContext--sort--splitByValue(valuechange)---collapse Context---splitbyvalue(each Value)---BillNo(Target)
BillNo-removeContext---------------------------
                            -------------------------- SortByKey----------FormatByExample(2nd argument mapping below)---UDF2---Line Item
BillSerailNo(set its context to Row)--UDF1---removeContext--
BillNo-removeContext--sort--splitByValue(valuechange)----2nd argument mapping of "formatbyexample"
BillNo-removeContext---
                            --------SortByKey----FormatByExample(2nd argument)---UDF2--splitbyvalue(each value)-Bill Serial No
BillSerailNo(set its context to Row)----UDF1---removeContext-----
BillNo-removeContext--sort--splitByValue(valuechange)----2nd argument mapping of "formatByExample"
udf1: Input will be var1
Execution type: all values of a context
String a="";
for(int i=0;i<var1.length;i++)
a = a + var1<i>+ ";";
int b= a.length();
result.addValue(a.substring(0,b-1));
UDF2: input will be var1
Execution type: all values of a context
for(int b=0;b<var1.length;b++)
String [] a = var1<b>.split(";");
for(int i=0;i<a.length;i++)
result.addValue(a<i>);
Input:
<MT_Source>
   <ROW>
        <Bill_No>8</Bill_No>
         <LineItems>
            <BillSerailNo>second</BillSerailNo>
           <LineItems>
          <LineItems>
            <BillSerailNo>second1</BillSerailNo>
         </LineItems>
     </Row>
      <ROW>
        <Bill_No>5</Bill_No>
         <LineItems>
            <BillSerailNo>First</BillSerailNo>
           <LineItems>
          <LineItems>
            <BillSerailNo>First1</BillSerailNo>
         </LineItems>
     </Row>
<ROW>
<Bill_No>8</Bill_No>
         <LineItems>
            <BillSerailNo>Third</BillSerailNo>
           <LineItems>
          <LineItems>
            <BillSerailNo>Third1</BillSerailNo>
         </LineItems>
     </Row>
<MT_Source>
Target:
<MT_Target>
    <Record>
        <Bill_No>5</Bill_No>
         <LineItems>
            <BillSerailNo>First</BillSerailNo>
           <LineItems>
          <LineItems>
            <BillSerailNo>First1</BillSerailNo>
         </LineItems>
   </Record>
   <Record>
       <Bill_No>8</Bill_No>
         <LineItems>
            <BillSerailNo>second</BillSerailNo>
           <LineItems>
          <LineItems>
            <BillSerailNo>second1</BillSerailNo>
         </LineItems>
         <LineItems>
            <BillSerailNo>Third</BillSerailNo>
           <LineItems>
          <LineItems>
            <BillSerailNo>Third1</BillSerailNo>
         </LineItems>
       </Record>
    <MT_1>

Similar Messages

  • BAPI to update PO's and Corresponding line items numbers **URGENT**

    Hi All,
    I have a requirement to create a program which will take list of POs and corresponding line item number and update Final invoice indicator for the same. This should be updated in SRM as well as R/3.
    I think, it can be done by a BAPI. Do anyone have idea, which BAPI will be applicable for the same?? You can also share yours views on this.
    Regards,
    Parvez.

    Hi
    We have done this.. This is easily possible using BAPIs.
    Try using SRM BAPIs
    META_PO_GETLIST
    META_PO_GETDETAIL
    <u>Note - SRM system calls BAPI in R/3 backend using RFC Call</u>
    In R/3 backend
    BAPI_PO_CREATE1
    BAPI_PO_CREATE
    BAPI_PO_CHANGE
    Hope this will definitely help.
    Regards
    - Atul

  • Is there any way to add PO no and  corresponding line item of PO in VL32N?

    Hello,
    The scenario is, we have created the IBD and deleted one of the line item and saved it.
    We went to VL32N and added the missing line item to IBD but PO number and corresponding item number of PO field of newly added line items are grayed out. We are not able to add PO number in VL32N screen.
    Is there any way to add PO number and corresponding line item of PO in VL32N screen of IBD? Our client does not want to create new IBD for same PO. He wants to add the line item in same IBD.
    Thanks,
    Milind
    Edited by: Csaba Szommer on Aug 27, 2011 4:52 PM

    Hello,
    This thread is pending since long time. No body has answered my question. Can any body suggest me?
    Thanks
    Milind

  • New GL,when do GR, message:Balancing field "Profit Center" in line item 001

    Hi
    We use new GL,and now when we do GR,the system report error message "Balancing field "Profit Center" in line item 001 not filled".so there must be anywhere to assign the profit to GR account ,but i can not find.:(
    can anyone tell me how to assign the profit to GR account?
    thanks a lot.

    Dear Mr Rahul
    Thanks for your suggestion
    but there's something odd about this..
    the other company code is working just fine for years..
    and i've already maintain configuration both for doc splitting especially the splitting rule and GSP_KD1
    yet the error still occur
    is there any suggestion Mr Rahul?
    or anyone?
    Best Regards
    Rumi

  • GR Doc# and GR Line Item Number

    Hi All,
    We have custom defined infocube actually WM-stocks.Now our requirement is to add GR Number and GR line Item Number. can be these be added to Infocube or should we go for ODS? any help from experts?
    Data has been loaded from generic datasource which is based on LQUA table.
    regards

    Hi,
    We implemented just the opposite:
    A cube for line items, an ODS for header data which didn't went to the cube (I mean those data that cannot be calculated by summing up item data).
    If we need summary data from ODS, we use RRI.
    Everything depends on a level of details you need. In our case we needed analysis on item data.
    Best regards,
    Eugene
    Message was edited by: Eugene Khusainov

  • Three same material document number generated for single PO line item.

    Hi,
    I found three same material number has been generated for single PO line item. Is there any specific reason for this.
    Here is the detail.
    PO
    LN   qty
    10    100
    PO history for LN 10
    Mat doc          qty               price
    5000000000     100               100
    5000000000     100               100
    5000000000     100               100

    see aditya , tables having document number as a primairy key will have a single entry , where as tables having primary key other then material documnet number is having multiple entries . as far as material document is concern , it is only one document in system , now we have to find why it is appearing 3 times . i will test this in my system and let you know .
    well thanx for your Cooperation . i will definatly get back to you .
    regards
    ravikant dewangan

  • Failed to create the CTI Route Point and corresponding Line on Cisco Unified CM.

    Dear All
               Kindly I got that message "Failed to create the CTI Route Point and corresponding Line on Cisco Unified CM." When I am trying to create Trigger on the UCCX for an Application,
    Bye the way I create Call Control Group and it gives me OK, and I create it from Subsystem>Cisco Unified CM Telephony>Call Control Group
    and Type CTI Ports: 4 | Inbound | Starting DN : 9000 "Nothing in my route pattern report have created CTI numbers"
    So Appreciate your help to avoid that errors raised when I am trying to create new prompts 
    Thanks 
    Ahmed Samir Yosuef 
    Integration Manager

    Let me know the deployment model and Node details

  • Derivation of Profit Centers in case of bank and Cash line items

    We are in the process of configuring the Profit Center Accounting functionality. We are in ECC 6.0 but have not migrated to New G/L.
    We understand that Profit center needs to be derived for each of the items for which it does not flow online in realtime. As regards Bank and Cash Line Items, we are not able to understand how Profit Center Derivation will happen.
    We have posted an FI payment document using Tcode F110 and further to which we executed F.5D and 1KEK. Further to this, we have checked the Profit Center Total records report (2KEE). It updates the vendor line items. But it does not reflect the Bank line item. Unless this happens, we understand that our Profit Center wise Trial Balance will not tally.
    Kindly let us know how bank and Cash line items will update in PCA. In our view, it should derive the Profit center from the offsetting entry in the vendor invoice. Pl. correct me if I am wrong.
    Pl. help.
    Venkat Iyer

    Hi Venkat,
    You may define a derivation rule in 3KEH
    Regarda
    Sachin

  • Profit Center population in the Vendor and Customer Line items

    hello
    our client is asking for  getting profit center in the vendor and customer line items  where in the view FBL5n and fbl1n we are not getting the profit center populated - in the new gl i understand that there is a standard report based on the gl account.
    but our business is not satisfied with the report and expecting report at profit center level.
    Can any one suggest any way of doing this.
    regards,
    Vijay

    Dear Vijay,
    Let me provide you my view of solutioning for this. This is an enahcement that needs to be done
    1. You can get the profit center from the given vendor and customer line item at the time of posting, using an enahcement you will be able to capture it.
    2. Existing the profit center field is not populated in the BSIK,BSAK,BSID and BSAD tables
    3. Hence, in the same enhancement once you capture the profit center , you can write the code that profit center is updated in these tables also.
    4. This will help you to do the vendor line item wise selection in the FBL1N,  FBL5N profit center wise.
    Constraints of this solution:
    The only constraint remains where in the for a given document if there are multiple profit center, then the system will do the splitting profit center wise for a vendor line item, which will not populate the profit center in those tables as there is only one field available in the bsid etc.. tables.
    This basically would be the one the soltuion where in as seeen from the end user ther eis no change in the front end interface , the way they are doing always they can do.
    You need to also take care the % of document splitting means cross profit center postings /cross document splitting charactericstics postings and the volume involved in this. so that you can suggest this to your client.
    Regards,
    Bharathi.

  • FBCJ LINE ITEM AND FI LINE ITEMS ARE DIFFERENT

    Dear Expert
    FBCJ LINE ITEM AND FI LINE ITEMS ARE DIFFERENT

    Hi,
    It seems from the screen shot you are seeing different documents as in the first screen shot it clearly shows you have booked the multiple expenses under one see the below screen shot we have circled it
    whereas FB03 screen shows different.
    You can do one thing click on circle item and check the expenses involved in it and accordingly go to FBL3N and display documents for that G/L for the date 05.04.2014.
    Hope your issue has been resolved else revert.
    Regards,
    Tejas.

  • Profit centerwise Vendor and Customer line items view

    Deal ALL,
    We have not activated Business Area.
    We have 10 plant under one company code. Client is booking the vendor and customer invoice as per the cost center and profit center of the plant. Payment and Receipt is also made according the bank maintain for each plant. As one customer or vendor is dealing with all the plants.
    Can any body can help me out how to get the vendor and customer line item display according plant or cost or profit center wise, so we can make or receive payment accordingly.
    Request you all to reply.
    Thanks & Regards,
    Bhadresh

    Hi
    Try the transaction codes for Profit Display by suitable config in TCode O7F1, O7F2, O7F3
    Assign Points if useful
    Regards
    Sanil

  • B2CBasket- Sales Order  How to add Vendor partner and new line item of SO

    Hi,
    I want to add the following BEFORE the sales order creation process starts:
    Add a VENDOR partner
    Add a new line item to ORDERADM_I
    I suspect in BADI CRM_ISA_BASKET_ITEMS and CRM_ISA_BASKET_HEAD. I have user 'HEAD' to add extension fields but cant figure the creation of NEW partners and NEW line item.
    regards,
    Dave

    Thank you for feedback Shantoor,
    The CRM_ORDER_MAINTAIN need not be called as this FM is called immediately following almost all of the CRM_ISA_* BADI's.
    For clarification I just want to expand on the solution..
    In all of these BADI's SAP uses the CT_INPUT_FIELDS parameter. This is where you should enter WHICH fields you have made changes to in the exit. CRM_ORDER_MAINTAIN uses the same parameter.
    However the challenge is .. WHAT do you enter in the CT_INPUT_FIELDS. This is where you have to follow a strategy. I yused the following:
    1. Looked where the structure was used in programs/class to see how SAP used it
    2. Set breakpoints at the call of the BADI. Check what CT_INPUT_FIELDS content is (SAP uses same technique)and try and replicate for your new entries.
    I hope this helps those that, like me, battled a bit with the use of these BADI's.

  • Offsetting account in Vendor, Customer and GL line item report

    Hi All,
    There is one requirement from our client. They want offsetting account in Vendor, Customer and GL line item report.(FBL1n, FBL3n and FBL5n).
    As this field is there in selection screen in lay out setting but field coming as blank no off setting account is coming. It was coming in old SAP 4.7 system but same is not coming in ECC6.0.
    Kindly let me know if any development is requirement, if yes than which tables we have refer for the same.
    Thanks and Regards,
    Abhinav Sharma

    Hi Abhinav,
    There is a SAP not and you can refer to that - SAP OSS note 112312
    T.Code: FIBF
    After entering in above T.code
    Follow Path
    Settings  Products of a customer
    Product   : XXXX
    Text        :  XXXX
    Active     :  Tick it
    Click on Back i.e. F3
    Follow Path
    Settings >P/S Function Modules > of a customer
    Event: 00001650
    Product: XXXX
    Function Module: LINE_ITEMS_GET_GKONT
    Now Go to FBL3N display of any account
    After opening the account display click on Change Layout i.e. CTRL+ F8
    And Select
    Offsetting A/C Type & Offsetting A/C no.
    Regards,
    SAPFICO
    Edited by: SAPFICO on Dec 1, 2010 8:26 AM

  • Customer and vendor line item report FBL5N/FBL1N

    Dear all,
    Could you please let me know, whether there is any way that we can get cost center ans wbs element in customer and vendor line item report FBL1N/FBL5N.
    REgards,
    Suresh Patipati.

    Hi Suresh
    Through BTE1650 you can fetch it . for this you have to  do some development.
    You can add additonal field to FBL*N reports with using BTE exit.
    Regards
    SAP student

  • Profit Center in Customer and Vendor Line item

    Hello Guru
    i have one doubt we have activated the new GL in one of client for profit center level. while posting through any of financial transaction particularly customer and vendor there is no filed for input parameters for profit center. while booking these kind of transaction system pick up the dummy profit center. even our field status group for  gl master data and posting key made as optional PCA filed not displaying.    client want it should be pick up  automatically from line item and should be input parameters.
    how to resolve this issue please let me know.
    waiting for your reply
    Thanks & Regards
    Laxmi narayan

    Hi,
    You are saying that u have activated New G/L, but are u gone for document spliting also or not? if you have activated document spliting customer and vendor line items not at all required any profit center because it will petch the profit center from oppsite line item automatically for giving tallyed balance sheet at profit center leavel, so no question profit center required or going to dummy profit center because dummy profit center will be locked automatcially once u activate document spliting.
    if you have not activated document spliting then customer and vendor line items may require profit center its depends on your field status settings, if you feel that it should not go to dummy profit center then maintain some profit center in 3keh & 3kei settings for customer and vendor reconcliation accounts, so that it will post to that profit center.
    Thanks & Regards
    T N R

Maybe you are looking for