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

Problem with data selection

Former Member
0 Likes
300

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.

2 REPLIES 2
Read only

Former Member
0 Likes
262

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.

Read only

AlexanderOv
Product and Topic Expert
Product and Topic Expert
0 Likes
262

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.