‎2009 Mar 18 5:35 AM
hi experts.....................
part of my code below......
problem is ....i have used a select stmt from table vbfa where it has a
field called vbelv , it may have any number of documents in it , whenever there
is a movement type '101', that document should not be displayed in my final alv.
when i restrict in my select using where condition as NE 101, other movement type are
coming in the output which is NE to 101,
my criteria is not that, it that document has no 101 in the movemt (BWART) field
those document should be displayed else it should not....
So i thought of specifying that condition in loop where bwart = 101
and thought of deleting inside....
i dont know how to code this ....can you pls help me to solve this issue
thanx in advance
;
;
;
SELECTING RECEIVER PLANT AND SLOC.
select vbeln pstyv matnr lfimg arktx erdat werks lgort vgbel bwart
from lips into corresponding fields of table it_lips
for all entries in it_ekko
where vgbel = it_ekko-ebeln and
werks = it_ekko-reswk and
aedat = it_ekko-bedat and
lgort in so_sen and
matnr in so_matnr.
****added for mvmt type NE 101
select VBELV bwart matnr from vbfa
into corresponding fields of table it_vbfa
for all entries in it_lips
where
vbelV = it_lips-vbeln and
matnr = it_lips-matnr." and
bwart <> '101' and bwart <> ' '. .
;
;
;
;
loop at it_lips into wa_lips .
read table it_ekpo into wa_ekpo with key ebeln = wa_lips-vgbel.
If sy-subrc = 0.
wa_final-aedat = wa_ekpo-aedat.
wa_final-ebeln = wa_lips-vgbel.
wa_final-senp = wa_lips-werks.
wa_final-sen = wa_lips-lgort.
Endif.
;
;
;
endloop.
‎2009 Mar 18 5:37 AM
Hello,
If you want to fetch only those documents where movemt (BWART) field = 101, why you need NE 101.
try this:
select vbeln pstyv matnr lfimg arktx erdat werks lgort vgbel bwart
from lips into corresponding fields of table it_lips
for all entries in it_ekko
where vgbel = it_ekko-ebeln and
werks = it_ekko-reswk and
aedat = it_ekko-bedat and
lgort in so_sen and
matnr in so_matnr
and bwart = 101.
Rgds,
Sandeep
‎2009 Mar 18 5:48 AM
thanx for your reply....
but my requirement is that
when it sees 101 in that document it should not be displayed
as you said if i give = 101 ,,,,it willl fetch that document ,
if i give NE 101 , it will fetch the same document where the mvmt type will be 334 667 etc....
wat i need is ,,,,there may be 3 to 4 same document no with different mvmt type , if that doucment has 101 , i dont want it to be displayed
‎2009 Mar 18 5:51 AM
hmmm....
Then first select all documents.
loop at itab into wa.
if bwart = 101.
delete table itab from wa.
else.
continue.
endif.
endloop.
‎2009 Mar 18 5:40 AM
If bwart NE '101'.
you can write ur select statement here..----
> In this way you can fetch only the required records.
endif.
In this way u can avoid..
Hope this is what you are looking for.
‎2009 Mar 18 5:50 AM
Try this,
select vbelv bwart matnr
from vbfa
into corresponding fields of table it_vbfa
for all entries in it_lips
where vbelv eq it_lips-vbeln
and matnr eq it_lips-matnr
and bwart eq '101' .
Regards,
Joan
‎2009 Mar 18 5:54 AM
hi,
In final internal table after appending from workarea, delete final internaltable where bwart eq 101.
Regards,
vino.
‎2009 Mar 18 5:54 AM
select VBELV bwart matnr from vbfa
into corresponding fields of table it_vbfa
for all entries in it_lips
where
vbelV = it_lips-vbeln and
matnr = it_lips-matnr and
bwart NE '101'.
loop at it_lips into wa_lips .
read table it_ekpo into wa_ekpo with key ebeln = wa_lips-vgbel.
If sy-subrc = 0.
if wa_lips-bwart ne '101'
wa_final-aedat = wa_ekpo-aedat.
wa_final-ebeln = wa_lips-vgbel.
wa_final-senp = wa_lips-werks.
wa_final-sen = wa_lips-lgort.
append wa_final to it_final.
endif.
Endif.
;
;
;
endloop.
otherwise...
loop at it_lips into wa_lips .
read table it_ekpo into wa_ekpo with key ebeln = wa_lips-vgbel.
if sy-subrc eq 0.
delete it_lips where bwart eq '101'.
endif.
endloop.
‎2009 Mar 18 5:56 AM
Hi,
In final internal table after appending from workarea delete final internaltable where bwart eq 101, after endloop.
Regards,
vino
‎2009 Mar 18 6:03 AM
Hi
Select all the records without giving restriction of 101 movement type.
Then loop the table if any record is movement type 101 then delete it from the table else keep it.
‎2009 Mar 18 6:17 AM
Hi,
So basically you can have the following example:
VBELV POSNV VBELN POSNN VBTYP_N BWART
1300000202 000000 10000384 000001 8
1300000202 000010 20070329 100905 Q
1300000202 000010 4900001632 000001 R 641
1300000202 000010 5000000730 000001 i 101So what you require is for any doc, if it has one entry with bwart 101 (GR), it should not be displayed. Right?
If yes, please do as follows (keep your select without the BWART = 101 restriction):
select VBELV bwart matnr from vbfa
into corresponding fields of table it_vbfa
for all entries in it_lips
where
vbelV = it_lips-vbeln and
matnr = it_lips-matnr."
if sy-subrc = 0.
loop at it_vbfa into wa_vbfa.
if wa_vbfa-bwart = '101'.
r_excl_vbelv-sign = 'I'.
r_excl_vbelv-option = 'EQ'.
r_excl_vbelv-low = wa_vbfa-vbelv.
append r_excl_vbelv.
endif.
endloop.
if r_excl_vbelv[] is not intial.
delete it_vbfa where vbelv in r_excl_vbelv.
endif.
Regards.
endif.
Edited by: Dev Parbutteea on Mar 18, 2009 7:17 AM
‎2009 Mar 18 7:12 AM
Exactly the same as you mentioned
iam trying your code...but pls can you help me by saying wat is
r_excl_vbelv-sign = 'I'.
r_excl_vbelv-option = 'EQ'.
r_excl_vbelv-low = wa_vbfa-vbelv.
wat should i declare in data part as????
thank you so much
‎2009 Mar 18 6:19 AM
Hi Rachel,
u can do it in the following ways.
1) select * from ___
into ____
where bwart eq '101'.
2) select * from ___
into ____
where bwart in ( '101').
3) after the endloop.
delete itab where bwart ne '101'.
thanks & regards,
kat
‎2009 Mar 18 6:34 AM
u can loop at your internal table it_vbfa .
loop at it_vbfa into wa_vbfa where bwart = '101'.
DELETE TABLE it_vbfa WITH TABLE KEY VBELV = wa_vbfa-vbelv.
endloop.
after doing this ur internal table will have only those documents where mov type has never been 101.
‎2009 Mar 18 7:01 AM
Hi,
Try with Control break events
1) Sort the it_lips table by vgbel and bwart
2) In loop and endloop, for every new vgbel, check for bwart value if it is 101, skip complete vgbel.
Note :- It may work only when bwart start with '101' only.
SORT it_lips BY vgbel bwart.
LOOP AT it_lips INTO wa_lips.
AT NEW vgbel.
ENDAT.
IF wa_lips-bwart = '101'.
CONTINUE.
ELSE.
READ TABLE it_ekpo INTO wa_ekpo WITH KEY ebeln = wa_lips-vgbel.
IF sy-subrc = 0.
wa_final-aedat = wa_ekpo-aedat.
wa_final-ebeln = wa_lips-vgbel.
wa_final-senp = wa_lips-werks.
wa_final-sen = wa_lips-lgort.
ENDIF.
ENDIF.
AT END OF vgbel.
APPEND wa_final TO it_final.
ENDAT.
ENDLOOP.Regards
Bala Krishna
Edited by: Bala Krishna on Mar 18, 2009 12:31 PM
‎2009 Mar 18 7:21 AM
thanx krishna for your response
but i dont want to check bwart of lips table
i want to check for vbfa - bwart....... but it can be specified inside loop at it_lips........
thats the problem