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

selection query problem

Former Member
0 Likes
1,174

hi all.....

i want to setct some data from table vbrp ,vbrk and vbfa .

on selection screen i have vbrk-vbeln and vbfa-erdat i hav written one code for tht but thts not working can nybdy plz help me in this..

parameter : p_vbeln type vbrk-vbeln ,

p_erdat type vbfa-erdat .

*--start of selection events

start-of-selection.

*--SELECTING THE DATA FROM DATABASE INTO INTERNAL TABLE

SELECT v1~vbeln AS vbeln

v1~kunag AS kunag

v1~vkorg AS vkorg

v1~netwr AS netwr

v2~ntgew AS ntgew

v2~matnr AS matnr

v3~erdat AS erdat

INTO CORRESPONDING fields of table it_data1

FROM vbrk AS v1

INNER JOIN vbrp AS v2

ON v1vbeln = v2vbeln

INNER JOIN vbfa AS v3

ON v1vbeln = v3vbeln

WHERE v1~vbeln eq p_vbeln .

loop at it_data1 into wa_data where erdat ne p_erdat.

delete it_data1 from wa_data.

endloop.

end-of-selection.

thanks in advance.....

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,131

Hi

Pls check in VBFA table, whether it is available in VBELN or VBELV

Regards

MD

10 REPLIES 10
Read only

Former Member
0 Likes
1,131

Use this,

SELECT v1~vbeln

v1~kuna

v1~vkorg

v1~netwr

v2~ntgew

v2~matnr

v3~erdat

INTO CORRESPONDING fields of table it_data1

FROM vbrk AS v1

INNER JOIN vbrp AS v2

ON v1vbeln = v2vbeln

INNER JOIN vbfa AS v3

ON v1vbeln = v3vbeln

WHERE v1~vbeln eq p_vbeln

Regards,

Midhun Abraham

Edited by: Midhun Abraham on Oct 3, 2008 10:51 AM

Read only

Former Member
0 Likes
1,132

Hi

Pls check in VBFA table, whether it is available in VBELN or VBELV

Regards

MD

Read only

0 Likes
1,131

hi madhan....

yes its in vbelv i hav changed tht but the thing is data is not coming through ...

what is the problem in the select query....

Read only

0 Likes
1,131

Hi

Pls let me know, how the select querry looks like, after modification

Regards

MD

Read only

Former Member
0 Likes
1,131

Hi,

have u checked in debugging , by setting a break point at select statement.

bcoz it may happens, u r deleting the data from internal table

by

delete it_data1 from wa_data.

revert back if any issues,

regards

Naveen

Read only

0 Likes
1,131

hi naveen,

yes i hav tried debugging tht query but i m not able to understand y its not selecting ny data.....

i hav commented tht deleting part then too no data is being selected...

Read only

0 Likes
1,131

Hi,

I have tried ur program in my system.

select querry is working fine i.e i can see the data in the interrnal table.

i am sure that the data is being deleted by the delete statement.

moreover check whether the data u entered in the selection screen exits in the database.

Revert back...

regards,

Naveen

Read only

Former Member
0 Likes
1,131

I am not sure if this help, you may try this:

WHERE v1~vbeln IN p_vbeln .

If your vbeln is in range (i.e. you see two boxes with for that parameters in the selection screens), you need to use IN to check value instead of eq

Read only

Former Member
0 Likes
1,131

Hi

WHERE v1~vbeln eq p_vbeln .

change to

WHERE v1~vbeln like p_vbeln and see, whether it works

MD

Read only

Former Member
0 Likes
1,131

How have you defined your itab ?

You query looks perfectly ok , even if you use vbeln or vbelv it wont matter , it depends on the requirement.

So have you defined your itab correctly ?

for example :


data : begin of itab occurs 0,
         vbeln like vbrk-vbeln,
         kunag like vbrk-kunag,
         netwr like vbrk-netwr,
         ntgew like vbrp-ntgew,
         matnr like vbrp-matnr,
         erdat like vbfa-erdat,
         end of itab.

regards,

Advait