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: 

Concatenate the 2 fields

Former Member
0 Kudos

Hi,

My doubt is i wrote the concatenate statement to 2 fields like this

DATA : V_AWKEY TYPE STRING.

LOOP AT T_OUT.

CONCATENATE T_COBK-KOKRS T_COBK-BELNR INTO V_AWKEY.

T_OUT-AWKEY = V_AWKEY.

ENDLOOP.

after concatenate how to inser the concatenate field in select statements plz any one give me idea about this question.

Regards,

soni.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

Try this,


DATA: v_awkey LIKE t_out-awkey.

LOOP AT t_out.
  CONCATENATE t_cobk-kokrs t_cobk-belnr INTO v_awkey.

  t_out-awkey = v_awkey.

  MODIFY t_out.
ENDLOOP.

SELECT * FROM <TABLE> INTO TABLE <itab> WHERE <field> = t_out-awkey FOR ALL ENTRIES IN t_out.

Regards,

4 REPLIES 4

Former Member
0 Kudos

Hi Soni,

Can you clarify more on the requirement

Are you looking for this

Concatenate '%' V_AWKEY into V_AWKEY.

SELECT

.....

....

WHERE AWKY LIKE V_AWKEY.

0 Kudos

Hi,

actually this is my requirement ,

TABLES: cobk, bkpf, coep, bseg, bsik, aufk.

DATA: BEGIN OF t_out OCCURS 0,

aufnr LIKE bseg-aufnr, "Order Number

bukrs LIKE bkpf-bukrs, "Company Code

ferc_ind LIKE aufk-user0, "FERC Indicator

prctr LIKE bseg-prctr, "Profit Center

cbelnr LIKE cobk-belnr, "Controlling Document

gjahr LIKE cobk-gjahr, "Fiscal Year

vbund LIKE coep-vbund, "Trading Partner

hkont LIKE bseg-hkont, "G/L Account

belnr LIKE bkpf-belnr, "Accounting Docuemnt

blart LIKE bkpf-blart, "Document Type

xblnr LIKE bkpf-xblnr, "Reference Document

bktxt LIKE bkpf-bktxt, "Document Header Text

bschl LIKE bseg-bschl, "Posting Key

dmbtr LIKE bseg-dmbtr, "Amount in local Currency

wrbtr LIKE bseg-wrbtr, "Amount in Document Currency

budat LIKE bkpf-budat, "Posting Date

kstar LIKE coep-kstar, "Cost Element

pfkber LIKE coep-pfkber, "Partner Functional Area

parob LIKE coep-parob, "Partner Object

pbukrs LIKE coep-pbukrs, "Company code of partner

uspob LIKE coep-uspob, "Source Object (Cost Center / Activity Type)

fkber LIKE coep-fkber, "Functional Area

wtgbtr LIKE coep-wtgbtr, "Total Value in Transaction Currency

wogbtr LIKE coep-wogbtr, "Total Value in Object Currency

wkgbtr LIKE coep-wkgbtr, "Total Value in Controlling Area Currency

bldat LIKE bkpf-bldat, "Document Date in Document

vrgng LIKE cobk-vrgng, "CO Business Transaction

bvorg LIKE bkpf-bvorg, "Number of Cross-Company Code Posting

Transaction

kokrs LIKE cobk-kokrs, "Controlling Area

END OF t_out.

SELECT-OPTIONS: s_bukrs FOR bkpf-bukrs OBLIGATORY NO-EXTENSION NO INTERVALS,

s_gjahr FOR bkpf-gjahr,

s_belnr FOR bkpf-belnr NO-DISPLAY,

s_cbelnr FOR cobk-belnr,

s_bldat FOR cobk-bldat,

s_budat FOR cobk-budat,

s_vrgng FOR cobk-vrgng,

s_kstar FOR coep-kstar,

s_bvorg FOR bkpf-bvorg.

START-OF-SELECTION.

*& From COBK, get the KOKRS and BELNR fields. Concatenate them and

*& reference the value back to BKPF-AWKEY.

Regards,

soni.

Former Member
0 Kudos

Hello,

Try this,


DATA: v_awkey LIKE t_out-awkey.

LOOP AT t_out.
  CONCATENATE t_cobk-kokrs t_cobk-belnr INTO v_awkey.

  t_out-awkey = v_awkey.

  MODIFY t_out.
ENDLOOP.

SELECT * FROM <TABLE> INTO TABLE <itab> WHERE <field> = t_out-awkey FOR ALL ENTRIES IN t_out.

Regards,

Former Member
0 Kudos

Hi Soni,

Try this,

DATA: v_awkey LIKE t_out-awkey.

LOOP AT t_out.

CONCATENATE t_cobk-kokrs t_cobk-belnr INTO v_awkey.

t_out-awkey = v_awkey.

MODIFY t_out transporting awkey.

ENDLOOP.

SELECT * FROM BKPF INTO TABLE ITAB WHERE awkey = t_out-awkey FOR ALL ENTRIES IN t_out.

Dont use loop at t_out for select statement that cause lot of performance issue again..

check the concatenate statement cos u r using same values of kokrs and belnr in awkey and filling t_out records.

Regards

Syed A