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

Check for empty field in selection screen.

Former Member
0 Likes
6,408

Hi all,

how can I achieve this ?

Selection screen:

    1. Sales  Document number -- range
    2. 2.Date on Which Record Was Created – range

Validate selection screen:

Mandatory fields, user has to enter either 1 OR 2 OR both .

selection-screen begin of block b1 WITH FRAME.

select-OPTIONS: so_vbeln for vbak-vbeln ,
                                so_erdat
for vbak-erdat.

SELECTION-SCREEN end of BLOCK b1.

At selection screen.
 
IF so_vbeln = 0 .
   
IF so_erdat = 0.
     
MESSAGE 'CANNOT EMPTY'  TYPE 'E'.
   
ENDIF.
 
ENDIF.

I am not able to validate my selection screen.

please help.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,978

hi,

on selection screen output

check if so_erdat is initial

and so_vbeln is initial

regards

Stefan Seeburger

Hi all,

how can I achieve this ?

Selection screen:

    1. Sales  Document number -- range
    2. 2.Date on Which Record Was Created – range

Validate selection screen:

Mandatory fields, user has to enter either 1 OR 2 OR both .

selection-screen begin of block b1 WITH FRAME.

select-OPTIONS: so_vbeln for vbak-vbeln ,
                                so_erdat
for vbak-erdat.

SELECTION-SCREEN end of BLOCK b1.

At selection screen.
 
IF so_vbeln = 0 .
   
IF so_erdat = 0.
     
MESSAGE 'CANNOT EMPTY'  TYPE 'E'.
   
ENDIF.
 
ENDIF.

I am not able to validate my selection screen.

please help.

Thanks.

8 REPLIES 8
Read only

Former Member
0 Likes
2,979

hi,

on selection screen output

check if so_erdat is initial

and so_vbeln is initial

regards

Stefan Seeburger

Read only

0 Likes
2,978

Stefan Seeburger wrote:

hi,

on selection screen output

check if so_erdat is initial

and so_vbeln is initial

regards

Stefan Seeburger

A better way to check is


if so_erdat[] is initial

and so_vbeln[] is initial
           ->Error

This because select-options are internal tables

Read only

0 Likes
2,978

But my requirement is :

user has to enter either 1 OR 2 OR both.

can I achieve this using above code?

Read only

0 Likes
2,978

But i wrote it!

AT SELECTION-SCREEN.
   IF so_vbeln[] IS INITIAL AND so_erdat[] IS INITIAL.
     MESSAGE 'CANNOT EMPTY'  TYPE 'E'.
   ENDIF.

So the user is forced to fill so_vbeln OR so_erdat OR both, otherwise get the error..

Read only

0 Likes
2,978

It works.

Thank you so much .

1 more Question:

Get  the Sales Order relevant records from VBAK table using selection screen details

and Get relevant line item records from VBAP.

for this i tried it in below way:

select vbeln
        posnr
        matnr
        lfrel
        ablfz
kwmeng
        erdat
   
FROM vbap
   
INTO TABLE it_vbap
   
WHERE vbeln = so_vbeln.

SELECT vbelv
              fplnr
             fpltr
   
FROM vbfa
   
INTO TABLE it_vbfa.

but i am not getting any data in my internal table.

Read only

0 Likes
2,978

Sorry, i'm missing the point:which is the issue?

Read only

0 Likes
2,978

i have to Get  the Sales Order relevant records(fplnr,fpltr) from VBAK table using selection screen details(so_vbeln and so_erdat)

and Get relevant line item records from VBAP(vbeln,posnr,matnr,lfrel,ablfz,kwmeng,erdat).

for that I tried above code but its not working.

Read only

0 Likes
2,978

Select <fields you need> into table <internal table with vbeln + posnr +fields you need> from vbak

                                        inner join vbap on vbap~vbeln = vbak~vbeln

                                       Where vbak~vbeln in so_vbeln

                                            and vbap~erdat in so_Erdat.

But this is basic question about SQL, even before abap....