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

logic needed

Former Member
0 Likes
333

I have problem in following logic. S_werks is in selection screen.

read statement is always fails.

for example s_werks = 1201. it_z1ychclientid also have 1201 data

READ TABLE it_z1ychclientid WITH KEY
       werks = s_werks.
IF sy-subrc = 0.
  REPLACE 'PCCCPPPP' WITH it_z1ychclientid-prefix INTO p_pcfile.
  CONDENSE p_pcfile NO-GAPS.
ELSE.
 MESSAGE  text-505  TYPE 'I'.
ENDIF.

2 REPLIES 2
Read only

Former Member
0 Likes
316

write the logic as

READ TABLE it_z1ychclientid WITH KEY

werks = s_werks-low.

IF sy-subrc = 0.

REPLACE 'PCCCPPPP' WITH it_z1ychclientid-prefix INTO p_pcfile.

CONDENSE p_pcfile NO-GAPS.

ELSE.

MESSAGE text-505 TYPE 'I'.

ENDIF.

Read only

Former Member
0 Likes
316

Use a loop.

loop at it_z1ychclientid where werks in s_werks.

IF sy-subrc = 0.

REPLACE 'PCCCPPPP' WITH it_z1ychclientid-prefix INTO p_pcfile.

CONDENSE p_pcfile NO-GAPS.

ELSE.

MESSAGE text-505 TYPE 'I'.

ENDIF.

endloop.