Routine in Infopackage data selection doesnt give appropriate results...

Hi Gurus,
I need to pull data into PSA (BW 3.5) based on a certain selections in the Infopackage. Selection is based on specific values of Infoobject 0PLANT , however, as these values are multiple and do not fall in a specific range I have written a routine to derive these values.
The routine  does the following steps :
- creates an internal table from /bio/mplant and deletes the plant values that I do not wish to consider in the extraction.
- delete data from l_t_range for fieldname = 'PLANT'
- Appends data from the internal table to l_t_range.
However, when I execute the infopackage, the extraction is done for ALL the 0PLANT values i.e it includes the data for 0PLANT value which have been delete from the internal table.
My routine is :
$$ end of global - insert your declaration only before this line   -
    InfoObject      = 0PLANT
    Fieldname       = PLANT
    data type       = CHAR
    length          = 000004
    convexit        =
form compute_PLANT
  tables   l_t_range      structure rssdlrange
  using    p_infopackage  type rslogdpid
           p_fieldname    type rsfnm
  changing p_subrc        like sy-subrc.
      Insert source code to current selection field
$$ begin of routine - insert your code only below this line        -
TYPES ls_range like l_t_range.
data: l_idx like sy-tabix.
DATA: lt_plant like /bi0/mplant OCCURS 0 with header line.
          SELECT PLANT from /bi0/mplant into lt_Plant WHERE objvers = 'A
          ENDSELECT.
          delete lt_plant WHERE plant = 'W206'.
          delete lt_plant WHERE plant = 'WF11'.
          delete lt_plant WHERE plant = 'W945'.
          DELETE lt_plant WHERE plant = 'W530'.
          read table l_t_range with key
               fieldname = 'PLANT'.
          l_idx = sy-tabix.
          DELETE l_t_range where fieldname = 'PLANT'.
          Loop at lt_plant.
                l_t_range-sign = 'I' .
                l_t_range-low = lt_plant-plant.
                l_t_range-OPTION = 'EQ'.
                append l_t_range.
          endloop.
          modify l_t_range index l_idx.
          p_subrc = 0.
$$ end of routine - insert your code only before this line         -
endform.
Any bugs in the routines ?

try this one:
Loop at lt_plant.
if lt_plant-plant ne 'WF11' or lt_plant-plant ne 'W945' or lt_plant-plant ne 'W530'.
l_t_range-sign = 'I' .
l_t_range-low = lt_plant-plant.
l_t_range-OPTION = 'EQ'.
append l_t_range.
endif.
endloop.
or
don't use a table with header ( use a standard table and use a work area to access the table ) and do an other select like this:
SELECT PLANT from /bi0/mplant
into corresponding fields of table lt_Plant
WHERE objvers = 'A
and plant ne 'WF11'
and plant ne 'W945'
and plant ne 'W530'.
I hope it helps...
Kind regard.
Tobias
Edited by: Tobias Kreuser on Aug 23, 2010 11:34 AM

Similar Messages

  • Routine in Infopackage Data selection Tab

    HI,
    I am having one InfoObject (marital staus) in InfoPackage Data selection Tab.
    Now I want to write a ABAP routine for that infoObject in Infopackage to select only those records of  marital status = ‘SINGLE’.
        I am new to ABAP . please let me know what code should I write in this routine.

    Hi Kris,
    You would do it like this:
    data: l_idx like sy-tabix.
              read table l_t_range with key
                   fieldname = 'MARITAL_STATUS'.
              l_idx = sy-tabix.
              move: 'I'      to l_t_range-sign,
                    'EQ'     to l_t_range-option,
                    'SINGLE' to l_t_range-low.
              modify l_t_range index l_idx.
    Thanks,
    Joseph

  • How to debug a ABAP Routine which is in Infopackage Data selection Tab

    Hi ,
       Please let me know How to debug a ABAP Routine which is in Infopackage Data selection Tab.

    Hi,
    You can try to create infinite loop:
    DATA: STOP.
    WHILE STOP IS INITIAL. ENDWHILE.
    Start InfoPackage and then go to SM50 and swich on debugging for your process. Then in debugger you can change value of STOP variable to skip the loop.
    Krzys

  • Infopackage Data Selection Problem

    Hi All,
    When i load master data from source system, in Infopackage data selection tab i give some criteria (e.g Customer number = 1000) But in infopackage the data load with all customer.(Not only 1000)
    How can i solve this problem??

    Hello Ozan,  
    Please check the datasource in RSA3 and make sure that its working for the same selection.
    Is there any routine in your infopackage and what is your source system?
    [Thanks|http://chandranonline.blogspot.com/]
    [Chandran|http://chandranonline.blogspot.com/]

  • Abap routing in infopackage data selection

    Hi guys
    I'm using an ABAP routin for the Data selection in my infopackage. I want to fetch all the records which is having value Less than 'IN14' for company code.I have modifuied the l_t_range as shown
              l_t_range-sign = 'I'.
              l_t_range-option = 'LT'.
              l_t_range-low = 'IN14'.
              modify l_t_range index l_idx.
    But while executing, its giving the followinf error message.
    "For sel. field 'COMP_CODE', no selection with SIGN = 'I'; OPTION 'LT' allowed"
    Does anybody knows what should be done for this?
    Regards
    Sriram

    Hi Sriram,
    Instead use an OLAP variable to achieve the results you want.
    But first check what are the selection oprions supported by your data source in the table <b>ROOSFIELD</b> in your source system.
    Bye
    Dinesh
    Message was edited by: Dinesh Lalchand
    Message was edited by: Dinesh Lalchand

  • Filed not reflecting in infopackage data selection screen

    Hello Gurus,
    I have added a time stamp fiield in generic datasource in R3 and selected that field,but when i replicate the data source in BI and go to infopackage data selection screen,i dont see that field.I tried all the possible things but its not working.
    Please help me.
    Thanks in advance.
    Regards,

    Hi,
    Did you select that  Time stamp field as Selection field in RSA6? If not then select it as selection field and activate and then replicate the DS in BW and then check if that comes in Infopackage level.
    Hope this helps..
    Murali

  • Several single value selection in InfoPackage Data selection using Routine

    Hi,
    I am trying to extract data from a table(containing Ticket data) in R/3 using Generic extractor with table. As the table is not supporting the delta functionality i have to do daily full load for more than 5 lak records.
    I dont want all the tickets from R/3, i just need the tickets which are open. Unfortunately there is no field in R/3 table which indicates Ticket status. But in BW i have a DSO where i can get the tickets along with their status.
    Now what i want to do is:
    in the Infopackage i want to give the dataselection for ticket, whose status is open which will be calculated in ABAP code by lookup to the DSO. Is this possible?
    I know that in ABAP routine for Data selection we can give single values and range values. but here i just want to give several single values. That means if suppose i have 4 tickets T1,T2,T3,T4 in the DSO and if T1 and T4 are open tickets, then i have to get the data from R/3 just for T1 and T4.
    in the above case if we use range then the low and high values in the range will be T1 and T4 respectively and the data pulled from R/3 will be from T1 - T4 ie all T1,T2,T3 & T4. but i need just T1 and T4.
    Please share your ideas. also please send the code as i am not an ABAPer.
    If Several single value selection is not possible at least send the code for the range values.
    Thanks,
    Cnu.

    you can write a code like this in the ABAP routine in data selection in front of ticket characteristic
    types: Begin of s_ticket,
         ticket type <type of ticket characterisitcs>,
          End of s_ticket.
    data: l_idx like sy-tabix,
          wa_ticket type s_ticket,
          it_ticket type standard table of s_ticket,
          l_s_range type rsrdrange.
    You can declare
    read table l_t_range with key
         fieldname = '<your field name for ticket>'.
    l_s_range-infoobject = '<infoobject name>'.
    l_s_range-fieldname = '<field name of ticket cahracteristics>'.
    l_s_range-sign = 'I'.
    l_s_range-option = 'EQ'.
    select * from <ODS active table> into table it_ticket where status = <value for open status>.
    if sy-subrc = 0.
         loop at it_ticket into wa-ticket.
              l_s_range-low = wa_ticket-ticket.
              append l_s_range to l_t_range.
         endloop.
    end if.
    p_subrc = 0.
    you need to modify it as per your requirements, i hope this might help you.

  • ABAP Routine in the Infopackage data selection

    All,
    I have requirement where i need to write a routine on a Date field(Activity Year Month) which has to return values from the first to the last day of the Previous month in the data selection of the infopackage.
    I know that on Date there is a STD that can be used but my requirement is on Year Month.
    there are 3 vartypes available
    5. free temporal selection
    6. ABAP routine
    7. OLAP variable
    when i pick ABAP routine it asks me to create a routine i need some help with the code here
    Can someone help.
    Thanks

    Hi there
    If the Data field is 0FISCPER you can use the OLAP variable 0P_PRFP1. If you have developed the field yourself i think you need to write code. The code could look something like this.
    DATA:  sysdat TYPE d.
      sysdat = sy-datum.
      sysdat4(2) = sysdat4(2) - 1.
      IF sysdat+4(2) = '0'.
        sysdat+4(2) = '12'.
        sysdat(4) = sysdat(4) - 1.
      ENDIF.
      CONCATENATE sysdat(4) '0' sysdat+4(2) INTO l_t_range-low.
      MODIFY l_t_range INDEX l_idx.
      p_subrc = 0.
    This code returns the previous months as a single value.
    Chris

  • Routine in infopackage for selection

    I am writing an ABAP routine in an infopackage to select data upto a certain year. I want to load data for all the years upto 7 years ago. However, if I leave the l_t_range-low blank, the infopackage throws an error when I run it saying invalid date range. What's the right way to assign the low value?
    l_year = sy-datum(4) - 4.
    l_t_range-sign    = 'I'.
    l_t_range-option  = 'BT'.
    l_t_range-low     = ''.
    l_t_range-high = l_year.
    modify l_t_range index l_idx.

    Hi Uday
    Add l_t_range-low = sy-datum(4). Also i see that in l_year you have defined it as sy-datum(4) - 4. So you are only picking latest 4 years. Please change it to 7 if you want the latest 7 yrs.
    Regards,

  • ABAP Routine in InfoPackage for selection

    Hello,
    I have 2 InfoPackages for loading from ODS1 to ODS2. InfoPackage 1 is restricted via ABAP Routine to load only certain customer numbers.
    InfoPackage 2 is supposed to load all other customer numbers - therefore the ABAP Routine makes ranges that exclude the customer numbers selected in InfoPackage 1.
    Now I face the fact that the selection of InfoPackage 2 is much to small in numbers. Problem is, the ranges only work when entered manually - but via ABAP entry these ranges don`t work. I can`t understand why this problem happens. Do you have an idea?
    Example (first number is from, 2nd number is to)
    InfoPackage 1:       customer numbers     
    5| 5
    100|100
    999|999
    InfoPackage 2: customer numbers
    0|4
    4|99
    101|998
    1000|99999
    But selection of InfoPackage 2 does not work propberly...
                                                                                    Thanks for your help,
    Angelika

    Hi,
    no, that was just a typing mistake. Sorry.
    The problem is, that in Monitoring I can see the selection and it looks good.
    But when I check the number of datasets selected it is far to small. Therefore I don`t believe the selection works.
    I tried manually to put all the ranges selected by ABAP Routine in InfoPackage 2 in another InfoPackage 3 - the selection is identically to InfoPackage 2 (but not made via ABAP, but manually) and in Monitoring the selection looks absolutly alike.
    But the manuall InfoPackage 3 selects far more records than InfoPackage 2.
    I can`t understand the problem. Can you? Can you give me advice?
    Thanks,
    Angelika

  • Special Characters in InfoPackage Data Selection

    Hi Experts,
    Is it possible to include special key such as * in the data selection tab in the infoPackage? e.g. *AB
    I have created a custom DataSource to extract all work order with costs data.
    However we only need work order data with revision number that finishes with 'AB' for reporting. (if I do not apply this selection, extracted data will be too big).
    i.e.
        REVNR
        00000012AB --> to be included in extraction
        00000231AB --> to be included in extraction
        00012322AB --> to be included in extraction
        Y07WK06    --> excludes this record
        00000007AB --> to be included in extraction
    Can this be achieve by using '*AB' in the data selection screen?
    Currently, SELOPTS of custom DataSource is been set to '0'. (where can I change this SELOPTS value to something else?)
    If special key is not allowed in the data selection screen, can you suggest any alternative solution?
    Kind regards,
    Steve

    Hi steven,
       Yes you can do this one at info package level by selecting the ABAP Coding at Type (variable change for selective values) at selection tab of info package.
      Here you need write ABAP coding according to your business requirements….
      or
      You can drop unnecessary data at update routine.
    Regards,
    PRK
    Message was edited by: PRK

  • InfoPackage Data Selection ignored

    Hi
    I have a weird issue that I hope someone can advise me on.  I have created an identical generic datasource based on table USR02 in our CRM, R/3 and BW systems.  Then in BW I have 3 InfoPackages (one for each datasource) with identical data selections.  For the InfoPackages using the CRM and R/3 datasources I get exactly the records I expect but for the BW InfoPackage I get all records irrespective of the data selections!?
    Why are the data selections ignored for the InfoPackage using the BW source system - any ideas? 
    Thanks
    Gareth

    To All
    Finally found the problem.  Basically the datasource in BW had the 'Field only known in customer exit' checkbox checked for the TRDAT field.  I hadn't set this - the system did and would not allow be to change it.  However I found SAP note 895801DataSource fields are interpreted as customer fields which seemed to suggest that this was the real problem.
    I applied the note and re-created the datasource and it now work as expected.
    Regards
    Gareth

  • InfoPackage Data Selection disappear when INIT

    Hi All,
    Just wondering if anyone faced this issue before and/or has a solution.
    I have an infopackage that is loading from an ODS to an InfoCube. The ODS has close to 20 million records.
    When I do a FULL UPDATE, i am able to use the Data Selection tabe to only filter certain criteria to be pulled over to my Cube.
    However, when i try to select and do an INIT, all the fields in my DataSelection tab disappears. and i am forced to load all 20 million records from the ODS.
    Appreciate any input or feedback.
    Regards,
    Gary.

    oh i see...
    i thought otherwise as in the F1  for the init without data transfer, this is what is mentioned...
    "If the delta process has not yet been initialized, but you want to test the delta upload, you have the option of simulating the initialization.
    This runs the help entries in all the required tables in BW and in the source system, without loading any data from the source system.
    In the monitor, you get a message telling you that a record has been loaded. The initialization-simulation request appears in all the data targets in which an update has taken place. However, this request contains only help entries. The simulation does not update any data in the data targets.
    Dependencies
    After you have tested the delta upload in this way, initialize the delta process"

  • Infopackage data selection & deltas

    Hi BW Experts,
    I have a few questions about infopackage and delta loads:
    1) How to perform mulitiple data selection.  e.g. company codes 1000, 1001 and 5000?  I can't filter by From To data selection since I do not want to include companies 2000, 3000, etc. 
    2) How to perfrom delta loads for just the company codes 1000, 1001, etc.?
    I would appreciate any suggestions or advice.
    l_sap

    Hi ,
    First of all, what is the delta identifier you have for loading the deltas for 1000, 1001, etc.
    For your requirement, create 2 InfoPackages,
    1. For FULL loads - Here as advised by others do duplicate rows and maintain the company codes for which you want to do FULL load.
    Note: Daily full loads and you can delete the overlapping requests if your target is InfoCube.
    2. For DELTA loads - here maintain 1000, 1001, etc and start Init and following deltas.
    Sankar Kumar

  • Can't find 0FYTLFP OLAP Variable in InfoPackage Data Selection tab on 3.5

    On BW 3.5, when generating an InfoPackage with the datasource as Purchasing Data(80PUR_C01), under Data Selection tab, for the InfoObject 0FISCPER, I selected 7 (OLAP variables)for the Type column, then click the button next to it and under the column of Details for Type to bring up a window, but when expending the OLAP Variable field list, can't find the following value in the list which shows up on BW 3.1:
    0FYTLFP     0FISCPER Cumulated to Last Fiscal Year/Period (SAP Exit)
    How to make the above value show up in the OLAP Variable list?   I thought maybe the variable 0FYTLFP needs to be installed in Business Contents, but there is no variable object type in Business Content.  It sounds like a SAP Exit, but how to make the SAP Exit value show up on BW 3.5?
    Thanks for everyone's input!

    hey Rohit,
    Besides the three variable values in the list on BW 3.5, now I find a new one in the list, called "0E_ROLE     0SR_ROLE     Role (SAP Exit)", I have no idea why this one shows up now.  Now all the four variables in the list are:
    1. 0CML12LM     0CALMONTH     Last 12 Months Excluding the Current Month
    2. 0CMONTH     0CALMONTH     Current Calendar Month
    3. 0E_ROLE     0SR_ROLE     Role (SAP Exit)
    4. 0S_RQMRC     0REQUID     Most Current Data
    0FYTLFP is still not in the list!   We can't try to create BEx query since our BW 3.5 system is just installed and we have not got to the step to ceate a query.  I try the 2nd way you suggested by pressing F6 on this variable with the typed in value 0FYTLFP, get the following msg "BEx variable 0FYTLFP could not be evaluated - No error message", that means it would not work on BEx query as well, right? 
    What could be the reason that we can't see 0FYTLFP variable in our new installed BW 3.5?  Do you think our BASIS missed installing sth?
    Thanks
    Message was edited by: Kevin Smith

Maybe you are looking for