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

Module Pool Prog: Populate selection screen based on radio button

Former Member
0 Likes
1,408

Hi ABAPers,

I am working on a report of type M module pool program ( not to be mistaken with type 1 executable prog.)

I have a subscreen 400 on screen 101 and have declared parametrs and radion button group r2 in TOP include.

In the selection screen on subscreen 400 I have:

parameters : grdate RADIOBUTTON GROUP r2 DEFAULT 'X'.

parameters : crdate RADIOBUTTON GROUP r2 .

parameters : mblnr like mseg-mblnr ."OBLIGATORY.

parameters : matnr1 like MARA-MATNR ."OBLIGATORY.

parameters : pdate like mkpf-bldat ."OBLIGATORY.

parameters : qty like mseg-bstmg ."OBLIGATORY.

Based on radio button seleted (grdate or crdate) I need to populate pdate.

How Do I do this??

Regards,

DEP

Edited by: DeepakNandikanti on Mar 3, 2011 12:10 PM

Hi ABAPers,

I am working on a report of type M module pool program ( not to be mistaken with type 1 executable prog.)

I have a subscreen 400 on screen 101 and have declared parametrs and radion button group r2 in TOP include.

In the selection screen on subscreen 400 I have:

parameters : grdate RADIOBUTTON GROUP r2 DEFAULT 'X'.

parameters : crdate RADIOBUTTON GROUP r2 .

parameters : mblnr like mseg-mblnr ."OBLIGATORY.

parameters : matnr1 like MARA-MATNR ."OBLIGATORY.

parameters : pdate like mkpf-bldat ."OBLIGATORY.

parameters : qty like mseg-bstmg ."OBLIGATORY.

Based on radio button seleted (grdate or crdate) I need to populate pdate.

How Do I do this??

Regards,

DEP

Edited by: DeepakNandikanti on Mar 3, 2011 12:10 PM

12 REPLIES 12
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,246

You can assign the values to pdate in the PAI of teh subscreen.

Read only

0 Likes
1,246

Hi Sandeep,

The value in pdate should be populated at selection screen itself after that on I will trigger PAI by pressign enter button.

like:

when crdate is selected, pdate = sy-datum.

when grdate is selected, pdate = sy-datum + 1.

Then the furterh processign takes place. So I guess it is written in AT SELECTION SCREEN or AT SELECTION SCREEN ON RADIOBUTTON GROUP R2. Which I tried but dint get any results.

--DEP

Read only

0 Likes
1,246

Hi,

Try this,

At selection-screen output.
If radiobutton1 = 'X'.

<Set value to ur parameters.>

else.

<Set value to ur parameters.>

endif.

Read only

0 Likes
1,246

Hi,

At selection-screen output is not gettign triggered. I wrotre it in TOP declaration.

--DEP.

Read only

0 Likes
1,246

You said you use standard dynpros, therefore AT SELECTION-SCREEN* are not applicable here. Do all your coding in PBO and PAI of screen 101. In this case setting date should be done in PBO as you have by default one of radio selected.

Regards

Marcin

Read only

0 Likes
1,246

Hi,

There is no select options on your screen. so why do u need a separate selection for your program.

You can directly place I/O fields(Similar to your parameters) on your screen 101 itself, and populate values based on radio button(PBO of screen 101).

PBO
If radiobutton1 = 'X'.
date = sydatum.
else.
date = sy-datum - 1.
endif.

Regards,

Mr.A

Read only

0 Likes
1,246

Thanks Mr. A.

This is enhancement which I need to make in the existing program.

The Subscreen is called dynamically based on the material type, in this case there is no Select-Options but can be there for others.

I cannot remove the Subscreen and selection screen call.

Thanks,

Dep

Read only

0 Likes
1,246

Try this,

TOP_INCLUDE

DATA : v_dynnr TYPE sy-dynnr VALUE '0100',
       v_repid TYPE sy-repid VALUE 'ZTEST_SC',
       ok_code TYPE sy-ucomm.

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
PARAMETERS : p_rb1 RADIOBUTTON GROUP grp1 USER-COMMAND naa,
             p_rb2 RADIOBUTTON GROUP grp1.

PARAMETERS p_date TYPE sy-datum DEFAULT sy-datum.
SELECTION-SCREEN END OF SCREEN 100.

Screen 200

PROCESS BEFORE OUTPUT.
 MODULE STATUS_0200.
  CALL SUBSCREEN sub INCLUDING v_repid v_dynnr.

PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0200.
  CALL SUBSCREEN sub .

Module STATUS_0200.

*&---------------------------------------------------------------------*
*&      Module  STATUS_0200  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0200 OUTPUT.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.

  IF ok_code = 'NAA'.
    IF p_rb1 = 'X'.
      p_date = sy-datum.
    ELSE.
      p_date = sy-datum - 1.
    ENDIF.
  ENDIF.
ENDMODULE.                 " STATUS_0200  OUTPUT

Read only

0 Likes
1,246

Hi,

The ok_code is not gettting captured.

Read only

0 Likes
1,246

Hi

Go to Elemnet List tab of screen 200,

Mention OK_CODE in the last row of tab general attibutes

Ie : Where type of screen element is 'OK'.

Regards,

Mr.A

Read only

Former Member
0 Likes
1,246

You can assign an OK code to each radio button and then in the PAI, populate your fields based on that.

Rob

Read only

Former Member
0 Likes
1,246

Hi ALL,

Thank you for your replies, I guess I dint convey my question properly,

I have called a Selection-Screen in Module Pool .

These were the steps which i followed to archive this.

1. Created a subscreen area in your screen layout (Main Screen- Module Pool).

2. In the Top Include of Module pool program declared a Selection-Screen as a subscreen.

TOP-INCLUDE.

SELECTION-SCREEN BEGIN OF SCREEN 400 AS SUBSCREEN. 
    SELECTION-SCREEN BEGIN OF BLOCK d3 WITH FRAME TITLE text-003. 
      PARAMETERS : grdate RADIOBUTTON GROUP r2  DEFAULT 'X' USER-COMMAND FR1.  " GRN date 
      PARAMETERS : crdate RADIOBUTTON GROUP r2 .       " Current Date 
    SELECTION-SCREEN END OF BLOCK d3. 
   SELECTION-SCREEN END OF SCREEN 400.

3. In the PBO and PAI of the Main Screen called Subscreen.

PBO

CALL SUBSCREEN SUB_SCREEN_STAPLES INCLUDING 'zprogram' '0400'.

PAI

CALL SUBSCREEN SUB_SCREEN_STAPLES..

I have to do certain operations when the user selects the radio button on subscreen (which is actually a Selection-Screen).

I have tried to assign the function code to radio button and as this screen is a Selection-Screen I cannot use PAI and PBO.

Used the below code in TOP-INCLUDE.

TOP-Include

AT SELECTION-SCREEN ON RADIOBUTTON GROUP r2. 
   
  CASE ok_rb. 
    WHEN 'FR1' . 
      IF crdate = 'X'. 
        pdate = sy-datum. 
      ELSE. 
        pdate = sy-datum + 1. 
      ENDIF. 
  ENDCASE.

But after executing this logic the flow is going to PAI which is validating the mandatory fields of Module-Pool Screen (which is not part of sub screen), hence not solving my purpose.

Is there any way by which I can Only trigger the AT-Selection screen for the selection screen.

or Any other approach which will solve my purpose.

Thanks a lot for Suggestions and Inputs.