2007 Jan 12 7:52 AM
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
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
2007 Jan 12 7:54 AM
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
2007 Jan 12 7:55 AM
Hi,
at selection-screen on fieldname.
if not fieldname is valid.
message e0001 with "Invalid'.
endif.
2007 Jan 12 7:56 AM
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.
2007 Jan 12 7:58 AM
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
2007 Jan 12 7:59 AM
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
2007 Jan 12 8:06 AM
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
2007 Jan 12 8:09 AM
Just check my preivious post and modify accordingly ..it will work
2007 Jan 12 8:14 AM
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
2007 Jan 12 8:29 AM
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.
2007 Jan 12 8:03 AM
Hi Try these statement for set curser,
SET CURSOR { { FIELD field [LINE line] [[DISPLAY] OFFSET off] }
SET CURSOR { { col lin } }.
2007 Jan 12 8:06 AM
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
2007 Jan 12 8:34 AM
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.
2007 Jan 12 9:12 AM
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
2007 Jan 12 9:18 AM
Hi Mahesh,
It will work with AT SELECTION-SCREEN also.
Can you paste your code?
2007 Jan 12 9:52 AM
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
2007 Jan 12 9:58 AM
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
2007 Jan 12 9:57 AM
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
2007 Jan 12 9:59 AM
Hi,
In your message class z_sd change the length of the message 000 to 132 char.
2007 Jan 12 10:00 AM
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.
2007 Jan 12 10:02 AM
double click on TEXT-053 and checkout the length , if it is 50 increase to 132 and checkout if the whole error message appears
2007 Jan 12 10:31 AM
Hi chandraekar I did that giving the text lengh 132 but still it's not working .
2007 Jan 12 11:58 AM
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
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |