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

Function module ?

Former Member
0 Likes
620

hi,

function module for converting digit to total no of digit in number..

for example 5 -


> 10000

6 -


> 100000

7 -


> 1000000

11 -


> 10000000000

number will be int only.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
593

Hello Deepak,

I don't know is there a FM for ur requirement.

But try this code:


REPORT ZV_TEST41 .

PARAMETERS: P_INDEX LIKE SY-INDEX.
DATA: CHAR(15).
DO P_INDEX TIMES.
  IF SY-INDEX = 1.
    CONCATENATE '1' '0' INTO CHAR.
  ELSE.
    CONCATENATE CHAR '0' INTO CHAR.
  ENDIF.
ENDDO.

WRITE: CHAR.

REgards,

VAsanth

6 REPLIES 6
Read only

Former Member
0 Likes
593

You need to be a bit more clearer..

Read only

Former Member
0 Likes
593

Hi Deepak

just execute this code it will give you the exact output


Parameter: w_int type i default 5.
data w_val type i.
*there is a simple way to achieve this
w_int = w_int - 1.
w_val = 10 ** w_int.
write : w_val.

Regards Rk

Message was edited by:

Rk Pasupuleti

Read only

Former Member
0 Likes
594

Hello Deepak,

I don't know is there a FM for ur requirement.

But try this code:


REPORT ZV_TEST41 .

PARAMETERS: P_INDEX LIKE SY-INDEX.
DATA: CHAR(15).
DO P_INDEX TIMES.
  IF SY-INDEX = 1.
    CONCATENATE '1' '0' INTO CHAR.
  ELSE.
    CONCATENATE CHAR '0' INTO CHAR.
  ENDIF.
ENDDO.

WRITE: CHAR.

REgards,

VAsanth

Read only

0 Likes
593

thanx

Read only

Former Member
0 Likes
593

Are you looking for some CONVERSION_EXIT_*_OUTPUT ?

Try , SE37 > Enter "CONVERSION_EXIT_*" press F4 Key,

identify the FM you need.

Regards,

Vishal

Read only

Former Member
0 Likes
593

or you can use the power operator.

REPORT ZTEST.

data: v_num type i.

parameter p_num(2) type n.

if p_num > 1.
p_num = p_num - 1.
v_num = 10 ** p_num.
endif.

write: v_num.