2009 Jan 21 1:48 PM
hi i have a parameter month,
the user wants it default to the month before 10 days..
so sy-datum - 10 and then the month of new date..
i hve tried to calculate this in intialization but doesnt work, can you help please.
thanks,
AJ
hi,
You creating the screen as subscreen you are you calling this some where in your program.
before calling this screen you set the value of p_perio.
selection-screen begin of screen 100 as subscreen.
selection-screen begin of block rep_perio with frame title text-bl2.
Selection-screen begin of line .
SELECTION-SCREEN COMMENT 1(31) TEXT-018.
parameters: p_perio type co_perio .
SELECTION-SCREEN COMMENT 37(30) TEXT-019.
Selection-screen end of line.
selection-screen end of block rep_perio.
selection-screen end of screen 100.
initialization.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
DATE = sy-datum
DAYS = '7'
MONTHS = '00'
SIGNUM = '-'
YEARS = '00'
IMPORTING
CALC_DATE = lv_default_date.
p_perio = lv_default_date+4(2). " Pass the month to p_perio field
2009 Jan 21 1:51 PM
Hello,
Try this code:
PARAMETERS: P_MONTH TYPE NUMC2.
INITILIZATION.
V_DATE = SY-DATUM - 10.
V_MONTH = V_DATE+4(2).
P_MONTH = V_MONTH.
Suhas
2009 Jan 21 1:52 PM
PARAMETER: p_mon(2) TYPE n.
INITIALIZATION.
DATA: lv_date TYPE d.
lv_date = sy-datum - 10.
p_mon = lv_date+4(2).
2009 Jan 21 2:12 PM
guys thanks for your help, but as stupid as it may sound, i already have that code in place.
begin of screen 100
parameter definition.
end of screen 100.
initialization.
code to get the date.
any bright ideas ??
2009 Jan 21 2:14 PM
2009 Jan 21 2:19 PM
selection-screen begin of screen 100 as subscreen.
selection-screen begin of block rep_perio with frame title text-bl2.
Selection-screen begin of line .
SELECTION-SCREEN COMMENT 1(31) TEXT-018.
parameters: p_perio type co_perio default lv_default_date+4(2) obligatory.
SELECTION-SCREEN COMMENT 37(30) TEXT-019.
Selection-screen end of line.
selection-screen end of block rep_perio.
selection-screen end of screen 100.
initialization.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
DATE = sy-datum
DAYS = '7'
MONTHS = '00'
SIGNUM = '-'
YEARS = '00'
IMPORTING
CALC_DATE = lv_default_date.
at selection-screen on p_bukrs.
-
lv_default_date is defined in another include
2009 Jan 21 2:25 PM
hi,
Try this way
selection-screen begin of screen 100 as subscreen.
selection-screen begin of block rep_perio with frame title text-bl2.
Selection-screen begin of line .
SELECTION-SCREEN COMMENT 1(31) TEXT-018.
parameters: p_perio type co_perio . " Remove the default statement
SELECTION-SCREEN COMMENT 37(30) TEXT-019.
Selection-screen end of line.
selection-screen end of block rep_perio.
selection-screen end of screen 100.
initialization.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
DATE = sy-datum
DAYS = '7'
MONTHS = '00'
SIGNUM = '-'
YEARS = '00'
IMPORTING
CALC_DATE = lv_default_date.
lp_perio = v_default_date+4(2). " Try this way..
at selection-screen on p_bukrs.
2009 Jan 21 2:27 PM
Since this is a sub screen, put the provided code from others in your PBO routine for the subscreen.
2009 Jan 21 2:28 PM
2009 Jan 21 2:29 PM
More of an issue may be that you are asking to back up 7 days.. not 10
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = sy-datum
days = '7' "<== I would think needs to be 10
months = '00'
signum = '-'
years = '00'
IMPORTING
calc_date = lv_default_date.
2009 Jan 21 2:35 PM
This worked
DATA: lv_default_date TYPE d.
*SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK rep_perio WITH FRAME TITLE text-bl2.
SELECTION-SCREEN BEGIN OF LINE .
SELECTION-SCREEN COMMENT 1(31) text-018.
PARAMETERS: p_perio TYPE co_perio. " This was changed
* DEFAULT lv_default_date+4(2) OBLIGATORY. " This was changed
SELECTION-SCREEN COMMENT 37(30) text-019.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK rep_perio.
*SELECTION-SCREEN END OF SCREEN 100.
INITIALIZATION.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = sy-datum
days = '7'
months = '00'
signum = '-'
years = '00'
IMPORTING
calc_date = lv_default_date.
p_perio = lv_default_date+4(2). " This was added
2009 Jan 21 2:38 PM
Paul, Avi
Still not working, however i am not able to debug it all , which leads me to believe that may be this code is not being executed at all.
2009 Jan 21 2:49 PM
hi,
You creating the screen as subscreen you are you calling this some where in your program.
before calling this screen you set the value of p_perio.
selection-screen begin of screen 100 as subscreen.
selection-screen begin of block rep_perio with frame title text-bl2.
Selection-screen begin of line .
SELECTION-SCREEN COMMENT 1(31) TEXT-018.
parameters: p_perio type co_perio .
SELECTION-SCREEN COMMENT 37(30) TEXT-019.
Selection-screen end of line.
selection-screen end of block rep_perio.
selection-screen end of screen 100.
initialization.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
DATE = sy-datum
DAYS = '7'
MONTHS = '00'
SIGNUM = '-'
YEARS = '00'
IMPORTING
CALC_DATE = lv_default_date.
p_perio = lv_default_date+4(2). " Pass the month to p_perio field
2009 Jan 21 2:51 PM
Hi
U need to fill the parameter in INITIALIZATION event and not by DEFAULT option at selection-screen level:
selection-screen begin of screen 100 as subscreen.
selection-screen begin of block rep_perio with frame title text-bl2.
Selection-screen begin of line .
SELECTION-SCREEN COMMENT 1(31) TEXT-018.
*parameters: p_perio type co_perio default lv_default_date+4(2) obligatory.
parameters: p_perio type co_perio obligatory.
SELECTION-SCREEN COMMENT 37(30) TEXT-019.
Selection-screen end of line.
selection-screen end of block rep_perio.
selection-screen end of screen 100.
initialization.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
DATE = sy-datum
DAYS = '7'
MONTHS = '00'
SIGNUM = '-'
YEARS = '00'
IMPORTING
CALC_DATE = lv_default_date.
move lv_default_date+4(2) to p_perio.Max
2009 Jan 21 3:07 PM
2009 Jan 21 2:11 PM
PARAMETERS : p_date TYPE sy-datum .
INITIALIZATION .
p_date = sy-datum - 10 .
check above code.
Tushar
2009 Jan 21 2:21 PM
As also said by others do it this way:
Parameters:
p_date(2) type c.
Initialization.
Data:
w_date like sy-datum.
w_date = sy-datum - 10.
p_date = w_date+4(2).or if you want the month in words than do it this way:
Parameters:
p_monam type t015m-monam.
Initialization.
Data:
w_date like sy-datum,
w_monum type t015m-monam.
w_date = sy-datum - 10.
w_monum = w_date+4(2).
select single monam
from t015m
into p_monam
where spras eq 'E'
and monum eq w_monum.With luck,
Pritam.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |