‎2009 Apr 03 9:40 AM
Hello gurus.......
my input
1. code (from bseg)
2. Date (bkpf
3. Regio ( kna1
The below is the looping code, My Select stmts are proper such that the criteria gets
satisfied but when it goes inside the loop ,
i have used
select Bseg
select bkpf
select knal
what happens is if i give the input for code , date and
for regio which is not in that code and date
it selects in bkpf and bseg but not in kna1 since does not match till here its proper
but inside the loop it fetches the data for watever is satisfied in bkpf and bseg
and does not bring value for kna1
but it should not bring any value since wat i specified for regio is not satisfied
ie it partially shows the output ....but actually no data should be displayed in output
Please guru's suggest .......
LOOP AT it_bseg INTO wa_bseg WHERE kunnr <> ' '.
READ TABLE it_kna1 INTO wa_kna1 WITH KEY kunnr = wa_bseg-kunnr .
IF sy-subrc = 0.
wa_final-name1 = wa_kna1-name1.
wa_final-mcod3 = wa_kna1-MCOD3.
wa_final-belnr = wa_bseg-belnr.
READ TABLE it_bkpf INTO wa_bkpf WITH KEY belnr = wa_bseg-belnr.
IF sy-subrc = 0.
wa_final-bldat = wa_bkpf-bldat.
so onnnnn.......................
APPEND wa_final TO it_final.
Endloop.
Endloop.
clear: wa_bseg, wa_bkpf, wa_kna1, wa_t005u, wa_vbrp, wa_konv, wa_final.
ENDLOOP.
Thanx
‎2009 Apr 03 9:45 AM
Hi,
do selection screen validation for all the PARAMETERS in 'AT SELECTION-SCREEN ON FIELD XXXX...and display message if any thing fails...
Hope its clear...
Let me know for any clarifications...
Regards,
Pavan
‎2009 Apr 03 9:51 AM
Since you are giving code and date in selection screen ,data related to them will be displayed.
If you dont want data, if any field is empty then put a condition for the same.
If not regio is initial.
loop at it_bseg into wa_bseg.
..................
...................
endloop.
endif.
‎2009 Apr 03 10:03 AM
hi
thank u for the reply
if i give so....even if there is value in regio field , its taking as blank and not showing data in the output
‎2009 Apr 03 10:26 AM
Hello,
Either check for SY-SUBRC after each select statement or check
if the above internal table is INITIAL.
For ex:
select BSEG.
if sy-subrc = 0.
select BKPF.
if sy-subrc =0 .
select KNA1.
OR
select BSEG
if (internal table BSEG) is NOT INITIAL.
select BKPF.
if (internal table BKPF) is NOT INITIAL.
select KNA1.
And also put the validations as required on the selection screen fields.