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 in internal table values

Former Member
0 Likes
1,012

I have brought the output of a field in the alv output which is Konv_kbetr for condition type (kschl) of ZCH, whose value appears as 250 instead 25. Konv table value also shows this as 250. I want to do 250/10.

For bring the value of 250 in the output, i have used select statement, created internal table , Loop statement created and modified the internal table etc. I  am now struck to proceed further for doing this calculation 250/10.

please guide as i am very new to this abap.

1 ACCEPTED SOLUTION
Read only

satyabrata_sahoo3
Contributor
0 Likes
888

You want to display 250 or 25 in output?

Can you post ur code here, so that we can check where you facing issue.

5 REPLIES 5
Read only

Former Member
0 Likes
888

Hi Pooja,

10 is fixed or you are calculating unit price? If latter, you should use konv-kbetr/konv-kpein before appending the value to internal table.

Chloe

Read only

satyabrata_sahoo3
Contributor
0 Likes
889

You want to display 250 or 25 in output?

Can you post ur code here, so that we can check where you facing issue.

Read only

0 Likes
888

wanted 25 in the output. My code as follows :

SELECT

        KONV~KNUMV

        konv~kposn

        konv~kschl

        konv~kbetr as kbetr2

    into  CORRESPONDING FIELDS OF TABLE it_display3 from konv

     for ALL ENTRIES IN it_display where

               konv~knumv = it_display-knumv AND

               konv~kschl = 'ZCAS'.

     LOOP AT it_display.

      READ TABLE it_display3 WITH KEY knumv = it_display-knumv .

     IF sy-subrc = 0.

       it_display-kbetr2 = it_display3-kbetr2.

       MODIFY it_display.

     ENDIF.

     ENDLOOP.

Read only

0 Likes
888

hi,

SELECT

        KONV~KNUMV

        konv~kposn

        konv~kschl

        konv~kbetr as kbetr2

into  CORRESPONDING FIELDS OF TABLE it_display3 from konv

for ALL ENTRIES IN it_display where

               konv~knumv = it_display-knumv AND

               konv~kschl = 'ZCAS'.

LOOP AT it_display.

READ TABLE it_display3 WITH KEY knumv = it_display-knumv . ( You also need to match the KPOSN )

IF sy-subrc = 0.

       it_display-kbetr2 = ( it_display3-kbetr2 / 10 ).

MODIFY it_display.

ENDIF.

ENDLOOP.

Regards,

Rahul Singh

Read only

0 Likes
888

Hi Pooja,

In the loop you can have :

it_display-kbetr2 = it_display3-kbetr2 / 10.

So your code becomes:

SELECT

        KONV~KNUMV

        konv~kposn

        konv~kschl

        konv~kbetr as kbetr2

    into  CORRESPONDING FIELDS OF TABLE it_display3 from konv

     for ALL ENTRIES IN it_display where

               konv~knumv = it_display-knumv AND

               konv~kschl = 'ZCAS'.

     LOOP AT it_display.

      READ TABLE it_display3 WITH KEY knumv = it_display-knumv .

     IF sy-subrc = 0.

       it_display-kbetr2 = it_display3-kbetr2 / 10.

       MODIFY it_display.

     ENDIF.

     ENDLOOP.

Regards,

Sonal