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

calculation

Former Member
0 Likes
1,003

hi,

i have 2 field on screen. 1 is percentage & 2nd is value.

now on on basis of % i want to calculate a value & show it in a particular field.

how to write in PAI.

regards

raj

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
981

anvesha,

thru break-point only i come to know that particular this statement is not working.

and i found that table of dynpread FIELDVALUE is char 255.

and my field value is numeric. do you think because of type mismatch it is not working.

thanks

raj

9 REPLIES 9
Read only

anversha_s
Active Contributor
0 Likes
981

hi,

<b>in PAI.</b>

val_per = screen_field_percenage.

val_value = (number * val_per)/100.


  DATA: BEGIN OF dynprofelder OCCURS 10.
          INCLUDE STRUCTURE dynpread.
  DATA: END OF dynprofelder.


  REFRESH dynprofelder.

  dynprofelder-fieldname = 'WF_FIELD_VALEU_SCREEN'. "screen field name
  dynprofelder-fieldvalue = val_value .
  APPEND dynprofelder.




    call function 'DYNP_VALUES_UPDATE'
      exporting
        dyname               = sy-cprog
        dynumb               = sy-dynnr
      tables
        dynpfields           = dynprofelder
      exceptions
        invalid_abapworkarea = 1
        invalid_dynprofield  = 2
        invalid_dynproname   = 3
        invalid_dynpronummer = 4
        invalid_request      = 5
        no_fielddescription  = 6
        undefind_error       = 7
        others               = 8.

rgds

Anver

<b><i>if hlped pls mark points</i></b>

Read only

Former Member
0 Likes
981

in PAI.

per = screen_field_percenage.

value = (number * per)/100.

DATA: BEGIN OF dynprofelder OCCURS 10.

INCLUDE STRUCTURE dynpread.

DATA: END OF dynprofelder.

REFRESH dynprofelder.

dynprofelder-fieldname = 'WF_FIELD_VALEU_SCREEN'. "screen field name

dynprofelder-fieldvalue = val_value .

APPEND dynprofelder.

call function 'DYNP_VALUES_UPDATE'

exporting

dyname = sy-cprog

dynumb = sy-dynnr

tables

dynpfields = dynprofelder

exceptions

invalid_abapworkarea = 1

invalid_dynprofield = 2

invalid_dynproname = 3

invalid_dynpronummer = 4

invalid_request = 5

no_fielddescription = 6

undefind_error = 7

others = 8.

Read only

0 Likes
981

good copy paste ramesh

Read only

Former Member
0 Likes
981

thanks anvesha,

i did as per your instructions it is working good.

but this statement is not working.

<b> dynprofelder-fieldvalue = val_value .</b>

it is not assigning val_value to dynprofelder-fieldvalue. (val_value = 1200.00)

please help.

regards

raj

Read only

0 Likes
981

try this.

data: dynfields type table of dynpread with header line.
 
  REFRESH dynfields.
  dynfields-fieldname = 'WF_FIELD_VALEU_SCREEN'. "screen field name
  dynfields-fieldvalue =  val_value .
  append dynfields.
 
 
    call function 'DYNP_VALUES_UPDATE'
      exporting
        dyname               = sy-cprog
        dynumb               = sy-dynnr
      tables
        dynpfields           = dynfields
      exceptions
        invalid_abapworkarea = 1
        invalid_dynprofield  = 2
        invalid_dynproname   = 3
        invalid_dynpronummer = 4
        invalid_request      = 5
        no_fielddescription  = 6
        undefind_error       = 7
        others               = 8.

rgds

anver

Read only

Former Member
0 Likes
981

no anversha same problem

dynfields-fieldvalue = XBDC.

xbdc = 1200.00

it is not assigning to dynfields-fieldvalue .

thanks & regards

raj

Read only

0 Likes
981

hi,

put a break point after the FM dynp_values_update.

i think the getting refreshed some where.

put a break point and try.

rgds

Anver

Read only

Former Member
0 Likes
982

anvesha,

thru break-point only i come to know that particular this statement is not working.

and i found that table of dynpread FIELDVALUE is char 255.

and my field value is numeric. do you think because of type mismatch it is not working.

thanks

raj

Read only

0 Likes
981

hi,

if so convert the numeric to char and try.

eg:

  • Converting type n to type c

DATA: int_val(4) TYPE N.
          ch_val(4).

MOVE: int_val TO ch_val.

rgds

Anver