*
* Pop a Date in selection screens for the users to choose the month and
* year
*
* Written by : SAP Basis, ABAP Programming and Other IMG Stuff
*
*
REPORT ZPOPDATE.Tips: Date Formats with popups
DATA: V_CODE LIKE SY-SUBRC.
PARAMETER: V_MONTH LIKE ISELLIST-MONTH.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR V_MONTH.
CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
EXPORTING
ACTUAL_MONTH = '200205'
LANGUAGE = SY-LANGU
START_COLUMN = 8
START_ROW = 5
IMPORTING
SELECTED_MONTH = V_MONTH
RETURN_CODE = V_CODE
EXCEPTIONS
FACTORY_CALENDAR_NOT_FOUND = 1
HOLIDAY_CALENDAR_NOT_FOUND = 2
MONTH_NOT_FOUND = 3
OTHERS = 4.
With Compliments from: Shweta Sahay
Email: shwetasahay20032003@yahoo.co.in
*--------Display different date formats with popups-----------------*
REPORT zdate .
DATA: l_code LIKE sy-subrc.
DATA: lv_date(10) TYPE c.
DATA: BEGIN OF lwa_date OCCURS 0,
lv_d(2) TYPE c VALUE '1',
END OF lwa_date.
PARAMETER: p_month LIKE isellist-month.
PARAMETER: p_date(2) TYPE c.
AT SELECTION-SCREEN.
INITIALIZATION.
DO 31 TIMES.
APPEND lwa_date TO lwa_date.
lwa_date-lv_d = lwa_date-lv_d + 1.
WRITE lwa_date-lv_d.
ENDDO.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_month.
CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
EXPORTING
actual_month = '200505'
language = sy-langu
start_column = 8
start_row = 5
IMPORTING
selected_month = p_month
return_code = l_code
EXCEPTIONS
factory_calendar_not_found = 1
holiday_calendar_not_found = 2
month_not_found = 3
OTHERS = 4.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_date.
CHECK NOT lwa_date[] IS INITIAL.
CALL FUNCTION 'POPUP_WITH_TABLE'
EXPORTING
endpos_col = 5
endpos_row = 10
startpos_col = 2
startpos_row = 1
titletext = 'DATE'
IMPORTING
choice = lwa_date
TABLES
valuetab = lwa_date
EXCEPTIONS
break_off = 1
OTHERS = 2.
p_date = lwa_date-lv_d.
END-OF-SELECTION.
CONCATENATE p_date '/' p_month+4(2) '/' p_month+0(4) INTO lv_date.
WRITE:/ 'IN DD/MM/YYYY', lv_date.
CONCATENATE p_month+4(2) '/' p_date '/' p_month+0(4) INTO lv_date.
WRITE:/ 'IN MM/DD/YYYY', lv_date.
CONCATENATE p_month+0(4) '/' p_month+4(2) '/' p_date INTO lv_date.
WRITE:/ 'IN YYYY/MM/DD', lv_date.
*end of program.
No comments:
Post a Comment