欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

年月的F4

程序员文章站 2022-05-31 07:57:38
...

TABLES :s031.
parameter p_spmon  type spmon default sy-datum+0(6) obligatory.
select-options s_spmon for s031-spmon default sy-datum+0(6) obligatory.

at selection-screen on value-request for p_spmon.
      perform monat_f4.
at selection-screen on value-request for s_spmon-low.
      perform monat_f4.
at selection-screen on value-request for s_spmon-high.
      perform monat_f4.



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>.

      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.
          mf_hlp_repid = 'SAPLALDB'.
        else.
          read table mf_dynpfields index 1.
          translate mf_dynpfields-fieldvalue using '_ '.
          exit.
        endif.
      enddo.
      if sy-subrc = 0.
        call function 'CONVERSION_EXIT_PERI_INPUT'
             exporting
                  input  = mf_dynpfields-fieldvalue
             importing
                  output = mf_monat
             exceptions
                  error_message = 1.
        if mf_monat is initial.
          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.
          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.
        endif.
      endif.
    endform.                               "MONAT_F4

年月的F4

相关标签: abap