Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

abap logic for lookup

Former Member
0 Kudos

Hi all,

I have a requirement where i need to lookup for a value in ods1 and based on that value i should update in ods2. can anyone help me with any abap logic --- is there one for look-up ? any sample code would be really helpful.

~rahul

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Rahul - I'm not entirely sure what you want. Is it something like:


parameter: p_seln.
SELECT SINGLE zfield1
  FROM  ztab1
  INTO  ztab1-zfield1
  WHERE zkey1 = p_seln.
UPDATE ztab2
  SET   zfield2 = ztab1-zfield1
  WHERE zkey2   = ztab1-zkey1.

Rob

4 REPLIES 4

Former Member
0 Kudos

Rahul - I'm not entirely sure what you want. Is it something like:


parameter: p_seln.
SELECT SINGLE zfield1
  FROM  ztab1
  INTO  ztab1-zfield1
  WHERE zkey1 = p_seln.
UPDATE ztab2
  SET   zfield2 = ztab1-zfield1
  WHERE zkey2   = ztab1-zkey1.

Rob

0 Kudos

thanks rob. assume there is an infoobject A in ods1. Based on A's value i need to update the infoobject B in ods2 based on some calculation. for this i need to lookup for the value of A. Hope i am a bit clear now.

P.S: A resides in ods1, B in ods2.

Message was edited by: rahul choudhury

Message was edited by: rahul choudhury

0 Kudos

the following method will give the ODS table name

CALL METHOD cl_rsd_odso=>get_tablnm

EXPORTING

i_odsobject = <ods name>

i_tabt = '0'

IMPORTING

e_tablnm = ods_tab_name .

do a select from the ODS table to find whether infoobject A is there and get the value and based on that update ods2.

Regards

Raja

0 Kudos

thanks raja. do i need to write the code in se38 to find out the ods table first. could u please tell. i will try that and let u know the outcome.

Message was edited by: rahul choudhury