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: 

Field symbol Assign/unassign issue

former_member202771
Contributor
0 Kudos

Hi Experts,

I am facing an issue. I get dump BDC_OVERFLOW dump. I understand it because I am inserting a 11+2(dec) value into 9+(2) variable.

ASSIGN COMPONENT 'PREIS' OF STRUCTURE <fs_gwa_tab> to <lw_amnt13>.


      if <lw_amnt13> IS ASSIGNED.

        CLEAR lw_value.

      lw_value = <lw_amnt13>.

            CALL FUNCTION 'CURRENCY_AMOUNT_SAP_TO_DISPLAY'

       EXPORTING

         CURRENCY              = 'KRW'

         AMOUNT_INTERNAL       = lw_value                                                   " =12146092.15

      IMPORTING                                                                                         "this FM multiplies value. 100 in this case.

        AMOUNT_DISPLAY         = lw_value.                                                  " = 1214609200.15

      <lw_amnt13> = lw_value.                                " Dump here

Endif.

How do I over come.

I tried, after above code.

UNASSIGN <lw_amnt>.

ASSIGN lw_int to <lw_amnt> .             " where lw_int is 11+2.

But this unassign doesnt modify value in STRUCTURE <fs_gwa_tab>.


Please help me with this issue.

Thanks,

Anil

8 REPLIES 8

Former Member
0 Kudos

Hi

But the dump?

In which line?

Max

0 Kudos

Hi Max,

  <lw_amnt13> = lw_value.                                " Dump here


Hi Sumeet,


Dump : BDC_FIELD_OVERFLOW.


Thanks,

Anil

former_member226419
Contributor
0 Kudos

Hi,

can you please provide the full code?

And what dump are you getting?

BR

Sumeet

maryshchak_conti
Explorer
0 Kudos

Hi,

Kindly check the following code

DATA lv_value TYPE wmto_s-amount.

ASSIGN COMPONENT 'PREIS' OF STRUCTURE <fs_gwa_tab> to <lw_amnt13>.


      if <lw_amnt13> IS ASSIGNED.

        CLEAR lw_value.

      lw_value = <lw_amnt13>.


CALL FUNCTION 'ROUND'

     EXPORTING

       DECIMALS            = 4

       input               = <lv_amn13>

    IMPORTING

      OUTPUT              =  lv_value

    EXCEPTIONS

      OTHERS              = 1.

             .

            CALL FUNCTION 'CURRENCY_AMOUNT_SAP_TO_DISPLAY'

       EXPORTING

         CURRENCY              = 'KRW'

         AMOUNT_INTERNAL       = lw_value                                                   " =12146092.15

      IMPORTING                                                                                         "this FM multiplies value. 100 in this case.

        AMOUNT_DISPLAY         = lw_value.                                                  " = 1214609200.15

      <lw_amnt13> = lw_value.                                " Dump here

CALL FUNCTION 'ROUND'

     EXPORTING

       DECIMALS            = 2

       input               = lv_value

    IMPORTING

      OUTPUT              <lv_amn13>

    EXCEPTIONS

      OTHERS              = 1.

Endif.


Regards,

Serge M

0 Kudos

Hi Serge,

Thanks for your inputs.
I get error while using call function 'ROUND', the second time. There seems top be an overflow. with return code 1.


Still the same overflow issue.

Can you please help further.

Thanks,

Anil

jrg_wulf
Active Contributor
0 Kudos

Hi,

your problem is not one of field-symbol assignment.

As you stated in your original post, you are trying to assign a value of 11+2, well actually 10+2 with 1214609200.15 in your example, to a field that can only hold 9+2!

If you are free to alter the definition of the table, assigned to <fs_gwa_tab>, i would suggest you define field PREIS as 11+2 as well.

If not, you'll have to wriggle your way around, like doing the currency adaption at a later time, leaving the value until you need to process it and probably are able to work with a field large enough.

This has nothing to do with field-symbols. If you're not certain about using them and don't know exactly what you're doing, then just don't.

Best regards - Jörg

0 Kudos

Hi Jorg,

Thanks for the input.

How ever I will not be able to alter data type for PREIS. As this is a field from EBAN table.

The function of my report is to fetch table extracts dynamically based on table mentioned in the selection screen.So I had used <fs_table> type ANY TABLE.  There are many table in the selection screen.

I am using CALL FUNCTION 'CURRENCY_AMOUNT_SAP_TO_DISPLAY' as for certain currencies, like in my example, KRW, amount field in PR shows  xxxx, but the same will be stored as xxxx/100 in eban table.

As this data has to be used for data analytics, I need to convert this data from table, depending on currency and send the extract to PI.

Thanks,

Anil

0 Kudos

Hi,

wenn the table is "EBAN", then you can try to use the field price unit "PEINH". Maybe we are lucky, and the field is greater than 1.


........

    CALL FUNCTION 'CURRENCY_AMOUNT_SAP_TO_DISPLAY'

       EXPORTING

         CURRENCY              = 'KRW'

         AMOUNT_INTERNAL       = lw_value                                                 

      IMPORTING                                                                                      

        AMOUNT_DISPLAY         = lw_value.                                              

     FIELD-SYMBOLS <PEINH> type EPEIN.

     if  lw_value => 1000000000.

          ASSIGN COMPONENT 'PEINH' OF STRUCTURE <fs_gwa_tab> to <PEINH>.

           if <PEINH> IS ASSIGNED.

             if  <PEINH> > 1.

               lw_value lw_value / <PEINH>.

               <PEINH> = 1.

             endif         

         endif.    

     endif.

........


Regards,

Serge M