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

Week selection screen sd reports

Former Member
0 Likes
1,500

Hi experts,

My boss want report that he can select any week on selection screen after that execute report?

How can I assign week selection on selection-screen?

any help will be appriciate...

thanks

7 REPLIES 7
Read only

Former Member
0 Likes
1,076

Hi Kutay,

use SPWOC (S000-SPWOC).

regards,

Edgar

Read only

0 Likes
1,076

hi Edgar

I wıll use it as seelect-optıons but ı need to assign f4 search button so ı can choose weeks on selection screen( for example   ''execute program for 20.week "

f4 search button

1.week

2.week

.

.

.

.

.

.

52.week.

any help will be appriciate...

thank u

Read only

0 Likes
1,076

You can try to use search help RSCALWEEK, but normally it will only available in BW systems.

Also the only thing it can do is list weeks so my advice is to to this type of code:

TABLES: s012.

SELECT-OPTIONS s_spwoc FOR s012-spwoc.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_spwoc-low.

   PERFORM f_f4_spwoc USING s_spwoc-low.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_spwoc-high.

   PERFORM f_f4_spwoc USING s_spwoc-high.

*&---------------------------------------------------------------------*

*&      Form  F_F4_SPWOC

*&---------------------------------------------------------------------*

FORM f_f4_spwoc USING p_spwoc.

   DATA: l_date TYPE sy-datum.

   CALL FUNCTION 'F4_DATE'

     EXPORTING

       date_for_first_month         = sy-datum

     IMPORTING

       select_date                  = l_date

     EXCEPTIONS

       calendar_buffer_not_loadable = 1

       date_after_range             = 2

       date_before_range            = 3

       date_invalid                 = 4

       factory_calendar_not_found   = 5

       holiday_calendar_not_found   = 6

       parameter_conflict           = 7

       OTHERS                       = 8.

   IF sy-subrc = 0.

     CALL FUNCTION 'DATE_GET_WEEK'

       EXPORTING

         date         = l_date

       IMPORTING

         week         = p_spwoc

       EXCEPTIONS

         date_invalid = 1

         OTHERS       = 2.

   ENDIF.

ENDFORM.                    " F_F4_SPWOC

Read only

0 Likes
1,076

Edgar thank u so much,

this is what ı was lookn ffor.

best regard.

Read only

0 Likes
1,076

Edgar ı need to learn something too,

ın my zprogram ı was usıng bldat as a selection screen and now

how can I assıgn SELECT-OPTIONS s_spwoc FOR s012-spwoc. to my program as select-optıons,

I dont know the logic how to do connect?

any help will be appriciate...

thank u

Read only

0 Likes
1,076

Kutay,

there is not great shortcut for it. I think you want to convert a week range into a date range. The simplest way to do it, and I actually used it before, is to check all dates in an interval. Processing is very fast but the range might get rather big:

START-OF-SELECTION.

   RANGES: rs_sptag FOR s012-sptag.

   DATA: l_date TYPE sy-datum,

         l_spwoc TYPE s012-spwoc,

         ls_sptag LIKE LINE OF rs_sptag.

   ls_sptag-sign = 'I'.

   ls_sptag-option = 'EQ'.

   l_date = '20000103'. "monday, 1st day of week 2000.01

   WHILE l_date <= sy-datum.

     CALL FUNCTION 'DATE_GET_WEEK'

       EXPORTING

         date         = l_date

       IMPORTING

         week         = l_spwoc

       EXCEPTIONS

         date_invalid = 1

         OTHERS       = 2.

     IF l_spwoc IN s_spwoc[].

       DO 7 TIMES.

         ls_sptag-low = l_date.

         APPEND ls_sptag TO rs_sptag.

         ADD 1 TO l_date.

       ENDDO.

     ELSE.

       ADD 7 TO l_date.

     ENDIF.

   ENDWHILE.

*  test results

   LOOP AT rs_sptag INTO ls_sptag.

     WRITE: / ls_sptag-low.

   ENDLOOP.



The catch in this strategy is that you'll have to provide an initial and end date. Hopefully this will work for you. If it doesn't you'll have to work out the dates in the s_sptag range. I'm afraid this to me is basic ABAP so I won't provide you with code.


Regards,

Edgar

Read only

yogendra_bhaskar
Contributor
0 Likes
1,076

Hi Kutay ,

You can make a date selection on screen and according to the date you can have the week no.

Use FM DATE_GET_WEEK

Regards,

Yogendra Bhaskar