cancel
Showing results for 
Search instead for 
Did you mean: 

Unit Price Calculation on Smartform

Former Member
0 Kudos

Hi Friends,

I am in a need to calculate and print unit price in Smartform, I am not supposed to make any changes in Driver Program. Here, the fields FKIMG(total quantity) and NETWR(Total amount) are selected from table VBRP and stored in an internal table itab. now this itab is passed to smartform tables interface. So my itab only have 2 fields FKIMG and NETWR. I need to calculate Unit Price = NETWR / FKIMG.

The out put required is like this,

Total Qty Unit Price Amount

20 100 2000

05 300 1500

08 200 1600

How to do this in smartform--- please help me.

Regards,

Ajoy

Accepted Solutions (1)

Accepted Solutions (1)

varma_narayana
Active Contributor
0 Kudos

Hi Ajoy..

In case of SMARTFORMS we can add the Logic using PROGRAM LINES Node.

Steps:

1. Create a <b>variable</b> in the Global data Tab in Global Definitions of Smartform.

Eg: V_UNITPR TYPE VBRP-NETWR

2. Create a <b>Program lines</b> node above the Text node where the Unit price has to be displayed.

Input Parameters: VBRP-NETWR and VBRP-FKIMG

Output Parameters: V_UNITPR.

Code:

V_UNITPR = VBRP-NETWR / VBRP-FKIMG.

3. Check the Program lines node and Display the Field V_UNITPR.

<b>Reward if Helpful.</b>

Former Member
0 Kudos

Sorry Friends, I forgot to tell one thing. Smartform is not permitting me to create any Program Lines within Table( not after Header or before any Text of Table ). It only permitting LOOP withinn a Table. Though, I can create Program Lines Before or After the table. But that does not make sense when I have more than one records in Internal Table Itab. I need to calculate the unit price within Table and write it in the Main area of the Table. Please, help me.

Regards,

Ajoy

varma_narayana
Active Contributor
0 Kudos

Hi Ajoy...

We can create the PROGRAM LINES under the CELL or TEXT Node inside a table . It is definitely possible. Try it.

You cannot create under the Table or Table Line.

reward if Helpful.

Former Member
0 Kudos

Hi Infy Tree,

Thank u very much. It solved the problem. U have your 10 points.

Thanks & Regards,

Ajoy

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Create PROGRAM LINES in the Smartform and write little piece of code to calculate the Total amount using this ITAB data Unit Price and Qty

and you can print that in smartform straight away.

This is the extra benefit(writing our own code) of the smartforms over scripts

so do like that

Regards

Anji