또다른 산이네요.
*------------------------------------------------------------------*
ALV를 더블클릭하면 MM03로 이동하끔 하고 싶은데 안되네요. 'MTN' 부분을 제가 아무렇게나 적었는데 이게 문제인가요? 그리고 더블클릭없이 그냥 material code 셀 한번 클릭하면 MM03로 이동하게 할 순 없나요?
|
댓글 14
-
SAP폐인
2010.05.28 05:11
-
모포
2010.05.28 05:21
이벤트 등록은 어떻게 하나요?
-
모포
2010.05.28 05:42
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' 부분에
i_callback_usercommand = 'USER_COMMAND' 로 이미 등록해 놓았는데 이게 이벤트 등록인가요?
MTN을 MAT로 변경하고 이벤트 등록된걸 확인했는데도 마찬가지네요...
-
정회원
2010.05.28 06:36
*------------------------------------------------------------------*
* FORM USER_COMMAND
*------------------------------------------------------------------*
FORM user_command USING pi_ucomm LIKE sy-ucomm
pi_selfield TYPE slis_selfield.
DATA: ls_data LIKE LINE OF gt_data.
CASE pi_ucomm.
WHEN '&IC1'. " SAP standard code for double-clicking
READ TABLE gt_data INTO ls_data INDEX pi_selfield-tabindex.
IF sy-subrc EQ 0.
SET PARAMETER ID 'MAT' FIELD ls_data-matnr. " 자재 코드
SET PARAMETER ID 'BUK' FIELD '1000'. " 회사 코드
SET PARAMETER ID 'WRK' FIELD ls_data-werks. " 플랜트
SET PARAMETER ID 'MXX' FIELD 'BDEKLPQSVXZA'. " 한개 자모 - 한개 뷰
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
위에 코딩을 참조해서 해보시면 어떠실지...^^ -
정회원
2010.05.28 06:37
아! 그리고 필드카탈로그 속성중에 HOTSPOT 이라는 속성이 있는데 그부분에 'X'값을 주면 필드를 한번클릭해도 직접 이벤트를 실행시킬수 있습니다.
그럼 수고하세요 ^^
-
모포
2010.05.28 14:43
*------------------------------------------------------------------*
* FORM USER_COMMAND
*------------------------------------------------------------------*
FORM user_command USING pi_ucomm LIKE sy-ucomm
pi_selfield TYPE slis_selfield.
DATA: ls_data LIKE LINE OF gt_data.
CASE pi_ucomm.
WHEN '&IC1'. " SAP standard code for double-clicking
READ TABLE gt_data INTO ls_data INDEX pi_selfield-tabindex.
* IF sy-subrc EQ 0.
SET PARAMETER ID 'MAT' FIELD ls_data-MATNR.
SET PARAMETER ID 'BUK' FIELD ls_data-BUKRS.
SET PARAMETER ID 'WRK' FIELD ls_data-WERKS.
SET PARAMETER ID 'MXX' FIELD 'K'.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
* ENDIF.
ENDCASE.
ENDFORM.
제 상황에 맞게 이렇게 했습니다만 아무 반응이 안일어나니 답답하네요...
user_command 안에 까지 들어와서 case 문 잘 타고 있다는걸 디버깅하려면 어떻게 해야하나요?
write 문을 써도 아무데도 안나타나던데요..
-
래피드
2010.05.28 18:06
Function Alv 에 대한 이벤트 등록은
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = GT_EVENTS.
PERFORM FORM_SETTING USING :
SLIS_EV_USER_COMMAND 'USER_COMMAND'. 요정도가 되겠네요.
Form form_setting USING P_COM P_FORM .
* Get form
DATA L_EVENT_S TYPE SLIS_ALV_EVENT.
READ TABLE GT_EVENTS WITH KEY NAME = P_COM
INTO L_EVENT_S.
* Create form
IF SY-SUBRC = 0.
MOVE P_FORM TO L_EVENT_S-FORM.
MODIFY GT_EVENTS FROM L_EVENT_S INDEX SY-TABIX.
ENDIF.
endform.
요정도가 되겠네요.
-
남군
2010.05.28 20:01
펑션 ALV로 하셨으면 이벤트 등록 할 거 없이
i_callback_user_command = 'USER_COMMAND'
이렇게만 추가해 주시면 될텐데...
-
모포
2010.05.28 20:29
아래처럼 했는데 클릭 이벤트가 먹지 않습니다.,..
소스 전체입니다....감사합니다..
*------------------------------------------------------------------*
* DECLARATIONS
*------------------------------------------------------------------*
*------------------------------------------------------------------*
* DECLARATIONS
*------------------------------------------------------------------*
TYPE-POOLS: slis.
TABLES: MARA, MCHA, MCH1, MCHB, MARD, MBEW, T001K, T001.
TYPES: BEGIN OF ty_data,
MATNR TYPE MAKT-MATNR,
MAKTX TYPE MAKT-MAKTX,
MATKL TYPE MARA-MATKL,
PRDHA TYPE MARA-PRDHA,
WERKS TYPE MCHA-WERKS,
CHARG TYPE MCHA-CHARG,
VFDAT TYPE MCH1-VFDAT,
LICHA TYPE MCH1-LICHA,
QNDAT TYPE MCH1-QNDAT,
HSDAT TYPE MCH1-HSDAT,
LGORT TYPE MCHB-LGORT,
CLABS TYPE MCHB-CLABS,
CINSM TYPE MCHB-CINSM,
CSPEM TYPE MCHB-CSPEM,
VERPR TYPE MBEW-VERPR,
WAERS TYPE T001-WAERS,
MEINS TYPE MARA-MEINS,
BUKRS TYPE T001K-BUKRS,
TOTAL TYPE MCHB-CLABS,
STOTL TYPE MCHB-CLABS,
AGEDY TYPE CHAR5,
RSTDY TYPE CHAR5,
LIFDY TYPE CHAR5,
END OF ty_data.
DATA: gt_data TYPE STANDARD TABLE OF ty_data with header line,
i_fldcat TYPE slis_t_fieldcat_alv,
wa_fldcat TYPE slis_fieldcat_alv.
*------------------------------------------------------------------*
* SELECTION SCREEN
*------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-100.
SELECT-OPTIONS: s_matnr FOR MARA-MATNR,
s_hsdat FOR MCH1-HSDAT.
SELECTION-SCREEN END OF BLOCK b1.
*------------------------------------------------------------------*
* FORM GET_DATA
*------------------------------------------------------------------*
FORM get_data.
RANGES: r_matkl FOR mara-matkl.
CLEAR: r_matkl.
REFRESH r_matkl.
IF sy-tcode EQ 'ZSMIQ' OR sy-tcode EQ 'ZSMIQV'.
r_matkl-sign = 'I'.
r_matkl-option = 'EQ'.
r_matkl-low = 'YG10010'.
APPEND r_matkl. CLEAR r_matkl.
r_matkl-sign = 'I'.
r_matkl-option = 'EQ'.
r_matkl-low = 'YG10020'.
APPEND r_matkl. CLEAR r_matkl.
r_matkl-sign = 'I'.
r_matkl-option = 'EQ'.
r_matkl-low = 'YG10040'.
APPEND r_matkl. CLEAR r_matkl.
ELSE.
r_matkl-sign = 'I'.
r_matkl-option = 'EQ'.
r_matkl-low = 'YG10030'.
APPEND r_matkl. CLEAR r_matkl.
r_matkl-sign = 'I'.
r_matkl-option = 'EQ'.
r_matkl-low = 'YG10050'.
APPEND r_matkl. CLEAR r_matkl.
r_matkl-sign = 'I'.
r_matkl-option = 'EQ'.
r_matkl-low = 'YG10060'.
APPEND r_matkl. CLEAR r_matkl.
ENDIF.
SELECT
MAKT~MATNR
MAKT~MAKTX
MARA~MATKL
MARA~PRDHA
MCHA~WERKS
MCHA~CHARG
MCH1~VFDAT
MCH1~LICHA
MCH1~QNDAT
MCH1~HSDAT
MCHB~LGORT
MCHB~CLABS
MCHB~CINSM
MCHB~CSPEM
MBEW~VERPR
T001~WAERS
MARA~MEINS
T001K~BUKRS
INTO CORRESPONDING FIELDS OF TABLE gt_data
FROM MAKT
INNER JOIN MARA ON MAKT~MATNR = MARA~MATNR
INNER JOIN MCHA ON MARA~MATNR = MCHA~MATNR
INNER JOIN MCH1 ON MCHA~MATNR = MCH1~MATNR
AND MCHA~CHARG = MCH1~CHARG
INNER JOIN MCHB ON MCHA~MATNR = MCHB~MATNR
AND MCHA~WERKS = MCHB~WERKS
AND MCHA~CHARG = MCHB~CHARG
INNER JOIN MBEW ON MCHB~MATNR = MBEW~MATNR
AND MCHB~WERKS = MBEW~BWKEY
INNER JOIN T001K ON MBEW~BWKEY = T001K~BWKEY
INNER JOIN T001 ON T001K~BUKRS = T001~BUKRS
WHERE MAKT~MATNR IN s_matnr
AND MCH1~HSDAT IN s_hsdat
AND MAKT~SPRAS = 'E'
AND MARA~MATKL IN r_matkl.
SORT gt_data BY MATNR CHARG WERKS LGORT.
ENDFORM. "get_data
*------------------------------------------------------------------*
* FORM DISPLAY_DATA
*------------------------------------------------------------------*
FORM display_data.
LOOP AT gt_data.
gt_data-TOTAL = gt_data-CLABS + gt_data-CINSM + gt_data-CSPEM.
gt_data-STOTL = gt_data-VERPR * gt_data-TOTAL.
IF gt_data-HSDAT = '00000000'.
gt_data-AGEDY = '-'.
ELSE.
gt_data-AGEDY = SYST-DATUM - gt_data-HSDAT.
CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
CHANGING
VALUE = gt_data-AGEDY.
ENDIF.
IF gt_data-QNDAT = '00000000'.
gt_data-RSTDY = '-'.
ELSE.
gt_data-RSTDY = gt_data-QNDAT - SYST-DATUM.
CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
CHANGING
VALUE = gt_data-RSTDY.
ENDIF.
IF gt_data-VFDAT = '00000000'.
gt_data-LIFDY = '-'.
ELSE.
gt_data-LIFDY = gt_data-VFDAT - SYST-DATUM.
CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
CHANGING
VALUE = gt_data-LIFDY.
ENDIF.
MODIFY gt_data TRANSPORTING TOTAL STOTL AGEDY RSTDY LIFDY.
CLEAR gt_data.
ENDLOOP.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = gt_data-MATNR
IMPORTING
OUTPUT = gt_data-MATNR.
wa_fldcat-fieldname = 'MATNR'.
wa_fldcat-seltext_l = 'Material Code'.
* wa_fldcat-hotspot = 'X'.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'MAKTX'.
wa_fldcat-seltext_l = 'Material Description'.
wa_fldcat-outputlen = 30.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'MATKL'.
wa_fldcat-seltext_l = 'Group'.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'PRDHA'.
wa_fldcat-seltext_l = 'Product Hierachy'.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'CHARG'.
wa_fldcat-seltext_l = 'Batch'.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'LICHA'.
wa_fldcat-seltext_l = 'Vendor Batch'.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'HSDAT'.
wa_fldcat-seltext_l = 'Manuf. Date'.
wa_fldcat-outputlen = 9.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
IF sy-tcode EQ 'ZSMIQV' OR sy-tcode EQ 'ZFGIQV'.
wa_fldcat-fieldname = 'VERPR'.
wa_fldcat-seltext_l = 'Unit Price'.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
ENDIF.
wa_fldcat-fieldname = 'WAERS'.
wa_fldcat-seltext_l = 'Crcy'.
wa_fldcat-outputlen = 5.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'WERKS'.
wa_fldcat-seltext_l = 'Plant'.
wa_fldcat-outputlen = 6.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'LGORT'.
wa_fldcat-seltext_l = 'Loc.'.
wa_fldcat-outputlen = 6.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'QNDAT'.
wa_fldcat-seltext_l = 'Next Insp. Date'.
wa_fldcat-outputlen = 9.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'VFDAT'.
wa_fldcat-seltext_l = 'Exp. Date'.
wa_fldcat-outputlen = 9.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'CLABS'.
wa_fldcat-seltext_l = 'Unrestricted'.
wa_fldcat-outputlen = 13.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'CINSM'.
wa_fldcat-seltext_l = 'Inspection'.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'CSPEM'.
wa_fldcat-seltext_l = 'Blocked'.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'MEINS'.
wa_fldcat-seltext_l = 'Unit'.
wa_fldcat-outputlen = 4.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'TOTAL'.
wa_fldcat-seltext_l = 'Total Qty'.
wa_fldcat-outputlen = 13.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
IF sy-tcode EQ 'ZSMIQV' OR sy-tcode EQ 'ZFGIQV'.
wa_fldcat-fieldname = 'STOTL'.
wa_fldcat-seltext_l = 'Sub Total'.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
ENDIF.
wa_fldcat-fieldname = 'AGEDY'.
wa_fldcat-seltext_l = 'Age'.
wa_fldcat-outputlen = 5.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'RSTDY'.
wa_fldcat-seltext_l = 'Reset'.
wa_fldcat-outputlen = 5.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
wa_fldcat-fieldname = 'LIFDY'.
wa_fldcat-seltext_l = 'Life'.
wa_fldcat-outputlen = 5.
APPEND wa_fldcat TO i_fldcat.
CLEAR: wa_fldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_user_command = 'user_command'
it_fieldcat = i_fldcat
TABLES
t_outtab = gt_data
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
EXIT.
ENDFORM. "display_data
*------------------------------------------------------------------*
* FORM USER_COMMAND
*------------------------------------------------------------------*
FORM user_command USING pi_ucomm LIKE sy-ucomm
pi_selfield TYPE slis_selfield.
DATA: ls_data LIKE LINE OF gt_data.
CASE pi_ucomm.
WHEN '&IC1'. " SAP standard code for double-clicking
READ TABLE gt_data INTO ls_data INDEX pi_selfield-tabindex.
* IF sy-subrc EQ 0.
SET PARAMETER ID 'MAT' FIELD ls_data-MATNR.
SET PARAMETER ID 'BUK' FIELD ls_data-BUKRS.
SET PARAMETER ID 'WRK' FIELD ls_data-WERKS.
SET PARAMETER ID 'MXX' FIELD 'K'.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
* ENDIF.
ENDCASE.
ENDFORM.
*------------------------------------------------------------------*
* MAIN PROGRAM
*------------------------------------------------------------------*
END-OF-SELECTION.
PERFORM get_data.
PERFORM display_data. -
애불래
2010.05.28 20:59
i_callback_user_command = 'user_command' <--괄호안에 대문자로 바꿔보시지요.
괄호안에는 소문자로 쓰면 인식못합니다.
-
정회원
2010.05.28 21:07
아~ ' ' 안에 무조건 대문자를 쓰는것을 원칙으로 하는것이 좋을듯 싶습니다...ㅎㅎㅎ 드뎌 문제찾았네요~ 축하드립니다 ㅎㅎ
-
모포
2010.05.28 21:25
대문자로도 바꿔봤는데 먹히질 않습니다...우웅
-
맑은하늘
2010.05.28 21:51
이벤트를 callback 으로 지정하실 경우 I_CALLBACK_PROGRAM 을 지정해야 되지 않나요?
I_CALLBACK_PROGRAM = sy-cprog or sy-repid 정도를 펑션 매개변수로
추가해보세요.
reuse를 잘 안써서 안 넣으면 기본 프로그램으로 잡히는지는 잘 모르겠지만요.. ^^;;
-
모포
2010.05.28 22:21
커허헉
I_CALLBACK_PROGRAM = sy-cprog
이거 넣는 순간 모든게 해결됐습니다...
감사합니다 맑은하늘님.....
계속된 허접질문들 답좀 해주세요...
event등록해주셔야 합니다. 그리고 자재코드에 대한 parameter id는 data element에서 조회하실 수 있으며 정화한 값은 'MAT'입니다.