2006 Sep 18 11:59 AM
Hi Experts,
I have a requirement where my ON CHANGE criteria is dynamic. It is based on wa_charakeyfrmt-value which I am reading from a table. If it is 'DO' then ON CHANGE will have wa_errtabcopy-DO. Else if it is 'LI' then ON CHANGE will have wa_errtabcopy-LI. There will be many cases like this. So instead of writing so many IF/ELSE or SWITCH/CASE conditions is it possible to dynamically create ON CHANGE criteria for the last field. See the example code below:
IF wa_charakeyfrmt-value = 'DO'. "On DO change
LOOP AT i_errtabcopy into wa_errtabcopy
WHERE sold_to = wa_errtab-sold_to.
ON CHANGE OF wa_errtabcopy-key_value
OR wa_errtabcopy-rep_created_date
OR wa_errtabcopy-rep_created_time
OR wa_errtabcopy-rep_counter
OR wa_errtabcopy-DO.
ENDON.
ENDLOOP.
ELSEIF wa_charakeyfrmt-value = 'LI'. "On LI change
LOOP AT i_errtabcopy into wa_errtabcopy
WHERE sold_to = wa_errtab-sold_to.
ON CHANGE OF wa_errtabcopy-key_value
OR wa_errtabcopy-rep_created_date
OR wa_errtabcopy-rep_created_time
OR wa_errtabcopy-rep_counter
OR wa_errtabcopy-LI.
ENDON.
ENDLOOP.
|
Thanks
Gopal
Hi Experts,
I have a requirement where my ON CHANGE criteria is dynamic. It is based on wa_charakeyfrmt-value which I am reading from a table. If it is 'DO' then ON CHANGE will have wa_errtabcopy-DO. Else if it is 'LI' then ON CHANGE will have wa_errtabcopy-LI. There will be many cases like this. So instead of writing so many IF/ELSE or SWITCH/CASE conditions is it possible to dynamically create ON CHANGE criteria for the last field. See the example code below:
IF wa_charakeyfrmt-value = 'DO'. "On DO change
LOOP AT i_errtabcopy into wa_errtabcopy
WHERE sold_to = wa_errtab-sold_to.
ON CHANGE OF wa_errtabcopy-key_value
OR wa_errtabcopy-rep_created_date
OR wa_errtabcopy-rep_created_time
OR wa_errtabcopy-rep_counter
OR wa_errtabcopy-DO.
ENDON.
ENDLOOP.
ELSEIF wa_charakeyfrmt-value = 'LI'. "On LI change
LOOP AT i_errtabcopy into wa_errtabcopy
WHERE sold_to = wa_errtab-sold_to.
ON CHANGE OF wa_errtabcopy-key_value
OR wa_errtabcopy-rep_created_date
OR wa_errtabcopy-rep_created_time
OR wa_errtabcopy-rep_counter
OR wa_errtabcopy-LI.
ENDON.
ENDLOOP.
|
Thanks
Gopal
2006 Sep 18 12:13 PM
2006 Sep 18 12:18 PM
Hi Anupama,
Can you explain what do you mean?
It will be great if you can give some sample code.
Thanks
Gopal
2006 Sep 18 12:24 PM
Hi
I dont think there is any dynamic calling of fields using on change of statement. Instead of on change of you can use at new (<field name which you wish to mention>).
Regards
Haritha.
2006 Sep 18 12:43 PM
DATA: BEGIN OF text,
word1(4) TYPE c VALUE 'This',
word2(4) TYPE c VALUE 'is',
word3(4) TYPE c VALUE 'a',
word4(4) TYPE c VALUE 'loop',
END OF text.
DATA: string1(4) TYPE c, string2(4) TYPE c.
DO 4 TIMES VARYING string1 FROM text-word1 NEXT text-word2.
WRITE string1.
IF string1 = 'is'.
string1 = 'was'.
ENDIF.
ENDDO.
SKIP.
DO 2 TIMES VARYING string1 FROM text-word1 NEXT text-word3
VARYING string2 FROM text-word2 NEXT text-word4.
WRITE: string1, string2.
ENDDO.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |