‎2011 Aug 22 11:12 AM
Hi,
I have an internal table with a single field of size 132 characters. I have to do some validations if the last character in contents of the internal table is 'F'. How can I achieve this.?
I am using the internal table i_data in a smartform. I have declared it as i_data type table of tab512 in the global data section.
I tried using the following code, but it is not working.
if i_data CP '*F'.
***do some validations
endif.
Could anyone help me on this?
Regards,
Pavan.
‎2011 Aug 22 11:21 AM
Hi,
chk below code..
DATA: v_len TYPE i,
v_len1 TYPE i.
LOOP AT i_data.
CLEAR: v_len,v_len1.
v_len = strlen(i_data-field).
v_len1 = v_len - 1.
IF i_data-field+v_len1(1) EQ 'F'.
validate as per your req..
ENDIF.
ENDLOOP.
here i_data is your internal table.
‎2011 Aug 22 11:26 AM
Hi,
what do you mean "not working"?
You can check your internal table in loop:
DATA:
i_data type table of tab512.
FIELD-SYMBOLS:
<lv_data> TYPE tab512.
LOOP AT i_data[] ASSIGNING <lv_data>
WHERE wa CP '*F'.
***do some validations
ENDLOOP.