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

help in the code

Former Member
0 Likes
784

hello experts,

I am uploading the data. For one field I am getting the value like 1341. So i have to equate this values to the first 4 charecters of LFA1-BAHNS

I have to get the LFA1-LIFNR where the value 1341 matches to the first 4 chars of LFA1-BAHNS and update the corrsponding field.

Its urgent plz

Thanks & Regards,

Naveen

6 REPLIES 6
Read only

Former Member
0 Likes
724

See the below logic :

suppose you have data at internal table itab.

loop at itab.

select single * from lfa1 into lfa1

where BAHNS+(4) = itab-fld3. -> itab-fld3 contains value like 1341

if sy-subrc eq 0.

update lfa1 from itab.

endif.

endloop.

Thanks

Seshu

Read only

0 Likes
724

Seshu,

thanks a lot for your valuable time.

Actually I did the same coding but it is giving me the error like "FIELD BAHNS+(4) IS UNKNOWN"

can exactly tell me where i am going wrong...

here is the statement

select single lifnr from lfa1 into vndno where bahns+(4) = wa_data-mkfct.

Read only

0 Likes
724

Try This:

select single lifnr from lfa1 into vndno where bahns+0(4) = wa_data-mkfct.

Sri

Read only

0 Likes
724

Sri,

I tried that also, but same error.....

Read only

0 Likes
724

Hello Nitesha,

offset will not work in select query ..

Try to use below logic :

tables : lfa1.

data v_data(5) type c.

data i_lfa1 like lfa1 occurs 0 with header line.

start-of-selection.

refresh i_lfa1.

clear v_data.

concatenate itab-fld3 '%' into v_data.

select * from lfa1 into table i_lfa1

where BAHNS like v_data.

loop at i_lfa1.

if i_lfa1-bahns+(4) = itab-fld3.

update table .

exit.

endif.

endloop.

Thanks

Seshu

Read only

Former Member
0 Likes
724

Hi,

Try to use "LIKE" operator in update statement.

update <table> set <field> = <value> where <field> like '1341%'

Reward if answer is useful...

Regards,

Hema