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

[SAP ABAP] ํŠน์ • ํ•„๋“œ ๊ฐ’ ๋ณ€๊ฒฝ TRANSPORTING ์ด๋ž€? (์˜ˆ์‹œ ํฌํ•จ)

by Jay Din 2024. 5. 22.
728x90
๋ฐ˜์‘ํ˜•

MODIFY . . . TRANSPORTING

`TRANSPORTING` ์€ ํŠน์ • ํ•„๋“œ๋งŒ ์—…๋ฐ์ดํŠธํ•  ๋•Œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.

 

๊ธฐ๋ณธ ์‚ฌ์šฉ๋ฒ•

MODIFY itab FROM work_area TRANSPORTING field1 field2

`itab`์ด๋ผ๋Š” ์ธํ„ฐ๋„ ํ…Œ์ด๋ธ”์˜ ํŠน์ • ํ•„๋“œ( field1 field2) ๊ฐ’์„ `work_area`์˜ ํŠน์ • ํ•„๋“œ(field1 field2) ๊ฐ’์œผ๋กœ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค.

 

MODIFY . . . TRANSPORTING ์˜ˆ์‹œ

์ธํ„ฐ๋„ ํ…Œ์ด๋ธ” `gt_flights`์™€ ์ž‘์—… ์˜์—ญ `gs_flight`๊ฐ€ ์žˆ๋‹ค๊ณ  ๊ฐ€์ •ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

์ด ์ž‘์—… ์˜์—ญ์—๋Š” ์—ฌ๋Ÿฌ ํ•„๋“œ๊ฐ€ ์žˆ์ง€๋งŒ, ํŠน์ • ํ•„๋“œ๋งŒ ์—…๋ฐ์ดํŠธ ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

 

DATA ์ •์˜

* ์ž‘์—… ์˜์—ญ(gs_flight) ๋ฐ ์ธํ„ฐ๋„ ํ…Œ์ด๋ธ”(gt_flights) ์ •์˜
DATA: BEGIN OF gs_flight,
        flight_id TYPE char10,
        destination TYPE char20,
        departure_time TYPE t,
        color TYPE i,
        light TYPE i,
      END OF gs_flight.

DATA: gt_flights LIKE TABLE OF gs_flight.

 

์ธํ„ฐ๋„ ํ…Œ์ด๋ธ”์— ๋ฐ์ดํ„ฐ ์‚ฝ์ž…

* ์ธํ„ฐ๋„ ํ…Œ์ด๋ธ”์— ๋ฐ์ดํ„ฐ ์‚ฝ์ž…
gs_flight-flight_id = 'FL001'.
gs_flight-destination = 'New York'.
gs_flight-departure_time = '120000'.
gs_flight-color = 1.
gs_flight-light = 1.
APPEND gs_flight TO gt_flights.

gs_flight-flight_id = 'FL002'.
gs_flight-destination = 'Los Angeles'.
gs_flight-departure_time = '150000'.
gs_flight-color = 2.
gs_flight-light = 2.
APPEND gs_flight TO gt_flights.

 

์•„๋ž˜ ์‚ฌ์ง„๊ณผ ๊ฐ™์ด gt_flights ํ…Œ์ด๋ธ”์— ๋ฐ์ดํ„ฐ 2๊ฐœ๊ฐ€ ๋“ค์–ด๊ฐ„ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

ํŠน์ • ํ•„๋“œ๋งŒ ์—…๋ฐ์ดํŠธ

`FL001` ํ•ญ๊ณตํŽธ์˜ `color`์™€ `light` ํ•„๋“œ๋งŒ ์—…๋ฐ์ดํŠธํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

* gs_flight๋ฅผ ์ค€๋น„
gs_flight-flight_id = 'FL001'.
gs_flight-color = 3.
gs_flight-light = 3.

* ํŠน์ • ํ•„๋“œ๋งŒ ์—…๋ฐ์ดํŠธ
MODIFY gt_flights FROM gs_flight TRANSPORTING color light
                                      WHERE flight_id = 'FL001'.

 

์œ„์˜ ๊ตฌ๋ฌธ์€ `gt_flights` ์ธํ„ฐ๋„ ํ…Œ์ด๋ธ”์—์„œ `FL001` ํ•ญ๊ณตํŽธ์„ ์ฐพ์•„ `color` ์™€ `light` ํ•„๋“œ๋งŒ `gs_flight` ์˜ ๊ฐ’์œผ๋กœ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ํ•„๋“œ๋Š” ๋ณ€๊ฒฝ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์œ„ ์‚ฌ์ง„๊ณผ ๋น„๊ตํ•˜์—ฌ `FL001` ํ•ญ๊ณตํŽธ์˜ `color` ์™€ `light` ํ•„๋“œ๊ฐ’์€ 1 ์—์„œ 3์œผ๋กœ ๋ณ€๊ฒฝ๋œ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

TRANSPORTING ์žฅ๋‹จ์ 

`TRANSPORTING` ์˜ต์…˜์€ ์„ฑ๋Šฅ ํ–ฅ์ƒ๊ณผ ์ฝ”๋“œ ๋ช…ํ™•์„ฑ ์ธก๋ฉด์—์„œ ์œ ๋ฆฌํ•˜์ง€๋งŒ, ํ•„๋“œ ๋ชฉ๋ก์„ ์ •ํ™•ํžˆ ๊ด€๋ฆฌํ•ด์•ผํ•˜๋Š” ๋ถ€๋‹ด์ด ์žˆ์Šต๋‹ˆ๋‹ค.

๋ณ€๊ฒฝํ•  ํ•„๋“œ๊ฐ€ ๋งŽ์ง€ ์•Š๊ณ  ์„ฑ๋Šฅ์ด ์ค‘์š”ํ•œ ๊ฒฝ์šฐ `TRANSPORTING`์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

 

  • ์„ฑ๋Šฅ:
    • `TRANSPORTING`์„ ์‚ฌ์šฉํ•˜๋ฉด ํ•„์š”ํ•œ ํ•„๋“œ๋งŒ ์ˆ˜์ •ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ „์ฒด ๊ตฌ์กฐ๋ฅผ ์ˆ˜์ •ํ•˜๋Š” ๊ฒƒ๋ณด๋‹ค ์„ฑ๋Šฅ์ด ๋›ฐ์–ด๋‚ฉ๋‹ˆ๋‹ค.
  • ๋ช…ํ™•์„ฑ:
    • `TRANSPORTING`์„ ์‚ฌ์šฉํ•˜๋ฉด ๋ณ€๊ฒฝํ•  ํ•„๋“œ๋ฅผ ๋ช…์‹œ์ ์œผ๋กœ ์ง€์ •ํ•˜๋ฏ€๋กœ, ์ฝ”๋“œ์˜ ๋ช…ํ™•์„ฑ๊ณผ ๊ฐ€๋…์„ฑ์ด ํ–ฅ์ƒ๋ฉ๋‹ˆ๋‹ค.
  • ์œ ์ง€๋ณด์ˆ˜:
    • ์ „์ฒด ๊ตฌ์กฐ๋ฅผ ์ˆ˜์ •ํ•˜๋Š” ๊ฒฝ์šฐ ํ•„๋“œ ์ถ”๊ฐ€๋‚˜ ๋ณ€๊ฒฝ์ด ๊ฐ„๋‹จํ•˜์ง€๋งŒ, `TRANSPORTING`์„ ์‚ฌ์šฉํ•˜๋ฉด ํ•„๋“œ ๋ชฉ๋ก์„ ๊ด€๋ฆฌํ•ด์•ผ ํ•˜๋ฏ€๋กœ ์•ฝ๊ฐ„์˜ ์ถ”๊ฐ€ ๊ด€๋ฆฌ๊ฐ€  ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
  •  
728x90
๋ฐ˜์‘ํ˜•