Application Development 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: 

Validating Table control line items

Former Member
0 Kudos

Hi,

In My report , I am displaying a table control where user can enter some data. My requirement is to validate the entered data only when user presses a button.

So For this , I have not used command like FIELD t_item-matnr MODULE validate_matnr , as it is getting triggered evrytime. I need to validate fields only when a particular button 'Select' is prseesd.

So I have written the validations after loop...endloop in a seprate module in PAI . I have thrown an error message if validation fails which is putting my table control in non editable mode.

What I need is, on click of select button if validation fails, only that particular field should be in editable mode and cursor should be on that field only.

Regards,

Rajneesh

1 ACCEPTED SOLUTION

Former Member
0 Kudos

IN PAI:

1) Use Warning Message in the LOOP it will make the Table control Editable.

Message 'XXX' TYPE 'W' Display like 'E'.

2) Use SET CURSOR to place the cursor to set cursor at line where error has occured.

Use system field Sy-Stepl to get the line where error has occured.

3) Use Loop at screen to Disable the the rows that are not required.

Regards,

Gurpreet

4 REPLIES 4

Former Member
0 Kudos

If you validate after the loop then table control will always in the greyed out mode.

One thing you can do is to perform validation, only if user has changed a particular field in the table control. For ths use "On request" or "On Chain-request" with module statement.

You need to check something line....

Loop.

field: t_mara-matnr module validate_matnr on request.

endloop.

Module Validate_matnr.

  • Validate

endmodule.

Hope this will help.

Former Member
0 Kudos

IN PAI:

1) Use Warning Message in the LOOP it will make the Table control Editable.

Message 'XXX' TYPE 'W' Display like 'E'.

2) Use SET CURSOR to place the cursor to set cursor at line where error has occured.

Use system field Sy-Stepl to get the line where error has occured.

3) Use Loop at screen to Disable the the rows that are not required.

Regards,

Gurpreet

0 Kudos

Displaying 'W' like 'E' was all that it required in PAI MODULE. Thanks a lot Gurpreet.

sarbajitm
Contributor
0 Kudos

Hi,

In the Flow Logic of the corresponding screen , I kept code like the following one....

PROCESS AFTER INPUT.

MODULE EXIT_9998 AT EXIT-COMMAND.

MODULE MODIFY_ITAB .<<<<<<<<<<<<<

LOOP AT IT_EKKO .

ENDLOOP.

MODULE USER_COMMAND_9998.

Now kept code in Modify_itab like the following one................

MODULE Modify_Itab INPUT.

data: index type sy-index.

CLEAR Ch.CLEAR lin.CLEAR val.

GET CURSOR FIELD f LINE lin VALUE val.

index = tc_9998-current_line - 1 + lin.

READ TABLE IT_EKKO INTO WA_EKKO INDEX index.

CALL FUNCTION 'CHECK_AND_CONVERT_NUMERICS'

EXPORTING

DFELD = 'ZSAR_TCNTRL-MENGE'

DMZEI = ','

DTYPE = 'QUAN'

  • DYPNO = ' '

EFELD = val

  • FNAME = ' '

  • PROGR = ' '

IMP_DECIMALS = '3'

IMPORTING

ERROR = Ch

IFELD = temp_val

  • MESSG =

  • MSGLN =

.

IF Ch <> 'X'.

WA_EKKO-MENGE = temp_val.

MODIFY IT_EKKO FROM WA_EKKO INDEX index.

clear WA_EKKO.

MESSAGE S016.

ELSE.

MESSAGE I017 DISPLAY LIKE 'E'.

ENDIF.

ENDMODULE.

Hope in this way you can solve your issue.

Regards.

Sarbajit.