Abap Routine in DTP Filter with selection in a table

Hi guys,
I need help please.
I'm trying include a abap routine in a DTP filter, for this case I need to make a select in a dso table and return a list of criterias.
Example: for this characteristic 0GL_ACCOUNT i need in a fiter 20 or more 0GL_ACCOUNT of table  "/BIC/DSO_XXX".
How can I select more than one 0GL_ACCOUNT in a tranparency table  "/BIC/DSO_XXX"... and put in a DTP Fiter.
DTP FILTER ROUTINE.
data: l_idx like sy-tabix.
          read table l_t_range with key
               fieldname = 'GL ACCOUNT'.
          l_idx = sy-tabix.
          if l_idx <> 0.
            modify l_t_range index l_idx.
          else.
            append l_t_range.
          endif.
          p_subrc = 0.

Try this:
DATA: lv_rows TYPE n LENGTH 10,
        it_zbw_pl_proj LIKE STANDARD TABLE OF /BIC/DSO_XXX 
        lw_zbw_pl_proj LIKE LINE OF it_zbw_pl_proj .
  SELECT COUNT(*) INTO lv_rows FROM  /BIC/DSO_XXX Where <your condition> .
SELECT * INTO TABLE it_zbw_pl_proj FROM zbw_pl_proj where <your condition>
  IF lv_rows <> 0.
    LOOP AT it_zbw_pl_proj INTO lw_zbw_pl_proj  .
      l_t_range-iobjnm = '/BI0/GL_ACCOUNT'.
      l_t_range-fieldname = 'GL_ACCOUNT'.
      l_t_range-sign = 'I'.
      l_t_range-option = 'BT'.
      l_t_range-low = lw_zbw_pl_proj-GL_ACCOUNT.
      l_t_range-high = lw_zbw_pl_proj-GL_ACCOUNT.
      APPEND l_t_range.
    ENDLOOP.
  ELSE.
    " No data found for Current Forecast Version.
    p_subrc = 4.
  ENDIF.
I just copied this data from a DTP routine where i am fetching Versions from a DB table zbw_pl_proj. You may need to change the naming convention and performance tune the code ( like defining internal table only to hold GL_account and then only selecting GL_Account from ODS).
Hope this helps!
Regards
Amandeep Sharma
Edited by: AmanSharma123 on Jul 14, 2011 2:42 PM

Similar Messages

  • ABAP routine in DTP

    hi,
    I need some help withe ABAP routine in the DTP selection
    I have requirement to load the data for specific company codes on a specific days.
    If the current date is monday then it should pick Taiwan  or
    if the current date is Tuesday the it should pick Australia and Korea or
    if the current date is sunday then it should pick CHINA and Vietnam.
    I want to use only one DTP for this requirement. Please help me with the code for Info Object 0COMP_Code.
    Regards,
    Raghu

    hi,
    I have tried the code and it is not populating any value in the selection.
    Please check
    data: l_idx like sy-tabix.
    data: day like SCAL-INDICATOR.
    *Finding out the day
      clear day.
      CALL FUNCTION 'DATE_COMPUTE_DAY'
        EXPORTING
          DATE = sy-datum
        IMPORTING
          DAY  = day.
      read table l_t_range with key
           fieldname = 'COMP_CODE'.
      l_idx = sy-tabix.
    case day.
        when 1.                                 "Monday
          l_t_range-low = '0711'.
          l_t_range-high = ' '.
          l_t_range-option = 'EQ'.
          l_t_range-sign   = 'I'.
          modify l_t_range index l_idx.
        when 2.                                 "Tuesday
          l_t_range-low = '0355'.
          l_t_range-high = ' '.
          l_t_range-option = 'EQ'.
          l_t_range-sign   = 'I'.
          modify l_t_range index l_idx.
        when 3.                                 "Wednesday
         l_t_range-low = '0211'.
          l_t_range-high = ' '.
          l_t_range-option = 'EQ'.
          l_t_range-sign   = 'I'.
          modify l_t_range index l_idx.
       when 4.
       when 5.
       when 6.
       when 7.
         l_t_range-low = 'China'.
         l_t_range-high = ' '.
         l_t_range-option = 'EQ'.
         l_t_range-sign   = 'I'.
         modify l_t_range index l_idx.
    endcase.
    p_subrc = 0.

  • 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

  • ABAP routine for DTP fiscal year/period filter

    Hi All,
    Delta loads are which not possible for when the transformation source is an InfoSet.  To limit the data in these loads, currently a filter is set in the DTPs on fiscal year/period so only load the current month and 2 prior months are loaded.  This filter has to be updated each month for each of the DTPs manually.  To eliminate this monthly task a dynamic filter (routine) needs should be used rather than a static filter. Can anybody help me in providing the logic
    Regards
    Siri

    data: l_idx like sy-tabix.
    read table l_t_range with key
         fieldname = give field name .
         Data : Year(4) type n,
                   period1(2) type n.
                   period2(2)type n.
    Currper = sy-datum+4(2) .
    period1 = currper-1 .
    period2 = currper-2.
    year = sy-datum+0(4).
    concatenate  year currper to P1.
    concatenate  year period1 to P2. // define P1 , P2 , P3 as 0fiscper .
    concatenate  year period2 to P3.
    l_t_range-sign = 'I'.
    l_t_range-option = 'BT'.
    l_t_range-low =  P3.
    l_t_range-high=  P1.

  • Report -- filter with selection list -- show all values after select page

    Hello!
    I have the following problem:
    - I have a report
    - this report can be filtered with a selection-list
    - the selection list is based on dynamic LOV and has a null-value
    - I added the code of the report the following, to filter the report after choosing a value of the selection list:
    ... and (instr(type, decode(:P8_FILTER_type, '%null%',type,:P8_FILTER_type)) > 0)
    This works very well.
    But my problem is: When the user logs out and the next time, he logs in, the selection list shows " --- show all values --- " (my null-display-value) and the report is empty "no values found".
    ---> I want to show the first time, the page is selected ALL the values of the report. (this is now only possile if I press the button which belongs to the selection list)
    I hope, somebody understands my problem.
    Thank you so much,
    LISA

    Hello Lisa,
    The first time it's probably NULL.
    So what you can do in your where: (instr(type, decode(NVL(:P8_FILTER_type,'%null%'), '%null%',type,:P8_FILTER_type)) > 0)
    Off topic: I also wonder if that where clause can't be simpler? Do you rely need the instr?
    Regards,
    Dimitri
    http://dgielis.blogspot.com/
    http://www.apex-evangelists.com/
    http://www.apexblogs.info/

  • Using a filter with selection?

    Hello, I am using CS6 extended with windows7 and am pretty new to Photoshop. What I am trying to do with a portrait image is use the Filter/Stylize/Diffuse/Anisotropic on everything but the face. I want to kee the face sharp but I love the effect the diffuse has on the hair and background. I've been messing around with this for a few days and haven't come up with a solution othe than cutting the selection of the face, applying the filter then pasting the face back on but because of the filter it leaves a grey edge at the cut line. I'm sure there is a simple process that I'm missing. Any help would be much appreciated:) Thank you for your time:)

    All you need to do is right click on your layer, and click "convert to smart object." Then apply the filter. You'll then see a little white box below your layer. This is known as a layer mask.  Click on the white box (layer mask) and paint over the area that you do not want filtered with a soft, black brush. Job done.

  • Routine in DTP Filter

    HI Gurus,
    We have two Cubes, Cube A and Cube B. Take 'X' as current Month (Ex: X = October 2010). Once in every month, the Cube A will load data from X-13 (if X is October 2010 then X-13 = September 2009) to X-2 (if X is October 2010 then X-2 = August 2010).
    Before the above step i need to do this.  In the DTP, i want to write a routine in filters Field: 0CALMONTH that X-14 (if X is October 2010 then X-14 = August 2009) data should be moved from Cube A to Cube B.
    Please provide me the code for routine to be added in DTP for above logic.
    Thanks & REgards,
    Balaji.S

    You can use the following logic. Suppose X as 201010 oct 2010
    Period = sy-datum+4(2) // This comes as 10
    year = sy-datum+0(4) // this comes as 2010.
    Now 14 months back would mean year = last year and month = current month -2 //  that is aug 2009
    so year1 = year-1 .
    period1 = period -2
    concatenate year1 period1 into l_t_range-low .
    You need to write for special cases Jan and feb . in that case month cant be obtained by subtracting 2 , you can give fix value for these .
    if period = 01 .
    period1 = 11 // nov
    if period = 02
    period1 = 12 // dec
    hope this helps.

  • Help with select from USREXTID table

    HI,
    I try to select from table USREXTID and when i try to use do the select like below
    SELECT bname FROM usrextid
       INTO TABLE lt_bname
           WHERE type    = 'DN'
           AND extid     =  temp_extid
           AND status    = 'X'.
    here when i take the exact entry from the table i get sy-subrc = 0.
    Working o.k.
    when i try to use the select for SAML like
    SELECT bname FROM usrextid
       INTO TABLE lt_bname
             WHERE type      = 'SA'
               AND extid     =  temp_extid
               AND status    = 'X'.
    I get sy-subrc = 4.
    I have entry on the table with SA and i copy all the entry from EXTID field and put it on
    temp_extid ,
    What can be the problem ?
    Best Regards
    Nina
    Edited by: Nina C on Jun 15, 2009 10:05 AM

    HI,
    i copy the entry from the table exactly and i put it ,
    The problem here is with SA.
    when i copy entry from table with DN it work fine.
    it's behave strange .
    Best Regards
    Nina

  • Update table with select from another table

    Hallo,
    I'd like to update table b with codes from a mapping table a.
    a has:
    town_id, town_code, town_name
    b has town_code, town_id, town_population, town_zip_code,...
    Table a has all the details - town_id, town_code and town_name and acts as the mapping between town_id and town_code
    In table b, town_code is null. I want to update the column b.town_code with town_code from table a where a.town_id = b.town_id.
    How will the update query look like?
    I tried
    UPDATE B SET town_code = (SELECT A.town_code FROM A,B WHERE A.town_id=B.town_id)
    and I get the error 'single-row subquery returns more than one row'
    Will appreciate your assistance

    This is what I did.
    First, I created and populated the TOWN_INFO table:
    CREATE TABLE "TOWN_INFO"
    (     "TOWN_ID" NUMBER,
         "TOWN_CODE" NUMBER,
         "E_MAIL" CHAR(15 BYTE)
    Table Created.
    insert all
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3024,'[email protected]')
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3040,'[email protected]')
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3052,'[email protected]')
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3065,'[email protected]')
    into TOWN_INFO (TOWN_ID, E_MAIL) values (3066,'[email protected]')
    select * from dual
    5 rows created.
    The following creates and populates the mapping table:
    CREATE TABLE "TOWN_MAPP"
    (     "TOWN_CODE" NUMBER,
         "TOWN_ID" VARCHAR2(255 BYTE),
         "TOWN_NAME" CHAR(6 BYTE)
    insert all
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3024,'1001','TOWN_1')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3040,'1003','TOWN_3')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3052,'1002','TOWN_2')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3065,'1004','TOWN_4')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3066,'1006','TOWN_6')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3088,'1007','TOWN_7')
    into TOWN_MAPP (TOWN_ID,TOWN_CODE, TOWN_NAME) values (3020,'1009','TOWN_9')
    select * from dual
    7 rows created.
    And now the update query:
    UPDATE TOWN_INFO
    SET TOWN_CODE=(SELECT B.TOWN_CODE FROM TOWN_MAPP B, TOWN_INFO C
    WHERE B.TOWN_ID=B.TOWN_ID)
    SET TOWN_CODE=(SELECT B.TOWN_CODE FROM TOWN_MAPP B, TOWN_INFO C
    ERROR at line 2:
    ORA-01427: single-row subquery returns more than one row
    Thanx in advance
    Edited by: user9954260 on Apr 13, 2010 7:40 AM
    Edited by: user9954260 on Apr 13, 2010 7:44 AM

  • ABAP Routine in selection of Info package in 3x

    Hello Experts
    We need to load distinct PO data in 3x server.
    I have added this distinct po values in range table of info package abap routine.
    However its not loading for range table values more than two selections/pos.
    If I try to append more than 2 values,only last one is uploaded.
    However after load, in monitor tab-header , selection paramenters I can see all PO values in selection.
    Some how it works only for two inputs (rows) in range table of ABAP routine in infopackage.
    Anybody has faced such issue? any help is appreciated!
    Edited by: Kanchan Angalwar on Jan 30, 2010 9:59 AM

    Hi,
    Please post your ABAP code here

  • Routine in DTP to load data from previous fiscal period - current

    Hi Friends,
    I want to load data for previous & current fiscal period and I want to write a routine in DTP to automate this process, can any one help me with this routine!
    Thanks & Regards,
    vidiyala

    Hi Bilal,
    We cant create ABAP routine in DTP, instaed we can create in Info package.
    $$ begin of routine - insert your code only below this line -
    data : v_date like sy-datum.
    data : v_new_date like sy-datum.
    data: l_idx like sy-tabix.
    read table l_t_range with key
    fieldname = ' '.
    l_idx = sy-tabix.
    v_date = sy-datum.
    l_t_range-low = v_date+0(6).
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    *anzahl_jahre =
    anzahl_monate = 8
    *anzahl_tage =
    datum_ein = v_date
    IMPORTING
    datum_aus = v_new_date.
    l_s_range-sign = 'BT.
    l_s_range-opt = 'I'.
    if l_idx 0.
    modify l_t_range index l_idx.
    else.
    append l_t_range.
    endif.
    p_subrc = 0.
    $$ end of routine - insert your code only before this line

  • InfoPackage ABAP Routine for Date Range - Only Start Date Extracted

    I am using an ABAP Routine in an InfoPackage to select data for a 2 year period.  The routine converts SY-DATUM into the Current Fiscal Year and Period, and then calculates the Starting and Ending Fiscal Year / Period of a 24 month period.  The Start and End values are passed to the InfoPackage as l_t_range-low and l_t_range-high.
    The Source and Target are both Basic Infocubes.
    The InfoPackage executes successfully, and the Selection values on the Header tab of the monitor reflect a 24 month period.  Unfortunately, on closer review of the data in the cube, only data for the first month appears to have been loaded.  I’m guessing that the extract was only performed with the From value, even though a To value was also provided.
    I created a simple Infopackage and manually input the selection parameter values just to be sure I wasn’t overlooking something. The InfoPackage performed as expected, loading more data which spanned the selection time period.
    I can provide the code if it helps, but the fact that the monitor reflects a Start and End value suggests that the problem is with the InfoPackage, not the ABAP routine.
    Has anybody ever experienced this before ?  Any ideas would be greatly appreciated ?
    Thanks,
    Lyle

    We can write ABAP routine in Infopackage with a range of values (From & To). Make sure you fill all the following information while building the final range information as below,
       l_s_range-sign    = 'I'.
       l_s_range-option  = 'BT'.
       l_s_range-low     = lowvalue.
       l_s_range-high    = highvalue.
      MODIFY l_t_range FROM l_s_range INDEX l_idx.
    As you can see the key is passing the "BT" information for capturing range.
    Hope it helps..
    thanks
    Kumar

  • Abap routine

    Hello SDN Experts,
    I like to find out can abap routine in data selection be used to do anything normal abap can do. I meant, can it perform a date or day check and trigger events?
    Thanks,
    Alfonso S.

    dear Alfonso,
    say you choose type '6-abap routine' for 0calday from infopackage selection, take a look following sample code ...
          Insert source code to current selection field
    $$ begin of routine - insert your code only below this line        -
    data: l_idx like sy-tabix.
              read table l_t_range with key
                   fieldname = 'CALDAY'.
              loop at l_t_range where fieldname = 'calday'.
              if l_t_range-low < sy-datum.
    *-- raise event.
              endif.
              endloop.
              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.
    hope this helps.
    please take a little time to reward this
    Re: Is it possible to transport everything at 1 go?

  • ABAP Routine Variable in DTP filter

    Helllo,
    I am trying to create a routine in the Filter of DTP, so that I can only pass records that are between sy-datum and 12/31/9999 date range. In the filter are of DTP I created ABAP routine with this code:
    form compute_HE_SPCEND
      tables l_t_range structure rssdlrange
      changing p_subrc like sy-subrc.
          Insert source code to current selection field
    $$ begin of routine - insert your code only below this line        -
    data: l_idx like sy-tabix.
              read table l_t_range with key
                   fieldname = 'HE_SPCEND'.
              l_idx = sy-tabix.
              data: v_day type dats.
              v_day = sy-datum.
              l_t_range-sign = 'I'.
              l_t_range-option = 'BT'.
              l_t_range-low = v_day.
              l_t_range-high = '99991231'.
                modify l_t_range index l_idx.
              p_subrc = 0.
    $$ end of routine - insert your code only before this line         -
    endform.
    However, when I execute the DTP I get an ABAP dump TABLE_INVALID_INDEX. Do you see anything wrong with the code?
    Thank you
    Edited by: AG on Jul 10, 2009 2:31 PM

    Thanks Mr V.
    I added that part of code. So now my code looks like this:
    form compute_HE_SPCEND
      tables l_t_range structure rssdlrange
      changing p_subrc like sy-subrc.
          Insert source code to current selection field
    $$ begin of routine - insert your code only below this line        -
    data: l_idx like sy-tabix.
              read table l_t_range with key
                   fieldname = 'HE_SPCEND'.
              l_idx = sy-tabix.
              data: v_day type datum.
              v_day = sy-datum.
              l_t_range-sign = 'I'.
              l_t_range-option = 'BT'.
              l_t_range-low = v_day.
              l_t_range-high = '99991231'.
             if l_idx <> 0.
                modify l_t_range index l_idx.
              else.
                append l_t_range.
              endif.
              p_subrc = 0.
    $$ end of routine - insert your code only before this line         -
    endform.
    I do not get the ABAP dump anymore, but I still have the problem. When I run the DTP, It gets errors. In a log it says that it cannot determine the value:
    @5C@     Incorrect initial value for characteristic 0HE_SPCEND in i_t_range     @35@
    @5C@     Error while extracting from source ZHE_O03 (type DataStore)     @35@
    @5C@     Package 1 / 07/10/2009 14:43:41 / Status 'Processed with Errors'     @35@
    Am I missing something? Looks like the values still do not get assigned to the field in the filter through my routine.
    Thanks

  • Help requeried in populating DTP filter through ABAP routine.

    Hi experts,
    I have written the following routine in my DTP filter.
    While debugging , the values are getting populated fine , but selections are not getting pupulated in the DTP. Thus, filter is not working.
              DATA: l_idx like sy-tabix ,
              w_dt(2) type n ,
          *Previous month
              w_pvmon(2) type n,
    Current month
              w_mon(2) type n,
    Year
              w_yr(4) type n,
    Start date of previous month and Start date of current month
              w_sdt1 LIKE sy-datum ,
              w_sdt2 LIKE sy-datum.
      Read table l_t_range with key
           fieldname = '/BIC/ZUPDDATE'.
      l_idx = sy-tabix.
      w_dt = sy-datum+6(2).
      w_mon = sy-datum+4(2) .
      w_yr = sy-datum+0(4).
    ****If first week of the month then start date = first day of previous
    *month
      If w_dt <= 07.
        IF w_mon = 01 .
          w_pvmon = 12.
          w_yr = w_yr - 1.
        else.
          w_pvmon = w_mon - 1.
        ENDIF.
        CONCATENATE w_yr w_pvmon '01' into w_sdt1.
        l_t_range-iobjnm = '/BIC/ZUPDDATE'.
        l_t_range-sign = 'I'.
        l_t_range-option = 'EQ'.
        l_t_range-fieldname = '/BIC/OIZUPDDATE'.
        l_t_range-low = w_sdt1.
        l_t_range-high = sy-datum.
        append l_t_range.
      else .
    After first week of the month ,  start date = first day of current
    *month
        CONCATENATE w_yr w_mon '01' into w_sdt2.
        l_t_range-iobjnm = '/BIC/ZUPDDATE'.
        l_t_range-sign = 'I'.
        l_t_range-option = 'EQ'.
        l_t_range-fieldname = '/BIC/OIZUPDDATE'.
        l_t_range-low = w_sdt2.
        l_t_range-high = sy-datum.
       " modify l_t_range index l_idx.
       append l_t_range.
        p_subrc = 0.
    endif.
    clear:w_dt ,w_pvmon ,w_mon ,w_sdt1,w_sdt2 ,w_yr.
    I have tried different fieldname values as well.
    Please share your inputs.
    Regards,
    Taru
    Edited by: Taru Dhawan on Feb 23, 2012 12:59 PM

    Hi
    What Alexandre said is right
    fieldname must be '/BIC/ZUPDDATE'
    and the iobjnm must be  'ZUPDDATE'.
    This should work.
    If no, just try
    fieldname = 'ZUPDDATE'.
    and iobjnm = '/BIC/ZUPDDATE'
    One of this will definitely work.
    Regards,
    Joe

Maybe you are looking for

  • Isn't the vga cable a little too short?

    i want to buy another display or projector, but how am I supposed to connect my macbook pro to it when the cable is only like 4 inches long?

  • Aperture as a Multi-User Digital Asset Management Tool

    Does anyone have any experience using Aperture in a multi-user environment? I'm trying to compare it to Cumulus by Canto which is designed as a multi-user tool. I realize that each user would have a copy of Aperture on their Mac, but are there other

  • Airplay shown in CoreAudio but did not connect

    Hey Guys, my Airplay Audio Devices is everytime shown in the "Menubar?", it works fine, but once on a while it is shown the devices but if i click on it, it doesnt connect to it. My iOS Devices can connect without problems. i can fix that if i reboot

  • How to split an A3 page to two A4 pages?

    Hello, I need to scan an A4 booklet to upload, but I cannot cut it in order to have a bunch of pages to scan. Therefore I'm scanning it spread on a fladbed scanner, resulting in a series of A3 spreads. How can I split these A3 pages into two A4 pages

  • Quicktime Pro and Indeo Codec 5?

    I have a Casio Exilim camera and my .avi movie files do not play on QuickTime 7 on my Mac OS X. I have sound but no video output. I tried downloading a variety of players/codecs and converting the files to other video file types (.mov, mpeg) but the