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

plz help

Former Member
0 Likes
1,070

hello friends,

i was try to get all the line items in vbrp table where two fields donnot match

ie.

display all the document numbers where fields kzwi2 not equal to kzwi4.

in order to do this i thougt of creating 2 aliases a and b for the table vbrp in sq02.

and then thought of joining them,

but i created alis but its not appearing there are the screen, i dont know how to handle this.

does any body have correct idea.

if you are thinking of coding for this , where and how do we put this code.

thank you.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,036

Hello Sanjana,

You can not use same table in join.

Solution:

1.

Create a the info set by direct database selection

Give the table name VBRP.

2.

Go to the 'Code' tab.

Create extra fields those you wan to display in the list.

3.

In the code section select the 'Data'

declare a work area

DATA: wa_vbrp LIKE vbrp.

4. Now select the list processing.

Please enter this code:

CLEAR wa_vbrp

Select single * from VBRP

where vbeln = vbrp-vbeln "<---this is already selected by query

and posnr = vbrp-posnr

and kzwi2 <> vbrp-kzwi4.

Important step.

5. For each extra fields declared please populate the code like this:

Example you have declared a extra field EXTRA_VBELN for VBELN

CLEAR EXTRA_VBELN.

IF NOT wa_vbrp is initial.

EXTRA_VBELN = wa_vbrp-vbeln.

ENDIF.

Likewise you populate each extra fields.

In the query Q01, in the list output select those extra fields only.

Your list will display all the desired list plus few blank lines.

Ignor the blank lines.

Regards,

A.Singh

9 REPLIES 9
Read only

Former Member
0 Likes
1,036

Hi Sanjana,

YOu cannot have a simple query for this. You need a bit of ABAP here.

First get the VBRP data into an internal table for the selection criteria.

then.

loop at it_VBRP.

if it_vbrp-kzwi2 <> it_vbrp-kzwi4.

delete it_vbrp index sy-tabix.

endif.

endloop.

Regards,

Ravi

Read only

Former Member
0 Likes
1,036

Hi,

get the VBRP data into itab for the selection criteria.

loop at it_VBRP.

if itab_vbrp-kzwi2 NE itab_vbrp-kzwi4.

delete itab_vbrp index sy-tabix.

endif.

endloop.

where itab_vbrp should contain kzwi2 kzwi4 of type or like any......

thanks

Divya

Reward if helpful

Read only

Former Member
0 Likes
1,036

I don't think it is possible using SQ02 Transaction,make it is as ABAP report,then use loop endloop,within loop keep the condition.

if you do not know how to write the code,then get the ABAP Developer Help..

Thanks

Seshu

Read only

Former Member
0 Likes
1,036

thank you friends for the precious replies,

i can do this work with report in no time,

but my lead is insisting to do it with abap query,

can any one plz help.

Read only

0 Likes
1,036

Hi sanjana!

Can you send mo the specs for your project so that i can help...

regards,

Mackoy

Read only

Former Member
0 Likes
1,036

no specs only words.

Read only

Former Member
0 Likes
1,036

any one plz help

Read only

0 Likes
1,036

In the Join at the query level,we cannot compare two fields i guess. I think you can only get the similar data using query here,not the data which doesnot match.

Thanks,

vamshi p

Message was edited by:

vamshi p

Read only

Former Member
0 Likes
1,037

Hello Sanjana,

You can not use same table in join.

Solution:

1.

Create a the info set by direct database selection

Give the table name VBRP.

2.

Go to the 'Code' tab.

Create extra fields those you wan to display in the list.

3.

In the code section select the 'Data'

declare a work area

DATA: wa_vbrp LIKE vbrp.

4. Now select the list processing.

Please enter this code:

CLEAR wa_vbrp

Select single * from VBRP

where vbeln = vbrp-vbeln "<---this is already selected by query

and posnr = vbrp-posnr

and kzwi2 <> vbrp-kzwi4.

Important step.

5. For each extra fields declared please populate the code like this:

Example you have declared a extra field EXTRA_VBELN for VBELN

CLEAR EXTRA_VBELN.

IF NOT wa_vbrp is initial.

EXTRA_VBELN = wa_vbrp-vbeln.

ENDIF.

Likewise you populate each extra fields.

In the query Q01, in the list output select those extra fields only.

Your list will display all the desired list plus few blank lines.

Ignor the blank lines.

Regards,

A.Singh