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

ERROR MESSAGE

Former Member
0 Likes
401

hi all,

i have one table cotrol having 2 flds ID and VALUE. ID is input fld but VALUE is in display mode.

also there is another screen fld TOTAL in display mode. it will show total of VALUE of all rows of table control.

when ID is entered if it is valid, VALUE will be populated and also TOTAL will be updated.

if ID is changed and new ID is not valid, ERROR msg should be shown and ID will be in editable mode and TOTAL will be updated subtracting the VALUE of old value of ID.

plz help how to solve this issue.

rgds,

Avijit

2 REPLIES 2
Read only

Former Member
0 Likes
380

Hi Avijit,

Follow the steps given below(note just a statistical approach): You can improvize on your requirement.

Assumptions:

You have already created a screen, fields & buttons(table-control is in place).

1) Once ID is entered in PAI, use an ok-code to perform the validation against whatever the rule specified.

2) On success of validation, use the business logic to populate the value into the VALUE field.

3) Use on-screen cursor to figure out which row are you validating i.e; based on cursor position perform business logic for that row, thereby even if you tend to delete or put in a wrong ID, on failure of validation; FIRST clear the VALUE value & develop the TOTAL logic to add the VALUE of each lines so when there is no entry in one ID automatically the TOTAL value is adjusted.(like doing sum in excel)

4) If proper ID's are entered automatically the TOTAL logic will pick up the lines entered & sum the VALUE fields.

Hope this helps. Enjoy developing.

Reward if useful.

Thanks

Chandra

Read only

megha_h
Participant
0 Likes
380

Hi Avijit,

Try this -

PAI.

module process1.

-


module process1.

loop at i_tab.

  • validate id

if sy-subrc ne 0.

i_tab-total = i_tab-total - i_tab-VALUE.

message 'Invalid ID'.

else.

i_tab-TOTAL = i_tab-TOTAL + i_tab-VALUE.

endif.

endloop.

endmodule.

Regards

Megha