cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in displaying no decimals and suppress blanks same time Smartform

former_member242512
Participant
0 Kudos

Hi All

I have an issue.

data : w_netpr type text18.

Using below logic in smartform.

data: moff ,W_LENGTH_NODECIMAL type i.

   SHIFT w_netpr RIGHT DELETING TRAILING space.

   W_LENGTH_NODECIMAL = strlen( w_netpr ).

  find '.' in w_netpr  MATCH OFFSET moff.

  SUBTRACT moff FROM W_LENGTH_NODECIMAL .

I have this below code in text field :

<C5> &w_netpr(&W_LENGTH_NODECIMAL&.0C)&

But the statement don't works . I have suppress the blanks and also runtime have to determine no. of numbers before decimal.

If i use :

<C5> &w_netpr(5.0C)&  : this works fine.

Please let me how can use both supress as well as value to display no. of characters.

Thanks in advance.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member212913
Participant
0 Kudos

Hi,

      If your requirement is just to take out the decimals then we have function module .

first declare w_netpr1 as a string and now assign w_netpr1 = w_netpr.

use this function module.

CALL FUNCTION 'HRCM_STRING_TO_AMOUNT_CONVERT'
   EXPORTING
     STRING                    = w_netpr1
*   DECIMAL_SEPARATOR         =
*   THOUSANDS_SEPARATOR       =
*   WAERS                     = ' '
* IMPORTING
    BETRG                     = w_netpr
* EXCEPTIONS
*   CONVERT_ERROR             = 1
*   OTHERS                    = 2
           .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Regards,

Mahipal.

bharat_rathod2
Active Participant
0 Kudos

Dear,

Use CIZ.0 after variable in SF

former_member242512
Participant
0 Kudos

Thanks for suggesting. I tried but CIZ.0 still gives decimals.

I used like this :  &w_netpr(CIZ.0)&

bharat_rathod2
Active Participant
0 Kudos

Dear,

please give me peace of code and SF

former_member242512
Participant
0 Kudos

Hi Bharat

Sorry for replying late.

I have used a program line in that i have written following code:

  

data: moff type i.
W_LENGTH_NODECIMAL = strlen( w_netpr ).
find '.' in w_netpr  MATCH OFFSET moff.
SUBTRACT moff FROM W_LENGTH_NODECIMAL .

Finally in text node below to it im writting :

<C5>&ekko-waers&</><C5> &w_netpr(15.0)& &'/ 'w_ekpo-PEINH(C)&

&w_ekpo-bprme(C)&</>

Can you give any advice.

SharathSYM
Contributor
0 Kudos

try concatenating W_LENGTH_NODECIMAL & 0.C into another variable & pass to

<C5> &w_netpr(&W_new_variable&)&