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: 

DATE Range Selection option in Module Pool

Former Member
0 Kudos

Dear Experts,

Being new to ABAP I want to learn as how to provide a possibility for

DATE Range Selection Option on Module pool Screen.

Looking forward for your suggestions.

regards

chandan

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Here are two links that walk you through the creation of select-options in module pool programs.  You can use the same concept but use a data field as the type.

http://www.samplecodeabap.com/select-option-in-module-pool-program/

SAPTechnical.COM - Simple way of defining Select-options in Module Pool Programming

9 REPLIES 9

Former Member
0 Kudos

Here are two links that walk you through the creation of select-options in module pool programs.  You can use the same concept but use a data field as the type.

http://www.samplecodeabap.com/select-option-in-module-pool-program/

SAPTechnical.COM - Simple way of defining Select-options in Module Pool Programming

0 Kudos

Dear Shover,

Thanks a lot for the links. I had already tried it. It doesn't works for my code as I have some other processing code inmy MPP.

For all I have the following code in my Report Progg, which I want to use convert/use in MPP.

SELECTION-SCREEN begin of block blk2 with frame title text-102.

  DATA:           gv_datum  Type   dats.

  SELECT-OPTIONS: s_datum FOR gv_datum.

SELECTION-SCREEN end of block blk2.

INITIALIZATION.

        s_datum-low  = sy-datum - 10.

        s_datum-high  = sy-datum.

        APPEND s_datum.

The above introduces a Date selection range in Report Progg. Now I want to have this Date range in MPP. (Module Pool). Hpw to do it.

Regards

Chandan

0 Kudos

If you want to consume the screen defined by you in program you have to define sub-screen as mentioned in above post by Aaron.

0 Kudos

In a module pool you can create a selection screen for a subscreen.  The 2nd link walks you through it.  Here is their example with your code integrated.

DATA:           gv_datum  Type   dats.

* Here we create a selection screen for a subscreen.  This will be used in screen 100 as the selection screen.

SELECTION-SCREEN BEGIN OF SCREEN 400 AS SUBSCREEN.

PARAMETERS : p_vkorg TYPE vbrk-vkorg OBLIGATORY DEFAULT '1000'.

SELECT-OPTIONS : s_datum FOR gv_datum,

                  s_posnr FOR vbrp-posnr.

SELECTION-SCREEN END OF SCREEN 400 .

START-OF-SELECTION .

   CALL SCREEN 100 . "We call screen 100 and the subscreen will be called in the PBO event.



Now in screen 100 you need to create a subscreen area.  I called mine 'SEL'.  Here is the flow logic for screen 100.


PROCESS BEFORE OUTPUT.

  MODULE STATUS_0100.

*

     call SUBSCREEN sel INCLUDING sy-repid '400'.

PROCESS AFTER INPUT.

  MODULE USER_COMMAND_0100.

To default the date range you can do that in your STATUS_0100 module.

MODULE status_0100 OUTPUT.

   SET PF-STATUS '0100'.

*  SET TITLEBAR 'xxx'.

   s_datum-low  = sy-datum - 10.

   s_datum-high  = sy-datum.

   APPEND s_datum.

ENDMODULE.                 " STATUS_0100  OUTPUT



Does that make sense?


Regards,

Aaron

0 Kudos

I think, INITIALIZATION event would still trigger. You can set the the default values in the that event, instead of the PBO.

INITIALIZATION would be more appropriate than PBO. If you set the default values in PBO, those default values would overwrite the actual user entered values when the PBO triggers again, e.g. on ENTER when you don't have any screen control in PAI.

Thanks,
Naimesh Patel

0 Kudos

It won't (at least it didn't for me) which is why I suggested to place it in the PBO.

0 Kudos

Dear Aaron,

Thanks it works, except that the Sy-datum in PBO sud n't be used as it overwrited the user given date!!!

Thanks to all.

Regards

Chandan

former_member248300
Participant
0 Kudos

Hello Chandan,

In module pool screen, insert 'From' and 'To Date' field elements. In PBO event of the screen, do the validation of date entered by user if required. Then in PAI event use this date range for further processing, like in select query etc.

Thanks,

Shreekant

VenkatRamesh_V
Active Contributor
0 Kudos

Hi Chandan,

Create a Subscreen name it as 'SEL'.

Add the Syntex in Moudle pool.

PROCESS BEFORE OUTPUT.

MODULE STATUS_0250.

Call subscreen SEL including sy-repid '300'.

*

PROCESS AFTER INPUT.

CALL SUBSCREEN SEL.

In Abap Editor.

SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.

SELECT-OPTIONS : s_werks FOR vbrp-werks NO INTERVALS,

                 s_erdat FOR vbrk-erdat,

                 s_vbeln FOR vbrk-vbeln.

SELECTION-SCREEN END OF SCREEN 300 .

Regards,

Venkat.