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

how to control itab

Former Member
0 Likes
1,132

Hi,

I have itab data like this.

SEL-ITEMMATERIAL--QTY

X -


10----abcdes-----10

-


20-----xbyen-----20

-


30-----nhbeu-----30

If 'SEL' field having more than one 'X' i want to give message.

ponts guarantedd

kaki

Hi,

I have itab data like this.

SEL-ITEMMATERIAL--QTY

X -


10----abcdes-----10

-


20-----xbyen-----20

-


30-----nhbeu-----30

If 'SEL' field having more than one 'X' i want to give message.

ponts guarantedd

kaki

8 REPLIES 8
Read only

Former Member
0 Likes
1,111

Hi Kaki,

look at following

count type i value '0'.
loop at itab.
if itab-sel = 'X'.
count = count + 1.
 if count gt '1'.
  your code.
  exit.*(if needed)
 endif.
endif.
endloop.

hope it helps,

Regards,

Amit

Read only

Former Member
0 Likes
1,111

Kaki,

loop at iTab into waTab.

<b>if waTab-sel+0(1) = 'X'.

if waTab-sel+1(1) = 'X'.

message ...

endif.

endif.</b>

endloop.

count = 0.

loop at iTab into waTab where sel = 'X'.

count = count + 1.

if count > 1.

message ...

endif.

endloop.

Thanks

Kam

Message was edited by: Kam

Read only

Former Member
0 Likes
1,111

data: v_count.

clear v_count.

Loop at itab.

if itab-sel = 'X'.

v_count = v_count + 1.

if v_count > 2.

message e000 with 'XXXXXXXXXXXXXXXX'.

endif.

endif.

endloop.

Read only

Former Member
0 Likes
1,111

Hi

Take a temp table.

data: v_lines type i.

itab_tmp[] = itab[].

delete itab_tmp where sel = ' '.

describe itab_tmp lines v_lines.

if v_line > 1.

message....

endif.

Read only

Former Member
0 Likes
1,111

Hi Kaki,

How are you displaying this data to the user? Instead of giving this as a checkbox, why not give it as a radiobutton to the user?

Srinivas

Read only

Former Member
0 Likes
1,111

the condition should be v_count > 1.

Read only

Former Member
0 Likes
1,111

data: wa like itab,

i type i.

i = 0.

loop at itab into wa.

if wa-sel = 'X'.

i = i + 1.

endif.

if i > 1.

exit.

endif.

endloop.

regards,

Hemendra

Read only

Former Member
0 Likes
1,111

HI

READ TABLE with where condition

or

Put the records in another internal table using where clause.

And then check value of SY-TFILL

SY-TFILL : contains the number of lines in the relevant internal table

If it is greater than 1.Show a message.

MESSAGE eid(MSGCLASS) WITH text.

Or else Use Radio Button.So that user is not able to select two records.

For Sample code or Radio Button.

GO TO SE38:

Program name: <b>DEMO_AT_SELECTION_ON_RADIO</b>

Cheers,

Vijay Raheja