End Routine to populate custom AFS field for Billing Item extractor

I have the following scenario for Billing 2LIS_13_VDITM datasource
Doc_No   Item  Material    Item_Categ   AFS_field
2000        11     XYZ          123
2000        12     XYZ          123                  US1
3000        11     PQR          456                 
3000        12     PQR          456                  CA1
I need to populate the AFS_field in the first row also for all Doc Nos for certain Item categories (eg 123 & 456). I need to do this on the first transformation from PSA to DSO. I was planning to write a SELECT statement in the Start Routine with the PSA table as the reference as seen below and then write an End Routine calling this reference table. But the PSA table name is different in Dev, QA and Prod so I cannot use this.
TYPES: BEGIN OF S_AFS,
VBELN TYPE C LENGTH 10,
PSTYV TYPE C LENGTH 4,
MATNR TYPE C LENGTH 18,
J_4KRCAT TYPE C LENGTH 16,
J_4KSCAT TYPE C LENGTH 16,
END OF S_AFS.
DATA: LT_AFS TYPE STANDARD TABLE OF S_AFS,
      LS_AFS TYPE S_AFS.
DATA: LT_DATA TYPE tyt_SC_1.
LT_DATA[] = SOURCE_PACKAGE[].
SORT LT_DATA DESCENDING BY VBELN MATNR J_4KRCAT.
DELETE ADJACENT DUPLICATES FROM LT_DATA COMPARING VBELN MATNR.
SELECT VBELN MATNR J_4KRCAT J_4KSCAT
INTO CORRESPONDING FIELDS OF TABLE LT_AFS
FROM /BIC/B0000777001
FOR ALL ENTRIES IN LT_DATA WHERE VBELN = LT_DATA-VBELN AND MATNR =
LT_DATA-MATNR.
SORT LT_AFS BY VBELN MATNR.
I am not an expert in writing ABAP code. Any suggestions are greatly appreciated and points will be assigned. Thank you.

Hi
why do want to select the data from PSA table ?Already your trying to load data from PSA to DSO.
you want to populate the AFS field value in DSO right?
1. First you have to add AFS field in ur DSO
2. Write the Start routine based on ur scenario(select the data based on ur scenario and put into internal table).
3. wirte AFS field leval  transfer routine(Read the corresponding record based on docu num,item num) pass into RESULT.
Regards,
GR

Similar Messages

  • Populate customer reference field for credit memo from RMA order

    There is requirement to populate customer reference field  for credit memo generated for RMA order..
    In RMA order which filed i need to populate which will come as customer reference in credit memo.
    Please help me  to populate customer reference field from RMA orderes

    Hi Javier,
    Please check following site:
    http://help.sap.com/saphelp_crm60/helpdata/en/2e/b0da18dbe84ed9bdff9a5d6d91f531/frameset.htm
    Cheers,
    Gun.

  • Customer no to populate the Assignment field for Sales A/c using sort key

    Dear All,
    In 6.0, I am trying to get the Customer number to populate the Assignment field for Sales Account
    We have set the sales account to a 031 sort key - sort by customer, in FS00. When 031 is set, SAP goes to the BSEG table and looks at the KUNNR (customer) field and populates the Assignment field with what is in the KUNNR field of BSEG.
    The problem is: the customer number (KUNNR) does not contain any data in BSEG.
    The KUNNR field of all the other account lines for the document number are blank.
    Is it possible to bring the field in the General Ledger display?
    Does anyone know of a user exit or other solution?
    Thanks,
    Gov

    Hi,
    Check with SD consultant and use Copy control.

  • Start Routine to Populate Account Group Field from Master data of 0Customer

    Hello Friends. Please help me edit this ABAP code to make it work. I am putting this code in start routine in between two DSO. where I am using the
    Start Routine to Populate Account Group Field from Master data of 0Customer. I do not want to use read from master data functionality since that field 0customer is not there in dso but similar field 0debitor is there. so i want to put this code
    during the load from source DSO to Target DSO.
    Error Explicit length specifications are necessary with types C, P, X, N und
    DATA: L_S_DP_LINE TYPE DATA_PACKAGE_sTRUCTURE.
        types: begin of comp,
         CUSTOMER       type  /BI0/OICUSTOMER,
         ACCNT_GRP          type /BI0/OIACCNT_GRP,
       end of comp.
        DATA: l_S_comp type comp.
        DATA: L_th_COMP TYPE HASHED TABLE OF COMP WITH UNIQUE KEY customer INITIAL SIZE 0.
    IF  L_th_COMP[] IS INITIAL.
    SELECT CUSTOMER ACCNT_GRP FROM /BI0/PCUSTOMER APPENDING CORRESPONDING FIELDS OF TABLE L_th_COMP.
    ENDIF.
    LOOP AT SOURCE_PACKAGE INTO L_S_DP_LINE.
    READ TABLE L_TH_COMP INTO L_S_COMP WITH TABLE KEY CUSTOMER = L_s_DP_LINE-CUSTOMER
    IF SY-SUBRC = 0.
    L_S_DP_LINE-/BIC/ACCNT_GRP = L_S_COMP-/BIC/ACCNT_GRP.
    MODIFY SOURCE_PACKAGE FROM L_S_DP_LINE.
    ENDIF.
    ENDLOOP.
    soniya kapoor
    Message was edited by:
            soniya kapoor

    Hello Wond Thanks for Good Answer and good option, But Client does not like this option and does not like Nav Attribute so he does not want to turn on any Nav Attribute, In general also We hav requirement to read a third table while uploading 1 dso table to 2 dso table,
    so  Please help me edit this ABAP code to make it work. I am putting this code in start routine in between two DSO. where I am using the
    Start Routine to Populate Account Group Field from Master data of 0Customer.
    No syntax Error But during the load it is updating the source table and not the target table. how to define now target table.
    ***SOURCE DSO Table
    types: begin of typ_tgl1.
        include type /BIC/AZDAFIAR000.
        types: end of typ_tgl1.
        types: begin of comp,
         CUSTOMER       type  /BI0/OICUSTOMER,
         ACCNT_GRP          type /BI0/OIACCNT_GRP,
       end of comp.
    DATA: L_th_COMP TYPE HASHED TABLE OF COMP WITH UNIQUE KEY customer
    INITIAL SIZE 0.
      data: wa_itab type COMP.
        data: wa_zdtg type typ_tgl1.
    IF  L_th_COMP[] IS INITIAL.
    ***Master Data Table
    SELECT CUSTOMER ACCNT_GRP FROM /BI0/PCUSTOMER APPENDING CORRESPONDING
    FIELDS OF TABLE L_th_COMP.
    sort L_th_COMP by CUSTOMER.
    ENDIF.
    LOOP AT L_th_COMP into wa_itab.
    select * from /BIC/AZDAFIAR000 into wa_zdtg
                        where DEBITOR  eq wa_itab-CUSTOMER.  *** SOURCE DSO Table
    IF SY-SUBRC = 0.
    wa_zdtg-ACCNT_GRP = wa_itab-ACCNT_GRP.
    MODIFY /BIC/AZDAFIAR000 from wa_zdtg. *** modify SOURCE DSO Table
    ENDIF.
      endselect.
        endloop.
    soniya kapoor

  • How system will automatically populate clearing date field for invoices paid similar to when payments are made to the vendors

    Hi SAP Gurus,
    Could you help me on this, How system will automatically populate clearing date field for invoices paid similar to when payments are made to the vendors.
    Regards
    Mohan

    Hi Ramakrishnappa,
    If you clear the invoice against payment, then the invoice clearing date would be payment document posting date.
    Regards,
    Mukthar

  • Customer Master Field for Customer Category

    Hi Experts,
    Are there any fields available for Customer Master Field for maintaince in the Customer - Basic Data Level? This is to Categorize the Customers regarding the Sales Report we customized.
    Thanks a lot!

    Hi,
    Use field Customer class/Industry sectors in MARKETING TAB under general data
    or use customer group in sales tab under sales area data
    kapil

  • Additional fields for line item display for Vendor Accounts

    Hi,
    The additional fields for line item display have been defined for the vendor accounts. I am able to see the additional fields in SAP 4.7 system but not in ECC 6.0.
    Could you help me to know how the same will be displayed in ECC 6.0 system.
    Thanks

    In SPRO, Vendor Accounts -> Line Items -> Display Line Items -> Define Additional fields for Line item display, the fields for Check number from (PAYR-CHECF) and Tax Jurisdiction (BSEG-TXJCD) have been defined.
    When I am executing Vendor Line Item display (FBL1N), I am not able to select these fields for defining a layout. Could you please let me know, how I will get these fields in FBL1N.
    Thanks

  • FBL1N - field for open item at key date

    Hi All,
    we are developing a customising report like FBL1N.
    for vendor open itesm, we have table BSIK. In that table, we could not find field for open items at key date.
    Could you please suggest which field we can use in table BSIK for that.
    Regards
    Deepak

    Hi
    You may find a list of some famous  tables on FI.. honestly i do not know which one is the required ? \\
    Accounting documents
        BKPF                Accounting documents
        BSEG               item level
        BSID                 Accounting: Secondary index for customers        
        BSIK                 Accounting: Secondary index for vendors          
        BSIM                 Secondary Index, Documents for Material          
        BSIP                 Index for vendor validation of double documents  
        BSIS                 Accounting: Secondary index for G/L accounts
        BSAD               Accounting: Index for customers (cleared items)
        BSAK                Accounting: Index for vendors (cleared items)  
        BSAS                Accounting: Index for G/L accounts (cleared items)
    Regards
    Mahmoud EL Nady

  • In a sales order, entering the cost center field for line items

    In a sales order, the cost center field for the tab 'account assignment' of line items is suppressed. Is there any possibilities to open the cost center field(for line items)?

    Hi kim,
    You can do this in Account Assignment Catagory..
    Hope this helps.
    Regards,
    Sree

  • Define Additional Fields for Line Item Display

    Dear gurus,
    I'd like to ask for your help again, please. I've just added the field BKPF-USNAM to the list of fields of FBL1N using IMG:" Financial Accounting-> Accounts Receivable and Accounts Payable->Vendor Accounts->Line Items-> Display Line Items->Define Additional Fields for Line Item Display". When I run the report the field is correctly displayed but if I save the current layout and set it into the selection screen, the column appears is blank. And if I open the change layout window and click OK the column gets filled.
    Is there another transaction that I must set new columns to FBL1N.
    Thank you very much.
    Paresh Jivani
    Edited by: Jivani Paresh on Jul 31, 2009 9:16 AM

    Hii,
    When you will execute FBL1N, it will come up in standard format. if you want to see any specific fields,then you have to go to Change Layout button and choose from available fields as per your requirement and then execute.
    For future reference, you can save this layout as a Variant and then you can directly execute that report using that variant.
    Dhara D.

  • End routine to populate Info-cube.

    Hi ,
    Is it possible to load fileds of a Info-cube using End routines in the following scenairos.
    1.Loading fields of info-cube by referencing/using a master data table in End routine.
    2.Loading fields of info-cube by referencing/using a DSO fields  in End routine.
    3.Loading fields of info-cube by referencing/using a fields of another info-cube in End routine.
    Please advise.

    Hi Stalin,
    Before answering your question you need to understand something about "End routine" and "Expert routine".
    End Routine:
    - Result_fields and Result_package are available
    - End routine contains only those fields available in Data target.
    Start Routine:
    - Source_fields and Source_package are available
    - Start routine contains only those fields coming from source.
    Expert Routine:
    -  Source_fields, Source_package, Result_fields and Result_package are available
    So Now if you want write code to look up into some other cube, in look up you may need to test condition using source fields, in that case " Expert Routine" is only the option.
    For Ex
    my data target contains : x,y and z fields (it becomes result_field)
    source contains : a field ( it becomes source_field)
    now if i want to write look up code like this " select x,y and z fields from other cube where my a field value = other cube a field value. here u r accessing both S_F as well as R_F. So only the option is "EXPERT ROUTINE"
    or else u want to write code only with R_F then "End routine " is enough.
    Thanks,
    Gowd

  • End Routine and test on a field not present in target system

    Hello,
    I find an issue in testing a field present in the ODS source system, using a Transformation.
    More exactly, I do not have a field that I need to test in my end routine because I can't find it in the RESULT_PACKAGE structure (because it is not present in the target Cube). In BW 3.x I solved this problem with an enhancement in the communication structure of my ODS and using a start routine.
    Any idea for a Transformation?
    Many thanks in advance for your kind support.
    Regards,
         Giovanni

    Hello and thanks for your reply.
    I have two conditions to implement.
    1) Fill some fields of the Cube, NON present in my ODS.
    2) Condition on one filed of my ODS (filed NON present in the Cube) for filling some field of the Cube.
    In my tys_SC_1 structure of the start routine I find all fields of my ODS and the fields that I need to check but I need to check this filed in one point of my process and set a filed in  my Cube (filed not present in my ODS), not present in the tys_SC_1 structure of the start routine.
    I hope to have described in a better way may issue.
    Any idea?
    Thanks.
          Giovanni

  • Using the end routine to populate the Cubes

    Hi BI Gurus,
    I am having following requirement:
    DSO: ZODS1  -
    > This DSO gets all the raw data from Source system.
    DSO:ZODS4   -
    >  Updates ZCUBE4
           ,ZODS5    -
    > Updates ZCUBE5
    there is no data flow between ZODS1 and  ZODS4
                                                     ZODS1  and  ZODS5
    I have added same new fields to ZODS1,ZCUBE4,ZCUBE5.
    So i want to populate fields of ZCUBE4,ZCUBE5.What is best possible way to do that without chaning ZODS4,ZODS5 structure?
    I am thinking to write an end routine ?Any idea if its possible?
    Also if possible can somebody sample code .
    Please help.

    Hi,
      U can populate ur new fields easily thorugh end routine in transformation ds04 to cube 4 ....
    Provided u can sufficient key in ds04 and which is the same key in ds01 to get the information of newly added fields in cube....
    please give ur fields and some sample data then it will be more clear ....
    but it can be achieved if u have necessary key fields in both dso's.
    Regards
    vamsi

  • How to populate custom table field value into standard DFF

    Hi Gurus
    I am newbie to the OAF
    I have a requirement to populate the custom table field value into standard DFF. we enabled the DFF in ReqDistDFFOnAcct(po_req_distributions_all). On the requisition tab as soon as i click on the checkout button, the custom field value has to be shown in the requisition distributions DFF field along with the standard Columns like charge account, percent, qty and when we click on the next button, it has to hit the base table ie., po_req_distributions_all.
    the standard columns data is showing the screen. how to acheive this requirement programatically
    There is a EO for the req distributions table. please help me how to achevie this requirement.
    Any help woud be greatly appreciated.
    Thank You!
    Krishna

    Thanks Aj. Finally i made some progress....but i am getting an error in the inst_top OPMN folder 10/10/08 15:37:14 Error: <connector name="OracleASjms" path="OracleASjms.rar" /> will not be bootstrapped since corresponding module declaration was not found in application.xml. I cleared the cache, bounced the webserver. Could not able to understand what is this error
    Following is the code that i have written. I am not able to find out what is the error. please help me how to fix this error. there is no changes in the page and the value is not auto populating. the page is having the normal behaviour as the standard one.
    Thanks in Advance for your help...
    public class xxCheckoutDistsCO extends CheckoutDistsCO
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    String UnitId="";
    //First get the Application Module
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    OAViewObject vo = (OAViewObject)am.findViewObject("PoRequisitionLinesVO");
    String Reqlineid="";
    String Linenum="";
    String DeliverLoc="";
    if(vo.first() !=null)
    Reqlineid= vo.first().getAttribute("RequisitionLineId").toString();
    Linenum = vo.first().getAttribute("LineNum").toString();
    DeliverLoc = vo.first().getAttribute("DeliverToLocationId").toString();
    // if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    // pageContext.writeDiagnostics("TEST >", Reqlineid,1);
    // pageContext.writeDiagnostics("TEST >", Linenum,2);
    // pageContext.writeDiagnostics("TEST >", DeliverLoc,3);
    UnitId=null;
    String Querry="select amli_icx_oaf_utils.get_blding_unit_id (?,?,?) from dual";
    try
    PreparedStatement ps=am.getOADBTransaction().getJdbcConnection().prepareStatement(Querry);
    ps.setInt(1,Integer.parseInt(Reqlineid));
    ps.setInt(2,Integer.parseInt(Linenum));
    ps.setInt(3,Integer.parseInt(DeliverLoc));
    ResultSet rs=ps.executeQuery();
    // ps.execute();
    // am.getOADBTransaction().commit();
    while (rs.next())
    System.out.println(" Query Results ");
    UnitId= rs.getString(1);
    System.out.println(" first > ");
    rs.close();
    ps.close();
    catch(SQLException a)
    System.out.println(" Error "+a);
    System.out.println(" Second > ");
    System.out.println(" Third > "); ----the program is executing upto here...it is not setting the value after this.
    OAViewObject povo = (OAViewObject)am.findViewObject("PoReqDistributionsVO");
    if(povo.getCurrentRow()!=null ) --------If i remove this condition i am getting the nullpointer exception in page.....
    System.out.println(" Fourth > ");
    povo.getCurrentRow().setAttribute("Attribute12",UnitId);
    // if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    // pageContext.writeDiagnostics("TEST >", UnitId, 1);
    Thanks
    krishna

  • How to populate customer specific field data in table /SAPAPO/ORDFLDS

    Dear Gurus,
    I have explained in detail about the problem we face. I guess persons who has implemented enhancement:  /SAPAPO/RRP_IO_COL in their system can help me out.
    Background:
    Purchase requisitions in APO is created by an idoc that comes from a legacy system using BAPI CALL FUNCTION 'BAPI_POSRVAPS_SAVEMULTI3'.
    Business Requirement:
    I have a business requirement where I need to populate an additional data 'Original delivery date' from the idoc during PR creation in Product view.
    Development:
    To achieve the above requirement, we are following the below procedure in our development system.
    1. We are using enhancement:  /SAPAPO/RRP_IO_COL, method: RRP_USEX_COLS_FILL_01 and RRP_USEX_COLS_GET_TEXT_01 to display an additional field 'Original delivery date' in /sapapo/rrp3 - elements view. This field is restricted to Purchase requisition (Order category: AG) only. We are planning to populate the additional data 'Original delivery date' in this customer specific field and store it in table: /SAPAPO/ORDFLDS at the time of PR creation.
    2. Table: /SAPAPO/ORDFLDS is appended with the 'customer specific field'.
    3. We couldnt find a document on how the data can be populated in table /SAPAPO/ORDFLDS.
    4. How to polulate the live cache data in the table  '/APAPO/ORDFLDS' ? ( i.e using connection parameter )?
    Appreciate if you can throw me some light on this.
    Thanks
    Vignesh M

    Hi Vignesh,
    ANy luck on this ? I am trying the almost same thing...and stuck at same point.
    Please let us know if you have any more information.

Maybe you are looking for

  • Image buttons won't go away

    Hi there I have created an up, down and over state for my image buttons and saved them into the Captivate "Gallery > Buttons" folder. Two odd things are happening: 1. When I delete the image files from the "Gallery > Buttons" folder the buttons do no

  • Itunes 11 unknown error

    if I want to login on itunes to buy something, I always get displayed an unknown error.

  • Badi triggered on po creation?

    hi experts, can anyone tell me which BADI is triggered when A PURCHASE ORDER is been created in tcode ME21N? thanks a lot. Moderator Message: Please search before posting. Thread locked. Edited by: Suhas Saha on Jan 2, 2012 12:23 PM

  • React on a transaction with user specific code

    Hello, I am new in the field of SAP development and I have some questions about the general strategy. It's the task to react on a transaction in SAP (an order generated by a user in the SAP system). After the order is done I have to control a Lego tr

  • Jars and .class files - security of the source code

    Hi, I have an app that is in a jar file with the .class files (so no source code). I'm wondering how difficult it is to attain the source code from these .class files in my jar? Looking through the contents of the .class files it seems there is a lar