cancel
Showing results for 
Search instead for 
Did you mean: 

printing quanity/price fields in smart forms

Former Member
0 Kudos

yes i have seen few threads on this subject line.... my question is

though i can read english, but could not understand what they mean here.....

http://help.sap.com/saphelp_nw70/helpdata/en/0b/5da4e42cf511d5b692006094192fe3/content.htm

have solved the problem by using program lines, changing the qty and prices into character variable and printing it.

still i would like to know ... what SAP intented to say by this..............

http://help.sap.com/saphelp_nw70/helpdata/en/0b/5da4e42cf511d5b692006094192fe3/content.htm

if possible can some one help me understand it.

thanks

sai

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member

hi

Its a general rule that whenever a CURR/QUAN type is used/declared it has to referenced to a REFERENCE FIELD

u can see this in the SMARTFORMS --GLOBAL INTERFACE -- CURRENCY/QUAN field Tab. and also inany DDIC tables/structure su have the same TAB ..

In smartforms if u donot declare u wil get an error/warning message "NETWR is not REFERENCED ....." so this field has included in the currency tab...

surya

Former Member
0 Kudos

Hi Surya,

thanks, i try to do the same, to what i have done for any custom table or structure when we define prince and quanity,

so it did not work for me here at def tabe in smart form

i am printing MENGE, NETPR on to a smartform,

In Print program or driver program:

i select MENGE,NETPR from EKPO table and putinto internal table IT_EKPO

pass the IT_EKPO to tables tab of smartform interface,

now tell me what do i define in the global definitions and quan/curry tab of smart form.

thats the problem for me

Former Member
0 Kudos

Hi

Can u let Us know the Exact problem that u r Facing the error ... then we can guide u accordingly.

Regarding Passing of Table to Smartform

Pass the Internal Table in the Tables Tab IT_EKKO LIKE EKKO. and declare Lv_menge and lv_netwr in Curr/Quan tab

surya

Former Member
0 Kudos

Hi,

Declare variables in global definition of smart form:

v_netwr type char20

v_menge type char20

Pass these variables wherever you want to print Quantity & Price fields.

I have done the same thing and its working fine.

I hope it helps solve your problem.

Regards,

Radhika

Sandra_Rossi
Active Contributor
0 Kudos

As recommended by SAP, you DON'T NEED TO DEFINE DUMMY CHARACTER FIELDS for displaying amounts and quantities. This is important to make a reference to currency code and unit of measure, because there is a different number of decimals (USD = 2 decimals, JPY = 0 decimals, etc.), see examples below.

Let assume IT_EKPO is defined by type EKPO.

In reference units/currencies tab of the global definitions, indicate the reference currency code and units of measure.

For IT_EKPO-MENGE, use for example IT_EKPO-MEINS as unit of measure

For each line of IT_EKPO, fill IT_EKPO-MEINS with the right unit of measure (I mean just select record from EKPO table unchanged).

What you'll get if IT_EKPO-MENGE is 10,000:

If IT_EKPO-MEINS = "UN", it will be printed "10" (without decimals)

If IT_EKPO-MEINS = "KG", it will be printed "10,000" (with 3 decimals)

For IT_EKPO-NETPR, use for example G_WAERS as currency code, and define G_WAERS as global variable based on type WAERS.

Each time you print IT_EKPO-NETPR, fill G_WAERS with the right currency code.

What you'll get if IT_EKPO-NETPR is 10,00 (internal value):

If G_WAERS = "USD", it will be printed "10.00" (10 with 2 decimals)

If G_WAERS = "JPY", it will be printed "1,000" (1000 with 0 decimal)

You may be surprised by JPY result (10 with 2 decimals is considered 1000 JPY) but this is exactly how SAP works and for a very good reason. If you want to know why, please post the question in another thread (in ABAP language forum).

Former Member
0 Kudos

miss radhika,

thaks for the reply, if u see my posting, this is what i have done, after checking through internet, not only did i declare it as char13, but also condensed it, in program lines, so that i can print the quan/curr in the same line. if we dnot condense, they wil print in second line ( my case)..

but the question is what sap wanted to say about displaying quan/curr field in this url as in my posting.. is my doubt....

cheers thanks

Former Member
0 Kudos

Hi surya,

there are three fields in curr/quan fields tab in smart form global definition,

1. field name, 2 reference field, 3 data type.

so you are telling me to type in lv_menge in 1 . so what should i put in 2.

last time i tried also options and failed, so i thought, would ask some one and do the correct way.............

passing IT_EKPO to tables tab in smartform

declared as below in tables tab of forminterace

IT_EKPO like ZPOSTRUCT

ZPOSTRUCT is a structure with EBELN,EBELP,MATNR,MENGE,NETPR.

in global definitions/global data i have declared as below

WA_EKPO like ZPOSTRUCT

LV_MENGE type ekpo-menge

LV_menge type ekpo-netpr

in curr/quan field

fieldname ref field datatype

lv_menge ??? QUAN

lv_netpr ?? curr

what to give in ??? is my dobut.....

thans again

Former Member
0 Kudos

sandra

thanks for the reply, yoru reply is good, but not able to digest, see my latest posting, where i have given complete scenarios of my problem... see if u can guide me with that.. what to input in ref field and etc....

i am also using a structure having ebeln, ebelp, matnr, netpr and menge in it.

wa_ekpo like ZPSOSTRUCT in global data of global definition... bcz i am using IT_EKPO into WA_EKPO at the table to print the values as &wa_ekpo-NETPR&, &wa_ekpo-menge&

inbtw i am re-reading ur posting, to see if i can catch the point of what ur trying to tel me....

Former Member
0 Kudos

my driver program and structure, incase if havent define meins, netwr in it and causing problem?

Driver program:

data : v1 like ekpo-ebeln.

select-options : S_ebeln for v1.

data : w_name type rs38l_FNAM.

data : begin of wa_ekpo,

ebeln like ekpo-ebeln,

ebelp like ekpo-ebelp,

matnr like ekpo-matnr,

menge like ekpo-menge,

netpr like ekpo-netpr,

end of wa_ekpo.

data IT_ekpo like table of wa_ekpo.

select ebeln ebelp matnr menge netpr from EKPO into table IT_ekpo where ebeln in s_ebeln.

call function module SSF_function_module_name

call the imported function module....

any typo erorrs just igorne as the program has been tested and working fine...

Def of structure

ZPOSTRUCT

components in it

EBELN

EBELP

MATNR

MENGE

NETPR

Sandra_Rossi
Active Contributor
0 Kudos

What you don't understand is that SAP can't invent which currency code it is, and which unit of measure it is. For example, amount 10.00 is in USD or in JPY? (see explanation at the end of my post). You can't just refer to a field. You must refer to a variable which contain the right currency code: you must program that from scratch.

So, you MUST add 2 new fields in ZPOSTRUCT: MEINS and WAERS for example. And you must fill them in your calling program.

I corrected my previous answer with bold font hereafter:

For IT_EKPO-NETPR, define IT_EKPO-WAERS as currency code.

For each line of IT_EKPO, fill IT_EKPO-WAERS with the right currency code (I mean just select record from EKKO table, WAERS field, unchanged).

What you'll get if IT_EKPO-NETPR is 10.00 (internal value):

If IT_EKPO-WAERS = "USD", it will be printed "10.00" (10 with 2 decimals)

If IT_EKPO-WAERS = "JPY", it will be printed "1,000" (1000 with 0 decimal)

Note: for JPY currency, here is why internal number 10.00 with 2 decimals is considered 1000 JPY. This is because SAP uses a floating decimal point according to currencies so that to always have the same significant number of digits. For example, let say an amount field is defined like 999.99 (3 bytes, 2 decimals). It may contain price from -999.99 USD to +999.99 USD (as USD currency code is defined with 2 decimals). JPY is defined with 0 decimal (table TCURX), so SAP considers it can contain from -99999 JPY to +99999 JPY. This is because, numerically speaking, prices are much higher in JPY than in USD (a DELL inspiron 15 computer will cost 399 USD and 59980 JPY).

Edited by: Sandra Rossi on Dec 1, 2009 2:36 PM:

"the right unit of measure (I mean" replaced with "the right currency code (I mean"

Sandra_Rossi
Active Contributor
0 Kudos

Hi SAI, I guess you found a solution. Could you give us a feedback? (how did you solve?)

Former Member
0 Kudos

fieldname               ref field          datatype

lv_menge                ???               QUAN

lv_netpr                   ??                curr

You can leave this ref field as blank.

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi.

In the global data tab of global definitions of smartform, declare 2 variables like

V_NETPR type EKPO-NETPR

V_MENGE type EKPO-MENGE

Now you are passing the internal table it_ekpo from the driver program to the table that u have created in smartform.

In the cells in which you want to display these 2 fields, you have to add a program line. ( right click on cell -> create -> flow logic -> program lines.

in the program line pass the value from the work area to the variable we declared

V_MENGE = WA_ekpo-MENGE.

write wa_ekpo-menge in input parameters and v_menge in output parameters

similarly in the cell of netpr, create a program line and pass the value.

V_NETPR = WA_ekpo-NETPR.

write wa_ekpo-netpr in input parameters and v_netpr in output parameters

now u can use these 2 variables in the table to display the data.

Please close the thread if it is answered.

Former Member
0 Kudos

Hi makan

thanks for the reply, this was i done at the first time, it did not work, so found out frm sap that have to give ref fields for quan/curr, that why i posed this thread,

anyways, i again, what you said, and when i run the print program (se38) the status in red colur in se38 is as below(after i click print preview)

" Reference field WA_EKPO-MENGE unknow in form.

Sandra_Rossi
Active Contributor
0 Kudos

First, welcome to SCN

>

> have solved the problem by using program lines, changing the qty and prices into character variable and printing it.

>

What problem did you have?

What SAP explains here is that a variable containing a quantity or an amount must refer to a variable containing (respectively) a unit of measure code (KG, etc.) or a currency code (USD, EUR, etc.) This is a general rule in SAP (data dictionary, ABAP statements, etc.), and the different solutions. You don't need to convert your number to character to print it.

Former Member
0 Kudos

Dear sandra,

thanks for the reply, my problem is

i am printing MENGE, NETPR on to a smartform,

In Print program or driver program:

i select MENGE,NETPR from EKPO table and putinto internal table IT_EKPO

pass the IT_EKPO to tables tab of smartform interface,

now tell me what do i define in the global definitions and quan/curry tab of smart form.

thats the problem for me