Using plsql tables in select statement of report query

Hi
Anyone have experience to use plsql table to select statement to create a report. In otherwords, How to run report using flat file (xx.txt) information like 10 records in flat files and use this 10 records to the report and run pdf files.
thanks in advance
suresh

hi,
u can use the utl_file package to do that using a ref cursor query in the data model and u can have this code to read data from a flat file
declare
ur_file utl_file.file_type;
my_result varchar2(250);
begin
ur_file := UTL_FILE.FOPEN ('&directory', '&filename', 'r') ;
utl_file.get_line(ur_file, my_result);
dbms_output.put_line(my_result);
utl_file.fclose(ur_file);
end;
make sure u have an entry in ur init.ora saying that your
utl_file_dir = '\your directory where ur files reside'
cheers!
[email protected]

Similar Messages

  • Using Nested Table in Select Statement

    Hi all ,
    Can i use the PL/SQL nested table or Varray
    in the select statement as a normal table joined with other database tables.
    i.e.
    I have a nested table NT_1 in PL/SQL proc
    i have to use this NT_1 in the select statement as
    select xxx from
    tab_1,
    tab_2,
    NT_1
    where
    < some conditional joins >.
    Please help me in this regard.
    regds
    Dhananjaya.H

    you can not use a varray as part of a SQL Statement in order to build joins.
    Can you explain better what do you want to do ?
    Joel P�rez

  • How to use SET ID in select statement of SQ02

    Hi,
    I have a infoset, where for one of my Zfield, i have writen a select statement in order to get my ouput.
    if aufk-aufnr = 'XYZ'.
      select sum( FKBTR ) from fmifiit into zfmifiit
      where fikrs = aufk-kokrs
      and fipex IN capex
      and wrttp NE '51'.
    endif.
    For the above statement, i have created (with 10 single values, table name FMCI, field name FIPEX)  a SET id named CAPEX and used with IN operator.
    But when i generating the infoset i am getting error like below
    The IN operator with "CAPEX" is followed neither by an internal table nor by a value list
    I was using IN opeartor for set ids during validation / substitutions, where if i have to validate multiple single values.
    What to do here?
    Regards,
    Srinu

    [OPEN-SQL|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_GENERAL.htm] set of statement, [SELECT|http://help.sap.com/abapdocu_70/en/ABAPWHERE.htm] statement, [WHERE|http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP.htm] addition requires a selection table (type range, [WHERE - IN seltab |http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP_SELTAB.htm]) of parameter and not a set. We are in Abap here, not in a Customizing screen
    You have to convert the set to a selection table in an ABAP coding before using it in a SELECT statement.
    (Check FM like G_SET_TREE_IMPORT to import definition of set (values and intervals) and map them to a select-table, or ask a developper to perform it, look at G_SET_TREE_IMPORT -> select statement)
    Regards,
    Raymond

  • [php+mysql] how to use variables in a select statement?

    Hi all,
    I'm searching for a way to use a variable in the select
    statement of mysql
    query.
    I have this variable that can contain:
    $var=field_1 field_2 field5
    or
    $var=field3 field4 field8
    so, the variable content is not always the same.
    I would like to filter a table selecting only the columns
    specified by the
    current $var content.
    Is this possible to do something like this?
    $var=field1 field5 field10
    SELECT string_to_array($var)
    FROM mytable
    ORDER BY mysortfield ASC
    Or, is there another way to select columns dynamically?
    Thanks for any suggestion.
    tony

    Hi all,
    I'm searching for a way to use a variable in the select
    statement of mysql
    query.
    I have this variable that can contain:
    $var=field_1 field_2 field5
    or
    $var=field3 field4 field8
    so, the variable content is not always the same.
    I would like to filter a table selecting only the columns
    specified by the
    current $var content.
    Is this possible to do something like this?
    $var=field1 field5 field10
    SELECT string_to_array($var)
    FROM mytable
    ORDER BY mysortfield ASC
    Or, is there another way to select columns dynamically?
    Thanks for any suggestion.
    tony

  • Proper use of END-OF-SELECTION event in report programme

    Hi,
    If we will write "WRITE" statements in side START-OF-SELECTION then it will help me to display the output.Then what is the need of END-OF-SELECTION .
    Can any body please tell me the <b>proper use of END-OF-SELECTION event in report programme.</b>

    This is the last of the events called by the runtime environment to occur. It is triggered after all of the data has been read from the logical database, and before the list processor is started.
    <b>In report programs using LDB for every value selected the program issues the output, to control this you would use END-OF-SELECTION.</b> Now if you call your output in this event, the output is made only after all the values are selected as per the selection criteria.
    suppose while coding, u need a logic like below:
    if a condition is satisfied continue with the report
    and if not satisfied, then display a message and end the report.
    then u can code like below.
    start-of-slection.
    if a = <condition>.
    do the following.......
    else.
    stop.
    end-of-selection.
    write: 'THIS IS END'.
    stop command triggers end-of-slection from anywhere.
    I hope it helps.
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • Error by using database procedure in select statement

    hi ,
    I have built a database procedure having one parameter with in out varchar type. that return value with some addition.
    i am using it with some column in select statement only for display purpuses but i am facing error by doing that in select statement. that procedure is working well with bind variable but not with select statement.
    plz help me how i can use a procedure in select statement. or can i do it or not.

    plz help me how i can use a procedure in select statement. or can i do it or not.A workaround could be to create a wrapper function for your procedure. One that only passes the input parameters and returns the output parameter.
    The simply call this function in your select which internally calls the procedure.

  • Using java function in select statement

    Hi,
    I am trying to use java function in select statement.
    public class ClassA{
         private static String MyConst = "foo";
         public static String functionA(){
              return MyConst;
    in my query I have:
    select
         ClassA.functionA() AS id,
         groupId AS newID,
    from
         myChannel[now]
    ClassA is part of the application (no need to import).
    I get and error of Invalid Expression on ClassA.functionA().
    I also tried to declare the function in the processor element:
    <wlevs:processor id="proc">
         <wlevs:function function-name="A" exec-methode="functionA">
              <bean class="mtPackage.ClassA"/>
         </wlevs:function>
    <wlevs:processor>
    but then I get a different error in the processor XML file:  "An InvocationTargetException was encoutered while attemting to register the user defind function A. The message was null"
    What am I missing here?

    Hi,
    From the above description, you have tried two manners to call method functionA() in the user defined  class ClassA. One uses java cartridge manner directly and the other try to use user defined function manner.
    For the java cartridge manner, the following CQL query should work if the ClassA is really included in the OEP app. I have done similar test before, it works.
    select
         ClassA.functionA() AS id,
         groupId AS newID,
    from
         myChannel[now]
    For user defined function manner, I think two things you need to change:
    1. Need to declare the function in the EPN assembly file(under META-INF/spring/), not component configuration file(under META-INF/wlevs/). The following is an example:
    <wlevs:processor id="proc">
         <wlevs:function function-name="A" exec-methode="functionA">
              <bean class="mtPackage.ClassA"/>
         </wlevs:function>
    </wlevs:processor>
    2. Call the user defined function in the CQL query in the component configuration file under processor. For example:
    select A() from myChannel
    Regards,
    XiYing

  • Passing values to OnDemandProcess from Select Statement on Reports Page

    I think I'm just missing some of the proper syntax, Can somebody please help me.
    As I've come to understand this process of passing the values,
    I recognize it as (3) steps.
    1. Referencing the "javascript" in the Select Statement of the Reports Page.
    2. Including the "javascript" in the Page Header region.
    3. Defining the Process as an OnDemand Application Process.
    My problem is:
    a. I can't seem to get the Value passed to the Application Process.
    b. I don't know how to reference the Value passed once I get it passed.
    Here's what I've got done so far:
    1. (The Select Statement)
       onClick="javascript:ORDER_CONNECT_SEQUENCE('||ID||')
    {code}
    2. (The javascript)
    {code}
    function ORDER_CONNECT_SEQUENCE('+ID+')
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=ORDER_CONNECT_SEQUENCE',0);
    get.add('+ID+');
    gReturn = get.get('+ID+');
    {code}
    3. (The Application Process)
    {code}
       BEGIN
       Select '+ID+' into THIS_CIRCUIT from dual;
    {code}
    I Know that the Application Process is being referenced and that the OnClick routine is working properly,
    because if I plug a Value into the Application Process, instead of using '+ID+',
    Then I get all of my desired results.
    Any help you can give me here is greatly appreciated.
    Thanks- Gary                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Dimitri, Thanks for your efforts here, but its still not working for me.
    Here's what I understand from your suggestions:
    1. (changes to the javascipt)
       a. replace function ORDER_CONNECT_SEQUENCE('+ID+')
           with
           function ORDER_CONNECT_SEQUENCE(pId)
       b. replace get.add('+ID+')
           with
           get.addParam('x01',pId)
       c. replace getReturn = get.get('+ID+')
          with
          getReturn = get.get()
          get = null2. (chages to the Application Process)
       a. add l_value varchar2(4000) to my list of declarations
       b. add l_value := wwv_flow.g_x01 below the begin statement
       c. I guess then I would reference the l_value like this:
           Select l_value into THIS_CIRCUIT from dual* Also, You didn't mention any changes in my Select statement in the Reports region of the page.
    FYI.
      onClick="javascript:ORDER_CONNECT_SEQUENCE('||ID||')
    {code}
      The 'ID' which I'm referencing here is an ID from the table which I'm querying.
    Am I misunderstanding you somewhere?
    Thanks- gary                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Using Multiple Parameters in Select Statement

    My goal is to be able to use more than one parameter for the select statement.  When I use OR instead of AND it works but with only one parameter. I thought using AND would return any parameter that is listed in the  ?Report Based On}. Any ideas why this will not work?
    I've created four parameters:
    Report Based on (string)  Allow Multiple Values (Default Values: Customer, Part Id, and Serial Number)
    RMA info by Customer  (string)
    RMA Info by Part Id  (string)
    RMA Info by SN  (string)
    This is my select statement
    (if {?Report Based On} = "Customer" then
        {RMA_Information.Customer}LIKE{?RMA info by Customer})
    and
    (if {?Report Based On} = "Part Id" then
    {RMA_Information.Part Id}LIKE{?RMA Info by Part Id})
    and
    (if {?Report Based On} = "Serial Number" then
      {RMA_Information.Serial Number}={?RMA Info by SN })
    tx Shirley

    Try this...
    IF "Customer" IN {?Report Based On} AND
         "Part Id" IN {?Report Based On} AND
         "Serial Number" IN {?Report Based On}
    THEN {RMA_Information.Customer}LIKE{?RMA info by Customer} AND
         {RMA_Information.Part Id}LIKE{?RMA Info by Part Id} AND
         {RMA_Information.Serial Number}={?RMA Info by SN}
    ELSE
    IF "Customer" IN {?Report Based On} AND
         "Part Id" IN {?Report Based On}
    THEN {RMA_Information.Customer}LIKE{?RMA info by Customer} AND
         {RMA_Information.Part Id}LIKE{?RMA Info by Part Id}
    ELSE
    IF "Customer" IN {?Report Based On} AND
         "Serial Number" IN {?Report Based On}
    THEN {RMA_Information.Customer}LIKE{?RMA info by Customer} AND
         {RMA_Information.Serial Number}={?RMA Info by SN}
    ELSE
    IF "Part Id" IN {?Report Based On} AND
         "Serial Number" IN {?Report Based On}
    THEN {RMA_Information.Part Id}LIKE{?RMA Info by Part Id} AND
         {RMA_Information.Serial Number}={?RMA Info by SN}
    ELSE
    IF "Customer" IN {?Report Based On}
    THEN {RMA_Information.Customer}LIKE{?RMA info by Customer}
    ELSE
    IF "Part Id" IN {?Report Based On}
    THEN {RMA_Information.Part Id}LIKE{?RMA Info by Part Id}
    ELSE
    "Serial Number" IN {?Report Based On}
    THEN {RMA_Information.Serial Number}={?RMA Info by SN}
    HTH,
    Jason

  • How to use  'is null' in select statement of ABAP program

    hi,
    I want to use 'is nul' or 'not null' in select statement of my ABAP program for any field. I have written below query but I am getting sy-subrc = 4 and getting no data.
    SELECT * FROM mara INTO TABLE it_mara
          WHERE volum IS NULL .
    Can anyone resolve this.

    Hi PKB,
    Check the below thread for NULL and Space value in ABAP . It will help you
    NULL and Space value in ABAP
    Regards,
    Pawan

  • Use of wildcard * in SELECT statement

    I have read that the use of the wildcard * in a SELECT statement cannot be utilized when using the INSERT INTO or other queries where data column/field alignment is critical. I have noted that the INSERT INTO column/fields must be in the same order
    as the SELECT statement (as there is no alignment to column/field names). Can someone please provide me with the information or article that covered this scenario?

    It is consider a good practice to specify columns name, however , SQL Server is smart enough to insert the data without too , but only if the table does not have an IDENTITY property
    CREATE TABLE #t (c1 int, c2 char(1),c3 real, c4 bit)
    CREATE TABLE #t1 (c1 int, c2 char(1),c3 real, c4 bit)
    ---Same thing with INSERT  like SELECT * you asked
    INSERT INTO #t1 VALUES (1,'A',2.5,0) 
    INSERT INTO #t1 VALUES (2,'B',3.5,1)
    INSERT INTO #t1 VALUES (3,'C',4.5,0)
    INSERT INTO #t SELECT * FROM #t1
    SELECT * FROM #t
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Using Variables in a select statement through a Database Adapter

    I was wondering how I reference a variable in a select statement through a Database Adapter.
    Ex.
    1. I have a global variable that stores an employee number
    2. I want to select an SSN # from a table based on an employee #
    variable.
    select ssn from emp where ssn = :input_variable - ????
    - how do i reference the variable - I am getting a 'missing IN or OUT parameter error?
    Any advice is much appreciated.
    ~Thanks

    I'm just wondering if anyone knows a work around so that I might be able to store a Table's FIELD name in a variable or an array[] so that I can do a query based on the decision of a loop without having to code 10 IF/ELSE statements.For instance, although the above code will not work, this code, although quite lengthy, does:
    If DataGrid1.SelStartCol = 0 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES__PUR_DT"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 1 Then
    Adodc1.RecordSource = "Select * from tblReservation order by VENDOR"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 2 Then
    Adodc1.RecordSource = "Select * from tblReservation order by VEN_LOC"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 3 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES_TYPE"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 4 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES_FROM_DT"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 5 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES_TO_DT"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 6 Then
    Adodc1.RecordSource = "Select * from tblReservation order by MISC_ADJ"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 7 Then
    Adodc1.RecordSource = "Select * from tblReservation order by STATE_TAX"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 8 Then
    Adodc1.RecordSource = "Select * from tblReservation order by LOC_CHARGE"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 9 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES_ID"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 10 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES_OP"
    Adodc1.Refresh
    End If
    Do you see where i'm going with this?
    I simple want to use a variable in the "select * from <Table> Order by <Field>"

  • Using Internal table in select queries

    Hi All,
    In the below mentioned code, i am reading an internal table and using the GUID i am fetching values from the database table and populating another internal table.
    SELECT  BUT000~PARTNER AS RESP_GROUP
          FROM BUT000 INTO CORRESPONDING FIELDS OF TABLE itab_Partner
          FOR ALL ENTRIES IN itab_PartnerGUID
          WHERE BUT000~PARTNER_GUID = itab_PartnerGUID-GUID.
    This code statement doesn't give any syntax error. But if i have to return values say from the itab as well as database table... then should it be something like...
    SELECT  itab_PartnerGUID-GUID as GUID
                   BUT000~PARTNER AS RESP_GROUP
          FROM BUT000 INTO CORRESPONDING FIELDS OF TABLE itab_Partner
          FOR ALL ENTRIES IN itab_PartnerGUID
          WHERE BUT000~PARTNER_GUID = itab_PartnerGUID-GUID.
    This statement throws an error saying "Unknown column name itab_PartnerGUID-GUID; not determined until runtime' .... what is the issue? can't i use the internal table that way? what is the right syntax to get the results.... please help....
    Ramya G

    Wow.. Chandrashekar.... that was an amazing catch in the code... you are rite.. when i am equating itab_PartnerGUID-GUID to BUT000PARTNER_GUID, i can as well use the BUT000PARTNER_GUID.... makes complete sense.....
    but there's a problem, its a mistake in the query.... the query shd actuall be this:
    SELECT <b>itab_PartnerGUID-GUID as GUID</b> 
         BUT000~PARTNER AS RESP_GROUP
    FROM BUT000 INTO CORRESPONDING FIELDS OF TABLE itab_Partner
    FOR ALL ENTRIES IN itab_PartnerGUID
    WHERE BUT000~PARTNER_GUID = <b>itab_PartnerGUID-PARTNER_GUID.</b>
    the internal table itab_PartnerGUID has 2 fields GUID and PARTNERGUID... in the where condition of the query i need to use PARTNERGUID, but in select i need to return GUID... how shd i do it? please help...

  • Delete adjacent duplicates how to use in the below select statement

    hi i have a problem
    i am suing the below select statement
    SELECT    a~extno
              a~guid_lclic       " for next select
              e~ctsim
              e~ctsex
    *revised spec 3rd
              f~guid_pobj
              f~amnt_flt
              f~amcur
              f~guid_mobj
              e~srvll     "pk
              e~ctsty     "PK
              e~lgreg  "PK
      INTO TABLE gt_sagmeld
      FROM /SAPSLL/LCLIC  as a
      INNER JOIN /sapsll/tlegsv as e on elgreg = algreg
      inner join /sapsll/legcon as f on fguid_lclic = aguid_lclic   " for ccngn1 selection
      inner join /sapsll/corcts as g on gguid_pobj = fguid_pobj
                               where   a~extno in s_extno.
      sort gt_sagmeld by guid_lclic lgreg ctsty srvll GUID_POBJ GUID_MOBJ.
      delete adjacent duplicates from gt_sagmeld comparing guid_lclic lgreg ctsty srvll GUID_POBJ GUID_MOBJ .
    now i am confused how to use delete adjacent dupliacate and on which fields
    as first table /sal../lclic primary key is guid_lclic
    and it is joined to table
    legcon by guid_lclci ( not a primary key here)
    legcon primary key is guid_legcon
    and table 3 legsv by lgreg (pk here)
    table 3 has tow more primary key srvll and ctsty also
    NOW MY QUESTIO IS TAHT IS I USE ABOVE DELETE ADJACENT STATMENT IT FETCHES 20 LAKH RECORDS
    I WANT TO REDUCE IS LET ME KNOW ON WHAT fields i need to use delete adjacen duplicates
    or use comparing all fields?
    regards
    Arora

    hi sudha
    if u see my select statement is contains four Primary keys
    srvll
    lgreg
    ctsty
    guid_lclic
    but the next table connected to this table legcon is by guid_pobj and anothe table by guid_mobj
    and if i take this gt_sagmeld to another temp table and i find abt 10 lakh uniques guid_pobj
    similary 6 lakh guid_mobj so the next slect is hanpering because of this
    not COMING TO OUR POINT IF I SORT ONLY BY OUR PRIMARY KEYS NOT TAKING INTO ACCOUNT TEH GUID_POBJ AND GUID_MOBJ
    THE ENTRIES ARE VERY LESS BUT IF I TAKE INOT ACCCOUNT IN GT_SAGMELD THE ENTRIES ARE ABT 20 LAKH
    SO I AM NOT SURE WHETHER TO TAKNE GUID_POBJ AND GUID_MOBJ INOT ACCOUNT FOR DELECTING ADJACENT DUPLICATES?
    HENCE THE QUESTION OF ON WHICH FIRLD DELETE OR COMPARING ALL FIELDS I USE?

  • Performance problem(ANEA/ANEP table) in Select statement

    Hi
    I am using below select statement to fetch data.
    Does the below where statement have performance issue?
    can you Pls suggest.
    1)In select of ANEP table, i am not using all the Key field in where condition. will it have performance problem?
    2)does the order of where condition should be same as in table, if any one field order change also will have effect performance
    SELECT bukrs                           
             anln1                          
             anln2                          
             afabe                          
             gjahr                        
             peraf                         
             lnran                         
             bzdat                          
             bwasl                        
             belnr                         
             buzei                         
             anbtr                       
             lnsan                         
        FROM anep
        INTO TABLE o_anep
        FOR ALL ENTRIES IN i_anla
       WHERE bukrs = i_anla-bukrs          
         AND anln1 = i_anla-anln1          
         AND anln2 = i_anla-anln2          
         AND afabe IN s_afabe              
         AND bzdat =< p_date                
         AND bwasl IN s_bwasl.              
      SELECT bukrs      
             anln1      
             anln2      
             gjahr      
             lnran       
             afabe      
             aufwv       
             nafal   
             safal       
             aafal      
             erlbt    
             aufwl      
             nafav    
             aafav     
             invzv   
             invzl      
        FROM anea
        INTO TABLE o_anea
        FOR ALL ENTRIES IN o_anep
       WHERE bukrs = o_anep-bukrs    
         AND anln1 = o_anep-anln1    
         AND anln2 = o_anep-anln2    
         AND gjahr = o_anep-gjahr    
         AND lnran = o_anep-lnran   
         AND afabe = o_anep-afabe.
    Moderator message: Please Read before Posting in the Performance and Tuning Forum
    Edited by: Thomas Zloch on Aug 9, 2011 9:37 AM

    1. Yes. If you have only a few primary keys in youe WHERE condition that does affect the performance. But some times requirement itself may be in that way. We may not be knowing all the primary keys to given them in WHER conditon. If you know the values, then provide them without fail.
    2. Yes. It's better to always follow the sequence in WHERE condition and even in the fields being fetched.
    One important point is, whenever you use FOR ALL ENTRIES IN, please make sure that the itab IS NOT INITIAL i.e. the itab must have been filled in. So, place the same conditin before both the SELECT queries like:
    IF i_anla[] IS NOT INITIAL.
    SELECT bukrs                           
             anln1                          
             anln2                          
             afabe                          
             gjahr                        
             peraf                         
             lnran                         
             bzdat                          
             bwasl                        
             belnr                         
             buzei                         
             anbtr                       
             lnsan                         
        FROM anep
        INTO TABLE o_anep
        FOR ALL ENTRIES IN i_anla
       WHERE bukrs = i_anla-bukrs          
         AND anln1 = i_anla-anln1          
         AND anln2 = i_anla-anln2          
         AND afabe IN s_afabe              
         AND bzdat =< p_date                
         AND bwasl IN s_bwasl.              
    ENDIF.
    IF o_anep[] IS NOT INITIAL.
      SELECT bukrs      
             anln1      
             anln2      
             gjahr      
             lnran       
             afabe      
             aufwv       
             nafal   
             safal       
             aafal      
             erlbt    
             aufwl      
             nafav    
             aafav     
             invzv   
             invzl      
        FROM anea
        INTO TABLE o_anea
        FOR ALL ENTRIES IN o_anep
       WHERE bukrs = o_anep-bukrs    
         AND anln1 = o_anep-anln1    
         AND anln2 = o_anep-anln2    
         AND gjahr = o_anep-gjahr    
         AND lnran = o_anep-lnran   
         AND afabe = o_anep-afabe.
    ENDIF.

Maybe you are looking for