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

[SAP ABAP] WA(Work Area) ๋ž€?

by Jay Din 2023. 12. 4.
728x90
๋ฐ˜์‘ํ˜•

WA(Work Area) ๋ž€?

WA(Work Area)๋Š” ์ฃผ๋กœ ๋‚ด๋ถ€ ํ…Œ์ด๋ธ”(Internal Table)์˜ ๋ ˆ์ฝ”๋“œ๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ ์ž„์‹œ์ ์ธ ๋ณ€์ˆ˜๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.

์ด ๋ณ€์ˆ˜๋Š” ๋ฃจํ”„(Loop) ๊ตฌ์กฐ์—์„œ ์‚ฌ์šฉ๋˜๋ฉฐ, ํŠน์ • ๋ ˆ์ฝ”๋“œ์— ์ ‘๊ทผํ•˜๊ณ  ํ•„์š”ํ•œ ์—ฐ์‚ฐ์„ ์ˆ˜ํ–‰ํ•˜๊ธฐ ์œ„ํ•œ ์šฉ๋„๋กœ ํ™œ์šฉ๋ฉ๋‹ˆ๋‹ค.

 

๋‚ด๋ถ€ ํ…Œ์ด๋ธ”(Internal Table) ์ด๋ž€?

https://jay-din.tistory.com/99

 

[SAP ABAP] ์ธํ„ฐ๋„ ํ…Œ์ด๋ธ”(Internal Table)์ด๋ž€?

์ธํ„ฐ๋„ ํ…Œ์ด๋ธ”(Internal Table) ์ธํ„ฐ๋„ ํ…Œ์ด๋ธ”(Internal Table)์€ ํ”„๋กœ๊ทธ๋žจ ๋‚ด์—์„œ ์ •์˜ํ•˜์—ฌ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” Local Table์ž…๋‹ˆ๋‹ค. ABAP ํ”„๋กœ๊ทธ๋žจ์—์„œ ๊ฐ•๋ ฅํ•œ ๊ธฐ๋Šฅ๊ณผ ํŽธ์˜์„ฑ์„ ์ œ๊ณตํ•˜๋Š” ๊ฒƒ ๋‘ ๊ฐ€์ง€๋ฅผ ๋ฝ‘์œผ๋ผ๋ฉด

jay-din.tistory.com

 

WA๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์ผ๋ฐ˜์ ์ธ ํŒจํ„ด๊ณผ ์˜ˆ์‹œ

wa_employee๋Š” ๋ฃจํ”„๋ฅผ ํ†ตํ•ด ํ˜„์žฌ ์ฒ˜๋ฆฌ ์ค‘์ธ ๋‚ด๋ถ€ ํ…Œ์ด๋ธ”์˜ ๋ ˆ์ฝ”๋“œ์— ๋Œ€ํ•œ ์›Œํฌ ์˜์—ญ์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.

์ด๋ฅผ ํ†ตํ•ด ๋ ˆ์ฝ”๋“œ์˜ ํ•„๋“œ์— ์‰ฝ๊ฒŒ ์ ‘๊ทผํ•˜๊ณ  ์กฐ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

WA๋Š” ์ฃผ๋กœ ๋ฃจํ”„๋ฅผ ํ†ตํ•ด ๋‚ด๋ถ€ ํ…Œ์ด๋ธ”์˜ ๋ ˆ์ฝ”๋“œ๋ฅผ ๋ฐ˜๋ณต์ ์œผ๋กœ ์ฒ˜๋ฆฌํ•˜๋Š” ๊ณผ์ •์—์„œ ํ™œ์šฉ๋˜๋ฉฐ,

์ฝ”๋“œ๋ฅผ ๊ฐ„๊ฒฐํ•˜๊ฒŒ ์œ ์ง€ํ•˜๊ณ  ๊ฐ€๋…์„ฑ์„ ๋†’์ด๋Š”๋ฐ ๋„์›€์ด๋„๋น„๋‹ˆ๋‹ค.

 

๋‚ด๋ถ€ ํ…Œ์ด๋ธ” ์ •์˜

๋จผ์ € ๋‚ด๋ถ€ ํ…Œ์ด๋ธ”์„ ์ •์˜ํ•˜๊ณ  ๋ฐ์ดํ„ฐ๋ฅผ ์ฑ„์›๋‹ˆ๋‹ค.

DATA: lt_employee_list TYPE TABLE OF ty_employee,
      wa_employee TYPE ty_employee.

* ๋‚ด๋ถ€ ํ…Œ์ด๋ธ”์— ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€ (์˜ˆ์‹œ)
APPEND VALUE #(id = '001' name = 'John' age = 30) TO lt_employee_list.
APPEND VALUE #(id = '002' name = 'Jane' age = 25) TO lt_employee_list.
APPEND VALUE #(id = '003' name = 'Bob' age = 35) TO lt_employee_list.

๋ฃจํ”„ ๊ตฌ์กฐ์—์„œ WA ์‚ฌ์šฉ

๋ฃจํ”„๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋‚ด๋ถ€ ํ…Œ์ด๋ธ”์˜ ๊ฐ ๋ ˆ์ฝ”๋“œ์— ์ ‘๊ทผํ•˜๊ณ  WA๋ฅผ ํ™œ์šฉํ•˜์—ฌ ํ•ด๋‹น ๋ ˆ์ฝ”๋“œ์— ๋Œ€ํ•œ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

LOOP AT lt_employee_list INTO wa_employee.
* WA๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํŠน์ • ๋ ˆ์ฝ”๋“œ์˜ ๋ฐ์ดํ„ฐ์— ์ ‘๊ทผ
  WRITE: / 'Employee ID:', wa_employee-id,
         / 'Employee Name:', wa_employee-name,
         / 'Employee Age:', wa_employee-age.
ENDLOOP.

 

 

 

 

728x90
๋ฐ˜์‘ํ˜•