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

selection-screen programming

Former Member
0 Likes
1,663

Hi all,

At selection-screen level, i've to pass 2 parameters i.e. bukrs and payroll area of both having single value (No range required)

And I've a ztable of containing values of these company code and payroll area fields.....

Validations given at selection-screen level is such that bukrs is to be selected (obligatory) and then for parameter p_payroll, it should be greyed out and defaulted to value 'xx' from the given ztable based on company code selection.

For the first selection field, p_bukrs, i done with that i.e. fetching data from ztable using f4 option...

pls provide logic to handle second selection field with the validations mentioned above...

TIA

Regards

Tham

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,622

Try this.

At Selection-screen on p_bukrs.

select value from <ztable> into p_payroll

where bukrs = p_bukrs.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF screen-name = 'P_PAYROLL'

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Regards

Vinod

13 REPLIES 13
Read only

Former Member
0 Likes
1,622

Hi....

you must use this:


AT SELECTION-SCREEN OUTPUT.
  IF p_payroll IS INITIAL.
       SELECT PAYROLL FROM TABLE INTO P_PAYROLL
  ENDIF.

best regards

Marco

Edited by: Menegazzo Marco on Mar 31, 2010 12:06 PM

Read only

Former Member
0 Likes
1,623

Try this.

At Selection-screen on p_bukrs.

select value from <ztable> into p_payroll

where bukrs = p_bukrs.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF screen-name = 'P_PAYROLL'

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Regards

Vinod

Read only

0 Likes
1,622

Hi Vinod,

I tried in the similar way but doesn't works out, as data is not fetching to p_payroll from the ztable.....

Also, my exact requirement is as we fill p_bukrs in the selection-screen and press enter, the corresponding value for p_payroll from ztable shud appear in the screen in greyed out, hope you understand.....

Do we need to handle screen attributes at screen painter level, i guess...?

TIA

Regards,

Tham

Read only

0 Likes
1,622

I have simulated the Scenario mentioned by you, and the same code worked for me.. Check whether data exist for the company code you are entering. is the p_payroll parameter getting grayed out after you press enter key?

Regards

Vinod

Read only

0 Likes
1,622

Hi Gautham,

data : sval type standard table of sval with header line.
parameters : bukrs type bukrs,
    pay_roll type "your pay roll type
data : first. " and in start-of-selection clear this variable I controlled it by declaring it in TOP Include
at selection-screen output.
data : str type string.

  if first = 'X'. " You need to provide this otherwise whenever you come back again this is triggered
    sval-tabname = 'T001'.
    sval-fieldname = 'BUKRS'.
    sval-field_obl = 'X'.
    append sval.
    perform popup_plant.
    select single payroll from your table 
      where bukrs = p_bukrs.
    if sy-subrc ne  0.
      concatenate 'Company Code' p_bukrs 'Does not exist'
      'Check your Entry' into str separated by space.
      message str type 'W'.
      perform popup_plant.
    endif.
    if p_bukrs is not initial
      loop at screen.
        if screen-name = '%_P_REM_%_APP_%-TEXT'   or " Get it from Screen Painter of selection Screen
           screen-name = 'P_'  " Your Payroll Parameter
          screen-active = 0.
          modify screen.
        endif.
      endloop.
    endif.  " Make Minor Modification if required to suit your requirements since it is not tested for your scenario
  endif.
form popup_plant.
  call function 'POPUP_GET_VALUES'
    exporting
     no_value_check        = ' '
      popup_title           = 'Please Enter Plant'
* IMPORTING
*   RETURNCODE            = RETURNCODE
    tables
      fields                = sval
   exceptions
     error_in_fields       = 1
     others                = 2
            .
  if sy-subrc = 0.
    read table sval index 1.
    if sy-subrc = 0.
      move sval-value to p_bukrs.
    endif.
  endif.
endform.

Cheerz

Ram

Read only

0 Likes
1,622

Hello

It is an example with table T001. For your Z-table you must replace T001 by your table (and fields accordingly).


parameters: p_bukrs type t001-bukrs.
parameters: p_land1 type t001-land1.

DATA : fmap TYPE TABLE OF dselc WITH HEADER LINE.
DATA : itab TYPE TABLE OF t001 WITH HEADER LINE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bukrs.
  SELECT * FROM t001 INTO TABLE itab.
  fmap-fldname = 'BUKRS'.
  fmap-dyfldname = 'P_BUKRS'.
  APPEND fmap.
  fmap-fldname = 'LAND1'.
  fmap-dyfldname = 'P_LAND1'.
  APPEND fmap.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
     ddic_structure         = 'T001'
     retfield               = 'BUKRS'
     dynpprog               = sy-repid
     dynpnr                 = sy-dynnr
     DYNPROFIELD            = 'P_BUKRS'
     value_org              = 'S'
    TABLES
     value_tab              = itab
     dynpfld_mapping        = fmap.

AT SELECTION-SCREEN OUTPUT.
IF NOT P_LAND1 IS INITIAL.
LOOP AT SCREEN.
IF screen-name = 'P_LAND1'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.

Read only

0 Likes
1,622

Hi

In my requirement, given selection-screen fields u2018bukrsu2019 u2018abkrsu2019 are referred to tables u2018t001u2019 u2018pa0001u2019 respectively

Here, weu2019re having a ztable of fields u2018abkrsu2019 u2018bukrsu2019 in which u2018abkrsu2019 (payroll) is key field

Coming to selection-screen conditions/validations, p_bukrs should be fetched from ztable using f4 option and coming to 2nd field, p_abkrs u2013 it should be fetched from the same ztable (corresponding value to selected p_bukrs) also the field should be greyed out.

I tried the logics given by Ramchander and Dzed, it works fine except the greyed out condition, which is very important in my scenario.

Please provide your valuable inputsu2026.

TIA

Regards

Tham

Read only

0 Likes
1,622

hello gautham,

I took , the same code that dzed gives to you and i change it a little bit according to your scenario


PARAMETERS: p_bukrs TYPE t001-bukrs.
PARAMETERS: p_land1 TYPE t001-land1.

DATA : fmap TYPE TABLE OF dselc WITH HEADER LINE.
DATA : itab TYPE TABLE OF t001 WITH HEADER LINE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bukrs.
  SELECT * FROM t001 INTO TABLE itab.
  fmap-fldname = 'BUKRS'.
  fmap-dyfldname = 'P_BUKRS'.
  APPEND fmap.
  fmap-fldname = 'LAND1'.
  fmap-dyfldname = 'P_LAND1'.
  APPEND fmap.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      ddic_structure  = 'T001'
      retfield        = 'BUKRS'
      dynpprog        = sy-repid
      dynpnr          = sy-dynnr
      dynprofield     = 'P_BUKRS'
      value_org       = 'S'
    TABLES
      value_tab       = itab
      dynpfld_mapping = fmap.

  LOOP AT SCREEN.
    IF screen-name = 'P_LAND1'.
      screen-input = 0.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

AT SELECTION-SCREEN OUTPUT.
  DATA: l_land1 LIKE dynpread-fieldvalue.

  IF p_bukrs IS NOT INITIAL.
    SELECT SINGLE land1
      INTO l_land1
      FROM t001
      WHERE bukrs EQ p_bukrs.

    CHECK sy-subrc EQ 0.

    p_land1 = l_land1.

    LOOP AT SCREEN.
      IF screen-name = 'P_LAND1'.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

I hope it helps,

Regards, SebastiĆ”

Read only

0 Likes
1,622

Hi Sebastian,

I tried the same way as given by you, but displayin the same result i.e field 'p_payroll' is not being greyed out in the selection-screen, so that user may have the option of editing the field, which is not matches to the requirement.

As the logic given by Ramchander, screen element list (at screen painter level) needs to be handle, i guess, but unfortunately it doesn't works out even !!

Any possible inputs pls....

Read only

0 Likes
1,622

Change the below code.

LOOP AT SCREEN.

IF screen-name = 'P_PAYROLL'. " Changed from P_LAND1 to P_PAYROLL.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Regards

Vinod

Read only

0 Likes
1,622

hello Gautham,

I developed that last code in a "Y" program (as local object) and worked without problems, at f4 and typing a bukrs code and pressing enter.

regards, sebastiĆ”

Read only

Former Member
0 Likes
1,622

At Selection-screen on p_bukrs.

select single payroll from <ztable> into p_payroll

where bukrs = p_bukrs.

AT SELECTION-SCREEN OUTPUT.

If p_payroll is not initial.

LOOP AT SCREEN.

IF screen-name = 'P_PAYROLL'

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Endif.

regards

Prajwal K.

Read only

Former Member
0 Likes
1,622

Hi Gautham,

Please make the second Parameter as Display only , so that user will be mandatory to fill the P_BUKRS either manuall or through F4 selection.

in the at selection-screen output , write the below source Code to fill Payroll area from your ZTABLE based on the input P_BUKRS.

select Single payroll_area into P_PAYROLL where BUKRS eq P_BUKRS.