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

selection screen fields

Former Member
0 Likes
1,102

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
979

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
*...............          

9 REPLIES 9
Read only

Former Member
0 Likes
979

hi,

if afpo-aufnr is not initial

then validate afpo-aufnr

endif.

if afko-resnum is not initial

validate afko-resnum

endif.

Thanks,

Praveena

Read only

Former Member
0 Likes
979

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

Read only

Former Member
0 Likes
979

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

Read only

Former Member
0 Likes
979

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

Read only

Former Member
0 Likes
979

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

Read only

Former Member
0 Likes
980

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
*...............          

Read only

Former Member
0 Likes
979

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

Read only

Former Member
0 Likes
979

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

Read only

Former Member
0 Likes
979

HI GURUS THANX'S FOR REPLY