ALV에서 년월(2010.04) 필드를 사용하려 합니다.
기본적으로 spmon을 참조해서 만든 필드인데
자동으로 F4기능을 지원하지는 않네요?
그럼 F4 이벤트에
POPUP_TO_SELECT_MONTH 펑션을 사용해서
구현해줘야하나요?
그냥 datum 타입처럼 그 타입만 참조하면 f4기능을 지원해주는
엘리먼트 없을까요?
댓글 4
-
양키
2010.04.22 18:22
-
갈매기
2010.04.22 18:35
spmon같은 경우에는 없을수도 있겠다라는 생각이 드네요.
찾아보이 아밥 딕셔너리 자체에 파서블 엔트리가 없습니다.
따로 만드셔야 합니다. 만약 달력타입으로 구현하고 싶다면 f4_date 를 카피해서 하나 만들어야죠
-
Test
2010.04.23 07:48
on_f4 기능에.... 아래 form 문 활용하면 되지않을까 생각합니다.
시간에 쫒겨 살다보니..테스트 해 볼 시간이 없어 그냥 댓글만 답니다.
부디 성공하시고, 완료되면 내용좀 올려 주십시오
*&---------------------------------------------------------------------*
*& Form F4_MONTH
*&---------------------------------------------------------------------*
FORM f4_month CHANGING p_month TYPE spmon.
DATA : mf_returncode LIKE sy-subrc
, mf_monat LIKE isellist-month
.
IF mf_monat IS INITIAL.
mf_monat = sy-datlo(6).
ENDIF.
CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
EXPORTING
actual_month = mf_monat
IMPORTING
selected_month = mf_monat
return_code = mf_returncode
EXCEPTIONS
factory_calendar_not_found = 01
holiday_calendar_not_found = 02
month_not_found = 03.
IF sy-subrc = 0 AND mf_returncode = 0.
p_month = mf_monat.
ENDIF.
ENDFORM.
-
shark
2010.05.18 00:14
년월 필드 도메인 ,엘리먼트 ZYRMON NUMC 6자리로 만드신후
도메인 변환루틴에.. ZPERI 이름은 이렇게 만드시구
변환루틴에
CONVERSION_EXIT_ZPERI_INPUT 기간필드에 대한 입력변환
CONVERSION_EXIT_ZPERI_OUTPUT 기간필드에 대한 출력변환
요렇게 만드신후에
조회를 만드시려면 화면에서 밑에 처럼 받으시고요
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_YRMON.
PERFORM F4_HELP_FOR_YRMON USING 'P_YRMON'
CHANGING P_YRMON.
이렇게 하시면 됩니다.
*&---------------------------------------------------------------------*
*& Form F4_HELP_FOR_YRMON
*&---------------------------------------------------------------------*
FORM F4_HELP_FOR_YRMON USING P_FIELDNAME TYPE DYNFNAM
CHANGING P_YRMON TYPE ZYRMON.
DATA: L_YRMON TYPE ZYRMON.
DATA: LT_DYNPFIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE.
LT_DYNPFIELDS-FIELDNAME = P_FIELDNAME.
APPEND LT_DYNPFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = LT_DYNPFIELDS.
READ TABLE LT_DYNPFIELDS WITH KEY FIELDNAME = P_FIELDNAME.
IF LT_DYNPFIELDS-FIELDVALUE IS INITIAL.
L_YRMON = SY-DATUM(6).
ELSE.
L_YRMON = LT_DYNPFIELDS-FIELDVALUE.
ENDIF.
CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
EXPORTING
ACTUAL_MONTH = L_YRMON
IMPORTING
SELECTED_MONTH = P_YRMON
EXCEPTIONS
FACTORY_CALENDAR_NOT_FOUND = 1
HOLIDAY_CALENDAR_NOT_FOUND = 2
MONTH_NOT_FOUND = 3
OTHERS = 4.
ENDFORM. " F4_HELP_FOR_YRMON
FUNCTION CONVERSION_EXIT_ZPERI_INPUT.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(INPUT)
*" VALUE(NO_MESSAGE) LIKE SY-DATAR OPTIONAL
*" EXPORTING
*" VALUE(OUTPUT)
*" VALUE(RETURN) LIKE BAPIRETURN STRUCTURE BAPIRETURN
*"----------------------------------------------------------------------
* Flag f? fehlerhafte Eingabe
DATA: FLG_FEHLER,
HLP_OUTPUT(4),
TRUE VALUE 'X'.
IF INPUT IS INITIAL OR INPUT = SPACE.
* Eingabe besteht nur aus Leerzeichen
CLEAR OUTPUT.
ELSE.
* Blanks im Datum l?chen
CONDENSE INPUT NO-GAPS.
IF USR01-BNAME IS INITIAL.
* Benutzereinstellungen noch nicht gelesen
SELECT SINGLE * FROM USR01 WHERE BNAME = SY-UNAME.
ENDIF.
CASE USR01-DATFM.
WHEN CON_DATFM_1.
* Format TT.MM.JJJJ
PERFORM PERIODE_PPJJJJ_KONVERTIEREN USING INPUT
'.'
CHANGING OUTPUT
FLG_FEHLER.
IF FLG_FEHLER = TRUE.
* "Bitte Periode in der Form __.____ eingeben"
IF NO_MESSAGE = TRUE.
PERFORM RETURN_FUELLEN USING 'E' '100'
CHANGING RETURN.
EXIT.
ELSE.
MESSAGE E100.
ENDIF.
ENDIF.
WHEN CON_DATFM_2.
* Format MM/TT/JJJJ
PERFORM PERIODE_PPJJJJ_KONVERTIEREN USING INPUT
'/'
CHANGING OUTPUT
FLG_FEHLER.
IF FLG_FEHLER = TRUE.
* "Bitte Periode in der Form __/____ eingeben"
IF NO_MESSAGE = TRUE.
PERFORM RETURN_FUELLEN USING 'E' '101'
CHANGING RETURN.
EXIT.
ELSE.
MESSAGE E101.
ENDIF.
ENDIF.
WHEN CON_DATFM_3.
* Format MM-TT-JJJJ
PERFORM PERIODE_PPJJJJ_KONVERTIEREN USING INPUT
'-'
CHANGING OUTPUT
FLG_FEHLER.
IF FLG_FEHLER = TRUE.
* "Bitte Periode in der Form __-____ eingeben"
IF NO_MESSAGE = TRUE.
PERFORM RETURN_FUELLEN USING 'E' '102'
CHANGING RETURN.
EXIT.
ELSE.
MESSAGE E102.
ENDIF.
ENDIF.
WHEN CON_DATFM_4.
* Format JJJJ.MM.TT
PERFORM PERIODE_JJJJPP_KONVERTIEREN USING INPUT
'.'
CHANGING OUTPUT
FLG_FEHLER.
IF FLG_FEHLER = TRUE.
* "Bitte Periode in der Form ____.__ eingeben"
IF NO_MESSAGE = TRUE.
PERFORM RETURN_FUELLEN USING 'E' '103'
CHANGING RETURN.
EXIT.
ELSE.
MESSAGE E103.
ENDIF.
ENDIF.
WHEN CON_DATFM_5.
* Format JJJJ/MM/TT
PERFORM PERIODE_JJJJPP_KONVERTIEREN USING INPUT
'/'
CHANGING OUTPUT
FLG_FEHLER.
IF FLG_FEHLER = TRUE.
* "Bitte Periode in der Form ____/__ eingeben"
IF NO_MESSAGE = TRUE.
PERFORM RETURN_FUELLEN USING 'E' '099'
CHANGING RETURN.
EXIT.
ELSE.
MESSAGE E099.
ENDIF.
ENDIF.
WHEN CON_DATFM_6.
* Format JJJJ-MM-TT
PERFORM PERIODE_JJJJPP_KONVERTIEREN USING INPUT
'-'
CHANGING OUTPUT
FLG_FEHLER.
IF FLG_FEHLER = TRUE.
* "Bitte Periode in der Form ____-__ eingeben"
IF NO_MESSAGE = TRUE.
PERFORM RETURN_FUELLEN USING 'E' '099'
CHANGING RETURN.
EXIT.
ELSE.
MESSAGE E099.
ENDIF.
ENDIF.
WHEN OTHERS.
* "Datumsformat des Benutzerstamms nicht interpretierbar"
IF NO_MESSAGE = TRUE.
PERFORM RETURN_FUELLEN USING 'A' '104'
CHANGING RETURN.
EXIT.
ELSE.
MESSAGE A104 WITH USR01-DATFM.
ENDIF.
ENDCASE.
** Zusatzpr?ung f? spiegelverkehrte Eingabe (199303 statt 031993)
* HLP_OUTPUT = OUTPUT.
* IF HLP_OUTPUT > '2500'.
** "Jahreseingabe gr秤er als 2500 (Bitte Eingabe pr?en)"
* IF NO_MESSAGE = TRUE.
* PERFORM RETURN_FUELLEN USING 'E' '105'
* CHANGING RETURN.
* EXIT.
* ELSE.
* MESSAGE E105.
* ENDIF.
* ENDIF.
ENDIF.
ENDFUNCTION.
*---------------------------------------------------------------------*
* FORM RETURN_FUELLEN *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> RF_TYPE *
* --> RF_MSGNR *
* --> RETURN *
*---------------------------------------------------------------------*
FORM RETURN_FUELLEN USING RF_TYPE LIKE BAPIRETURN-TYPE
RF_MSGNO LIKE SY-MSGNO
CHANGING RF_RETURN LIKE BAPIRETURN.
CALL FUNCTION 'BALW_BAPIRETURN_GET'
EXPORTING
TYPE = RF_TYPE
CL = 'M2'
NUMBER = RF_MSGNO
* PAR1 = ' '
* PAR2 = ' '
* PAR3 = ' '
* PAR4 = ' '
* LOG_NO = ' '
* LOG_MSG_NO = ' '
IMPORTING
BAPIRETURN = RF_RETURN
EXCEPTIONS
OTHERS = 1.
ENDFORM.
FUNCTION CONVERSION_EXIT_ZPERI_OUTPUT.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(INPUT)
*" EXPORTING
*" VALUE(OUTPUT)
*"----------------------------------------------------------------------
DATA: PERI_INTERN LIKE MCS0-SPMON,
PERI_EXTERN(7).
PERI_INTERN = INPUT.
IF PERI_INTERN IS INITIAL.
* Periode ist initial => Ausgabe von Leerzeichen
CLEAR PERI_EXTERN.
ELSE.
IF USR01-BNAME IS INITIAL.
* Benutzereinstellungen noch nicht gelesen
SELECT SINGLE * FROM USR01 WHERE BNAME = SY-UNAME.
ENDIF.
CASE USR01-DATFM.
WHEN CON_DATFM_1.
* Format TT.MM.JJJJ
PERI_EXTERN(2) = PERI_INTERN+4(2).
PERI_EXTERN+2(1) = '.'.
PERI_EXTERN+3(4) = PERI_INTERN(4).
WHEN CON_DATFM_2.
* Format MM/TT/JJJJ
PERI_EXTERN(2) = PERI_INTERN+4(2).
PERI_EXTERN+2(1) = '/'.
PERI_EXTERN+3(4) = PERI_INTERN(4).
WHEN CON_DATFM_3.
* Format MM-TT-JJJJ
PERI_EXTERN(2) = PERI_INTERN+4(2).
PERI_EXTERN+2(1) = '-'.
PERI_EXTERN+3(4) = PERI_INTERN(4).
WHEN CON_DATFM_4.
* Format JJJJ.MM.TT
PERI_EXTERN(4) = PERI_INTERN(4).
PERI_EXTERN+4(1) = '.'.
PERI_EXTERN+5(2) = PERI_INTERN+4(2).
WHEN CON_DATFM_5.
* Format JJJJ/MM/TT
PERI_EXTERN(4) = PERI_INTERN(4).
PERI_EXTERN+4(1) = '/'.
PERI_EXTERN+5(2) = PERI_INTERN+4(2).
WHEN CON_DATFM_6.
* Format JJJJ-MM-TT
PERI_EXTERN(4) = PERI_INTERN(4).
PERI_EXTERN+4(1) = '-'.
PERI_EXTERN+5(2) = PERI_INTERN+4(2).
WHEN OTHERS.
* "Datumsformat des Benutzerstamms nicht interpretierbar"
MESSAGE A104 WITH USR01-DATFM.
ENDCASE.
ENDIF.
OUTPUT = PERI_EXTERN.
ENDFUNCTION.
Possible entry값은 Table/structure의 entry help/check 탭에 도메인(datum)이 등록되어있어야 합니다.
확인해보세요.