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

Checking select option values.

Former Member
0 Likes
324

Hi Guys/Dolls

I have an ABAP program that works ok but I would like to make it more flexible.

The program populates a select option field on the INITILIZATION event but I need to check values entered are within valid range.

I’m using

CHECK p0008-TRFGR EQ 'PROF' OR p0008-TRFGR EQ 'GRADE 09'.

But I’m sure there is a way to use

CHECK p0008-TRFGR IN p_ps_grp.

Which is much more elegant but I don’t know how; if I use the above the program crashes and only way to resolve is not to populate it within the initilization section and to use a variant. Is there a solution out there.

A snippet of my code is as follows:-


REPORT zh119rep LINE-SIZE 175 NO STANDARD PAGE HEADING.


* Define the Pay scale group range.
SELECT-OPTIONS p_ps_grp FOR p0008-trfgr.


* INITIALIZATION EVENT
INITIALIZATION.
* Set the Pay Scale Groups but 1st clear it.
  REFRESH p_ps_grp.
  p_ps_grp-low = 'PROF'.
  APPEND p_ps_grp.
  p_ps_grp-low = 'GRADE 09'.
  APPEND p_ps_grp.


GET pernr.

* Check to see if selected wage type is in range.
  CHECK p0008-TRFGR IN p_ps_grp.	“ This crashes program
*  CHECK p0008-TRFGR EQ 'PROF' OR p0008-TRFGR EQ 'GRADE 09'. “ This ok.

Any ideas?

Many thanks in advance.

Raj

1 ACCEPTED SOLUTION
Read only

suresh_datti
Active Contributor
0 Likes
281

the following should work fine..

REPORT zh119rep LINE-SIZE 175 NO STANDARD PAGE HEADING.
 
 
* Define the Pay scale group range.
SELECT-OPTIONS p_ps_grp FOR p0008-trfgr.
 
 
* INITIALIZATION EVENT
INITIALIZATION.
* Set the Pay Scale Groups but 1st clear it.
  REFRESH p_ps_grp.
  p_ps_grp-sign = 'I'.
  p_ps_grp-option = 'EQ'.
  p_ps_grp-low = 'PROF'.
  APPEND p_ps_grp.
  p_ps_grp-low = 'GRADE 09'.
  APPEND p_ps_grp.
 
 
GET pernr.
 
* Check to see if selected wage type is in range.
  CHECK p0008-TRFGR IN p_ps_grp.	 

~Suresh

1 REPLY 1
Read only

suresh_datti
Active Contributor
0 Likes
282

the following should work fine..

REPORT zh119rep LINE-SIZE 175 NO STANDARD PAGE HEADING.
 
 
* Define the Pay scale group range.
SELECT-OPTIONS p_ps_grp FOR p0008-trfgr.
 
 
* INITIALIZATION EVENT
INITIALIZATION.
* Set the Pay Scale Groups but 1st clear it.
  REFRESH p_ps_grp.
  p_ps_grp-sign = 'I'.
  p_ps_grp-option = 'EQ'.
  p_ps_grp-low = 'PROF'.
  APPEND p_ps_grp.
  p_ps_grp-low = 'GRADE 09'.
  APPEND p_ps_grp.
 
 
GET pernr.
 
* Check to see if selected wage type is in range.
  CHECK p0008-TRFGR IN p_ps_grp.	 

~Suresh