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

Select on string

Former Member
0 Likes
590

The information below is contained in bsak-sgtxt. I need to find all the entries in bsak that are associated with delivery 80022016.

80022016, DED $15 DETENTION & 25 FRO POD (is in field bsak-sgtxt)

If v_sgtxt = '80022016'.

select belnr into bsak-belnr from bsak where sgtxt ca v_sgtxt.

I get a syntax error.

How should this be done?

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
564

Hi,

Please try this.


data: v_vgbel like itab-vgbel.

move itab-vgbel+2(8) to v_vgbel.

data: v_sgtxt like bsik-sgtxt.

concatenate v_vgbel '%' into v_sgtxt.

select bukrs belnr gjahr dmbtr sgtxt
into (bsik-bukrs, bsik-belnr, bsik-gjahr, bsik-dmbtr,
bsik-sgtxt)
from bsik
where bukrs = '0010'
and sgtxt like v_sgtxt.

Regards,

Ferry Lianto

5 REPLIES 5
Read only

Former Member
0 Likes
564

Hi,

Please try this.


data: lv_sgtxt like bsak-sgtxt.

If v_sgtxt = '80022016'.

  lv_sgtxt = '80022016%'.

  select belnr into bsak-belnr from bsak where sgtxt like lv_sgtxt. 

endif.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
564

Try this:

<b>data: begin of i_belnr occurs 0,

belnr like bsak-belnr,

end of i_belnr.

</b>If v_sgtxt = '80022016'.

<b>select belnr

into table i_belnr

from bsak where sgtxt ca v_sgtxt.

</b>

endif

Thanks,

Santosh

Read only

Former Member
0 Likes
564

Hi Janet,

We may get more than one entry from BSAK table, so it needs an internal table to stroe all those values.So, Use internal table to get the result.

DATA:
BEGIN OF ITAB OCCURS 0,
BELNR TYPE BSAK-BELNR,
END OF ITAB.

SELECT BELNR 
FROM BSAK
INTO TABLE ITAB
WHERE SGTXT LIKE '8022016%'.

Thanks,

Vinay

Read only

Former Member
0 Likes
564

How do I do that if v_sqtxt is really a field in an internal table?

data: v_vgbel like itab-vgbel.

move itab-vgbel+2(8) to v_vgbel.

select bukrs belnr gjahr dmbtr sgtxt

into (bsik-bukrs, bsik-belnr, bsik-gjahr, bsik-dmbtr,

bsik-sgtxt)

from bsik

where bukrs = '0010'

and sgtxt eq v_vgbel.

Read only

Former Member
0 Likes
565

Hi,

Please try this.


data: v_vgbel like itab-vgbel.

move itab-vgbel+2(8) to v_vgbel.

data: v_sgtxt like bsik-sgtxt.

concatenate v_vgbel '%' into v_sgtxt.

select bukrs belnr gjahr dmbtr sgtxt
into (bsik-bukrs, bsik-belnr, bsik-gjahr, bsik-dmbtr,
bsik-sgtxt)
from bsik
where bukrs = '0010'
and sgtxt like v_sgtxt.

Regards,

Ferry Lianto