Tuesday, April 16, 2013

Select Options in Module Pool Program

We can make Select Option for input element in the module pool program. Following are the steps.

Step-1
Go to SE80 and create a program (here it is zsandip_mod).

Step-2
Create top include with naming convention.
Here the names are:

INCLUDE zsandip_top                             .  " global Data
INCLUDE zsandip_o01                             .  " PBO-Modules
INCLUDE zsandip_i01                             .  " PAI-Modules
INCLUDE zsandip_f01                             .  " FORM-Routines

Step-3
Create a screen that contains a number (here 9000).

Step-4
Inside the screen create a sub screen by using the sub screen tool bar. There is no need to create that sub screen separately.

Step-5
In the Top Include mention the select option like below:

TABLES mara.
DATA: ok_code TYPE sy-ucomm.

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
SELECT-OPTIONS   s_matnr FOR mara-matnr.
SELECTION-SCREEN END OF SCREEN 100.

Step-6
Now write the code in the flow logic of the screen 9000. In PBO we are calling sub screen 'SEL' which is including the program name with the sub screen number '100'. After that we have to call sub screen 'SEL' at first in the PAI block. If here it is not declared then the Select Option will remain blank.

PROCESS BEFORE OUTPUT.
  MODULE status_9000.
  CALL SUBSCREEN sel INCLUDING sy-repid '100'.

PROCESS AFTER INPUT.
  CALL SUBSCREEN sel.
  MODULE user_command_9000.

Here in the Element List we have to declare the ok_code.

Step-7
After that create the GUI status and PF status in the PBO module.

Step-8
Next in PAI module mention the code shown below:

    CASE ok_code.
    WHEN 'BACK'.
      PERFORM leave.
    WHEN 'EXIT'.
      PERFORM leave.
    WHEN 'CANCEL'.
      PERFORM leave.
  ENDCASE.

Step-9
Next declare the subroutine in INCLUDE zsandip_f01 and mention the following code:

  LEAVE TO SCREEN 0.
  LEAVE LIST-PROCESSING.

Step-10
Finally create a transaction code (here zsr_mod) and run that by separately.

Layout is as follows (to view large click on the figure):



Output is as follows (to view large click on the figure):

13 comments:

David said...

In this Article Im not able to put
Select-options on Subscreen....
Its not invoking Select-optoons Declaration from Top_program...>
how...! Explain Clearly....!

Sandip Roy said...

I think you have created a sub screen separately. Please create sub screen by Screen Painter (Layout button) with sub screen toolbar. I have mentioned a screen shot.

David said...

Yeah...Now i Got it...! :)

Anonymous said...

The selection screen is getting refreshed each and every time i try to give an input and the range options dialog is also not displayed. What could be the problem??

Regards
Priscilla

Unknown said...

The more we exploit nature, The more our options are reduced, until we have only one: to fight for survival. See the link below for more info.


#options
www.ufgop.org

piyush said...

Hi,
We are doing product development like add-on product. Can anyone tell me that how can I provide some exits and implicit/explicit enhancement point in our program so that later a developer/customer could enhance it by using that?

Anonymous said...

Thank you very much for this article! S.

Anonymous said...

SAP Success Factors Real Time Hands on Training in Chennai...

Don't always Depend on Training Institute Alone and so please aware of Best Trainers too..

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/

If You need a Best Trainer over SAP Success Factors Means??? Please ready for an DEMO From the Trainer MR.Karthick
CONTACT:8122241286

Both Classroom/Online Training is Available!!!!!!

Unknown said...

Best SAP Success Factors Training Institute in Chennai
Best SAP MM Training in Chennai
Best SAP SD Training in Chennai
Best SAP ABAP Training in Chennai
Best SAP FICO Training in Chennai
Best SAP BASIS Training in Chennai

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/
http://thecreatingexperts.com/sap-mm-training-in-chennai/
http://thecreatingexperts.com/sap-sd-training-in-chennai/
http://thecreatingexperts.com/sap-hr-training-in-chennai/
http://thecreatingexperts.com/sap-fico-training-in-chennai/
http://thecreatingexperts.com/sap-abap-training-in-chennai/
http://thecreatingexperts.com/sap-basis-training-in-chennai/

If You need a Best Trainer in SAP Success Factors??? Then be ready for a DEMO From the Trainer MR.Karthick
CONTACT:8122241286
http://thecreatingexperts.com/sap-mm-training-in-chennai/

Both Classroom/Online Training is Available!!!!!!

Anonymous said...

Hi, I learned SAP Training in Chennai from THE CREATING EXPERTS. The training was good and i got selected in leading MNC company as SAP Consultant.

contact 8122241286

www.thecreatingexperts.com

jamesfo8376 said...

?I used to be very pleased to search out this net-site.I needed to thanks on your time for this excellent learn!! I definitely enjoying every little bit of it and I've you bookmarked to check out new stuff you weblog post. mgm online casino

Unknown said...

thank you for sharing nyce information really very nice ..i am intrested ur sap course for more info sap hr abap online classes

tes said...

Nice post,, i learned a lot from this site,, thank u.