๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿง‘‍๐Ÿ’ผ SAP/ABAP

[SAP ABAP] CONCATENATE ๋ž€? (ํŠน์ง• ๋ฐ ์˜ˆ์ œ)

by Jay Din 2023. 8. 21.
728x90
๋ฐ˜์‘ํ˜•
๋ฐ˜์‘ํ˜•

CONCATENATE ๋ž€?

CONCATENATE์˜ ์‚ฌ์ „์  ์ •์˜

  1. ์‚ฌ์Šฌ๊ฐ™์ด ์ž‡๋‹ค.
  2. ์—ฐ์‹œํ‚ค๋‹ค.

์‚ฌ์ „์  ์˜๋ฏธ์™€ ๋น„์Šทํ•˜๊ฒŒ ์“ฐ์ž…๋‹ˆ๋‹ค.

 

์ฆ‰, CONCATENATE๋Š” SAP ABAP ์–ธ์–ด์—์„œ ๋ฌธ์ž์—ด์„ ๊ฒฐํ•ฉํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” ๋ช…๋ น๋ฌธ์ž…๋‹ˆ๋‹ค.

์—ฌ๋Ÿฌ ๋ฌธ์ž์—ด์„ ํ•˜๋‚˜๋กœ ํ•ฉ์น˜๋Š” ๋ฐ ์œ ์šฉํ•˜๊ฒŒ ํ™œ์šฉ๋ฉ๋‹ˆ๋‹ค.

 

CONCATENATE  ํŠน์ง•

  1. ๋ฌธ์ž์—ด ๊ฒฐํ•ฉ:
    • CONCATENATE๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋‘ ๊ฐœ ์ด์ƒ์˜ ๋ฌธ์ž์—ด์„ ๊ฒฐํ•ฉํ•˜์—ฌ ํ•˜๋‚˜์˜ ์ƒˆ๋กœ์šด ๋ฌธ์ž์—ด์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
    • ๊ฒฐํ•ฉ๋œ ๋ฌธ์ž์—ด์€ ๊ณต๋ฐฑ ์—†์ด ์—ฐ๊ฒฐ๋ฉ๋‹ˆ๋‹ค.
  2. ๋ณ€์ˆ˜ ๋ฐ ๋ฆฌํ„ฐ๋Ÿด ์‚ฌ์šฉ:
    • CONCATENATE๋Š” ๋ณ€์ˆ˜์™€ ๋ฆฌํ„ฐ๋Ÿด ๊ฐ’์„ ๋ชจ๋‘ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
    • ๋ณ€์ˆ˜์™€ ๋ฆฌํ„ฐ๋Ÿด์„ ๊ฒฐํ•ฉํ•˜์—ฌ ์ƒˆ๋กœ์šด ๋ฌธ์ž์—ด์„ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  3. ๊ฒฐํ•ฉ ์ˆœ์„œ:
    • CONCATENATE ๋ช…๋ น๋ฌธ์—์„œ๋Š” ์ž…๋ ฅ๋œ ๋ฌธ์ž์—ด์ด ์ˆœ์„œ๋Œ€๋กœ ๊ฒฐํ•ฉ๋ฉ๋‹ˆ๋‹ค.
    • ๋”ฐ๋ผ์„œ ์ž…๋ ฅ๋œ ์ˆœ์„œ๋Œ€๋กœ ๋ฌธ์ž์—ด์ด ๊ฒฐํ•ฉ๋˜๋ฉฐ, ๋ณ€์ˆ˜์˜ ๊ฐ’์ด ๋ณ€๊ฒฝ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
  4. ๊ณต๋ฐฑ ์ฒ˜๋ฆฌ:
    • CONCATENATE๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฌธ์ž์—ด์„ ๊ฒฐํ•ฉํ•  ๋•Œ, ๊ฐ ๋ฌธ์ž์—ด ์‚ฌ์ด์— ๊ณต๋ฐฑ์„ ์ž๋™์œผ๋กœ ์ถ”๊ฐ€ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
    • ๋”ฐ๋ผ์„œ ๊ณต๋ฐฑ์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ์—๋Š” ๋ฌธ์ž์—ด์— ๊ณต๋ฐฑ์„ ๋ช…์‹œ์ ์œผ๋กœ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

 

CONCATENATE  ์‚ฌ์šฉ ์˜ˆ์ œ

REPORT ZABAP001 .

DATA : STR1(10) TYPE C VALUE 'Enjoy',
      STR2(10) TYPE C VALUE 'ABAP',
      STR3(10) TYPE C VALUE ':)',
      RESULT(30) TYPE C.

" ๋ฌธ์ž์—ด ๊ฒฐํ•ฉ
CONCATENATE STR1 STR2 STR3 INTO RESULT.
WRITE: / '1: ', RESULT.

" ๊ณต๋ฐฑ ์ฒ˜๋ฆฌ
CONCATENATE STR1 STR2 STR3 INTO RESULT SEPARATED BY SPACE.
WRITE: / '2: ', RESULT.

" ํƒญ ์ฒ˜๋ฆฌ
CONCATENATE STR1 STR2 STR3 INTO RESULT RESPECTING BLANKS.
WRITE: / '3: ', RESULT.

  1. ๋ณ€์ˆ˜ STR1, STR2, STR3๋ฅผ ์—ฐ๊ฒฐํ•˜์—ฌ RESULT์— ๋„ฃ์–ด์ค˜์—ˆ์Šต๋‹ˆ๋‹ค.
  2.  SEPARTED BY space์„ ํ†ตํ•ด ๋ณ€์ˆ˜๋งˆ๋‹ค space(๊ฐ„๊ฒฉ)์„ ์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค. 
    • ๋งŒ์•ฝ space ๋Œ€์‹  '-'์„ ๋„ฃ์–ด์ฃผ๋ฉด 'Enjoy-ABAP-:)'๊ฐ€ ๋ฉ๋‹ˆ๋‹ค.
  3. RESPECTING BLANK์„ ํ†ตํ•ด ๋ณ€์ˆ˜๋งˆ๋‹ค BLANK(๊ณต๋ฐฑ, ์—ฌ๋ฐฑ)์„ ์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค.
    • ์ง์—ญํ•˜๋ฉด '๊ณต๋ฐฑ์„ ์กด์ค‘'. ์ฆ‰, RESPECTING ๋’ค์— ์˜ค๋Š” ๋ช…๋ น์–ด๋ฅผ ์กด์ค‘ํ•˜์—ฌ ์‹คํ–‰ํ•ด์ค€๋‹ค๋Š” ๋œป ๊ฐ™์Šต๋‹ˆ๋‹ค.
๋ฐ˜์‘ํ˜•

 

728x90
๋ฐ˜์‘ํ˜•