Application Development 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: 

Multiplying the values of two fields and populate in the third field

Former Member
0 Kudos

Hi,

I need to Multiplying the values of two fields and populate in the third field,my requirement is to multiply a amount with a currency field and populate it in a value field,so can any body please suggest me a code that can help my work.

Thanks nd Regards

Subhashish Banerjee

3 REPLIES 3

Former Member
0 Kudos

Hi,

Try the code below :


"Assuming u have already have the data into two fields and 
"need to populate the calculate for the third field.

loop at itab.

itab-f3 = itab-f1 * itab-f2.
modify itab.
clear itab.

endloop.

Thanks,

Sriram POnna.

Former Member
0 Kudos

hi,

Refer the code below:

LOOP AT it_basic INTO wa_basic.
    READ TABLE it_vbbe INTO wa_vbbe WITH KEY matnr = wa_basic-matnr
                                             werks = wa_basic-werks.
    IF sy-subrc = 0.
      wa_basic-vbtyp = wa_vbbe-vbtyp.
    ENDIF.

    READ TABLE it_val INTO wa_val WITH KEY matnr = wa_basic-matnr
                                              bwkey = wa_basic-werks
                                              vprsv = 'S'.
    IF sy-subrc = 0.
      wa_basic-stprs = wa_val-stprs.
    ELSE.
      READ TABLE it_val INTO wa_val WITH KEY matnr = wa_basic-matnr
                                                bwkey = wa_basic-werks
                                                vprsv = 'V'.
      IF sy-subrc = 0.
        wa_basic-stprs = wa_val-VERPR.
      ENDIF.
    ENDIF.

    *wa_basic-salk3 = wa_basic-stprs * wa_basic-labst.*

    MODIFY it_basic FROM wa_basic TRANSPORTING vbtyp stprs salk3.
    CLEAR wa_basic.
  ENDLOOP.

Former Member
0 Kudos

Hi,

You can try this way.

DATA: amt type dec ,
          crry type curr,
          value type dec .

COMPUTE value = amt * crry.

this will help you.

Plz reward if useful.

Thanks,

Dhanashri.