‎2008 Dec 03 10:55 PM
Moderator message: please use a meaningful, informative subject for your future questions
Hi,
How to pass the date value on the selection screen to the FM DATE_TO_PERIOD_CONVERT which is written in a method.
thank You,
SB.
Edited by: Matt on Dec 4, 2008 11:42 AM
‎2008 Dec 04 8:11 AM
Hi,
I hope below code can answer your questions.
Class c1 definition.
Public section.
data:date type sy-datum,
E_BUPER type T009B-POPER,
E_GJAHR type T009B-BDATJ.
Methods: M1 importing date type sy-datum.
endclass.
class c1 implementation.
Method M1.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
I_DATE = date
* I_MONMIT = 00
I_PERIV = '24'
IMPORTING
E_BUPER = E_BUPER
E_GJAHR = E_GJAHR
* EXCEPTIONS
* INPUT_FALSE = 1
* T009_NOTFOUND = 2
* T009B_NOTFOUND = 3
* OTHERS = 4
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE:E_BUPER.
ENDMETHOD.
endclass.
* selection screen
parameter:Date1 type sy-datum.
start-of-selection.
data:myclob type ref to c1.
create object myclob.
call method myclob->m1 exporting date = date1.Regards,
Hemu.
Edited by: Matt on Dec 4, 2008 11:43 AM add tags
‎2008 Dec 04 6:29 AM
Hi
If method has no importing parameter which is passed to that function module
you will not be able to do so.
‎2008 Dec 04 8:11 AM
Hi,
I hope below code can answer your questions.
Class c1 definition.
Public section.
data:date type sy-datum,
E_BUPER type T009B-POPER,
E_GJAHR type T009B-BDATJ.
Methods: M1 importing date type sy-datum.
endclass.
class c1 implementation.
Method M1.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
I_DATE = date
* I_MONMIT = 00
I_PERIV = '24'
IMPORTING
E_BUPER = E_BUPER
E_GJAHR = E_GJAHR
* EXCEPTIONS
* INPUT_FALSE = 1
* T009_NOTFOUND = 2
* T009B_NOTFOUND = 3
* OTHERS = 4
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE:E_BUPER.
ENDMETHOD.
endclass.
* selection screen
parameter:Date1 type sy-datum.
start-of-selection.
data:myclob type ref to c1.
create object myclob.
call method myclob->m1 exporting date = date1.Regards,
Hemu.
Edited by: Matt on Dec 4, 2008 11:43 AM add tags
‎2008 Dec 04 10:43 AM
Please use a meaningful, informative subject for your future questions