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

date display

Former Member
0 Likes
1,305

hi folks,

I need your help here.I have the parameter option defined on the screen. depending upon which number i enter in the paramter the last date of the month has to be assigned to a variable.

i.e if I enter 07 in the parameters box, it the july month of the year and it should display 07/31/05 (dd/mm/yy) format.

What I have done is read the data from the parameter option into the variable using the case ... endcase i have been working on getting the last date of that month.

Is there any keyword that can generate the last date of the month in 'dd/mm/yy' format.

How can I take this further?

Thanks in advance.

Santhosh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
995

Hello,

Try FM RP_LAST_DAY_OF_MONTHS

Hope this helps you.

Regds, Murugesh AS

9 REPLIES 9
Read only

Former Member
0 Likes
996

Hello,

Try FM RP_LAST_DAY_OF_MONTHS

Hope this helps you.

Regds, Murugesh AS

Read only

0 Likes
995

Check out the "write" statement options.


write w_date to w_date_out dd/mm/yy .

Regards,

Erwan.

Read only

0 Likes
995

Hi Murugesh,

The FM asks for the current date. Is there a way where in the number of the month entered in the parameter option can be taken and the last day of the month be generated?

because I need this to run the monthly end financial statements.

And I need to capture that value(last day of the month) depending on the month number I enter in the parameter option and transfer into the form.

If you could just elaborate how can I use this module that owuld be great too.

thanks

Read only

0 Likes
995

Implement the following program. Run it, enter the date in the first field. Hit Enter. The end of that month will show in the second field.



report zrich_0001.


parameters: s_date type sy-datum,
           e_date type sy-datum.


at selection-screen.

  call function 'RP_LAST_DAY_OF_MONTHS'
       exporting
            day_in            = s_date
       importing
            last_day_of_month = e_date.

Regards,

Rich Heilman

Read only

0 Likes
995

Hello,

Here is the sample code. Hope this helps you.

REPORT ylastdate .

tables: bsid.
TYPE-POOLS: vrm.
DATA: name TYPE vrm_id,
      list TYPE vrm_values,
      value LIKE LINE OF list.
data: g_datum like sy-datum.
data: g_lastdatum like sy-datum.

PARAMETERS: p_monat(2) AS LISTBOX VISIBLE LENGTH 5 OBLIGATORY.

AT SELECTION-SCREEN OUTPUT.

  PERFORM p_monat.
at selection-screen.
  perform fill_g_datum.
start-of-selection.
  perform get_last_day.

*&---------------------------------------------------------------------*
*&      Form  p_monat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form p_monat.
  name = 'P_MONAT'.
  value-key = '01'.
  value-text = 'Jan'.
  APPEND value TO list.

  value-key = '02'.
  value-text = 'Feb'.
  APPEND value TO list.

  value-key = '03'.
  value-text = 'Mar'.
  APPEND value TO list.

  value-key = '04'.
  value-text = 'Apr'.
  APPEND value TO list.

  value-key = '05'.
  value-text = 'May'.
  APPEND value TO list.

  value-key = '06'.
  value-text = 'Jun'.
  APPEND value TO list.

  value-key = '07'.
  value-text = 'Jul'.
  APPEND value TO list.

  value-key = '08'.
  value-text = 'Aug'.
  APPEND value TO list.

  value-key = '09'.
  value-text = 'Sep'.
  APPEND value TO list.
  value-key = '10'.
  value-text = 'Oct'.
  APPEND value TO list.
  value-key = '11'.
  value-text = 'Nov'.
  APPEND value TO list.

  value-key = '12'.
  value-text = 'Dec'.
  APPEND value TO list.

  CALL FUNCTION 'VRM_SET_VALUES'
       EXPORTING
            id     = name
            values = list.

endform.                    " p_monat
*&---------------------------------------------------------------------*
*&      Form  fill_g_datum
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form fill_g_datum.
clear:g_datum.
concatenate sy-datum(4) p_monat '01' into g_datum.
endform.                    " fill_g_datum
*&---------------------------------------------------------------------*
*&      Form  get_last_day
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form get_last_day.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
  EXPORTING
    day_in                  = g_datum
 IMPORTING
   LAST_DAY_OF_MONTH       = g_lastdatum
 EXCEPTIONS
   DAY_IN_NO_DATE          = 1
   OTHERS                  = 2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.

write:/ g_lastdatum.
ENDIF.

endform.                    " get_last_day

Regds, Murugesh AS

Read only

0 Likes
995

thanks Rich, how can I extend this to have the month name too because I need to display that too.

santhosh

Read only

0 Likes
995

Here ya go.



report zrich_0001.

data: xt247 type t247.

parameters: s_date type sy-datum,
            e_date type sy-datum,
            monthn(30) type c.


at selection-screen.

  call function 'RP_LAST_DAY_OF_MONTHS'
       exporting
            day_in            = s_date
       importing
            last_day_of_month = e_date.


  select single * from t247 into xt247
          where spras = sy-langu
            and mnr = e_date+4(2).

  monthn = xt247-ltx.

If these posts have helped you solve your problem, please award points and close the post. Thanks.

Regards,

Rich Heilman

Read only

0 Likes
995

thanks a lot Rich.

Read only

0 Likes
995

hi Murugesh,

Thanks alot for your input it really helped.I have awarded points to you too.

Santhosh