Application Development and Automation 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: 
Read only

Read Table syntax

Former Member
0 Likes
13,754

hi,

Can i do read table with 2 keys?

Regards,

Ronita.

11 REPLIES 11
Read only

Former Member
0 Likes
1,676

hI,

oF Course !! Check the syntax of Read statement.

Thank you.

Read only

Former Member
0 Likes
1,676

Hi,

Yes, you can READ a table with 2 or more keys.

For your reference

READ TABLE pa_gt_actual_prices INTO ls_act_prices

WITH TABLE KEY kokrs = p_kokrs

perio = l_perio

objnr = ls_cssl-objnr

gjahr = p_gjahra.

Regards,

Farheen.

Read only

Former Member
0 Likes
1,676

yha

it wll b

read table it_vbap with key vbeln = it_vbeln posnr = it_posnr.

with regards

Rohan Shetty

Read only

Former Member
0 Likes
1,676

Yes you can.

loop at it1.

Read table itab with key abcd = it1-abcd

fghj = it1-fghj.

if sy-subrc = 0.

do process.

endif.

endloop.

Regards,

Madan.

Read only

Former Member
0 Likes
1,676

hi,

Check this link

Link:

[https://www.sdn.sap.com/irj/sdn/forums].

Regards.

Read only

Former Member
0 Likes
1,676

Check in SAP help or SDN .

read table <tab1> into <ls> with key

WHERE variable1 = value1

Binary search.

and

Read table itab with key variable1 = value1 variable2 = value2.....

thanks

Jagadeesh.G

Read only

Former Member
0 Likes
1,676

Hi Ronita,

Yes in the read statement we can use more than one key. Pls find the below syntax of the same.

read table it_circle into wa_circle 
with key circle_id = cid
             circle_name = cname
             circle_customer = cust.

Pls reward if useful.

Thanks,

Sirisha.

Read only

0 Likes
1,676

Hi Sirisha,

Is it possible to add same key field with two input field in an read statement ?

readtable it_circle into wa_circle 
withkey circle_id = cid or 
             circle_id = cid1
             circle_customer = cust
Read only

0 Likes
1,676

hi mohammedsarvar.ka

you can't use same key.

Read only

Former Member
0 Likes
1,676
  • with work area

Read table it_tab into wa_tab with key

key1 = wa_xyz-key1

key2 = wa_xyz-key2.

if sy-subrc = 0.

Perform your logic here.

endif.

  • with field symbols

Read table it_tab assigning <fs_tab> with key

key1 = wa_xyz-key1

key2 = wa_xyz-key2.

if sy-subrc = 0.

Perform your logic here.

endif.

Reward points if helpful

Regards

Bikas

Read only

Former Member
0 Likes
1,676

Hi Ronita De,

We can read an internal table with two keys.....

READ TABLE IT_KNA1

INTO WA_KNA1

WITH KEY KUNNR = P_KUNNR

LAND1 = C_LAND1.

IF SY-SUBRC = 0.

write: / 'Read is SUCCESS'.

ENDIF.

thanks & regards

Kishore Kumar Maram