‎2007 Sep 04 10:18 AM
hi gurus,
i created selection screen afpo-aufnr, afko-rsnum, resb-matnr fields with select options apart from that if i select either afpo-aufnr or afko-resnum for this i have to validate that selection fields plz sen the logic how to validate that
‎2007 Sep 04 10:27 AM
Hi babu,
Find the code below it will help you out.. even if your problem not solved .. feel free to contact me.
<b>Reward points if it useful. Which boost us help others.</b>
*&---------------------------------------------------------------------*
*& Report YPRG33
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT YPRG33.
tables : afpo, afko, resb.
select-options : so_aufnr for afpo-aufnr,
so_rsnum for afko-rsnum,
so_matnr for resb-matnr .
at selection-screen on so_aufnr.
*................
*.. statements over here
*...............
at selection-screen on so_rsnum.
*................
*..statements over here
*...............
‎2007 Sep 04 10:21 AM
hi,
if afpo-aufnr is not initial
then validate afpo-aufnr
endif.
if afko-resnum is not initial
validate afko-resnum
endif.
Thanks,
Praveena
‎2007 Sep 04 10:23 AM
HI,
at selection screen.
select aufnr from <b>AUFK</b> into table itab where aufnr in s_aufnr.
if sy-subrc ne 0.
message no data found for AUFNR.
endif.
select RSNUM from AFKO into table itab1 where RSNUM in s_rsnum.
if sy-subrc ne 0.
message no data found for RSNUM .
endif.
you can also use
at selection screnn on s_aufnr-low.
at selection screnn on s_aufnr-high.
at selection screnn on s_rsnum-low.
at selection screnn on s_rsnum-high.
thanks & regards,
Venkatesh
‎2007 Sep 04 10:25 AM
Hi,
Suppose you want to validate afpo-aufnr field then write as follows
supose you have a selct options SO_AUFNR for afpo-aufnr . then
data v_aufnr type afpo-aufnr.
SELECT SINGLE aufnr
FROM afpo
where aufnr IN so_aufnr.
IF SY-SUBRC NE 0.
Message E()....Raise error message whch u r using in Program.
ENDIF.
In the same way you can validate other fields
<b>Kindly Reward Points for Helpfill Answers</b>
Regards
Tanweer
‎2007 Sep 04 10:26 AM
Hi,
let say you have
<b>select-options: s_aufnr for afpo-aufnr,
s_rsnum for afko-rsnum.</b>
you can write:
<b>at selection-screen on s_aufnr.</b>
If s-aufnr[] is not initial.
data : lv_aufnr type aufnr.
here we are using select single because AUFNR is the only primary key in its **value table AUFK
select single sufnr from aufk into lv_aufnr where aufnr in s_aufnr.
If sy-subrc <> 0.
**Message " Error message here " please enter valid order number
endif.
endif.
<b>at selection-screen on s_rsnum.</b>
If s_rsnum[] is not initial.
data : lv_rsnum type rsnum.
here we are using select upto 1 rows because rsnum is a part of primary key in **its value table RESB.
select rsnum into lv_rsnum
from resb
up to 1 rows where rsnum in s_rsnum.
endselect.
if sy-subrc <> 0.
error message..
endif.
endif.
rewards if useful,
'
regards,
nazeer
‎2007 Sep 04 10:27 AM
AT SELECTION SCREEN ON s_aufnr
if s_aufnr[] IS NOT INOTIAL. " Select option for afpo-aufnr
VALIDATE AUFNR
SElect single aufnr from AUFK into v_aufnr where
aufnr in s_aufnr.
if sy-subrc ne 0.
Display error message
endif.
endif.
Similary validate others
Regards,
Taranam
‎2007 Sep 04 10:27 AM
Hi babu,
Find the code below it will help you out.. even if your problem not solved .. feel free to contact me.
<b>Reward points if it useful. Which boost us help others.</b>
*&---------------------------------------------------------------------*
*& Report YPRG33
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT YPRG33.
tables : afpo, afko, resb.
select-options : so_aufnr for afpo-aufnr,
so_rsnum for afko-rsnum,
so_matnr for resb-matnr .
at selection-screen on so_aufnr.
*................
*.. statements over here
*...............
at selection-screen on so_rsnum.
*................
*..statements over here
*...............
‎2007 Sep 04 10:29 AM
Hi babu,
Find the code below it will help you out.. even if your problem not solved .. feel free to contact me.
<b>Reward points if it useful. Which boost us help others.</b>
*&---------------------------------------------------------------------*
*& Report YPRG33
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT YPRG33.
tables : afpo, afko, resb.
select-options : so_aufnr for afpo-aufnr,
so_rsnum for afko-rsnum,
so_matnr for resb-matnr .
at selection-screen on so_aufnr.
*................
*.. statements over here
*...............
at selection-screen on so_rsnum.
*................
*..statements over here
*...............
regards
sharma
‎2007 Sep 04 10:31 AM
You can do this under "AT selection screen" event.
Logic goes here.
At selection -screen on afpo-aufnr-LOW.
Seelct single * from AUFK where AUFNR = afpo-aufnr-LOW.
If sy-subrc NE 0.
Raise PRoper message.
At selection -screen on afpo-aufnr-HIGH.
Seelct single * from AUFK where AUFNR = afpo-aufnr-HIGH.
If sy-subrc NE 0.
Raise PRoper message.
Same way Validate AFKO-Resnum againest table RESB table and raise proper messages.
HOpe this is helpful..
Cheers,
Jaleel
‎2007 Sep 04 10:59 AM