ABAP DSO Lookup Routine

I am new to ABAP......
I am supposed to create a lookup into a DSO1 while loading data to DSO2.
I wrote the routine as shown below. But, my problem is that my routine is not fetching any data into the DSO that i am loading into.
Here is my routine
Start Routine
Global Declaration
DATA: ITAB TYPE STANDARD TABLE OF /BIC/AZVC_MAT00,
      WA_ITAB TYPE  /BIC/AZVC_MAT00.
SELECT   /BIC/ZVC_PLAN /BIC/ZVC_STYR  MATERIAL  /BIC/ZVC_BILN
FROM /BIC/AZVC_MAT00  INTO CORRESPONDING FIELDS OF TABLE ITAB
FOR ALL ENTRIES IN SOURCE_PACKAGE WHERE
/BIC/ZVC_PLAN = SOURCE_PACKAGE-PLAN1
    AND
/BIC/ZVC_STYR = SOURCE_PACKAGE-STORAGEYEARS.
   endif.
Field Routine
READ TABLE ITAB INTO WA_ITAB
     WITH KEY
     /BIC/ZVC_PLAN = SOURCE_FIELDS-PLAN1
      /BIC/ZVC_STYR = SOURCE_FIELDS-STORAGEYEARS.
     IF SY-SUBRC = 0.
     RESULT = WA_ITAB-/BIC/ZVC_BILN.
       ENDIF.
What am i doing wrong? Someone help me.
Also, there is data in the active table of the DSO i created lookup to.

Hi Phil,
I am transforming the whole code into end routine and see if that gives you correct output or not.
Declaration of internal table:
TYPES: BEGIN OF ST_TAB,
               /BIC/ZVC_PLAN TYPE  /BIC/OIZVC_PLAN,
               /BIC/ZVC_STYR TYPE  /BIC/OIZVC_STYR,
                MATERIAL         TYPE  /BI0/OIMATERIAL,              
              /BIC/ZVC_BILN   TYPE   /BIC/OIZVC_BILN,
              END OF ST_TAB.
DATA: ITAB TYPE STANDARD TABLE OF ST_TAB,
      WA_ITAB TYPE  ST_TAB.
SELECT   /BIC/ZVC_PLAN /BIC/ZVC_STYR  MATERIAL  /BIC/ZVC_BILN
FROM /BIC/AZVC_MAT00  INTO  TABLE ITAB
FOR ALL ENTRIES IN RESULT_PACKAGE WHERE
/BIC/ZVC_PLAN = RESULT_PACKAGE-PLAN1
    AND
/BIC/ZVC_STYR = RESULT_PACKAGE-STORAGEYEARS.
loop at RESULT_PACKAGE ASSIGNING <result_fields>.
READ TABLE ITAB INTO WA_ITAB
     WITH KEY
     /BIC/ZVC_PLAN = <RESULT_FIELDS>-PLAN1
      /BIC/ZVC_STYR = <RESULT_FIELDS>-STORAGEYEARS.
     IF SY-SUBRC = 0.
<RESULT_FIELDS>-INFOOBJECT = WA_ITAB-/BIC/ZVC_BILN.
       ENDIF.
ENDLOOP.
*INFOOBJECT- Name of the infoobject which you created to store the value from look up DSO.
Note: Please refer this help doc.Make sure you select that option so that the value gets populated for dso in case of end routine.
http://help.sap.com/saphelp_nw70ehp2/helpdata/en/48/6e375c0b104e6de10000000a421937/content.htm
Hope that helps.
Regards,
AL

Similar Messages

  • Abap error in Transformation Endroutine - DSO Lookup

    Hi,
    I am trying to populate Key figure field in transformation end routine but I got this error.
    I have used similar code to perform DSO lookup without getting errors
    E:Unknown column name  "X_COST" until runtime, you cannot specify a field list.
    Data rp TYPE tys_TG_1.
    LOOP AT RESULT_PACKAGE INTO rp.
    SELECT SINGLE X_COST FROM DSO_CADO00 INTO rp- X_COST
    WHERE X_MATID  EQ rp X_MATID.
    MODIFY RESULT_PACKAGE FROM rp.
    ENDLOOP.
    thanks

    Hi,
    Just realised that  I was using the wrong DSO to fetch the data.
    It has now been corrected and the code is working properly.
    thanks alot

  • Lookup routine problem

    Hi
        I have problem in Lookup routine in transformation.
    But need for some object which were not in Standard infocube 0sd_c03, i have created one customize Infocube ZSD_C03_1 where data have been coming from Standard 0SD_C03 infocube by Lookup Transformation routine & running full load DTP in Daily basis. It is working fn till today.
    But problem is that now size of data is very huge while full DTP run from 0sd_c03 to ZSD_C03_1. can any one give suggestion what should i do for only delta data come. lookup routine should update data in daily.plz help

    Hi
    In that case i would suggest you to have a DSO between the data loding process as your expectation cannot be met with data
    loading between cube to cube.
    Just create a standard DSo between the cubes and do the data loading so that the delta handling will be as per your
    expectation
    Prathish

  • Special chs in DSO expert routine

    Hello All,
    Data is being pulled from Transfer order DSO to GR DSO. The transformation uses a expert routine which pulls a field 'Requisitiner' from another DSO i.e. Purchase DSO.
    This expert routine brings invalid characters i.e. the field value which is in small letters.
    If I delete the request in GR DSO, I cannot edit the PSA and get the correct data, because basically the incorrect entries are coming from the expert routine.
    The real problem occurs when I try to activate data in GR DSO. The activation fails because of the requisitioner field value is in small letters.
    Do I have to make changes in the expert routine? OR is there another way to solve this.
    The loads are delta loads and requests from last 3-4 days have been failing to activate.
    Kindly inform.
    Regards,
    NK

    hi,
    use the ABAP statement convert to Upper case, or you can change the settings for the target infoobject (check the lowercase letter) in the Dev and transport it to the target system.
    Check with the users to see if they are ok with seeing lower case letters in the report, if yes then transporting the info object is a better option.
    regards,
    Arvind.

  • Problem in getting correct datain DSO although routine is working!

    I have two DSOs -DSO03 and DSO04 and in-between a transformation where a 0Order_Val field is getting calculated using the routine code as below:-
    IF ( COMM_STRUCTURE-PROCESSKEY = '001' or  
        COMM_STRUCTURE-PROCESSKEY = '011' or
        COMM_STRUCTURE-PROCESSKEY = '021' or
        COMM_STRUCTURE-PROCESSKEY = '004' or    
        COMM_STRUCTURE-PROCESSKEY = '014' or
        COMM_STRUCTURE-PROCESSKEY = '024' )
        AND COMM_STRUCTURE-BWAPPLNM EQ 'MM'
        AND COMM_STRUCTURE-ORDER_VAL <> 0.
        perFORM QUANTITY_CONVERT
           USING    COMM_STRUCTURE-ORDER_VAL
                    COMM_STRUCTURE-po_UNIT
                    COMM_STRUCTURE-base_uom
                    COMM_STRUCTURE-numerator
                    COMM_STRUCTURE-denomintr
           CHANGING RESULT.
    Problem:-
    For few doc numbers, the Quantity convert is fetching correct data, after applying the convert subroutine.
    But in some, (although it is not supposed to return 0 after applying the sub-routine of Quantity_Convert),
    it is showing wrong result as "0" in DSO04,
    (although there is value in DSO03 for the field 0Order_Val).
    Example:-
    Doc num       Field name                   DSO 3 Value           DSO4Value       Remarks
    4500000089  0Order_ Val                    3686.21                 3686.21           Correct
    4500000084  0Order_Val                      500000                        0               Wrong
    While trying to debug the ABAP routine through breakpoints, I have found that the result fetched is correct (i.e. 500000 for doc_num: 4500000084) but when displaying data in DSO04 it is showing "0".
    I have checked the input parameters and all are same.
    Only exception is difference in currency between the two records.
    One is USD (Doc num :4500000089) and the other is ESD (Doc num :4500000084).
    Although currency is not any input parameter.
    Also have tried Overwrite/summation setting in the Transformation but with no result.
    If anyone can indicate any solution to this peculiar problem then it will be very helpful.
    Regards,
    Ritu.
    email: [email protected]

    Hi,
    it is a bug in the Acrobat Reader. I had the same problem. Just add an input field called "myIndex" into the row and store there the current index when creating the line. With this solution you can programatically work with your own created index without the bug of the Acrobat Reader.
    Take care,
    Thomas

  • ABAP assistance - start routine logic in update rule

    I have used an existing update rule and have based my logic around the same.  The purpose of the rule is to look up customer master data and get a subset of customer numbers from the transaction records so that the values for customer number from the transactional data will not be updated if it does not match with existing master data customer numbers.
    The loads are full and we drop the data before we load.
    I have listed the logic below (the number at the front is to be considered as the line number) and a list of open questions that I have thereafter:
    Start routine logic:
    1  DATA: l_index LIKE sy-tabix.
    2  DATA: BEGIN OF ls_customer,
    3        customer TYPE /BI0/OICUSTOMER,
    4        objver TYPE RSOBJVERS,
    5     END OF ls_customer,
    6      lt_customer LIKE TABLE OF ls_customer.
    7  REFRESH: lt_customer.
    8  LOOP AT DATA_PACKAGE.
    all customers from data package
    9    ls_customer-custno = DATA_PACKAGE-custid.
    10  ls_customer-objver = 'A'
    11    APPEND ls_customer TO lt_customer.
    12   ENDLOOP.
    12  SORT lt_customer.
    13  DELETE ADJACENT DUPLICATES FROM lt_customer.
    14   IF NOT lt_customer[] IS INITIAL.
    15    SELECT /BI0/OICUSTOMER RSOBJVERS
    16      FROM /BI0/PCUSTOMER
    17      INTO CORRESPONDING FIELDS OF TABLE lt_customer
    18      FOR ALL ENTRIES IN lt_customer
    19      WHERE ls_customer-custno = DATA_PACKAGE-custid
    20      AND ls_customer-objver = 'A'
    21    SORT lt_customer BY customer ASCENDING                    
    22  ENDIF.
    Questions
    Line
    1 - what is the purpose of this line? What is it that is being declared
    2 - in some code I have seen this line with OCCURS 0 at the end what does this mean with and without the term?
    4 - I am using the Data Element name is this correct or should I use the field name?
    3 - 5 here I declare an internal structure/table is that correct?
    6 - here I declare a work area based on the internal table is that correct?
    7 - What would happen if I avoided using the REFRESH statement?
    8 - 12 - Is this syntactically correct, I am trying to get a set of data which is the customer numbers which match the master data customers and the master data record is án active version and than appendíng to the work area?
    13 - My understanding is this will reduce the number of records in the work area is this correct and needed?
    14 - 22 I am trying to identify my required set of data but feel I am repeating myself, could someone advise?
    Finally what logic would I actually need to write in the key figure object, could I use something like:
    Result = lt_customer.
    Thanks
    Edited by: Niten Shah on Jun 30, 2008 8:06 PM

    1. This line is not required
    2. OCCURS 0 is the OLD way of defining an internal table with that structure.  As it is, it just defines a flat structure.
    3. Data element is usually best
    3-5 Yes
    6. No.  Here you are declaring a table of the type of the flat structure.  Just as the ABAP says!
    7. Nothing.  But by putting this in, you ensure that you know the state of the table (empty) before you start looping through the data package
    8-12. You can tell if it is syntactically correct by pressing Ctrl-F2 when in the editor.  Looks ok.
    13. Ensures your list of customers contains no duplicated.  The code up to this point is building a list of all the unique customers in the data package.
    14-22. Goes to the database and brings back ONLY those customers which are found in the master data.  Looks ok.
    This is a start routine (that's why you've got a data package).  You don't use result.  You should update the datapackage.  But this you haven't done.  Double click on the table name /BIC/PCUSTOMER to get the correct field names.
    So you have to loop through the data package again, and check if the customer in the datapackage is lt_customer.  If it is, fine, otherwise you blank it and report an error, or set an error message or whatever.
    I wouldn't do it like this.  I'd do something like this:
    STATICS: st_customer TYPE HASHED TABLE OF TYPE /bi0/oicustomer
                                  WITH UNIQUE KEY TABLE_LINE.
    * st_customer retains its value between calls, so only populate if empty
    * In one run of the infopackage, this will mean you do only one read of
    * the master data, so very efficient.
    IF st_customer IS INITIAL.
      SELECT customer FROM /BI0/PCUSTOMER
                              INTO TABLE st_customer
                              WHERE objvers EQ 'A'. " Only active values
    ENDIF.
    * Go through data package
    LOOP AT DATA_PACKAGE.
    * Check whether the customer exists.
      READ TABLE st_customer TRANSPORTING NO FIELDS
                  WITH TABLE KEY table_line = DATA_PACKAGE-custid.
      CHECK sy-subrc IS NOT INITIAL.
    * If you get here, the customer isn't valid.  So I'm just setting it blank
      CLEAR DATA_PACKAGE-custid.
      MODIFY DATA_PACKAGE. " Updates the datapackage record
    ENDLOOP.
    Even this is not fully optimised, but it's not bad.
    I strongly suggest that you get yourself sent on the basic ABAP programming course if you're going to do a lot of this.  Otherwise, read the ABAP documentation in the help.sap.com, and, from the editor, get the cursor on each ABAP keyword and press F1 to read the ABAP help.
    matt

  • Need ABAP code for Routine

    Hi Gurus My requirement goes like this.
                                  I need to write the routine in Transformation from DSO to DSO
    Source table
    Doc         Amt         Netduedate      Reference Doc
    1000      10000     01.01.2010        
    1500       5000      30.01.2010        1000
    1700       3000      02.02.2010        1000  
    In the Above table 1st document is Invoice Document, 2nd and 3rd are Partial Payment Document.
    My requirement is 2nd and 3rd record Netduedate value should have 01.01.2010 by referring reference Doc field, for the above Ex We should have the output like this
    Target table
    Doc         Amt         Netduedate      Reference Doc
    1000      10000     01.01.2010        
    1500       5000      01.01.2010        1000
    1700       3000      01.01.2010        1000  
    Please give me the syntax code and where to write the code ie in the start routine or in the field routine. the dataflow is between one DSO to Another DSO
    Please Provide me the solution ASAP as this is very Urgency.
    Thanks in Advance

    If suppose your documents are being loaded in same load,
    1. start routine - create internal table like SOURCE_PACKAGE
    DATA IT_SOURCE_PACKAGE TYPE TABLE OF SOURCE_PACKAGE.
    DATA WA_SOURCE_PACKAGE LIKE LINE OF SOURCE_PACKAGE.
    2. copy all records to new internal table, IT_SOURCE_PACKAGE[] = SOURCE_PACKAGE[]
    3. delete partial docs, DELETE IT_SOURCE_PACKAGE WHERE REF_DOC IS NOT INITIAL.
    4. Sort internal table SORT IT_SOURCE_PACKAGE BY DOC
    5. Look for original doc inside loop.
    LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS> WHERE REF_DOC IS NOT INITIAL.
    READ TABLE IT_SOURCE_PACKAGE 
          INTO WA_SOURCE_PACKAGE
          WITH KEY DOC = <SOURCE_FIELDS>-REF_DOC  BINARY SEARCH.
    IF SYSUBRC EQ 0.
      <SOURCE_FIELDS>-NDUEDATE = WA_SOURCE_PACKAGE -NDUEDATE.
    ENDIF.
    ENDLOOP.
    If the original documents are found in different loads in the source DSO, we need to pull the records from active table of the target DSO after step 2.
    -Jijo

  • DSO Lookup - Cannot get correct result

    Hi
    I have a requirement to create new report that will contain the following PO quantity , PO quantity received in time and PO quantity received late.
    I have identified in 2LIS_02_SCL DS that ProcessKey 001 is for PO quantity and ProcessKey 002 is the goods receipts (BWMNG-> CPQUAOU) while (DBWMNG-> CPDEOGQUOU) is for delta change
    The data is now in DSO but  I would like to have them in Cube
    Steps I have taken
    -     I have Created new Inobject ZPO_QUANTITY and ZPO_QTY_REC
    -     Added this infoobjects to the cube
    I wrote this code in END ROUTINE when loading from  DSO to the cube but I am not getting the required result. Instead  I get same values e.g 2  for all PO document numbers even though the values are different.
    u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026
    DATA: rp TYPE tys_tg_1.
    LOOP AT RESULT_PACKAGE INTO rp.
    SELECT SINGLE CPQUAOU FROM /BIC/APMMSC00 into rp-/BIC/ ZPO_QUANTITY
    WHERE PROCESSKEY = 001.
    MODIFY RESULT_PACKAGE FROM rp.
    ENDLOOP.
    u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026u2026
    Please whats wrong with my code and I can I achieve the result
    thanks

    Hello Vamsi and Mansi,
    thanks alot guys. Unfortunately I don't get correct result for all PO Documents
    I am trying to extract only CPQUAOU from DSO but not getting same in Infocube
    This is the code
    DOC_NUM    PROCESSKEY PSTNG_DATE MATERIAL           SCL_DELDAT COMPL_DEL CPQUAOU
    4500000118 001        00.00.0000 000000000500024490 18.05.2009                           12,000
    4500000118 002        18.05.2009 000000000500024490 18.05.2009                           10,000
    4500000119 011        00.00.0000 000000000400000023 18.05.2009                          100,000
    4500000120 001        00.00.0000 000000000500024490 18.05.2009                           20,000
    4500000120 002        21.05.2009 000000000500024490 18.05.2009 X                         20,000
    4500000121 002        18.05.2009 000000000500024490 18.05.2009 X                         10,000
    4500000121 001        00.00.0000 000000000500024490 18.05.2009                           10,000
    4500000122 001        00.00.0000 000000000500024490 18.05.2009                            4,000
    4500000122 002        24.05.2009 000000000500024490 18.05.2009 X                          4,000
    4500000123 011        00.00.0000 000000000400000026 18.05.2009                            4,000
    4500000124 001        00.00.0000 000000000500024490 18.05.2009                            5,000
    4500000124 002        25.05.2009 000000000500024490 18.05.2009 X                          5,000
    4500000125 011        00.00.0000 000000000400000026 18.05.2009                            2,000
    DATA: rp TYPE tys_tg_1.
    LOOP AT RESULT_PACKAGE INTO rp.
    SELECT SINGLE CPQUAOU FROM /BIC/AMOMMSC00 into rp-/BIC/ZPO_QTY
    WHERE DOC_NUM = rp-DOC_NUM AND PROCESSKEY = 001.
    *Deriving PO Quantity received in time based on posting date, planned
    *delivery date and delivery completed flag
    SELECT SINGLE CPQUAOU FROM /BIC/AMOMMSC00 into rp-/BIC/ZPO_REC
    WHERE DOC_NUM = rp-DOC_NUM AND PROCESSKEY = 002 AND COMPL_DEL = 'X' AND
    PSTNG_DATE <= rp-SCL_DELDAT.
    if sy-subrc = 0.
    MODIFY RESULT_PACKAGE FROM rp.
    endif.
    clear rp.
    ENDLOOP.
    Thanks alot

  • Writing ABAP code in routine

    hi all,
    actually we r loading data from flat file to the cube.in that flat file,there was a column x. under that clumn there are 2 repeated values A & B. in this case we have to tell the system that to pick only A under that X column. plz tell me the code and where to put that code in transfer rules
    thanks in advance,
    jack

    Hi Jack,
    You can use the following piece of code
    if tran_structure-columnX = 'A'.
    result = tran_structure-columnX.
    endif.
    u can put this routine code in the transfer rule for column X in the transfer rules tab.While creating the routine choose the 'column X' as source field.
    Alternatively u can do it at the update rule level as well.
    Hope it helps.
    Regards,
    Rathy

  • ODS Lookup Routine

    Hi Guys,
    I am using BI 7.0.
    My cube has 0material, 0salesorg, 0DISTR_CHAN,0rebate_grp and other characteristics. I have an ODS with 0material, 0salesorg, 0DISTR_CHAN,0rebate_grp only. I want to populate the 0rebate_grp data in the cube from the ods where 0material, 0salesorg, 0DISTR_CHAN are the key fields in the ODS.
    Do you think this can be done through direct mapping or i would need code. If code is needed, thanks for code samples.

    If 0rebate_grp data is present in ODS (key field or data field does not matter) than you can use direct mapping.
    You need to use routine only when field is not present in the source or you need to do some extra calcuation on the source field

  • Error - InfoObject cannot be used to read master data

    Hi All,
    We am working on mapping objects in a transformation, on some of the transformation I am using the master data attribute to fill the infoobject.  In some cases the mapping happens without incident but in others we are getting the following error
    InfoObject  cannot be used to read master data
    Inside the long text of the message it says:
    InfoObject  does not have the correct attributes to be used to read master data for the target field
    The object is one of the master data attributes, so we are not sure why we are recieving this error?
    We have recieved it with 0COMP_CODE trying to load Fiscal Year Variant and with a non standard enhanced object ZMATERIAL which is a copy of 0MATERIAL with added attributes for Product Class, Product Group and Product Line wich come from the product hierarchy and are populated on the load of the material from product hierarchy.
    Has anyone else had an issue with this error and can you tell us how you fixed it???
    Thank you!
    Caroline

    You received this error for loading 0FISCVARNT (Fiscal Year Variant) because that InfoObject isn't an attribute of 0COMP_CODE (Company Code) and it cannot therefore determine what data to populate based on your input. Instead of using 0COMP_CODE, you may have to enter a constant value for the Fiscal Year Variant if you don't have it in your source InfoProvider.
    When you created ZMATERIAL, did you use 0MATERIAL as a reference so that it would inherit the attributes and texts? If so, Product Class, Product Group and Product Line would have to be attributes of 0MATERIAL. If you didn't reference 0MATERIAL and are loading attributes directly to the custom InfoObject attributes, then Product Class, Product Group and Product Line would have to be attributes in ZMATERIAL in order to use the Use Master Data function for transformations. You may have to derive the values for these different, such as add ABAP for lookup routines.

  • LOOKUP-Master Data Attribute (ABAP Code)

    Hi,
    My requirment
    ZCOMPANY is an attribute of ZCostcenter
    ZCost center is an attribute ZEMPLOYEE
    zcomp is an attribute of employee
    While Loading attribute data to employee i need to write Lookup/routine in transformations that will
    Based on ZCOSTCENTER data of an employee i has to read setup tables in BW and update ZCOMP of an employee(attribute) from ZCOMPANY  of ZCostcenter
    Please update me with the ABAP Code
    Thanks in advance

    Hi,
    This is the routine written in transformations.
    My requirment is to modify this a bit to include following conditions
    1)source_fields-costcenter
    (It needs to be converted to CAPS)(Bcaz ZCOSTCENTER consists all the caps)
    2)I want to include 'OBJVERS'='A' in the code
    Please update me with the code
    select /bic/zcompany from /bic/mzcostcenter
    into result
    where zcostcenter = source_fields-costcenter.
    end select.
    Thanks

  • ABAP Routine  for 0FISCPER  slect options in InfoPackage

    Hi,
    I am trying to write an ABAP Routine for 0FISCPER as select options (range) dynamically.
    Ex:
    0FISCPER selection for this year as 001.2008 to 012.2008
    0FISCPER selection for next year as 001.2009 to 012.2009.
    Now  we are changing InfoPackage every year manually, so I need to write a routine for 0FISCPER in InfoPackage to handle dynamically every year
    Thanks,
    SK.

    Hi
    write an ABAP routine to get that value..But are you getting any planned data(why you want till end of the year...till infopackage runs is o.k i think, if you don't have planned data)...Any way you can check the below code, which can be useful...
    You can see the below code at->your infopackage selections>Ty-->choose variable type as 6 and enter any ABAP routine name( to create) and then there is a button on the application tool bar called 'routine info'..this give you the following information...
    Definition
    You can define complex selections for InfoPackages and control the automatic deletion of requests from InfoCubes in the scheduler, by using routines.
    Routines are processing blocks in ABAP programs that consist of a pre-defined data declaration section and an ABAP subroutine (form routine). In the subroutine you can use all of the ABAP programming functions.
    You can use the following routines for making selections in InfoPackages:
    1. Selection routines for fields, on the Data Selection tab page
    2. Selection routines for file names, on the External Data tab page
    3. Selection Routines for selecting the from and to dates for time-dependent data, on tab page Update
    4. Selection routines for determining old requests to be deleted after successfully loading a new request, on the Data Target tab page
    Program frame:
    After you have called up the Editor for routine maintenance, you get the following program frame:
    1. Selection routines for fields, on tab page Data Selection:
    program conversion_routine.
    '$*$ begin of global - insert your declaration only below this line -
    TABLES: ...
    DATA:   ...
    $$ end of global - insert your declaration only before this line    -
    FORM COMPUTE_<Fieldname>
      tables l_t_range structure rssdlrange
      changing p_subrc like sy-subrc.
    $$ begin of routine - insert your code only below this line       -
      data: l_idx like sy-tabix.
            read table l_t_range with key
                 fieldname = <Fieldname>.
            l_idx = sy-tabix.
            modify l_t_range index l_idx.
            p_subrc = 0.
    $$ end of routine - insert your code only before this line       -
    ENDFORM.
    2. Selection routines for file names, on tabstrip External Data:
    FORM compute_flat_file_filename
         changing p_filename like rsldpsel-filename
              p_subrc like sy-subrc.
    $$ begin of routine - insert your code only below this line-
              p_filename =
              p_subrc = 0.
    $$ end of routine - insert your code only before this line-
    ENDFORM.
    3. Selection routines for selecting the from and to date for time-dependent data, on tabstrip Update:
    form compute_time_dependent_dates
         changing p_datefrom type d
                  p_dateto   type d
               p_subrc like sy-subrc.
    $$ begin of routine - insert your code only below this line-
              p_datefrom =
              p_dateto   =
              p_subrc = 0.
    $$ end of routine - insert your code only before this line-
    ENDFORM.
    4. Routines for determining the old requests to be deleted after successfully loading a new request, on tab page Data Targets:
    form compute_<InfoCube-Name>
      tables l_t_request_to_delete structure rsreqdelstruc
      using l_request like rsreqdone-rnr
      changing p_subrc like sy-subrc.
    *Insert Source Code to decide if requests should be deleted.
    *All Requests in table l_t_request_to_delete will be deleted
    *from Infocube <InfoCube-Name>.
    *Add new requests if you want to delete more (from this cube).
    *Remove requests you did not want to be deleted.
    $$ begin of routine - insert your code only below this line-
         loop at l_t_request_to_delete.
         endloop.
         clear p_subrc.
    $$ end of routine - insert your code only before this line-
    ENDFORM.
    Note:
    Those fields flagged with <...> are dependent on the selection fields and are filled automatically by the system when you call up the Editor.
    Procedure
    Make the following entries:
    1. Between $$ begin of global ... and $$ end of global ... you can define data declarations. These are the declaration sections for the local data in the routine. This data is only visible in the routines.
    2. The subroutines begin with FORM and end with ENDFORM.
    The subroutines for the particular routines are:
    Selection routines for fields on tab page Data Selection: FORM COMPUTE_<Field name>
    Selection routines for file names on tab page External Data : FORM compute_flat_file_filename
    Selection routines for selecting the from and to dates for time-dependent data on tab page Update: FORM compute_time_dependent_dates
    Routines for determining old requests to be deleted after successfully loading a new request on tab page Data Target: FORM COMPUTE_<InfoCube-Name>
    The subprograms have the following parameters:
    Subprogram FORM COMPUTE_<Field name>:
    l_t_range
    In the table l_t_range the routines for all selection fields that are filled, or have a routine, are made available.
    The routines are executed in the scheduler last of all and therefore, you can change all the selections that you have carried out previously.
    p_subrc
    Using the variable p_subrc you can report errors to the scheduler. p_subrc <> 0 signals an error and means the data request is terminated.
    Subprogram FORM compute_flat_file_filename:
    p_filename:
    You give the name of the file that is to be loaded in parameter p_filename.
    This is useful if your file name contains date dependencies that should be determined by sy-datum and calculated during runtime.
    p_subrc
    You can inform the scheduler of an error with variable p_subrc. p_subrc <> 0 signals an error and means that the data request is terminated.
    Subprogram FORM compute_time_dependent_dates:
    p_datefrom and p_dateto
    Fill these parameters with the from and to dates for time-dependent master data and texts.
    p_subrc
    You can inform the scheduler about an error using variable >LS>p_subrc. p_subrc <> 0 signals an error and means the data request is terminated.
    Subprogram FORM COMPUTE_<InfoCube-Name>:
    l_t_request_to_delete
    You give the request number of the request that is to be deleted in parameter l_t_request_to_delete. You can also delete requests from the table. These are then not deleted.
    p_subrc
    You can inform the scheduler about an error with the variable p_subrc. p_subrc  signals an error and means the data request is terminated.
    3. Insert your program code for the routines between $$ begin of routine ... and $$ end of routine ... so that the respective subprogram variables are supplied with the corresponding values.
    4. Check the syntax of your routine with the Check function.
    5. You can then transfer the routine with the Save function.
    You end routine maintenance when you exit the Editor.
    Hope it helps
    Thanks,
    Teja

  • Thumbrule for Start/End Routines Usage

    Friends,
                 Is there any thumb rule to decide when to use start or end routine in BW 7 in transformations ?  Can anybody provide a scenario for demonstration .. from performing simple lookups on different DSOs to get descriptions vs any other specific scenarios..   Is there any scenario in which only start or only end routine can be performed.. ?
    Any thoughts would be great..?
    thanks,
    Sunil

    Start routine is totally concerned with source data , where you need to write logic for source_package.
    Start routine will execute before transformation execution.
    Executes packageby package.
    loop at source_package into source-feilds.
    End routine works on target structure  and we have lo write logic on result_package.
    Genarally dso lookups are concerned with end routines.
    loop at result_package into result-feilds.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/609eea32-455e-2c10-c08a-c23adf8c934e
    http://forums.sdn.sap.com/thread.jspa?threadID=1963087
    Regards,
    rvc

  • Lookup and a return table

    1.0 what's a lookup and a return table,  are they same thing?
    2.0 how do you create it?
    thanks

    Hi,
    a lookup table to enhance your data while loading. For instance you load sales in a cube and your source is providing the site and you require to post the Sale Organization.
    In a start routine (Ttransfer or Update rules) you fill via ABAP a lookup table having the relation site to Sales Org.
    In the sales org routine you read this lookup table with the key site and post the corresponding sales org in your IObj.
    The return table functionality in update rules:
    Imagine you are loading sales in a KF in a cube. Your requirement is have a year to date key figure stored as well in your cube.
    So you load sales for January, posted to period JAN.
    You would need to post this record for next 11 months as well in order to able to see YTD sales correctly when you select period FEB.
    The return table enables you to post many records from 1 loaded records.
    The lookup tables are created as internal table via ABAP in start routines
    The return table is located in an update routine for a particular key figure and you use ABAP as well
    Hoping this will answer your enquiries
    Olivier.

Maybe you are looking for