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

READ TABLE statement in ECC 6.0

Former Member
0 Likes
717

hi,

in 4.6, my statement was

READ TABLE S_XVTTS WHERE TKNUM = S_XVTTK-TKNUM

AND NOT S_XVTTS-VSTEL IS INITIAL.

This wont work in ECC 6.0, hence I need to modify this. so i write like

READ TABLE S_XVTTS INTO wa_vttsvb WITH KEY TKNUM = S_XVTTK-TKNUM ..................................

how to accomodate the check for NOT initial of S_XVTTS-VSTEL .. how will my statement look like ? thks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
659

You can't use inequality condition in READ TABLE statement.

Try this:


S_XVTTS1[] =  S_XVTTS[].
DELETE  S_XVTTS1 where S_XVTTS-VSTEL IS NOT INITIAL. 

READ TABLE S_XVTTS1 INTO wa_vttsvb WITH KEY TKNUM = S_XVTTK-TKNUM.
IF sy-subrc = 0.

ENDIF.

5 REPLIES 5
Read only

Former Member
0 Likes
659

hello,

After the READ stmnt, use a CHECK stmnt for the logic that follows after ur READ stmnt.

READ... .

CHECK NOT XVTTS-VSTEL IS INITIAL.

..

..

ur logic.

Rgds,

Raghu.

Read only

marcelo_ramos1
SAP Mentor
SAP Mentor
0 Likes
659

Hi Sdnuser1,

Try to use LOOP statement as follow.


"// This LOOP read only one line of table s_xvtt exactly as READ TABLE do.
LOOP AT s_xvtts INTO wa_vttsv WHERE tknum EQ s_xvttk-tknum AND s_xvtts-vstel IS NOT INITIAL.
  EXIT.
ENDLOOP.

IF sy-subrc IS INITIAL.
   "// You can use wa_vttsv
ELSE.
    "// Do something
ENDIF.

I hope it helps yous.

Greetings.

Marcelo Ramos

Read only

Former Member
0 Likes
659

Hi,

If the value you are checking is initial then what is the purpose to read the table...

If this is your context.

Check that particular field whether it is initial or not before reading the table..

if not then read the table..

Hope this would help you.

Regards

Narin Nandivada.

Read only

Former Member
0 Likes
659

This message was moderated.

Read only

Former Member
0 Likes
660

You can't use inequality condition in READ TABLE statement.

Try this:


S_XVTTS1[] =  S_XVTTS[].
DELETE  S_XVTTS1 where S_XVTTS-VSTEL IS NOT INITIAL. 

READ TABLE S_XVTTS1 INTO wa_vttsvb WITH KEY TKNUM = S_XVTTK-TKNUM.
IF sy-subrc = 0.

ENDIF.