Skip to Content
0
Former Member
Feb 16, 2014 at 09:29 AM

SELECT fails while shooting. Can you help please?

29 Views

TYPE-POOLS : slis.

TABLES : pa0001.

DATA : BEGIN OF itab OCCURS 0,

mark,

pernr TYPE pa0001-pernr, "personel numarası

uname TYPE pa0001-uname, "sorumlunun adı

bukrs TYPE pa0001-bukrs, "şirket kodu

werks TYPE pa0001-werks, "personel alanı

plans TYPE pa0001-plans, "pozisyon

END OF itab,

t-pernr LIKE pa0001-pernr.

DATA : itab2 LIKE itab OCCURS 0 WITH HEADER LINE.

DATA : ok_code TYPE sy-ucomm,

r_dock_container TYPE REF TO cl_gui_docking_container,

r_grid TYPE REF TO cl_gui_alv_grid.

DATA : gt_fieldcat TYPE lvc_s_fcat,

g_layout TYPE lvc_s_layo,

t_fieldcat TYPE lvc_t_fcat.

START-OF-SELECTION.

PERFORM display_output.

*&---------------------------------------------------------------------*

*& Form DISPLAY_OUTPUT

*&---------------------------------------------------------------------*

FORM display_output .

PERFORM fill_fieldcat USING :

'PERNR' 'ITAB2' 'Personel Numarası',

'UNAME' 'ITAB2' 'Personel Adı',

'BUKRS' 'ITAB2' 'Şirket Kodu',

'WERKS' 'ITAB2' 'Personel Alanı',

'PLANS' 'ITAB2' 'Pozisyon'.

CALL SCREEN 100.

ENDFORM. " DISPLAY_OUTPUT

*&---------------------------------------------------------------------*

*& Form fill_fieldcat

*&---------------------------------------------------------------------*

FORM fill_fieldcat USING pv_field TYPE any

pv_tabname TYPE any

pv_coltext TYPE any .

gt_fieldcat-fieldname = pv_field.

gt_fieldcat-tabname = pv_tabname.

gt_fieldcat-coltext = pv_coltext.

APPEND gt_fieldcat TO t_fieldcat.

CLEAR gt_fieldcat.

ENDFORM. " FILL_FIELDCAT

*&---------------------------------------------------------------------*

*& Module STATUS_0100 OUTPUT

*&---------------------------------------------------------------------*

MODULE status_0100 OUTPUT.

SET PF-STATUS 'GUI'.

SET TITLEBAR 'TITLE'.

ENDMODULE. " STATUS_0100 OUTPUT

*&---------------------------------------------------------------------*

*& Module CREATE_OBJECTS OUTPUT

*&---------------------------------------------------------------------*

MODULE create_objects OUTPUT.

"container oluşturma ve ekrana basma.

CHECK r_dock_container IS INITIAL.

CREATE OBJECT r_dock_container

EXPORTING

side = cl_gui_docking_container=>dock_at_right

extension = 780

caption = 'Materials'

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5

OTHERS = 6.

*--------------------------------------------------------------------*

"GRID oluşturmak için

*--------------------------------------------------------------------*

CREATE OBJECT r_grid

EXPORTING

i_parent = r_dock_container

EXCEPTIONS

error_cntl_create = 1

error_cntl_init = 2

error_cntl_link = 3

error_dp_create = 4

OTHERS = 5.

*--------------------------------------------------------------------*

* I N T E R N A L T A B L O M U Z U E K R A N A A T I Y O R U Z. *

*--------------------------------------------------------------------*

CALL METHOD r_grid->set_table_for_first_display

CHANGING

it_outtab = itab2[]

it_fieldcatalog = t_fieldcat

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4.

ENDMODULE. " CREATE_OBJECTS OUTPUT

*&---------------------------------------------------------------------*

*& Module USER_COMMAND_0100 INPUT

*&---------------------------------------------------------------------*

MODULE user_command_0100 INPUT.

IF sy-ucomm = '&EXIT'.

LEAVE PROGRAM.

ENDIF.

SELECT pernr

uname

bukrs

werks

plans

FROM pa0001

INTO TABLE itab2

WHERE pa0001~pernr = t-pernr.

*--------------------------------------------------------------------*

* A L A N I M I Z I T E M I Z L I Y O R U Z (REFRESH EDIYORUZ) *

*--------------------------------------------------------------------*

CALL METHOD r_grid->refresh_table_display.

ENDMODULE. " USER_COMMAND_0100 INPUT