‎2007 Jul 17 2:53 PM
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.
‎2007 Jul 17 3:46 PM
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
‎2007 Jul 17 2:55 PM
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
‎2007 Jul 17 2:59 PM
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
‎2007 Jul 17 3:04 PM
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
‎2007 Jul 17 3:15 PM
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.
‎2007 Jul 17 3:19 PM
Hi sanjana!
Can you send mo the specs for your project so that i can help...
regards,
Mackoy
‎2007 Jul 17 3:20 PM
‎2007 Jul 17 3:33 PM
‎2007 Jul 17 4:51 PM
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
‎2007 Jul 17 3:46 PM
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