You are on page 1of 5

TYPE-POOLS: ICON, ABAP, SLIS. TABLES: ADCP, USR02, USR06, USR21, PA0002.

TYPES: BEGIN OF USER_TABLE, PERSNUMBER TYPE USR21-PERSNUMBER, BNAME TYPE USR21-BNAME, VORNA TYPE PA0002-VORNA, NACHN TYPE PA0002-NACHN, LIC_TYPE TYPE USR06-LIC_TYPE, FUNCTION TYPE ADCP-FUNCTION, GLTGB TYPE USR02-GLTGB, USTYP TYPE USR02-USTYP, CLASS TYPE USR02-CLASS, UFLAG TYPE USR02-UFLAG, PWDSTATE TYPE USR02-PWDSTATE, USRID TYPE PA0105-USRID, PERNR TYPE PA0105-PERNR, LICENSE_AX TYPE I, LICENSE_AY TYPE I, LICENSE_AZ TYPE I, LICENSE_BA TYPE I, LICENSE_BK TYPE I, LICENSE_OT TYPE I, END OF USER_TABLE. DATA: IT_P2 IT_P0105 IT_TAB WA_TAB ITAB TYPE TYPE TYPE LIKE TYPE STANDARD TABLE OF PA0002 WITH HEADER LINE, STANDARD TABLE OF PA0105 WITH HEADER LINE, TABLE OF USER_TABLE WITH HEADER LINE, LINE OF IT_TAB, TABLE OF USER_TABLE. TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE REF TO CL_SALV_TABLE, REF TO CL_SALV_FUNCTIONS_LIST, REF TO CL_SALV_DISPLAY_SETTINGS, REF TO CL_SALV_COLUMNS_TABLE, REF TO CL_SALV_COLUMN_TABLE, REF TO CL_SALV_LAYOUT, REF TO CL_SALV_SELECTIONS, REF TO CL_SALV_EVENTS_TABLE, REF TO CL_SALV_FORM_LAYOUT_GRID, SALV_S_LAYOUT_INFO, SALV_S_LAYOUT_KEY, SALV_S_LAYOUT_KEY, LVC_S_COLO, SALV_DE_ALIGNMENT, SALV_DE_HEADER_SIZE.

DATA: GR_ALV GR_FUNCTIONS GR_DISPLAY GR_COLUMNS GR_COLUMN GR_LAYOUT GR_SELECTIONS GR_EVENTS GR_LINES G_LAYOUT KEY S_KEY COLOR RIGHT_ALIGNED LARGE_HEAD DATA: USER USER_SALON LIST_TITLE INITIALIZATION. KEY = SY-REPID. RIGHT_ALIGNED = 2.

TYPE SY-UNAME, TYPE SY-UNAME, TYPE LVC_TITLE VALUE 'Multiple UPC Codes per Article'.

"1=left, 2=right, 3=centered. Must be TYPEd as SALV_DE_AL

IGNMENT. USER = SY-UNAME+0(3). USER_SALON = SY-UNAME+3(4). SELECTION-SCREEN BEGIN OF BLOCK BLOCK1 WITH FRAME TITLE TEXT-001. SELECT-OPTIONS S_BNAME FOR USR21-BNAME. SELECT-OPTIONS S_LTYPE FOR USR06-LIC_TYPE. SELECT-OPTIONS S_TERM FOR USR02-GLTGB. PARAMETERS P_VARI TYPE SLIS_VARI. SELECTION-SCREEN END OF BLOCK BLOCK1. AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI. G_LAYOUT = CL_SALV_LAYOUT_SERVICE=>F4_LAYOUTS( S_KEY = KEY RESTRICT = IF_SALV_C_LAYOUT=>RESTRICT_NONE ). P_VARI = G_LAYOUT-LAYOUT. START-OF-SELECTION. SELECT USR21~PERSNUMBER USR21~BNAME USR06~LIC_TYPE ADCP~FUNCTION USR02~GLTGB USR02~USTYP USR02~CLASS USR02~UFLAG USR02~PWDSTATE "PA0105~USRID PA0105 ~PERNR INTO CORRESPONDING FIELDS OF TABLE IT_TAB FROM ( ( ( USR21 INNER JOIN ADCP ON ADCP~PERSNUMBER EQ USR21~PERSNUMBER ) INNER JOIN USR02 ON USR02~BNAME EQ USR21~BNAME ) INNER JOIN USR06 ON USR06~BNAME EQ USR21~BNAME ) * INNER JOIN PA0105 * ON PA0105~USRID EQ USR21~BNAME ) WHERE USR21~BNAME IN S_BNAME AND USR06~LIC_TYPE IN S_LTYPE AND USR02~GLTGB IN S_TERM. IF SY-SUBRC = 0. SORT IT_TAB BY BNAME LIC_TYPE ASCENDING. CLEAR ITAB. CLEAR WA_TAB. LOOP AT IT_TAB INTO WA_TAB. SELECT SINGLE * FROM PA0105 INTO IT_P0105 WHERE USRID = WA_TAB-BNAME. IF SY-SUBRC = 0. WA_TAB-PERNR = IT_P0105-PERNR. ENDIF. SELECT SINGLE * FROM PA0002 INTO IT_P2 WHERE PERNR EQ WA_TAB-PERNR AND ENDDA EQ '99991231'. IF SY-SUBRC = 0.

WA_TAB-VORNA = IT_P2-VORNA. WA_TAB-NACHN = IT_P2-NACHN. ENDIF. CASE WA_TAB-LIC_TYPE. WHEN 'AX'. WA_TAB-LICENSE_AX WHEN 'AY'. WA_TAB-LICENSE_AY WHEN 'AZ'. WA_TAB-LICENSE_AZ WHEN 'BA'. WA_TAB-LICENSE_BA WHEN 'BK'. WA_TAB-LICENSE_BK WHEN OTHERS. WA_TAB-LICENSE_OT ENDCASE. APPEND WA_TAB TO ITAB. CLEAR WA_TAB. ENDLOOP. TRY. CL_SALV_TABLE=>FACTORY( IMPORTING R_SALV_TABLE = GR_ALV CHANGING T_TABLE = ITAB ). CATCH CX_SALV_NOT_FOUND. CATCH CX_SALV_MSG. ENDTRY. TRY. GR_FUNCTIONS = GR_ALV->GET_FUNCTIONS( ). GR_FUNCTIONS->SET_ALL( ABAP_TRUE ). GR_DISPLAY = GR_ALV->GET_DISPLAY_SETTINGS( ). GR_DISPLAY->SET_VERTICAL_LINES( ABAP_TRUE ). GR_DISPLAY->SET_HORIZONTAL_LINES( ABAP_TRUE ). GR_DISPLAY->SET_STRIPED_PATTERN( CL_SALV_DISPLAY_SETTINGS=>TRUE ). CATCH CX_SALV_NOT_FOUND. CATCH CX_SALV_MSG. ENDTRY. TRY. GR_DISPLAY->SET_LIST_HEADER( LIST_TITLE ). GR_COLUMNS = GR_ALV->GET_COLUMNS( ). GR_COLUMNS->SET_KEY_FIXATION( ABAP_TRUE ). CATCH CX_SALV_NOT_FOUND. CATCH CX_SALV_MSG. ENDTRY. TRY. GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME = 'PERSNUMBER' ). GR_COLUMN->SET_LONG_TEXT( 'Person Number' ). GR_COLUMN->SET_MEDIUM_TEXT( 'Pers#' ). GR_COLUMN->SET_SHORT_TEXT( 'Pers#' ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME = 'BNAME' ). GR_COLUMN->SET_LONG_TEXT( 'Login Name' ).

= WA_TAB-LICENSE_AX + 1. = WA_TAB-LICENSE_AY + 1. = WA_TAB-LICENSE_AZ + 1. = WA_TAB-LICENSE_BA + 1. = WA_TAB-LICENSE_BK + 1. = WA_TAB-LICENSE_OT + 1.

GR_COLUMN->SET_MEDIUM_TEXT( 'Login Name' ). GR_COLUMN->SET_SHORT_TEXT( 'Login' ). GR_COLUMN->SET_ALIGNMENT( RIGHT_ALIGNED ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME GR_COLUMN->SET_LONG_TEXT( 'First Name' ). GR_COLUMN->SET_MEDIUM_TEXT( 'First Name' ). GR_COLUMN->SET_SHORT_TEXT( 'F. Name' ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME GR_COLUMN->SET_LONG_TEXT( 'Last Name' ). GR_COLUMN->SET_MEDIUM_TEXT( 'Last Name' ). GR_COLUMN->SET_SHORT_TEXT( 'L. Name' ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME GR_COLUMN->SET_LONG_TEXT( 'License Type' ). GR_COLUMN->SET_MEDIUM_TEXT( 'License Type' ). GR_COLUMN->SET_SHORT_TEXT( 'License' ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME GR_COLUMN->SET_LONG_TEXT( 'Job Description' ). GR_COLUMN->SET_MEDIUM_TEXT( 'Job Descr' ). GR_COLUMN->SET_SHORT_TEXT( 'Job Desc' ). GR_COLUMN->SET_ALIGNMENT( RIGHT_ALIGNED ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME GR_COLUMN->SET_LONG_TEXT( 'Term Date' ). GR_COLUMN->SET_MEDIUM_TEXT( 'Term Date' ). GR_COLUMN->SET_SHORT_TEXT( 'Term' ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME GR_COLUMN->SET_LONG_TEXT( 'License Type' ). GR_COLUMN->SET_MEDIUM_TEXT( 'License Type' ). GR_COLUMN->SET_SHORT_TEXT( 'License' ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME GR_COLUMN->SET_LONG_TEXT( 'Class' ). GR_COLUMN->SET_MEDIUM_TEXT( 'Class' ). GR_COLUMN->SET_SHORT_TEXT( 'Class' ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME GR_COLUMN->SET_LONG_TEXT( 'Login Staus' ). GR_COLUMN->SET_MEDIUM_TEXT( 'Login Staus' ). GR_COLUMN->SET_SHORT_TEXT( 'Login OK' ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME GR_COLUMN->SET_LONG_TEXT( 'Password Status' ). GR_COLUMN->SET_MEDIUM_TEXT( 'Pswd Status' ). GR_COLUMN->SET_SHORT_TEXT( 'Pswd OK' ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME GR_COLUMN->SET_LONG_TEXT( 'Employee Login' ). GR_COLUMN->SET_MEDIUM_TEXT( 'Empl Login' ). GR_COLUMN->SET_SHORT_TEXT( 'Empl.' ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME GR_COLUMN->SET_LONG_TEXT( 'Employee Number' ). GR_COLUMN->SET_MEDIUM_TEXT( 'Employee#' ). GR_COLUMN->SET_SHORT_TEXT( 'Empl#' ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME GR_COLUMN->SET_LONG_TEXT( 'License AX' ). GR_COLUMN->SET_MEDIUM_TEXT( 'License AX' ). GR_COLUMN->SET_SHORT_TEXT( 'AX' ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME GR_COLUMN->SET_LONG_TEXT( 'License AY' ). GR_COLUMN->SET_MEDIUM_TEXT( 'License AY' ). GR_COLUMN->SET_SHORT_TEXT( 'AY' ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME GR_COLUMN->SET_LONG_TEXT( 'License AZ' ). GR_COLUMN->SET_MEDIUM_TEXT( 'License AZ' ). GR_COLUMN->SET_SHORT_TEXT( 'AZ' ).

= 'VORNA' ).

= 'NACHN' ).

= 'LIC_TYPE' ).

= 'FUNCTION' ).

= 'GLTGB' ).

= 'USTYP' ).

= 'CLASS' ).

= 'UFLAG' ).

= 'PWDSTATE' ).

= 'USRID' ).

= 'PERNR' ).

= 'LICENSE_AX' ).

= 'LICENSE_AY' ).

= 'LICENSE_AZ' ).

GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME = 'LICENSE_BA' ). GR_COLUMN->SET_LONG_TEXT( 'License BA' ). GR_COLUMN->SET_MEDIUM_TEXT( 'License BA' ). GR_COLUMN->SET_SHORT_TEXT( 'BA' ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME = 'LICENSE_BK' ). GR_COLUMN->SET_LONG_TEXT( 'License BK' ). GR_COLUMN->SET_MEDIUM_TEXT( 'License BK' ). GR_COLUMN->SET_SHORT_TEXT( 'BK' ). GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( COLUMNNAME = 'LICENSE_OT' ). GR_COLUMN->SET_LONG_TEXT( 'License Other' ). GR_COLUMN->SET_MEDIUM_TEXT( 'License Other' ). GR_COLUMN->SET_SHORT_TEXT( 'Other' ). GR_LAYOUT = GR_ALV->GET_LAYOUT( ). KEY-REPORT = SY-REPID. GR_LAYOUT->SET_KEY( KEY ). GR_LAYOUT->SET_SAVE_RESTRICTION( CL_SALV_LAYOUT=>RESTRICT_NONE ). IF NOT P_VARI IS INITIAL. GR_LAYOUT->SET_INITIAL_LAYOUT( VALUE = P_VARI ). ENDIF. GR_ALV->DISPLAY( ). CATCH CX_SALV_NOT_FOUND. CATCH CX_SALV_MSG. ENDTRY. ENDIF.