ALV Variant enhancement

니언·2022년 10월 21일
0

SET_TABLE_FOR_FIRST_DISPLAY 메소드로 구현한 ALV에서
레이아웃 저장할때 타는 Enhancement

Include : LSALV_CUL_LAYOUT_SAVE_ASF02

form D051_prepare_screen .

  loop at screen.
      case screen-group1.
        when 'LBU'.
          screen-invisible = if_alv_cul=>con_on.
          screen-input     = if_alv_cul=>con_off.
          screen-output    = if_alv_cul=>con_off.
        when 'CBU'.
          if g51_screen-auth_uspec ne 'A'.
            screen-invisible = if_alv_cul=>con_off.
            screen-input     = if_alv_cul=>con_off.
            screen-output    = if_alv_cul=>con_on.
          endif.
        when 'DFT'.
          if g51_screen-default eq space.
            screen-invisible = if_alv_cul=>con_on.
            screen-input     = if_alv_cul=>con_off.
            screen-output    = if_alv_cul=>con_off.
          endif.
        when others.
          screen-invisible = if_alv_cul=>con_off.
          screen-input     = if_alv_cul=>con_on.
          screen-output    = if_alv_cul=>con_on.
      endcase.

    modify screen.
  endloop.


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Form D051_PREPARE_SCREEN, End                                                                                                                     A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1  ZLAYOUT_SAVE.    "active version

"특정 조건일때만 레이아웃 저장할 수 있게한다.
  IF ********
  SY-CPROG(1) EQ 'Z' and sy-uname(4) <> 'TEST' . 
    LOOP AT SCREEN.
      IF SCREEN-NAME EQ 'G51_SCREEN-USPEC'.
         screen-invisible = if_alv_cul=>con_off.
         screen-input     = if_alv_cul=>con_off.
         screen-output    = if_alv_cul=>con_on.
         modify screen.
      ENDIF.
    ENDLOOP.
  ENDIF.

  IF G51_SCREEN-USPEC IS INITIAL.
    G51_SCREEN-USPEC = ABAP_TRUE.
  ENDIF.

ENDENHANCEMENT.
*$*$-End:   (1)---------------------------------------------------------------------------------$*$*
endform.                    " D051_prepare_listbox

Z로 시작하는 프로그램중에 유저 아이디가 TEST로 시작하는 유저 아니면 레이아웃 저장할때 글로벌로 저장 못하게 함

profile
쭈니어 개발자

0개의 댓글