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

Former Member
0 Likes
1,323

Hi Experts,

my issue is , i have customer number & 2 amount fields which i get from this customer number & i calculate it in other field on selction screen. Everyhing is OK with that. But when i change the customer number am getting the same amount for the previous customer which i swrong. so how to solve it.

Regards,

Sunita

Moderator message: please use more descriptive subject lines from now on.

Edited by: Thomas Zloch on Aug 9, 2010 12:32 PM

1 ACCEPTED SOLUTION
Read only

bbalci
Contributor
0 Likes
1,281

Hi,

Which event u have used to do that?

Can you show us your code?

18 REPLIES 18
Read only

bbalci
Contributor
0 Likes
1,282

Hi,

Which event u have used to do that?

Can you show us your code?

Read only

Former Member
0 Likes
1,281

Hi,

This is my code.

{AT SELECTION-SCREEN OUTPUT.

CONCATENATE ICON_CALCULATION 'Calclulate'

INTO BUTT SEPARATED BY SPACE.

AT SELECTION-SCREEN ON P_RANL.

SELECT SINGLE BZUSAGE FROM VZZKOKO INTO P_H_KOS

WHERE RKEY1 EQ P_RANL.

SELECT SINGLE BUPRC FROM VTBFHAPO INTO P_H_BEL

WHERE RANL EQ P_RANL.

IF SSCRFIELDS-UCOMM = 'CLI1'.

P_KUANT = P_H_KOS / P_H_BEL .

ENDIF.

INITIALIZATION.

GET PARAMETER ID PARA FIELD P_RANL.

}

anymore doughts u let me knw..

regards

sunita

Read only

0 Likes
1,281

Hi Sunita

You should set the parameter P_KUANT with function DYNP_VALUES_UPDATE,

Insert this code at end of the event : AT SELECTION-SCREEN ON P_RANL.

DATA:

t_dynfields TYPE TABLE OF dynpread,

w_dynfields LIKE LINE OF t_dynfields.

w_dynfields-fieldname = 'P_KUANT'.

w_dynfields-fieldvalue = P_KUANT.

APPEND w_dynfields TO t_dynfields.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = lv_dynpprog

dynumb = lv_dynpnr

TABLES

dynpfields = t_dynfields

EXCEPTIONS

OTHERS = 8.

I hope it helps

Read only

Former Member
0 Likes
1,281

Hi

Can u solve this issue?

Read only

0 Likes
1,281

Execute this ... change the value of p1 and hit enter, you will get the solution


PARAMETERS:p1 TYPE i.
PARAMETERS:c1 TYPE i.

at selection-screen output.
  c1 = p1.
AT SELECTION-SCREEN ON p1.
  p1 = p1 + 1.

Read only

Former Member
0 Likes
1,281

Hi keshav,

But with ur code the values of P_ranl will increase by 1. then hw can it be solved?

may be i didnt understand ur logic canu make it clear?

Regards

Sunita

Read only

Former Member
0 Likes
1,281

When u change the customer number the change is not reflected immediately unless u press an enter so use FM DYNP_VALUES_READ to get the current customer number from screen and then do your calculation.

Edited by: Kartik Tarla on Aug 9, 2010 12:44 PM

Read only

Former Member
0 Likes
1,281

Hi,

One more thing that you should take care is that you should either remove GET PARAMETER ID PARA FIELD P_RANL from initialization or check field P_RANL is initial or not before GET PARAMETER ID PARA FIELD P_RANL. Because P_RANL is getting overwritten by parameter id's ('PARA') value again & again.

This will surely help in achieveing the desired results.

Read only

0 Likes
1,281

Hi Experts,

{AT SELECTION-SCREEN OUTPUT.

CONCATENATE ICON_CALCULATION 'Calclulate'

INTO BUTT SEPARATED BY SPACE.

AT SELECTION-SCREEN ON P_RANL.

w_dynfields-fieldname = 'P_RANL'.

w_dynfields-fieldvalue = P_RANL.

APPEND w_dynfields TO t_dynfields.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = SY-CPROG

dynumb = SY-DYNNR

TABLES

dynpfields = t_dynfields

EXCEPTIONS

OTHERS = 8.

READ TABLE t_dynfields INTO w_dynfields INDEX 1.

SELECT SINGLE BZUSAGE FROM VZZKOKO INTO P_H_KOS

WHERE RKEY1 EQ w_dynfields-fieldvalue.

SELECT SINGLE BUPRC FROM VTBFHAPO INTO P_H_BEL

WHERE RANL EQ w_dynfields-fieldvalue.

CLEAR: w_dynfields,t_dynfields.

IF SSCRFIELDS-UCOMM = 'CLI1'.

P_KUANT = P_H_KOS / P_H_BEL .

ENDIF.

*INITIALIZATION.

  • GET PARAMETER ID PARA FIELD P_RANL.

}

its not working . the 1st customer number values appear again wen i change the customer number.

i did debug also it changes the values but while coming to the screen back it puts the old values.

Regards

Sunita

Read only

0 Likes
1,281

Hello Sunita

I said put function to the end of the event : AT SELECTION-SCREEN ON P_RANL.

But it's on upper side in your code.

Just write like that :

AT SELECTION-SCREEN ON P_RANL.

  • 1 - You should first calculate the variable :

READ TABLE t_dynfields INTO w_dynfields INDEX 1.

SELECT SINGLE BZUSAGE FROM VZZKOKO INTO P_H_KOS

WHERE RKEY1 EQ w_dynfields-fieldvalue.

SELECT SINGLE BUPRC FROM VTBFHAPO INTO P_H_BEL

WHERE RANL EQ w_dynfields-fieldvalue.

CLEAR: w_dynfields,t_dynfields.

IF SSCRFIELDS-UCOMM = 'CLI1'.

P_KUANT = P_H_KOS / P_H_BEL .

ENDIF.

  • 2 - Than set the value of this variable on the screen :

  • Set your variable P_KUANT or P_RANL whatever it's name

w_dynfields-fieldname = 'P_RANL'.

w_dynfields-fieldvalue = P_RANL.

APPEND w_dynfields TO t_dynfields.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = SY-CPROG

dynumb = SY-DYNNR

TABLES

dynpfields = t_dynfields

EXCEPTIONS

OTHERS = 8.

Edited by: Bulent Balci on Aug 9, 2010 12:25 PM

Read only

0 Likes
1,281

Hi Keshav,

I did exactly wat u said but its not working

Hi buleten,

i have tried ur way also..its not working,

Hi seshu,

i put my code above plz check...just fed up with this small issue...head-ache . plz understand.

Regards,

Sunita.

Read only

0 Likes
1,281

Did u try and use the FM DYNP_VALUES_READ.

Use it before u do the calculations.

It will pick up teh most current value from the screen and do calculations accordingly

Read only

0 Likes
1,281
w_dynfields-fieldname = 'P_RANL'.
APPEND w_dynfields TO t_dynfields.


CALL FUNCTION 'DYNP_VALUES_READ' "It will read screen values DYNP_VALUES_UPDATE updates the screen back so u dont need it
EXPORTING
dyname = SY-CPROG
dynumb = SY-DYNNR
TABLES
dynpfields = t_dynfields
EXCEPTIONS
OTHERS = 8.

READ TABLE t_dynfields INTO w_dynfields INDEX 1.
SELECT SINGLE BZUSAGE FROM VZZKOKO INTO P_H_KOS
WHERE RKEY1 EQ w_dynfields-fieldvalue.

SELECT SINGLE BUPRC FROM VTBFHAPO INTO P_H_BEL
WHERE RANL EQ w_dynfields-fieldvalue.

Use it like this

Read only

0 Likes
1,281

Hi Sunita

Just use this code,

I hope it ends your headache

REPORT ztest1.

PARAMETERS : p_ranl LIKE vzzkoko-rkey1,


       p_h_kos LIKE vzzkoko-bzusage,
       p_h_bel LIKE vtbfhapo-buprc.

DATA :
      dynpfields LIKE STANDARD TABLE OF dynpread WITH HEADER LINE.


DATA p_ranl_value LIKE p_ranl.


AT SELECTION-SCREEN ON p_ranl.

* --1-- Get the value of parameter : P_RANL

  dynpfields-fieldname = 'P_RANL'.
  APPEND dynpfields.

  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname               = sy-cprog
      dynumb               = sy-dynnr
    TABLES
      dynpfields           = dynpfields
    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.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
         WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  READ TABLE dynpfields WITH KEY fieldname = 'P_RANL'.
  CHECK sy-subrc EQ 0.
  p_ranl_value = dynpfields-fieldvalue.

* --2-- Read amount values belong to this value :

  SELECT SINGLE bzusage
  FROM vzzkoko
  INTO p_h_kos
  WHERE rkey1 EQ p_ranl.

  SELECT SINGLE buprc
  FROM vtbfhapo
  INTO p_h_bel
  WHERE ranl EQ p_ranl.

* --3-- Update values on screen :

  CLEAR : dynpfields,  dynpfields[].

  dynpfields-fieldname = 'P_H_BEL'.
  dynpfields-fieldvalue = p_h_bel.
  APPEND dynpfields.

  dynpfields-fieldname = 'P_H_KOS'.
  dynpfields-fieldvalue = p_h_bel.
  APPEND dynpfields.

  CALL FUNCTION 'DYNP_VALUES_UPDATE'
    EXPORTING
      dyname               = sy-cprog
      dynumb               = sy-dynnr
    TABLES
      dynpfields           = dynpfields
    EXCEPTIONS
      invalid_abapworkarea = 1
      invalid_dynprofield  = 2
      invalid_dynproname   = 3
      invalid_dynpronummer = 4
      invalid_request      = 5
      no_fielddescription  = 6
      undefind_error       = 7
      OTHERS               = 8.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

Edited by: Bulent Balci on Aug 9, 2010 1:14 PM

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,281

I hope you've written the code for automatic population of the amount fields in the correct events.

Q: Why the amount fields are not getting populated ?

Ans: The PBO event which should be triggered (in this case it is AT SELECTION-SCREEN OUTPUT) is not getting triggered. Merely changing the value in the screen field does not trigger the PBO. Hence the data is not getting updated automatically.

How to solve this ?

Ans: Hit an "enter" after changing the value, your values should be updated.

BR,

Suhas

Read only

Former Member
0 Likes
1,281

Hi suhas,

of course i press enter thn also its not updating..

Regards

Sunita.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,281

>

> of course i press enter thn also its not updating.

Which SELECTION-SCREEN event you've written the code ? FYI tt should be in AT SELECTION-SCREEN OUTPUT.

Can you post the code ?

BR,

Suhas

Read only

0 Likes
1,281

AT SELECTION-SCREEN OUTPUT.
IF SSCRFIELDS-UCOMM = 'CLI1'.  "Paste this here
P_KUANT = P_H_KOS / P_H_BEL .
ENDIF.

CONCATENATE ICON_CALCULATION 'Calclulate'
INTO BUTT SEPARATED BY SPACE.

AT SELECTION-SCREEN ON P_RANL.
SELECT SINGLE BZUSAGE FROM VZZKOKO INTO P_H_KOS
WHERE RKEY1 EQ P_RANL.
clear p_h_bel . "<--
SELECT SINGLE BUPRC FROM VTBFHAPO INTO P_H_BEL
WHERE RANL EQ P_RANL.

INITIALIZATION.

GET PARAMETER ID PARA FIELD P_RANL.