๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
SAP/ABAP

ALV Display ↔ Change ํ† ๊ธ€ ๋ฒ„ํŠผ

by applemango2021 2020. 12. 23.

ALV Grid๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์—์„œ Display ↔ Change ํ† ํด ๋ฒ„ํŠผ์„ ๊ตฌํ˜„ํ•  ๋•Œ์—๋Š” ํด๋ž˜์Šค CL_GUI_ALV_GRID์˜ SET_READY_FOR_INPUT ๋ฉ”์†Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค. 

 


๋‹จ๊ณ„ 1. ํ”„๋กœ๊ทธ๋žจ GUI Status์˜ Application Toolbar์— ๋ฒ„ํŠผ ์ถ”๊ฐ€ 

- Function Code๋‚˜ Icon์€ ๊ฐœ๋ฐœ์ž ์›ํ•˜๋Š” ๋Œ€๋กœ ์ง€์ •

- SE80์ด๋‚˜ ๊ธฐํƒ€ ์Šคํƒ ๋‹ค๋“œ ํ”„๋กœ๊ทธ๋žจ์—์„œ ์‚ฌ์šฉํ•˜๋Š” ์•„์ด์ฝ˜ ์ด๋ฆ„์€ 'ICON_TOGGLE_DISPLAY_CHANGE' 

 

๋‹จ๊ณ„ 2. ํ•ด๋‹น๋˜๋Š” ์Šคํฌ๋ฆฐ PAI์— ๊ธฐ๋Šฅ ๊ตฌํ˜„

- Executable ํ”„๋กœ๊ทธ๋žจ์—์„œ 100๋ฒˆ ์Šคํฌ๋ฆฐ์„ ํ˜ธ์ถœํ•˜์—ฌ, 100๋ฒˆ ์Šคํฌ๋ฆฐ์— ALV๋ฅผ ๊ทธ๋ ค์ฃผ๋Š” ํ”„๋กœ๊ทธ๋žจ์ผ ๋•Œ, 100๋ฒˆ ์Šคํฌ๋ฆฐ์˜ PAI์— USER_COMMAND ๋ชจ๋“ˆ์„ ๋งŒ๋“ค์–ด์„œ OKCODE๋ฅผ ๋ฐ›์•„์™”๋‹ค.

 

2-1. TOP์—์„œ์˜ ๋ณ€์ˆ˜์„ ์–ธ 

DATA : GV_UCOMM    TYPE SY-UCOMM, 
   GV_OKCODE TYPE SY-UCOMM,  "100๋ฒˆ ์Šคํฌ๋ฆฐ์—์„œ ์‚ฌ์šฉํ•˜๋Š” OKCODE ๋ณ€์ˆ˜
   GO_ALV_GRID TYPE REF TO CL_GUI_ALV_GRID,
   GV_TITLE TYPE CHAR10.

   

2-2. 100๋ฒˆ ์Šคํฌ๋ฆฐ์˜ PAI

PROCESS AFTER INPUT.
   MODULE USER_COMMAND.

 

2-3. ๋ชจ๋“ˆ USER_COMMAND 

MODULE USER_COMMAND.
  GV_UCOMM = GV_OKCODE.
  CLEAR GV_OKCODE.
  
  CASE GV_UCOMM.
    WHEN 'EDIT'.       "๋‹จ๊ณ„ 1์—์„œ ์ง€์ •ํ•œ Function Code
    	PERFORM TOGGLE_MODE. 
  ENDCASE.
ENDMODULE.

 

 

2-4. ์‹ค์ œ ๋กœ์ง์ด ๋“ค์–ด๊ฐ€ ์žˆ๋Š” TOGGLE_MODE ์„œ๋ธŒ๋ฃจํ‹ด

- IS_READY_FOR_INPUT( )๋ฉ”์†Œ๋“œ๋Š” ํ˜„์žฌ ๋ชจ๋“œ๊ฐ€ Display์ธ์ง€ Change๋ฅผ ์•Œ๋ ค์ค€๋‹ค. 

FORM TOGGLE_MODE.
  LV_RESULT = GO_ALV_GRID->IS_READY_FOR_INPUT( ).

  CASE LV_RESULT. 
    WHEN 0.  "Display ๋ชจ๋“œ์ธ ๊ฒฝ์šฐ, Change๋กœ ๋ณ€๊ฒฝ
      CALL METHOD GO_ALV_GRID->SET_READY_FOR_INPUT
         EXPORTING
           I_READY_FOR_INPUT = 1.

    WHEN 1.  "Change ๋ชจ๋“œ์ธ ๊ฒฝ์šฐ, Display๋กœ ๋ณ€๊ฒฝ
      CALL METHOD GO_ALV_GRID->SET_READY_FOR_INPUT
         EXPORTING
           I_READY_FOR_INPUT = 0.   
  ENDCASE.

ENDFORM.

Display ↔ Change ๋ชจ๋“œ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•˜๋Š” ์ž์ฒด๋Š” ๊ฐ„๋‹จํ•œ๋ฐ, ํ•„๋“œ ์นดํƒˆ๋กœ๊ทธ์˜ EDIT ์†์„ฑ์ด๋‚˜ ๋ ˆ์ด์•„์›ƒ์˜ EDIT ์†์„ฑ๊ณผ ์—ฎ์—ฌ ์žˆ์–ด์„œ ์‹ ๊ฒฝ์จ์•ผํ•  ๋ถ€๋ถ„๋“ค์ด ์žˆ๋‹ค. 

1.  ํ•„๋“œ ์นดํƒˆ๋กœ๊ทธ/๋ ˆ์ด์•„์›ƒ EDIT ์†์„ฑ์ด ์ฒดํฌ๋˜์–ด ์žˆ์–ด์•ผ ํ•œ๋‹ค.

- ํ† ๊ธ€ ๋ฒ„ํŠผ์„ ๊ตฌํ˜„ํ•ด๋†จ์–ด๋„ ํ•„๋“œ์นดํƒˆ๋กœ๊ทธ/๋ ˆ์ด์•„์›ƒ-EDIT = 'X'์ด ๋˜์–ด ์žˆ์–ด์•ผ ๋ณ€๊ฒฝ ๊ฐ€๋Šฅํ•˜๊ฒŒ ๋ฐ”๋€๋‹ค. 

 

2. ๋งŒ์•ฝ ํ•„๋“œ ํ•˜๋‚˜๋ผ๋„ ํ•„๋“œ์นดํƒˆ๋กœ๊ทธ-EDIT = 'X' ๋˜์–ด ์žˆ์œผ๋ฉด ์ฒ˜์Œ ํ”„๋กœ๊ทธ๋žจ ์‹คํ–‰ ์‹œ ๋ฌด์กฐ๊ฑด Change๋ชจ๋“œ๋กœ ๋‚˜์˜ค๊ฒŒ ๋œ๋‹ค. 

- ๊ทธ๋ž˜์„œ SET_TABLE_FOR_FIRST_DISPLAY ์ดํ›„์— SET_READY_FOR_INPUT ๋ฉ”์†Œ๋“œ๋ฅผ ํ†ตํ•ด์„œ ๊ฐ•์ œ๋กœ Display ๋ชจ๋“œ๋กœ ๋ฐ”๊ฟ” ์ฃผ์–ด์•ผ ํ•œ๋‹ค.

 

3. ์ƒํƒœ์— ๋”ฐ๋ฅธ Title Bar ๋กœ์ง ๋ณ€๊ฒฝ

- ๋ชจ๋“œ์— ๋”ฐ๋ผ Title์„ 'Display OOO'๋‚˜ 'Change OOO'๋กœ ๋ฐ”๊พธ์–ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋Š”๋ฐ, ๊ทธ๋Ÿด ๋•Œ์—๋Š” ์•„๋ž˜ ๋‹จ๊ณ„์— ๋”ฐ๋ฅธ๋‹ค 

 1) ์ „์—ญ๋ณ€์ˆ˜ GV_TITLE ์„ ์–ธ

 2) GUI Title '0100' ์ƒ์„ฑํ•˜์—ฌ ๋‚ด์šฉ์— & OOO ์ž…๋ ฅ (&์— GV_TITLE ๊ฐ’์ด ๋“ค์–ด๊ฐ„๋‹ค) 

 3) PBO ๋ชจ๋“ˆ์—์„œ SET TITLEBAR '0100' WITH GV_TITLE

 4) PERFORM TOGGLE_MODE๋กœ์ง์—์„œ ์ƒํƒœ์— ๋”ฐ๋ผ GV_TITLE์— ๋ฌธ๊ตฌ ์ž…๋ ฅ 

'SAP > ABAP' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[ABAP] SMW0 ์ด์šฉํ•ด์„œ ํ…œํ”Œ๋ › ๋‹ค์šด๋กœ๋“œ  (0) 2021.01.08
[ABAP] ๊ธˆ์•ก ๋ณ€ํ™˜ - WRITE TO CURRENCY  (0) 2020.12.17