Application Development 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: 

How to use MM/YYYY Format in the selection Screen?

Former Member
0 Kudos

There is this program RMCB0300 where the date format in the selection screen has MM/YYYY Format.

I am working on a report which requires it "Period" Field in the selection screen to be in the same format.

However, i am trying to give the select option as " SL_SPMON FOR S031-SPMON MODIF ID PER." and declaring S031 table in the declaration part.

But still, its not been able to provide me F4 help in the inpur screen.

Can someone please provide me some guidance in this regard?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

FM POPUP_TO_SELECT_MONTH

If you debug the <b>PERFORM MONAT_F4</b> , you will know how to convert the value and call this FM and how to take the selections back.

Regards,

Raj

8 REPLIES 8

Former Member
0 Kudos

Hi Ravi,

Check this part of code in program <b>RMCB0300</b> Source code of RMCS00SO

AT SELECTION-SCREEN ON VALUE-REQUEST FOR SL_SPMON-LOW.

PERFORM MONAT_F4.

Regards,

Raj

0 Kudos

hi Raj,

Thanx for the reply..!!

Can you please explain in regard to the subroutine MONAT_F4 ? what is to be there in the sub routine?

Former Member
0 Kudos

Hi,

FM POPUP_TO_SELECT_MONTH

If you debug the <b>PERFORM MONAT_F4</b> , you will know how to convert the value and call this FM and how to take the selections back.

Regards,

Raj

0 Kudos

Hi Raj,

Thanks for the reply once again.

Since I am new in this field, can you explain little more for the last reply you sent. I would sincerely appreaciate that.

0 Kudos

Copy this code in PERFORM MONAT_4

DATA: BEGIN OF MF_DYNPFIELDS OCCURS 1.

INCLUDE STRUCTURE DYNPREAD.

DATA: END OF MF_DYNPFIELDS.

DATA: MF_RETURNCODE LIKE SY-SUBRC,

MF_MONAT LIKE ISELLIST-MONTH,

MF_HLP_REPID LIKE SY-REPID.

FIELD-SYMBOLS: <MF_FELD>.

  • Wert von Dynpro lesen

GET CURSOR FIELD MF_DYNPFIELDS-FIELDNAME.

APPEND MF_DYNPFIELDS.

MF_HLP_REPID = SY-REPID.

DO 2 TIMES.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = MF_HLP_REPID

DYNUMB = SY-DYNNR

TABLES

DYNPFIELDS = MF_DYNPFIELDS

EXCEPTIONS

INVALID_ABAPWORKAREA = 01

INVALID_DYNPROFIELD = 02

INVALID_DYNPRONAME = 03

INVALID_DYNPRONUMMER = 04

INVALID_REQUEST = 05

NO_FIELDDESCRIPTION = 06

UNDEFIND_ERROR = 07.

IF SY-SUBRC = 3.

  • Aktuelles Dynpro ist Wertemengenbild

MF_HLP_REPID = 'SAPLALDB'.

ELSE.

READ TABLE MF_DYNPFIELDS INDEX 1.

  • Unterstriche durch Blanks ersetzen

TRANSLATE MF_DYNPFIELDS-FIELDVALUE USING '_ '.

EXIT.

ENDIF.

ENDDO.

IF SY-SUBRC = 0.

  • Konvertierung ins interne Format

CALL FUNCTION 'CONVERSION_EXIT_PERI_INPUT'

EXPORTING

INPUT = MF_DYNPFIELDS-FIELDVALUE

IMPORTING

OUTPUT = MF_MONAT

EXCEPTIONS

ERROR_MESSAGE = 1.

IF MF_MONAT IS INITIAL.

  • Monat ist initial => Vorschlagswert aus akt. Datum ableiten

MF_MONAT = SY-DATLO(6).

ENDIF.

CALL FUNCTION 'POPUP_TO_SELECT_MONTH'

EXPORTING

ACTUAL_MONTH = MF_MONAT

IMPORTING

SELECTED_MONTH = MF_MONAT

RETURN_CODE = MF_RETURNCODE

EXCEPTIONS

FACTORY_CALENDAR_NOT_FOUND = 01

HOLIDAY_CALENDAR_NOT_FOUND = 02

MONTH_NOT_FOUND = 03.

IF SY-SUBRC = 0 AND MF_RETURNCODE = 0.

  • ASSIGN (MF_DYNPFIELDS-FIELDNAME) TO <MF_FELD>. " ==>> note 148804

  • <MF_FELD> = MF_MONAT.

CALL FUNCTION 'CONVERSION_EXIT_PERI_OUTPUT'

EXPORTING

INPUT = MF_MONAT

IMPORTING

OUTPUT = MF_DYNPFIELDS-FIELDVALUE.

COLLECT MF_DYNPFIELDS.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

DYNAME = MF_HLP_REPID

DYNUMB = SY-DYNNR

TABLES

DYNPFIELDS = MF_DYNPFIELDS

EXCEPTIONS

INVALID_ABAPWORKAREA = 01

INVALID_DYNPROFIELD = 02

INVALID_DYNPRONAME = 03

INVALID_DYNPRONUMMER = 04

INVALID_REQUEST = 05

NO_FIELDDESCRIPTION = 06

UNDEFIND_ERROR = 07. "<<== note 148804

ENDIF.

ENDIF.

0 Kudos

Hi,

the following works for me..


*&---------------------------------------------------------------------*
*& Report  ZPMONAT                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

report  zpmonat                                 .
tables: s031.
selection-screen begin of block abc.
select-options:  sl_spmon for s031-spmon.
selection-screen end of block abc.

at selection-screen on value-request for sl_spmon-low.
  perform monat_f4.

at selection-screen on value-request for sl_spmon-high.
  perform monat_f4.


start-of-selection.


end-of-selection.

*&---------------------------------------------------------------------*
*&      Form  monat_f4
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form monat_f4 .
  data: begin of mf_dynpfields occurs 1.
          include structure dynpread.
  data: end   of mf_dynpfields.
  data: mf_returncode   like sy-subrc,
        mf_monat        like isellist-month,
        mf_hlp_repid    like sy-repid.
  field-symbols: <mf_feld>.

* Wert von Dynpro lesen
  get cursor field mf_dynpfields-fieldname.
  append mf_dynpfields.
  mf_hlp_repid = sy-repid.
  do 2 times.
    call function 'DYNP_VALUES_READ'
      exporting
        dyname               = mf_hlp_repid
        dynumb               = sy-dynnr
      tables
        dynpfields           = mf_dynpfields
      exceptions
        invalid_abapworkarea = 01
        invalid_dynprofield  = 02
        invalid_dynproname   = 03
        invalid_dynpronummer = 04
        invalid_request      = 05
        no_fielddescription  = 06
        undefind_error       = 07.
    if sy-subrc = 3.
*     Aktuelles Dynpro ist Wertemengenbild
      mf_hlp_repid = 'SAPLALDB'.
    else.
      read table mf_dynpfields index 1.
*     Unterstriche durch Blanks ersetzen
      translate mf_dynpfields-fieldvalue using '_ '.
      exit.
    endif.
  enddo.
  if sy-subrc = 0.
*   Konvertierung ins interne Format
    call function 'CONVERSION_EXIT_PERI_INPUT'
      exporting
        input         = mf_dynpfields-fieldvalue
      importing
        output        = mf_monat
      exceptions
        error_message = 1.
    if mf_monat is initial.
*     Monat ist initial => Vorschlagswert aus akt. Datum ableiten
      mf_monat = sy-datlo(6).
    endif.
    call function 'POPUP_TO_SELECT_MONTH'
      exporting
        actual_month               = mf_monat
      importing
        selected_month             = mf_monat
        return_code                = mf_returncode
      exceptions
        factory_calendar_not_found = 01
        holiday_calendar_not_found = 02
        month_not_found            = 03.
    if sy-subrc = 0 and mf_returncode = 0.
*     ASSIGN (MF_DYNPFIELDS-FIELDNAME) TO <MF_FELD>. " ==>> note 148804
*     <MF_FELD> = MF_MONAT.
      call function 'CONVERSION_EXIT_PERI_OUTPUT'
        exporting
          input  = mf_monat
        importing
          output = mf_dynpfields-fieldvalue.
      collect mf_dynpfields.
      call function 'DYNP_VALUES_UPDATE'
        exporting
          dyname               = mf_hlp_repid
          dynumb               = sy-dynnr
        tables
          dynpfields           = mf_dynpfields
        exceptions
          invalid_abapworkarea = 01
          invalid_dynprofield  = 02
          invalid_dynproname   = 03
          invalid_dynpronummer = 04
          invalid_request      = 05
          no_fielddescription  = 06
          undefind_error       = 07.           "<<== note 148804
    endif.
  endif.

endform.                                                    " monat_f4

Regards,

Suresh Datti

0 Kudos

Hi Chandrasekhar,

Thanks a lot for your valuable input.

This has helped me a lot.

Regards,

Ravi

0 Kudos

hi Suresh,

Thanks a lot for your valuable input.

This helped me in the solving the entire problem.

Regards,

Ravi