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

Module Pool Error: Calculation Field is too Small.

Former Member
0 Likes
4,667

Hi all,

I am making a module pool program in which I have to capture the gross weight and tare weight.

I am importing the weight from the weigh bridge and the Importing medium is .net.

I have made an internal table with two fields.

cl_gui_frontend_services=>clipboard_import(

      IMPORTING

        data                = it_weight

      EXCEPTIONS

        cntl_error          = 1

        error_no_gui        = 2

        not_supported_by_gui = 3

        ).

      LOOP AT it_weight INTO wa_weight.

        ST_REF-GROSS_WEIGHT = wa_weight-in.

        ST_REF-TRUCK_WEIGHT = wa_weight-out.

      ENDLOOP.


Both the fields are of type P.


But I am getting this error.

Calculation Field is too Small.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,101

Issue is partially solved. I replaced decimal to numeric. Error is gone but the system fetches only 1 character of 100(for instance if i copy this value to clipboard).

Any solution????????

29 REPLIES 29
Read only

FredericGirod
Active Contributor
0 Likes
4,101

Hi,

when you define a variable type P you could specify the size. Witch size did you define, what it is the value SAP try to put in it ?

regards

Fred

Read only

0 Likes
4,101

Hi Frederic,

I have define the variable type P decimals 5.

Still it is giving error.

I cant declare the variable length in Module pool screen so in that screen i have maintained the field as type decimal.

Read only

0 Likes
4,101

You define the dynpro ?  you could make a reference to the dictionary and you could define the size of the field with the dictionary

no ?

Fred

Read only

0 Likes
4,101

hi Yash

the length of GROSS_WEIGHT or TRUCK_WEIGHT can`t small than wa_weight-in or out.

i think the module pool screen can define the length.

regards,

Archer

Read only

0 Likes
4,101

you can choose D16D as type. only large than wa_weight-in or out.

Read only

0 Likes
4,101

Hi Dengyong.

I didnt get you.

What is D16D.

Actaully I am getting the values in clipboard but it is some junk value.

E.g if i copy 6000     3000 in notepad and when my code gets executed the system show some 36600000.00000      333000000.00000 value.

Read only

0 Likes
4,101

hi,

you can try change the type of the field 'IN' and 'OUT' to c, length 4.

then

LOOP AT it_weight INTO wa_weight.

        MOVE wa_weight-in to ST_REF-GROSS_WEIGHT.

        MOVE wa_weight-out TO ST_REF-TRUCK_WEIGHT.

ENDLOOP.


but previous that, you must know the length of GROSS_WEIGHT and RUCK_WEIGHT. you can debug to check it.

regards,

Archer

Read only

Former Member
0 Likes
4,101

does the dynpro have anything to do with this? Is it an error message on the dynpro, or a dump, generated from the method clipboard_import( )?

Read only

0 Likes
4,101

Dynpro has nothing do with this. But when I capture the weight it is giving runtime error.

Read only

Former Member
0 Likes
4,101

Hi Yash,

As you told in module pool screen you defined type as Decimal better to define it as UNIT because Quantity all ways need to refer to type QUAN. And in program you define type as p length 13 decimals 3.

For more refenece abt type  you can see domain MENG13.

Regards,

Vineesh.

Read only

0 Likes
4,101

Thank You Vineesh.

But I am capturing weight in this module pool.

Read only

Former Member
0 Likes
4,101

Hi,

what is the content of wa_weight-in and wa_weight-out. Maybe there is a conversion issue with decimal points or something like that ...

Regards,

Klaus

Read only

0 Likes
4,101

Hi Klaus ,

But both the types are same.

Read only

0 Likes
4,101

In which line processing of your code do you get the error?

Read only

0 Likes
4,101

LOOP AT it_weight INTO wa_weight.

        ST_REF-GROSS_WEIGHT = wa_weight-in.

        ST_REF-TRUCK_WEIGHT = wa_weight-out.

      ENDLOOP.


when I get some junk value in the itab (IT_WEIGHT).

When the value which i am getting is transfferd to the ST_RED-GROSS_WEIGHT

the junk value also have 6 decimal place and in my declaration it is also having 6 decimal place.


Read only

0 Likes
4,101

By default type P has 8 Byte which is 15 digits. If you have DECIMALS 6 then you will have 9 digits before decimal point and 6 digits after it.

But you can increase ST_REF-GROSS_WEIGHT to ST_REF-GROSS_WEIGHT(16), then you have place for 31 digits with 25 digits before and 6 after decimal poitn.

Make sure, that you hve no unicode conversion issue (every second Byte will contain '00'.

Regards,

Klaus

Read only

0 Likes
4,101

Klaus the problem is as below. :

the value which i copy for clipboard import is different and the value which is imported is different.

the value which I have copied is a 4 digit value. but system returns some other value with 6 decimal plac and 10 before decimal.

Read only

0 Likes
4,101

Hi,

then you need

ST_REF-GROSS_WEIGHT(9) type P decimals 6

for that. It will have 17 digits with 11 before and 6 after the decimal point.

Regards,

Klaus

Read only

RaymondGiuseppi
Active Contributor
0 Likes
4,101

I have define the variable type P decimals 5.

So implicitly a length 8 (P) so maximum is 9999999999.99999, should be enough for a truck. If not use a bigger length.


Else I could only suppose the clipboard contains some thousand separator(s) and/or an unrecognized decimal separator, you could try to remove unwanted character and condense the string before the compute.

Also how did you define the internal table it_weight ?

Regards,

Raymond

Read only

Former Member
0 Likes
4,101

Hi Yash,

I have also worked in the Iron Ore and Mining Industry as an ABAPer for more than 1 year. I had exactly the same requirement. I used WS_EXECUTE and CLPB_IMPORT function modules to execute the 3rd party software.

Anyway in the above code, there are 2 fields, for which field it is showing too small?

Regards

Purnand

Read only

Former Member
0 Likes
4,102

Issue is partially solved. I replaced decimal to numeric. Error is gone but the system fetches only 1 character of 100(for instance if i copy this value to clipboard).

Any solution????????

Read only

0 Likes
4,101

Hi,

if you define a field of type n default length is 1.

DATA: myfield type n.

has length 1.

DATA: myfield(15) type n.

is of length 15,

Regards,

Klaus

Read only

0 Likes
4,101

I modified this as you said. Again it fired the same error. 😞

Read only

0 Likes
4,101

And you did it for both source and target fields?

      ST_REF-GROSS_WEIGHT = wa_weight-in.

      ST_REF-TRUCK_WEIGHT  = wa_weight-out.

All four fields need the length gt 1.

Regards,

Klaus

Read only

0 Likes
4,101

Yes both the fields are of same type.

Read only

0 Likes
4,101

please try what i said.

i copied a number to clipboard, and use that method to import.

it was worked.

Read only

0 Likes
4,101

If you fill and read your clipboard data with ABAP, the solution works fine:

REPORT  ztest_clipboard.

                                                                                                                                                                                                                                                             

TYPES: BEGIN OF x_weight,

         min_weight(15) TYPE n,

         max_weight(15) TYPE n,

       END OF x_weight.

                                                                                                                                                                                                                                                             

DATA: xv_rc     TYPE i.

DATA: xs_weight TYPE          x_weight.

DATA: xt_weight TYPE TABLE OF x_weight.

                                                                                                                                                                                                                                                             

START-OF-SELECTION.

                                                                                                                                                                                                                                                             

    CLEAR                       xt_weight.

    xs_weight-min_weight     =  15.

    xs_weight-max_weight     =  25.

                                                                                                                                                                                                                                                             

    APPEND  xs_weight       TO  xt_weight.

                                                                                                                                                                                                                                                             

    cl_gui_frontend_services=>clipboard_export(

       IMPORTING

         data                =  xt_weight

       CHANGING

         rc                  =  xv_rc

       EXCEPTIONS

        OTHERS               =  0

           ).

                                                                                                                                                                                                                                                             

    CLEAR                       xt_weight.

                                                                                                                                                                                                                                                             

    cl_gui_frontend_services=>clipboard_import(

      IMPORTING

        data                 =  xt_weight

      EXCEPTIONS

        OTHERS               =  0

        ).

You can try and debug the above code. But how do you fill your clipboard data?

Regards,

Klaus

Read only

0 Likes
4,101

Thanks man...

I am getting the data from notepad.. I mean, i simply copy the data from notepad.

Read only

0 Likes
4,101

Hi Yash,

Our Client is using "Avery India" WeighBridge

How can I copy weight from its software to clipboard.

They are using some standard software given by AVERY INDIA . Its built in VB I guess.


Thanks in advance