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

set cursor on error field in selection screen

Former Member
0 Likes
6,848

Hi ALL,

How to place the cursor on a particular selection screen field?I am doing validation if validation fails for a particular field the program should give error mesg and the cursor should place on the error field only but it's going to the Ist field on the selection can somebody tell me how do this? I tried with set cursor field <fieldname) but not working I am doing validations on at-selection screen.

Thanks&Regard

mahesh

Hi ALL,

How to place the cursor on a particular selection screen field?I am doing validation if validation fails for a particular field the program should give error mesg and the cursor should place on the error field only but it's going to the Ist field on the selection can somebody tell me how do this? I tried with set cursor field <fieldname) but not working I am doing validations on at-selection screen.

Thanks&Regard

mahesh

22 REPLIES 22
Read only

Former Member
0 Likes
4,167

why you have to place the cursor idont know...but you can

try these things in the event

AT SELECTION-SCREEN.

Additions:

1. ... ON psel

2. ... ON END OF sel

3. ... ON VALUE-REQUEST FOR psel_low_high

4. ... ON HELP-REQUEST FOR psel_low_high

5. ... ON RADIOBUTTON GROUP radi

6. ... ON BLOCK block

regards

shiba dutta

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
4,167

Hi,

at selection-screen on fieldname.

if not fieldname is valid.

message e0001 with "Invalid'.

endif.

Read only

Former Member
0 Likes
4,167

hi,

you have statements like

at-selection screen on fieldX.

validate fieldX.

if validation of fieldX goes wrong, I think, but I'm not sure, that only fieldX is enabled again...

Does this help?

Kind regards,

J.

Read only

Former Member
4,167
REPORT ztest.

PARAMETERS : p_var TYPE i DEFAULT '20',
             p_matnr LIKE mara-matnr.


AT SELECTION-SCREEN OUTPUT.

  IF p_var EQ '20'.
    SET CURSOR FIELD 'P_VAR'.
    MESSAGE e006(zz) WITH 'Enter valid value'.
  ENDIF.

null

Read only

Former Member
0 Likes
4,167

Hi Mahesh,

here a short example:

parameter: p_lifnr like lfa1-lifnr.

parameter: p_kunnr like kna1-kunnr.

parameter: p_matnr like mara-matnr.

*

INITIALIZATION.

set cursor field 'P_MATNR'.

*

start-OF-SELECTION.

*

...

regards, Dieter

Read only

0 Likes
4,167

Hi it's like this requirement i have 3 fields on sel screen

matnr

plant

lgort

When there is validation error happend for lgort the cursor on the selection screen should be on lgort but right now it's going to matnr field which is first field

how to rectify this?

Thanks&Regards

Mahesh

Read only

0 Likes
4,167

Just check my preivious post and modify accordingly ..it will work

Read only

0 Likes
4,167

Just execute teh code ..

REPORT zex12 MESSAGE-ID VIJ.


DATA : V_WERKS LIKE MARC-WERKS.
DATA : V_MATNR LIKE MARA-MATNR.
DATA : V_LGORT LIKE MARD-LGORT.

PARAMETERS: P_MATNR LIKE MARA-MATNR,
            P_WERKS LIKE MARC-WERKS,
            P_LGORT LIKE MARD-LGORT.


            AT SELECTION-SCREEN .

 SELECT SINGLE MATNR INTO V_MATNR
         FROM MARA WHERE MATNR = P_MATNR.

IF SY-SUBRC NE 0 .
SET CURSOR FIELD 'P_MATNR'.
MESSAGE E998 WITH 'INVALID MATERIAL'.
ENDIF.

 SELECT SINGLE WERKS INTO V_WERKS
         FROM MARC WHERE WERKS = P_WERKS AND MATNR = P_MATNR.

IF SY-SUBRC NE 0 .
SET CURSOR FIELD 'P_WERKS'.
MESSAGE E999 WITH 'INVALID PLANT'.
ENDIF.

 SELECT SINGLE LGORT INTO V_LGORT
         FROM MARD WHERE WERKS = P_LGORT AND
               WERKS = P_WERKS AND
               MATNR = P_MATNR.

IF SY-SUBRC NE 0 .
SET CURSOR FIELD 'P_LGORT'.
MESSAGE E996 WITH 'INVALID STORAGE LOCATION'.
ENDIF.

regards,

vijay

Read only

0 Likes
4,167

Hi,

Did you tried the code in my reply?

If you used

at selection-screen<b> on lgort</b>.

if ...condition.

message <b>e001</b> with 'Invalid'.

endif.

Read only

Former Member
0 Likes
4,167

Hi Try these statement for set curser,

SET CURSOR { { FIELD field [LINE line] [[DISPLAY] OFFSET off] }

SET CURSOR { { col lin } }.

Read only

Former Member
4,167

just give a valid plant and a wrong material and check the o/p.

REPORT zex12 MESSAGE-ID VIJ.

TABLES : MARA, MARC.
DATA : V_WERKS LIKE MARC-WERKS.
DATA : V_MATNR LIKE MARA-MATNR.

PARAMETERS: P_WERKS LIKE MARC-WERKS,
            P_MATNR LIKE MARA-MATNR.



            AT SELECTION-SCREEN .

 SELECT SINGLE WERKS INTO V_WERKS
         FROM MARC WHERE WERKS = P_WERKS.

IF SY-SUBRC NE 0 .
SET CURSOR FIELD 'P_WERKS'.  "give this in CAPS FOR FIELD
MESSAGE E999 WITH 'INVALID PLANT'.
ENDIF.

 SELECT SINGLE MATNR INTO V_MATNR
         FROM MARA WHERE MATNR = P_MATNR.

IF SY-SUBRC NE 0 .
SET CURSOR FIELD 'P_MATNR'. "give this in CAPS FOR FIELD
MESSAGE E998 WITH 'INVALID MATERIAL'.
ENDIF.

regards,

vijay

Read only

Former Member
0 Likes
4,167

Mahesh,

If your checking for particular field.Use

AT SELECTION-SCREEN ON filedname.

IF NOT fieldname is valid.

message e0001 with "Invalid'.

ENDIF.

Pls. Mark for all useful Ans.

Read only

0 Likes
4,167

Hi All,

I am trying with only at selection-screen not with at selection-screen on field

since I have to do this check for all the fields so we can not acheive this using at selection can be done only at selection-screen on field?can somebody clarify this

Thanks&Regards

Mahesh

Read only

0 Likes
4,167

Hi Mahesh,

It will work with AT SELECTION-SCREEN also.

Can you paste your code?

Read only

0 Likes
4,167

Hi chandrasekhar find my code below

this code i am writing under at selection-screen.

&----


*& Form Z_VALIDATE_TVKOV

&----


FORM z_validate_tvkov .

DATA: i_vtweg LIKE vbak-vtweg.

IF NOT s_vtweg-low IS INITIAL.

SELECT SINGLE vtweg FROM tvkov INTO i_vtweg

WHERE vtweg = s_vtweg-low.

IF sy-subrc <> 0.

set cursor FIELD 'S_VTWEG-LOW'.

MESSAGE e000(z_sd) WITH text-052.

ENDIF.

ENDIF.

IF NOT s_vtweg-high IS INITIAL.

SELECT SINGLE vtweg FROM tvkov INTO i_vtweg

WHERE vtweg = s_vtweg-high.

IF sy-subrc <> 0.

MESSAGE e000(z_sd) WITH text-052.

ENDIF.

ENDIF.

ENDFORM. " Z_VALIDATE_TVKOV

Read only

0 Likes
4,167

Hi,

It will be easy if you put you code in AT SELECTION-SCREEN ON s_vtweg-low .

Then it will automatically return the cursor to that field.

Regards,

Sesh

Read only

Former Member
0 Likes
4,167

Hi all,

I am displaying error mesg on status bar of selection screen when field validation failed but error message is truncating after 50 char is there any way we can avoid truncation and will give full text i am giving like below.

MESSAGE e000(z_sd) WITH text-053 "where text-053 ->"document type is invalid and should use transaction zcon"

it's displaying up to "document type is invalid and should use tran" it's truncating remaining characters.

can you pls suggest somebody how can we avoid this?

Thanks&Regards

mahesh

Read only

0 Likes
4,167

Hi,

In your message class z_sd change the length of the message 000 to 132 char.

Read only

0 Likes
4,167

sorry to all the above code that I gave is for the problem truncating message

in the status bar.I want to display full error mesg.

Read only

0 Likes
4,167

double click on TEXT-053 and checkout the length , if it is 50 increase to 132 and checkout if the whole error message appears

Read only

0 Likes
4,167

Hi chandraekar I did that giving the text lengh 132 but still it's not working .

Read only

0 Likes
4,167
IF SY-SUBRC NE 0 .
SET CURSOR FIELD 'P_LGORT'.
MESSAGE E996 WITH  text-001 text-002 . "-------> use this option
ENDIF.

U CAN MAKE THIS WORK

MESSAGE E996 WITH text-001 text-002 TEXT-003 TEXT-004.

you need to maintain this. this will do

text-001 = "'INVALID STORAGE LOCATION XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'.

text-002 = 'TTTTTTTTTTTTTTTTTTTYUVUVUUUUUUUUUUUUUUUUUUUUUUUU'.

with this u will get the full error message.

But we have started of with set cursor in this thread and in hte same thread now we are in the truncating of message .

Please close the thread .

regards,

vijay