[ABAP] IS (NOT) INITIAL / Null Value vs. Initial Value


๐ŸŒ IS INITIAL / IS NOT INITIAL


  • operand๊ฐ€ initial์ธ์ง€ ์•„๋‹Œ์ง€๋ฅผ ํ™•์ธ

  • IS INITIAL : ๊ฐ’์ด initial value๋ผ๋ฉด true

    • ๋Ÿฐํƒ€์ž„ ์‹œ์Šคํ…œ์ด ๊ฐ๊ฐ ๋ฐ์ดํ„ฐ ํƒ€์ž…(data type)์— ๋Œ€ํ•œ initial value๋ฅผ ์ •์˜

    • Elementary Data Types์˜ initial value : Predefined ABAP Type์— ๋”ฐ๋ผ ๊ฒฐ์ •

    • Reference Types์˜ initial value : Null Reference

    • Internal Table์˜ initial value : row๊ฐ€ ์—†๋Š” ๋นˆ ํ…Œ์ด๋ธ”

    • Structured Types์˜ initial value : ๊ฐ ์ปดํฌ๋„ŒํŠธ์˜ initial value์— ๋”ฐ๋ผ ๊ฒฐ์ •๋จ

  • IS NOT INITIAL : initial value๊ฐ€ ์•„๋‹Œ ๋‹ค๋ฅธ ๊ฐ’์„ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค๋ฉด true



๐ŸŒ Null Value vs. Initial Value


!! Null Value != Initial Value !!


๐ŸŒœ Null Value


  • ์–ด๋– ํ•œ ๊ฐ’๋„ ๊ฐ€์ง€์ง€ ์•Š๋Š”๋‹ค.

  • 0, '', ' ', SPACE๋กœ ๋Œ€์ฒด๋  ์ˆ˜ ์—†๋‹ค.

  • ๋น„๊ต๋˜๊ฑฐ๋‚˜ ์—ฐ์‚ฐ๋  ์ˆ˜ ์—†๋‹ค.

  • OPEN SQL์—์„œ โ€˜IS NULLโ€™์ด๋‚˜ โ€˜IS NOT NULLโ€™ ๊ตฌ๋ฌธ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๋‹ค.


๐ŸŒœ Initial Value


  • ๊ฐ’์„ ๊ฐ€์ง„๋‹ค. > ๋” ๋งŽ์€ ๋ฉ”๋ชจ๋ฆฌ ๊ณต๊ฐ„์„ ์ฐจ์ง€ํ•œ๋‹ค.

  • 0, '', ' ', SPACE๋กœ ๋Œ€์ฒด๋  ์ˆ˜ ์žˆ๋‹ค.

  • ๋น„๊ต๋˜๊ฑฐ๋‚˜ ์—ฐ์‚ฐ๋  ์ˆ˜ ์žˆ๋‹ค.

Categories:

SAP/ABAP