Data fetch problem from EBAN table

Hi All,
I have a problem in data fetching. My SQL statement is
        SELECT    A~BANFN
                  A~FRGDT
                  A~MATNR
                  A~MENGE
                  A~MEINS
                  A~AFNAM
                  A~EKGRP
                  A~PRIO_URG
                  A~STATU
                  A~RLWRT
                  A~EBELN
                  A~LOEKZ
                  A~EBELP
                  A~FRGKZ
          INTO CORRESPONDING FIELDS OF TABLE ITAB_DATA
          FROM EBAN AS A
          WHERE     A~STATU IN S_STATU
          AND       A~EKGRP  = S_EKGRP
          AND       A~BANPR  = '05'
          AND       AFNAM  IN P_AFNAM
          AND       BEDNR  IN P_BEDNR .
In EBAN table data in AFNAM field is like 'Mech', 'mech' & 'Mech'
Now in selection screen if user give Mech then system picks only that data where 'Mech' is there but requirement is it should pick all data related to ('Mech', 'mech', 'Mech') in AFNAM field. How do I do?
Thanks and regards,
Rajesh Vasudeva

Hello,
What you ask is not easy but it is feasible.
We had the same request to make a case-insensitive search on a text field.
As a reference for our development we took the following example:
[http://wiki.sdn.sap.com/wiki/display/Snippets/CaseInsensitiveSearchHelpExitforMaterialGroup|http://wiki.sdn.sap.com/wiki/display/Snippets/CaseInsensitiveSearchHelpExitforMaterialGroup]
In short : the purpose is that first of all you build up a list of all possible values in a separate internal table.
Then use this separate internal table in the FOR ALL ENTRIES clause when you perform the select on the actual data.
Success.
Wim

Similar Messages

  • Data fetching problem in internal table

    Hi All,
    I have two internal table which are of type as shown below.
    itab1 is of following type:
    regno(255) type c,
    uid type c
    itab2 is of following type
    regno type regno,
    uid type userid,
    address type add,
    phno type phn.
    Datas in itab2 are as follows:
    100       01       india              3454534
    200       01       china             34553543
    300       02       us                  6464654
    400       02       uk                   45654
    Itab1 is populated using the uid field as key as shown below.
    regno                          uid
    100 200                           01
    300 400                           02
    100 200 are values in field regno
    01  is uid.
    What we have done is collected all the regno which belong to the same uid for sending a single mail to the uid person with both the regno. We are able to achieve this. For this finally we loop into itab1 and fetch the uid and send mail to him.
    Now an extra requirement is to send the details of a regno (address and phno) along with the mail. The prob is in our final internal table we have a character field which will have all the regno for a uid (may be upto 20). Each regno will be of length 3.
    I have to loop into tab1 and read tab2 to achieve this using uid as key. But regno will for a uid will be combined. I have fetch each regno say 100 first and get the details and then 200 and then get the details and send a mail to uid 01. Then 300 and 400 details and then a mail to uid 02.
    Please explain how to get individual regno when i loop into tab1 and read tab2 so that i can fetch the details.
    Any suggestion will be very helpful

    Hi Aslam,
    As per my understanding...
    In itab1, instead of maintaining all the reg no in the same field(like 100 200 300 ....) againist uid 01
    maintain multiple records like
    regno  udi
    100      01
    200      01
    300      01 etc
    (in this case the combination of regno & uid becomes the key.)
    now while ur sending mail to the people, just loop the recors of itab1
    in the same loop u can just write a read statement to get the remainig details(address, phone no etc..) of that regno from itab2.
    Hope this helps you, revert back if still u hav any problm.

  • Sender JDBC Adapter : Fetch records from multiple tables

    Hi Friends,
    I am using sender JDBC adapter to select few records from DB2 database table.
    This scenario is working fine.
    Now my requirement is to fetch records from 3 tables. These table are independent to each other. There is no primary key or foreign key.
    Please let me know how to write the sql in sender JDBC adapter to fetch records from these 3 tables.
    Thanks,
    Sandeep Maurya

    hi sandeep...
    if the tables are completely independent and do not share any primary / foreign key relation ship...
    why dont u think towards creating a seperate interface for each of them..
    or if u still want to select from multiple table at once..the best way would be to write a stored procedure on the sender side which do all the fetching n processing and pass the final resultset to PI
    or u can think towards fetching the data from 1 table and then in UDF do lookup from other tables..which again is tricky and performace intensive

  • How can i fetch records from 3 tables in a single query  without using join

    Hi.
    Can any body please tell me <b>How can i fetch records from 3 tables with a single query  without using joins</b>
    Thanx
    prabhudutta

    Hi Prabgudutta,
    We can fetch the data by using the views concept.
    Go throuth this info we can know the how to create view and same like database table only we can fetch the data.
    Views conatin the data at runtime only.
    Four different view types are supported. These differ in the
    way in which the view is implemented and in the methods
    permitted for accessing the view data.
    Database views are implemented with an equivalent view on
    the database.
    Projection views are used to hide fields of a table (only
    projection).
    Help views can be used as selection method in search helps.
    Maintenance views permit you to maintain the data
    distributed
    on several tables for one application object at one time.
    step by step creation of Maintenance view:
    With the help of the table maintenance generator, you are able to maintain the ENTRIES of the table in SM30 transaction.
    It can be set in transaction SE11 - Tools - Table maintenance generator.
    Table maintanance Generator is used to manually input values using transaction sm30
    follow below steps
    1) go to se11 check table maintanance check box under attributes tab
    2) utilities-table maintanance Generator-> create function group and assign it under
    function group input box. Also assign authorization group default &NC& .
    3) select standard recording routine radio in table table mainitainence generator to move table
    contents to quality and production by assigning it to request.
    4) select maintaience type as single step.
    5) maintainence screen as system generated numbers this dialog box appears when you click on create button
    6) save and activate table
    One step, two step in Table Maintenance Generator
    Single step: Only overview screen is created i.e. the Table Maintenance Program will have only one screen where you can add, delete or edit records.
    Two step: Two screens namely the overview screen and Single screen are created. The user can see the key fields in the first screen and can further go on to edit further details.
    SM30 is used for table maintenance(addition or deletion of records),
    For all the tables in SE11 for which Table maintenance is selected , they can be maintained in SM30
    Sm30 is used to maintain the table ,i.e to delete ,insert or modify the field values and all..
    It creates the maintenance screen for u for the aprticular table as the maintenance is not allowed for the table..
    In the SE11 delivery and maintenance tab, keep the maintenance allowed..
    Then come to the SM30 and then enter the table name and press maintain..,
    Give the authorization group if necessary and give the function group and then select maintenance type as one step and give the screen numbers as system specified..
    Then create,,,
    Then u will able to see the maintenance view for the table in which u can able to insert and delete the table values...
    We use SM30 transaction for entering values into any DB table.
    First we create a table in SE11 and create the table maintenance generator for that Table using (utilities-> table maintenance generator) and create it.
    Then it will create a View.
    After that from SM30, enter the table name and Maintain, create new entries, change the existing entries for that table.
    Hope this resolves your query.
    Reward all the helpful answers.
    Rgds,
    P.Naganjana Reddy

  • How to fetch rows from a table like search engines do?

    Is it possible to fetch rows from a table like Google does? I want to fetch row number 20-40 after the select has ordered the rows.
    Pseudo code: select * from log where rownum > 20 and rownum < 40 order by date;
    Rownum doesn't work with ordering so I tried:
    select * from log where (select * from log order by date) and rownum <20;
    But that still doesn't do what I want. I get the "top 20" rows but I can't get rows 20-40.
    My real table has 70000 rows and I want to select 69000-70000 so I really need a SQL do fetch only the rows I need.
    Any help would be very appreciated!
    Best regards,
    Christer Nordvik

    SELECT alias_for_rownum, column_names
            FROM   (SELECT ROWNUM AS alias_for_rownum, column_names
                    FROM   (SELECT   column_names
                            FROM     table_name
                            ORDER BY columns_to_order_by)
                    WHERE  ROWNUM <= last_row_you_want)
            WHERE  alias_for_rownum >= first_row_you_want
    Example:
    -- (This example uses the Oracle dept demo table.
    SET AUTOTRACE ON EXPLAIN
    SELECT rn, deptno, dname, loc
            FROM   (SELECT ROWNUM AS rn, deptno, dname, loc
                    FROM   (SELECT   deptno, dname, loc
                            FROM     dept
                            ORDER BY deptno)
                    WHERE  ROWNUM <= 3)
            WHERE  rn >= 2
                    RN     DEPTNO DNAME          LOC
                     2         20 RESEARCH       DALLAS
                     3         30 SALES          CHICAGO

  • How to delete master data of materials from sap tables

    how to delete master data of materials from sap tables...its needed now.
    i know its not recommended but still we need to do this. give me the best possible approach.
    regards,
    suneetha

    Hi,
    I would suggest you not to write your own code to delete the entries.
    BAPI_MATERIAL_DELETE, this would mark all materials selected for deletion. But still the material would exist in SAP.
    Another solution: Delete a material manually and in another session execute the transaction SM04. This would display the tables which get locked when you do the operation, Then you can write your own code to delete the material numbers from all the related tables.
    Regards
    Subramanian

  • Need to fetch value from a table based on data range

    Hello there,
    I was hoping that the community could give me a hand with this little puzzle I got.
    I am currently creating a Time Dimension for a data wharehouse, and I have the requirement to populate a column named SEASON (e.g: Summer, Winter, Spring, Autumn) for each date row. So for the 20/Dec/2013, the Season column must say Winter.
    Here is now my Time Dimension table looks like, without the Season information (which I yet have to load):
    DimTime Table
    TIMEID
    FULLDATE
    YEAR
    SEASON
    MONTH
    MONTHDAY
    WEEK
    WEEKDAY
    274
    02-MAR-10
    2010
    3
    2
    9
    2
    275
    03-MAR-10
    2010
    3
    3
    9
    3
    276
    04-MAR-10
    2010
    3
    4
    9
    4
    277
    05-MAR-10
    2010
    3
    5
    9
    5
    278
    06-MAR-10
    2010
    3
    6
    9
    6
    279
    07-MAR-10
    2010
    3
    7
    9
    7
    This entire table is being populated using Oracle functions to manipulate a date field from another table, named PDATE:
    My ETL Code
    INSERT INTO DimTime(timeid, fulldate, year, month, monthday, week, weekday)
    SELECT tim_seq.NEXTVAL, pdate, year, month, monthday, week, weekday
    FROM (SELECT DISTINCT pdate, EXTRACT(year from pdate) year, EXTRACT(month from pdate) month,
    EXTRACT(day FROM pdate) monthday, to_number(to_char(to_date(pdate,'DD/MM/YY'),'IW')) week,
    TO_CHAR(pdate, 'D') weekday
    FROM Performance PER
    ORDER BY pdate);
    NOTE: Code considers the table DimTime to be truncated every time it loads (i.e.: I don't need to consider additional loads).
    As you can see, Season wasn't populated. Since the solstices and equinoxes vary for each year, I can't just say that Summer start at a given date (e.g: 21 of June) because one year it could be the 19/Jun, another the 22/Jun, etc. So in order to solve this problem, I have a table named Season which defines the START and END dates for the seasons:
    Season Table
    SEASON#
    SEASONNAME
    YEAR
    DATEFROM
    DATETO
    1
    Spring
    2010
    01-MAR-10
    30-MAY-10
    2
    Summer
    2010
    31-MAY-10
    29-AUG-10
    3
    Autumn
    2010
    30-AUG-10
    28-NOV-10
    4
    Winter
    2010
    29-NOV-10
    27-FEB-11
    5
    Spring
    2011
    28-FEB-11
    29-MAY-11
    6
    Summer
    2011
    30-MAY-11
    28-AUG-11
    7
    Autumn
    2011
    29-AUG-11
    27-NOV-11
    8
    Winter
    2011
    28-NOV-11
    26-FEB-12
    9
    Winter
    2009
    30-NOV-09
    28-FEB-10
    This is the bit I don't know how to do. How can I make sure that I populate the correct Season in my DimTime table based on the season specified in the Season table?
    Thanks in advance for your help!
    Regards,
    P.

    Just join to table Season:
    INSERT
      INTO DimTime(
                   timeid,
                   fulldate,
                   year,
                   month,
                   monthday,
                   week,
                   weekday,
                   seasonname
      SELECT  tim_seq.NEXTVAL,
              pdate,
              year,
              month,
              monthday,
              week,
              weekday
        FROM  (
               SELECT  DISTINCT pdate,
                                EXTRACT(year from pdate) year,
                                EXTRACT(month from pdate) month,
                                EXTRACT(day FROM pdate) monthday,
                                to_number(to_char(to_date(pdate,'DD/MM/YY'),'IW')) week,
                                TO_CHAR(pdate,'D') weekday,
                                seasonname
                 FROM  Performance PER,
                       season
                 WHERE pdate between datefrom and dateto
    SY.

  • Tbale Data Not picked from Child Table while configuring Database Adapter

    Hi,
    we are experiencing problem while picking multiple records from child table while polling from the database.
    details are, lets say we have one Parent table "Student (Id ,College) and one Child Table (Id,Book,Author)
    Id is Primary key in Student Table and Foregin in Child Table.Lets say data in tables are
    Student Table :196263,"Y.M.C.A"
    Child Table :196263,"English","Gill"
    196263 ,"Maths","Nagpal"
    Now what should be done while polling 1 record should be picked from student table and 2 diferent records from Child Table ..for the above given scenario...
    (I have used 1:M Relationship).
    But What is happening that from Child Table only first record got picked up 2 times..and record from Student Tablle was being picked correctly.....but in the ideal
    Cab anybody help me how to resolve this issues....

    Hi Gurus,
    I am facing similar kind of issue i.e. after polling on header table (Logical Delete), the header records are updated correctly.
    But the problem starts in child table. From Child Table only first record is getting picked up 2 times (if 2 rows are there for that particular header id).
    Kindly help.
    Thanks,
    Abhishek
    Edited by: Abhishek saurabh on Jul 31, 2009 1:09 AM
    Edited by: Abhishek saurabh on Jul 31, 2009 1:11 AM

  • How to convert data when transferring from one table to another

    I have two tables and these are the structure of the tables
    create table E1(
    ID NUMBER
    ,NAME VARCHAR2(30)
    , DESIGNATION VARCHAR2(30)
    ,GENDER VARCHAR2(10));
    create table E2(
    ID NUMBER
    ,NAME VARCHAR2(30)
    , DESIGNATION VARCHAR2(3)
    ,GENDER NUMBER); Now I want to transfer records from one table to another using a master tables where data are compared because the datatypes in tables are different
    The first one is a gender table to match the gender and convert
    create table Gender(
    E1 varchar2(10),
    E2 number);The second is for the designation
    create table Designation(
    E1 varchar2(30),
    E2 varchar2(3);How to match and convert the data so that it can be transfered.

    Peeyush wrote:
    Can we do it with the help of a cursor.
    All SQL executed by the database are parsed as cursors and executed as cursors.
    I mean I have to insert data in bulk and I want to use cursor for it.The read and write (select and insert) are done by the SQL engine. The read part reads data and passes it to the write part that inserts the data.
    Now why would using PL/SQL and bulk processing make this faster? It will reside in-between the read part and the write part being done by the SQL engine.
    So the SQL engine reads the data. This then travels all the way to the PL/SQL engine as a bulk collect. PL./SQL then issues an insert (the write part to be done by the SQL engine). And now this very same data travels all the way from the PL/SQL engine to the SQL engine for insertion.
    So just how is this approach, where you add extra travel time to data, faster?
    and i want to commit the transaction after every 50 recordsWhy? What makes you think this is better? What makes you think you have a problem with not committing every 50 rows?

  • Trouble fetching record from Internal table

    Hi all,
    I am using a binary search read for retrieving data from an internal table, but i am not able to fetch a particular record even while it is present in the internal table.

    Check if you are sorting the table. When you are not sorting the table, the read fetch the next highest key field from the table e.g.
    Suppose if you have an internal table with following keys:
    12
    9
    13
    2
    22
    the read will pick only 12,13 & 22 record.
    Regards,
    Prashant.

  • How to write ABAP Logic in SAP Query to fetch records from many Tables

    Hi Expert,
    I have one requirement, want to display all BOM (Equipment BOM, Function Location BOM and Meterial BOM) from a particular plant.
    List of tables as below:
    EQST: Equipment to BOM Link
    TPST: Link Between Functional Location and BOM
    MAST: Material to BOM Link
    STPO:BOM item
    Requirement: When user enters Plant then SAP Query should execute and fetch all BOMs (as mentioned above) from STPO Table.
    I have done so far is as follows:
    I create User Group, Infoset and SAP Query.
    While creating INFOSET, i used 4 tables (EQST,TPST,MAST & STPO) and link between then is as follows:
    STPO-STLNR ---> EQST-STLNR : Left Outer Join
    STPO-STLNR ---> TPST-STLNR : Left Outer Join
    STPO-STLNR ---> MAST-STLNR : Left Outer Join
    Now its showing all BOM from all plants though I enter one Plant value.
    Please advise me to write SAP Query and Logic to fetch all BOM from selected Plant Value.
    Thanks,
    Jay.
    Edited by: jaykrishna007 on Jul 29, 2011 11:41 AM

    Hi FCannavo,
    Thanks for your quick reply.
    See, now I changed my Infoset design.
    I added one Plant Table (T001W) and then
    T001W-WERKS--->EQST-WERKS
    T001W-WERKS--->MAST-WERKS
    T001W-WERKS--->TPST-WERKS
    and then
    EQST-STLNR--->STPO-STLNR
    MAST-STLNR--->STPO-STLNR
    TPST-STLNR--->STPO-STLNR
    on selection screen, user will enter Plant Value.
    Now its showing some records, but i dont think so i would be correct output or not, please guide me whether it is correct or not?
    Thanks,
    Jay.

  • Data load fails from DB table - No SID found for value 'MT ' of characteris

    Hi,
    I am loading data into BI from an external system (oracle Database).
    This system has different Units like BG, ROL, MT (for Meter). While these units are not maintaned in R3/BW. They are respectively BAG, ROLL, M.
    Now User wants a "z table" to be maintained in BW, which has "Mapping between external system Units and BW units".
    So that data load does not fail. Source system will have its trivial Units, but at the time of loading, BW Units are loaded.
    For example -
    Input Unit (BG) -
    > Loaded Unit in BW (BAG)
    Regards,
    Saurabh T.

    Hello,
    The table T006 (BW Side) will have all the UOM, only thing is to make sure that all the Source System UOM are maintained in it. It also have fields for Source Units and target units as you have mentioned BG from Source will become BAG. See the fields MSEHI, ISOCODE in T006 table
    If you want to convert to other units then you need to implement Unit Conversion.
    Also see
    [How to Report Data in Alternate Units of Measure|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b7b2aa90-0201-0010-a480-a755eeb82b6f]
    Thanks
    Chandran

  • Data fetching problem

    Hi Experts,
    Could you please anybody help me and resolve this issue
    As per my below requirement i had written below select queries but this requirement says ATWRT is next retest date and   manufacturer expiration date based on the values of AUSP-ATINN field.
    But the values of ATWRT from the table AUSP are
    1) CUST-N09.00602560
    2) CUST-N11.00220820
    3) CUST-N09.00602560 and so on..........
    but how can i get above  requirement  as mentioned above  dates .
    <b>Material number (RESB-MATNR) material short text,( MAKT-MAKTX) quantity weighed (RESB-BDMNG), unit of measure (RESB-MEINS), next retest date (READ AUSP-ATWRT where batch equals AUSP-OBJEK and AUSP-ATINN equals LOBM_QNDAT), manufacturer expiration date(READ AUSP-ATWRT where batch equals AUSP-OBJEK and AUSP-ATINN equals LOBM_VFDAT), batch number.(RESB-CHARG).</b>
    SELECT   a~matnr
             a~bdmng
             a~meins
             a~charg
             a~aufpl
             a~aplzl
             a~objnr
             b~maktx
             INTO TABLE gt_resb_makt
             FROM resb AS a INNER JOIN makt AS b
             ON    amatnr = bmatnr
             WHERE a~objnr = wa_afvc-objnr
             AND   a~aufpl = wa_afvc-aufpl
             AND   a~aplzl = wa_afvc-aplzl.
      IF gt_resb_makt[] IS NOT INITIAL.
        SELECT objek
               <b>atwrt</b>          
               atinn
               FROM ausp
               INTO TABLE gt_ausp
               FOR ALL ENTRIES IN gt_resb_makt
               WHERE objek = gt_resb_makt-charg
               AND   atinn = 9999999400.
        SELECT objek
               atwrt
               atinn
               FROM ausp
               INTO TABLE gt_ausp1
               FOR ALL ENTRIES IN gt_resb_makt
               WHERE objek = gt_resb_makt-charg
               AND   atinn = 9999999409.
    Regards,
    Divya

    HI Divya,
    as per i understand...
    try this method..
    1. select objek from ausp itab where atinn = urs characteristic.
    2. loop at itab.
    select objeck from inob into itab1 where cuobj = itab-objek.
    endloop.
    inob-objek is a mix of matnr + batch.
    matnr = itab1-objek+0(18).
    batch = itab1-objek+18(10).
    use these matnr and batch values in table RESB and get all other things as per ur requirement.
    hope it helps.. let me know if u have other requirement.
    Regards

  • I want to fill the data source 0CO_OM_WBS_3 from COSP table.

    Hi,
    I am working on Plan and actual for cost controlling, I need to fill the data source with data from COSP table.
    Please give me the steps for this. I checked in RSA3 for data source it don't have any data, but the corresponding table COSP having data.a
    Thanks
    Durg

    Hi,
    See the following DataSources for requirements,
    0CO_OM_WBS_1                      WBS elements: Costs
    0CO_OM_WBS_2                      WBS elements: Budget
    0CO_OM_WBS_3                      WBS elements: Overall plan
    0CO_OM_WBS_4                      WBS elements: Statistical key figures
    0CO_OM_WBS_5                      WBS Elements: Selections
    0CO_OM_WBS_6                      WBS Elements: Actual Costs Using Delta Extraction
    0CO_OM_WBS_7                      WBS Elements: Commitment Line Items
    0CO_OM_WBS_8                      WBS Elements: Budget Line Items
    Use 0CO_OM_WBS_6 for Actual , bcoz it is having Delta Option for Plan you can go 0CO_OM_WBS_2 or 0CO_OM_WBS_3. See the SAP Help on that.
    http://help.sap.com/saphelp_nw04/helpdata/EN/08/47c6f8bc1db04a84c9185954208ee7/frameset.htm
    In this help you can find complete details of the Tables, you can see help for all above DataSources.
    Thanks
    Reddy

  • How to fetch rows from multiple tables

    I have a page with items from 3 tables. I need to populate these items with values from the database. The page does not allow me to use multiple automated fetches. So instead I decided to use a pl/sql page process that runs a cursor to get my field values and the uses apex_util.set_session_state to set the field item values. IS there any isues with doing this? Is there a better way?

    These tables are not really related so I gues I will stick with the pl/sql to populate and then page process to insert/update/delete. Here is the code I'm using.
    Chris
    DECLARE
    CURSOR get_info IS
    select A.FK_STU_BASE, A.FK_CONTACT, A.FK_RELATION, A.PRIORITY, A.CAN_PICK_UP_STUDENT,
    A.GETS_STX, A.GETS_STG, A.GETS_STA, A.GETS_DIS, A.GETS_THX, A.GETS_MED,
    A.GETS_MAIL, A.NOTES as STUDENT_NOTES, A.USER_FLD1, A.USER_FLD2, A.USER_FLD3,
    A.USER_FLD4, A.USER_FLD5, A.LAST_UPDATE_DATE, A.LAST_UPDATE_USER,
    B.PK_ID as CONTACT_PK_ID, B.FIRST_NAME, B.LAST_NAME, B.MIDDLE_INIT, B.PREFIX,
    B.SUFFIX, B.FK_LANGUAGE, B.PHONE, B.PHONE_UNLISTED, B.PHONE_EXTENSION,
    B.PHONE_DESCRIPTION, B.EMERGENCY_PHONE, B.EMERGENCY_UNLISTED, B.EMERGENCY_EXTENSION,
    B.EMERGENCY_DESCRIPTION, B.CELL_PHONE, B.CELL_UNLISTED, B.CELL_EXTENSION,
    B.CELL_DESCRIPTION, B.CELL2_PHONE, B.CELL2_UNLISTED, B.CELL2_EXTENSION,
    B.CELL2_DESCRIPTION, B.WORK1_PHONE, B.WORK1_UNLISTED, B.WORK1_EXTENSION,
    B.WORK1_DESCRIPTION, B.WORK2_PHONE, B.WORK2_UNLISTED, B.WORK2_EXTENSION,
    B.WORK2_DESCRIPTION, B.FAX_PHONE, B.FAX_DESCRIPTION, B.EMAIL1, B.EMAIL2,
    B.NOTES as CONTACT_NOTES, B.FK_LODGING, B.FK_EDUCATION_LEVEL,
    C.PK_ID as LODGING_PK_ID, C.FK_ZIP, C.FK_DISTRICT, C.HOUSE_NO, C.LETTER,
    C.DIRECTION, C.STREET, C.STREET2, C.PLUS4, C.APT, C.FK_GRIDCODE,
    C.FK_MUNICIPALITY, C.OPTIONAL_INFO1, C.OPTIONAL_INFO2, C.OPTIONAL_INFO3,
    C.FK_DWELLING, C.OPTIONAL_ZIPCODE
    from contact_link A,
    contact B,
    lodging C
    where A.PK_ID = :P470_CONTACT_LINK_PK_ID and
    B.PK_ID (+) = A.FK_CONTACT and
    C.PK_ID (+) = B.FK_LODGING;
    BEGIN
    FOR x in get_info LOOP
    -- Set Contact Link Items
    APEX_UTIL.SET_SESSION_STATE('P470_FK_STU_BASE',X.FK_STU_BASE);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_CONTACT',X.FK_CONTACT);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_RELATION',X.FK_RELATION);
    APEX_UTIL.SET_SESSION_STATE('P470_PRIORITY',X.PRIORITY);
    APEX_UTIL.SET_SESSION_STATE('P470_CAN_PICK_UP_STUDENT',X.CAN_PICK_UP_STUDENT);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_STX',X.GETS_STX);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_STG',X.GETS_STG);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_STA',X.GETS_STA);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_DIS',X.GETS_DIS);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_THX',X.GETS_THX);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_MED',X.GETS_MED);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_MAIL',X.GETS_MAIL);
    APEX_UTIL.SET_SESSION_STATE('P470_STUDENT_NOTES',X.STUDENT_NOTES);
    APEX_UTIL.SET_SESSION_STATE('P470_USER_FLD1',X.USER_FLD1);
    APEX_UTIL.SET_SESSION_STATE('P470_USER_FLD2',X.USER_FLD2);
    APEX_UTIL.SET_SESSION_STATE('P470_USER_FLD3',X.USER_FLD3);
    APEX_UTIL.SET_SESSION_STATE('P470_USER_FLD4',X.USER_FLD4);
    APEX_UTIL.SET_SESSION_STATE('P470_USER_FLD5',X.USER_FLD5);
    APEX_UTIL.SET_SESSION_STATE('P470_LAST_UPDATE_DATE',X.LAST_UPDATE_DATE);
    APEX_UTIL.SET_SESSION_STATE('P470_LAST_UPDATE_USER',X.LAST_UPDATE_USER);
    --Set Contact Items
    APEX_UTIL.SET_SESSION_STATE('P470_CONTACT_PK_ID',X.CONTACT_PK_iD);
    APEX_UTIL.SET_SESSION_STATE('P470_FIRST_NAME',X.FIRST_NAME);
    APEX_UTIL.SET_SESSION_STATE('P470_LAST_NAME',X.LAST_NAME);
    APEX_UTIL.SET_SESSION_STATE('P470_MIDDLE_INIT',X.MIDDLE_INIT);
    APEX_UTIL.SET_SESSION_STATE('P470_PREFIX',X.PREFIX);
    APEX_UTIL.SET_SESSION_STATE('P470_SUFFIX',X.SUFFIX);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_LANGUAGE',X.FK_LANGUAGE);
    APEX_UTIL.SET_SESSION_STATE('P470_PHONE',X.PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_PHONE_UNLISTED',X.PHONE_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_PHONE_EXTENSION',X.PHONE_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_PHONE_DESCRIPTION',X.PHONE_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_EMERGENCY_PHONE',X.EMERGENCY_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_EMERGENCY_UNLISTED',X.EMERGENCY_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_EMERGENCY_EXTENSION',X.EMERGENCY_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_EMERGENCY_DESCRIPTION',X.EMERGENCY_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL_PHONE',X.CELL_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL_UNLISTED',X.CELL_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL_EXTENSION',X.CELL_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL_DESCRIPTION',X.CELL_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL2_PHONE',X.CELL2_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL2_UNLISTED',X.CELL2_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL2_EXTENSION',X.CELL2_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL2_DESCRIPTION',X.CELL2_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK1_PHONE',X.WORK1_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK1_UNLISTED',X.WORK1_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK1_EXTENSION',X.WORK1_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK1_DESCRIPTION',X.WORK1_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK2_PHONE',X.WORK2_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK2_UNLISTED',X.WORK2_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK2_EXTENSION',X.WORK2_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK2_DESCRIPTION',X.WORK2_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_FAX_PHONE',X.FAX_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_FAX_DESCRIPTION',X.FAX_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_EMAIL1',X.EMAIL1);
    APEX_UTIL.SET_SESSION_STATE('P470_EMAIL2',X.EMAIL2);
    APEX_UTIL.SET_SESSION_STATE('P470_CONTACT_NOTES',X.CONTACT_NOTES);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_LODGING',X.FK_LODGING);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_EDUCATION_LEVEL',X.FK_EDUCATION_LEVEL);
    --Set Lodging Items
    APEX_UTIL.SET_SESSION_STATE('P470_LODGING_PK_ID',X.LODGING_PK_ID);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_ZIP',X.FK_ZIP);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_DISTRICT',X.FK_DISTRICT);
    APEX_UTIL.SET_SESSION_STATE('P470_HOUSE_NO',X.HOUSE_NO);
    APEX_UTIL.SET_SESSION_STATE('P470_LETTER',X.LETTER);
    APEX_UTIL.SET_SESSION_STATE('P470_DIRECTION',X.DIRECTION);
    APEX_UTIL.SET_SESSION_STATE('P470_STREET',X.STREET);
    APEX_UTIL.SET_SESSION_STATE('P470_STREET2',X.STREET2);
    APEX_UTIL.SET_SESSION_STATE('P470_PLUS4',X.PLUS4);
    APEX_UTIL.SET_SESSION_STATE('P470_APT',X.APT);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_GRIDCODE',X.FK_GRIDCODE);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_MUNICIPALITY',X.FK_MUNICIPALITY);
    APEX_UTIL.SET_SESSION_STATE('P470_OPTIONAL_INFO1',X.OPTIONAL_INFO1);
    APEX_UTIL.SET_SESSION_STATE('P470_OPTIONAL_INFO2',X.OPTIONAL_INFO2);
    APEX_UTIL.SET_SESSION_STATE('P470_OPTIONAL_INFO3',X.OPTIONAL_INFO3);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_DWELLING',X.FK_DWELLING);
    APEX_UTIL.SET_SESSION_STATE('P470_OPTIONAL_ZIPCODE',X.OPTIONAL_ZIPCODE);
    END LOOP;
    END;

Maybe you are looking for