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

Help in the selection screen

Former Member
0 Likes
2,019

hi folks,

I need help in updating the selection screen, I have declared the 'parameters' object in the selection screen like this.

parameters:

Paygroup type ZPGKIS obligatory.

it has three values '5A', '5B' and '5V'. when I select '5V' from the parameters, I need to display another parameters selection object for 'date' otherwise NO

I tried something like this.....

if Paygroup = '5V'.

parameters: p_date type d.

endif.

It is not working...

How can I correct this??

Thanks in advance

Vinu

1 ACCEPTED SOLUTION
Read only

rahulkavuri
Active Contributor
0 Likes
1,956

did u do that in AT SELECTION-SCREEN OUTPUT .

To give u an idea check this code, here cal_tra is the variable


AT SELECTION-SCREEN OUTPUT.


  IF CAL_TRA = 'X'.
    LOOP AT SCREEN.

      IF SCREEN-GROUP1 = 'BL1'.
        SCREEN-ACTIVE = '1'.
      ENDIF.

      IF SCREEN-GROUP1 = 'BL2'.
        SCREEN-ACTIVE = '0'.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.

  IF SESSION = 'X'.

    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'BL1'.
        SCREEN-ACTIVE = '0'.
      ENDIF.

      IF SCREEN-GROUP1 = 'BL2'.
        SCREEN-ACTIVE = '1'.
      ENDIF.

      MODIFY SCREEN.

    ENDLOOP.
  ENDIF.

did u do that in AT SELECTION-SCREEN OUTPUT .

To give u an idea check this code, here cal_tra is the variable


AT SELECTION-SCREEN OUTPUT.


  IF CAL_TRA = 'X'.
    LOOP AT SCREEN.

      IF SCREEN-GROUP1 = 'BL1'.
        SCREEN-ACTIVE = '1'.
      ENDIF.

      IF SCREEN-GROUP1 = 'BL2'.
        SCREEN-ACTIVE = '0'.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.

  IF SESSION = 'X'.

    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'BL1'.
        SCREEN-ACTIVE = '0'.
      ENDIF.

      IF SCREEN-GROUP1 = 'BL2'.
        SCREEN-ACTIVE = '1'.
      ENDIF.

      MODIFY SCREEN.

    ENDLOOP.
  ENDIF.

23 REPLIES 23
Read only

rahulkavuri
Active Contributor
0 Likes
1,957

did u do that in AT SELECTION-SCREEN OUTPUT .

To give u an idea check this code, here cal_tra is the variable


AT SELECTION-SCREEN OUTPUT.


  IF CAL_TRA = 'X'.
    LOOP AT SCREEN.

      IF SCREEN-GROUP1 = 'BL1'.
        SCREEN-ACTIVE = '1'.
      ENDIF.

      IF SCREEN-GROUP1 = 'BL2'.
        SCREEN-ACTIVE = '0'.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.

  IF SESSION = 'X'.

    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'BL1'.
        SCREEN-ACTIVE = '0'.
      ENDIF.

      IF SCREEN-GROUP1 = 'BL2'.
        SCREEN-ACTIVE = '1'.
      ENDIF.

      MODIFY SCREEN.

    ENDLOOP.
  ENDIF.

Read only

Former Member
0 Likes
1,956

hii

you can make that using radio button

<b>

REPORT z_selectionscreen .

SELECTION-SCREEN BEGIN OF BLOCK blk.

PARAMETERS : p_rb1 TYPE PAYGROUP RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND FC,

p_rb2 TYPE PAYGROUP RADIOBUTTON GROUP rad1.

SELECTION-SCREEN END OF BLOCK blk.

SELECTION-SCREEN BEGIN OF BLOCK blk_1 WITH FRAME.

PARAMETERS : p_werks1 TYPE werks_d MODIF ID bk1.

SELECTION-SCREEN END OF BLOCK blk_1.

SELECTION-SCREEN BEGIN OF BLOCK blk_2 WITH FRAME.

PARAMETERS : p_werks2 TYPE werks_d MODIF ID bk2,

p_matnr2 TYPE matnr MODIF ID bk2.

SELECTION-SCREEN END OF BLOCK blk_2.

AT SELECTION-SCREEN OUTPUT.

IF p_rb1 = '5V'.

LOOP AT SCREEN.

IF screen-group1 = 'BK1'.

screen-active = 0.

MODIFY SCREEN.

ELSE.

screen-active = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSE.

LOOP AT SCREEN.

IF screen-group1 = 'BK2'.

screen-active = 0.

MODIFY SCREEN.

ELSE.

screen-active = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.</b>

you can as well check this code

-


SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS : P_FILE(25) TYPE C,

O_FILE(25) TYPE C.

SELECTION-SCREEN END OF BLOCK B1.

*Selection Screen 2

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.

PARAMETERS: CAL_TRA RADIOBUTTON GROUP G1 USER-COMMAND FLAG,

SESSION RADIOBUTTON GROUP G1 DEFAULT 'X'.

SELECTION-SCREEN END OF BLOCK B2.

*Selection Screen 3

SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-003.

PARAMETERS: MODE DEFAULT 'X' MODIF ID BL1,

UPDATE DEFAULT 'X' MODIF ID BL1.

SELECTION-SCREEN END OF BLOCK B3.

*Selection Screen 4

SELECTION-SCREEN BEGIN OF BLOCK B4 WITH FRAME TITLE TEXT-003.

PARAMETERS: SES_NAM TYPE APQI-GROUPID MODIF ID BL2,

KEP_TRAS TYPE C DEFAULT 'X' MODIF ID BL2,

LOC_DATE TYPE SY-DATUM MODIF ID BL2,

USER TYPE SY-UNAME DEFAULT SY-UNAME MODIF ID BL2.

SELECTION-SCREEN END OF BLOCK B4.

************************************************************************

  • At Selection-Screen Output *

************************************************************************

AT SELECTION-SCREEN OUTPUT.

IF CAL_TRA = 'X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'BL1'.

SCREEN-ACTIVE = '1'.

ENDIF.

IF SCREEN-GROUP1 = 'BL2'.

SCREEN-ACTIVE = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

IF SESSION = 'X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'BL1'.

SCREEN-ACTIVE = '0'.

ENDIF.

IF SCREEN-GROUP1 = 'BL2'.

SCREEN-ACTIVE = '1'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

Message was edited by: Naresh Kumar

Message was edited by: Naresh Kumar

Read only

Former Member
0 Likes
1,956

Hi Vinu,

In the at selection-screen output event,

YOu have to use the FM dynp_values_get to dynamically make the date field visible or invisible.

<b>at selection-screen output.

if p_field = <some value>.

loop at screen.

if screen-name = 'P_DATE'.

screen-invisible = 1.

screen-active = 0.

modify screen.

endif.

endloop.

endif. </b>

Regards,

ravi

Read only

Former Member
0 Likes
1,956

Hi,

instead of using parameters use radio buttons

and enable and disable the parameters.

EG:-

PARAMETERS : p_ra1 RADIOBUTTON GROUP rad1

USER-COMMAND radio DEFAULT 'X'.

PARAMETERS : p_rad2 RADIOBUTTON GROUP rad1 .

PARAMETERS : p_rad3 RADIOBUTTON GROUP rad1 .

PARAMETERS : p_sumfl TYPE char255 modif id ABC.

PARAMETERS : p_detfl TYPE char255 modif id ABC.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF p_rad1 = 'X'.

IF screen-group1 = 'ABC'.

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.

Copy paste code u will get an idea how it works

if u want one more another set of group to be activated and deactivated then declare parameter with different MODIF ID and one more if condition in loop at screen

Mark Helpfull Answers

Regards

manoj

Message was edited by: Manoj Gupta

Read only

Former Member
0 Likes
1,956

Hi,

You have to use loop at screen in this case.

PARAMETERS: xxx TYPE char01

You have to give all the input parameters in the screen. and define the date parameter as a separate group using modif id.

AT SELECTION-SCREEN OUTPUT.

if pay-group='5V'.

loop at screen.

if screen-group='G1'.

screen-active = 1.

MODIFY SCREEN.

endif.

endloop.

else.

loop at screen.

if screen-group = 'G1'.

screen-active = 0.

endif.

ENDLOOP.

endif.

Regards,

Aswin

Read only

Manohar2u
Active Contributor
0 Likes
1,956

Vinu,

You need to use AT SELECTION SCREEN OUTPUT event.

In this event code you need activate / deactivate based on the paygroup value.

Use dynproGetvalues fm to read the values of selection screen, then based on condition you have disable / enable the parameters.

Regds

Manohar

Read only

Former Member
0 Likes
1,956

You have to use DYNP_VALUES_READ function module to read the current value of this parameter and then depending on its value you can do the following in AT SELECTION-SCREEN OUTPUT event.


IF paygroup = '5V'.
  LOOP AT SCREEN.
    IF SCREEN-NAME = 'DATE'.
      SCREEN-ACTIVE = 1.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
ELSE.
  LOOP AT SCREEN.
    IF SCREEN-NAME = 'DATE'.
      SCREEN-ACTIVE = 0.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
ENDIF.

Read only

0 Likes
1,956

Thanks a lot folks,

while using the fm 'DYNP_VALUES_READ ' all I know is screen number '1000' it is asking for other parameters, which I do not have a clue, can anyone help me in that ??

Vinu

Read only

0 Likes
1,956

You pass program name to DYNAME parameter.

Read only

0 Likes
1,956

Although, I'm really not sure why you are using it, you can call it like this.



  data: dynfields type table of dynpread with header line.

* Add the field to the table
  dynfields-fieldname = 'P_PAYGRP'.
  append dynfields.

  call function 'DYNP_VALUES_READ'
       exporting
            dyname               = sy-cprog
            dynumb               = sy-dynnr
            translate_to_upper   = 'X'
       tables
            dynpfields           = dynfields
       exceptions
            invalid_abapworkarea = 1
            invalid_dynprofield  = 2
            invalid_dynproname   = 3
            invalid_dynpronummer = 4
            invalid_request      = 5
            no_fielddescription  = 6
            invalid_parameter    = 7
            undefind_error       = 8
            double_conversion    = 9
            stepl_not_found      = 10
            others               = 11.

* You can read this table to get the value from the screen
  read table dynfields with key fieldname = 'P_PAYGRP'.
  p_PAYGRP = dynfields-fieldvalue.

what exactly is the requirement here.

Regards,

Rich HEilman

Read only

0 Likes
1,956

Rich,

The 'Paygroup' parameters option has to display by default on the screen, however when I select the option as '5V' the date object has to be displayed otherwise NO.

Thanks

Vinu

Read only

0 Likes
1,956

Oh, I had it backwards. This is not working for you?



report zrich_0001.


parameters: p_paygrp(2) type c.
parameters: p_datum type sy-datum modif id GR1.


at selection-screen output.

  loop at screen.
    if screen-group1 = 'GR1'.
      if p_paygrp = '5V'.
        screen-active = '1'.
      else.
        screen-active = '0'.
      endif.
      modify screen.
    endif.
  endloop.

Regards,

Rich Heilman

Read only

0 Likes
1,956

Let me explain it clearly,

I need a selection object for the paygroup on the screen hence I used the 'parameters' and it contains three values in it '5A', '5B' and '5V' which represent differetn pay groups.

For <b>paygroup '5V'</b> I need to provide the pay period ending date on the screen, hence I need to use another 'parameters' object to display the date.

That's all.

Vinu

Read only

0 Likes
1,956

Ok, the above code should work well then. Unless you need this to happen when the user does the F4 help. Then you would have to do something else.

Regards,

Rich Heilman

Read only

0 Likes
1,956

Yes, I need that to happen. Because when I run the program only the paygroup 'parameter' option has to display and click on 'F4' from where I select the option '5V' then the pay date selection object has to display.If I select '5A' or '5B' the same screen has to be displayed with no pay period date

I used that peice of code it is not working...

Thanks

Vinu

Read only

0 Likes
1,956

So you need the screen to change automatically when the user selects the value from the F4 help without hitting ENTER, right?

Regards,

Rich Heilman

Read only

0 Likes
1,956

YES Rich.

Read only

0 Likes
1,956

That means that you will have to fire a round trip, but in selection screen processing, I don't think that what you want is possible.

Regards,

Rich Heilman

Read only

0 Likes
1,956

Why don't you throw an error message to enter the date when the paygroup selected is '5V' instead of making it dynamically available on the selection screen?

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,956

Here is a simple program. You enter the value and must hit enter. Is this what you are looking for?



report zrich_0001.


parameters: p_paygrp(2) type c.
parameters: p_datum type sy-datum modif id GR1.


at selection-screen output.

  loop at screen.
    if screen-group1 = 'GR1'.
      if p_paygrp = '5V'.
        screen-active = '0'.
      else.
        screen-active = '1'.
      endif.
      modify screen.
    endif.
  endloop.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,956

Do this way.


  PARAMETERS: paygroup TYPE zpgkis AS LISTBOX VISIBLE LENGTH 30
                     USER-COMMAND entry.
  PARAMETERS: p_date TYPE sy-datum.


  AT SELECTION-SCREEN OUTPUT.

    LOOP AT SCREEN.
      IF screen-name = 'P_DATE'.
        IF paygroup = '5V'.
          screen-active = '1'.
        ELSE.
          screen-active = '0'.
        ENDIF.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.

Read only

0 Likes
1,956

No Srinivas, it did not work, but thanks a lot for everyone for helping out here. I shall reward points accordingly to everyone.

Vinu

Read only

0 Likes
1,956

It worked for me. Can you paste your selection screen and AT SELECTION-SCREEN logic here please?