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 Splitting

Former Member
0 Likes
679

Hi,

I want to use the date format yyyy/mm on the selection screen for a report. How do i split the Date field AEDAT to use it on my report. Plz help.

2 REPLIES 2
Read only

former_member189629
Active Contributor
0 Likes
571

Sourav,

You can use offsets and concatenate the splitted values into a variable to display in your report...

data: lv_date(7) type c.

concatenate aedat + 4(4) '/' aedat+2(2) into lv_date.

THe offsets will haev to change depending on your sy-datum format.

For your selection screen date format, Check this part of code in program RMCB0300 Source code of RMCS00SO

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

PERFORM MONAT_F4.

&----


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

Reward if helpful...

Karthik

Message was edited by:

Karthik

Read only

varma_narayana
Active Contributor
0 Likes
571

Hi.

You can Declare like this : For Month and Year input.

PARAMETERS : p_period type BUPER. "Posting period in YYYYMM

<b>Reward if Helpful.</b>