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

ALV validation

Former Member
0 Likes
334

Hi,

I have a screen with some fields.

And below it I have a custom container with an <b>Editable</b> ALV (<b>Classical</b> ALV).

I have fields order number, <b><i>currency</i></b>, etc.

When I enter the order number, I validate the order number in the <b>Data Changed</b> event.

For currency, i can either enter order currency or company code currency.

How do I validate this ?

I am currently planning to get the entered value of currency at the data_changed event, read the alv table for order number and company code.

now check db table for order and company code if the currency entered is either of them.

Is this the right event at which validation should be done. And am I doing it the right way. Or is there a better event to do this ?

2. also, If i throw an error straight away, the screen aborts. so i chose the cl_alv_changed_data_protocol way of writing to logs.

I cant do the same in data_changed_finished because this event (unlike data_changed) doesnt generate an object to this protocol.

Kindly suggest.

Rgds,

Prashanth

1 REPLY 1
Read only

Former Member
0 Likes
299

hi, list what I know as following, hope it will be helpful:

DATA_CHANGED: will be triggered after user inputted, you can get the user inputted in the event.

DATA_CHANGED_FINISHED: will be triggered after the ALV automated validation. The ALV will automated check the inputted data format after DATA_CHANGED and before this event.

E.G. if you input alphabet into a DATE field, you can get the inputted alphabet in DATA_CHANGED, and ALV will do the validation after DATA_CHANGED, it blank the unvalid format data, and you can only get the blank in the DATA_CHANGED_FINISHED.

So if you need to get the data inputted, you can get it in DATA_CHANGED, like this:

  
  METHOD HANDLE_DATA_CHANGED.
    DATA:
      TMP_LS_GOOD    TYPE  LVC_S_MODI.

    LOOP AT ER_DATA_CHANGED->MT_GOOD_CELLS INTO TMP_LS_GOOD.
* ......
    ENDLOOP.
  ENDMETHOD.

Hope my reply is helpful

thanks