Application Development 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: 

check and append data

Former Member
0 Kudos
163

Hi All,

My queries as below. Hope can solving my issues. Thanks!

I have to check for the value assignment in table CABN -ATEIN.

If the value in that field equal to 'X', then I have to append the value 'S' to internal table i-display, otherwise will put 'M'.

Please correctly me if my coding wrongly.

code:

Select field1 field2 atein into (itab1_A, itab1_B, i_display) from CABN.

If the cabn-atein EQ 'X'.

itab1-atbew = 'S'.

ELSE.

itab1-atbew = 'M'.

ENDIF.

endselect.

Append itab1.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
85

Hi Little,

Try as follows.

SELECT FIELD1 FIELD2 ATEIN INTO TABLE ITAB1

FROM CABN.

UPDATE ITAB1 SET ATBEW = 'S' WHERE ATEIN = 'X'.

UPDATE ITAB1 SET ATBEW = 'M' WHERE ATEIN = ' '.

Thanks,

Vinay

4 REPLIES 4

Former Member
0 Kudos
86

Hi Little,

Try as follows.

SELECT FIELD1 FIELD2 ATEIN INTO TABLE ITAB1

FROM CABN.

UPDATE ITAB1 SET ATBEW = 'S' WHERE ATEIN = 'X'.

UPDATE ITAB1 SET ATBEW = 'M' WHERE ATEIN = ' '.

Thanks,

Vinay

Former Member
0 Kudos
85

Hi,

select field1 field2 atein into itab1.

if cabn-atein eq 'x'

i-display-atbew = 's'

else

i-display-atbew = 'm'

endif

append i-display.

endselect

Regards,

Bhaskar

former_member194669
Active Contributor
0 Kudos
85

Hi,


select field1 field2 atein atbew from CABN into corresponding field table itab1.
loop at itab1.
  if itab1-atein eq 'X'.
     itab1-atbew = 'S'.
  ELSE.
    itab1-atbew = 'M'.
  ENDIF.
  modify itab1 index sy-tabix.
endloop.

aRs

Former Member
0 Kudos
85

Hi,

Select field1 field2 atein into (itab1_A, itab1_B, i_display) from CABN 
                                                                          where ATEIN = 'X'.
IF sy-subrc = 0.
itab1-atbew = 'S'.
ELSE.
itab1-atbew = 'M'.
ENDIF.
Append itab1. 
endselect.

Regards

Sudheer