Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Query

Former Member
0 Likes
531

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
502

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

3 REPLIES 3
Read only

Former Member
0 Likes
502

Hi

If method has no importing parameter which is passed to that function module

you will not be able to do so.

Read only

Former Member
0 Likes
503

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

Read only

matt
Active Contributor
0 Likes
502

Please use a meaningful, informative subject for your future questions