‎2006 Dec 18 8:09 AM
Hallow I have a little problem that I spend a lot of time to solve it with out answer .my problem is that I have id.number NUMC 9 and pernr NUMC 8 .I wont in my loop to move id.number to pernr with out the last number ex. Id number 123456789 I wont perner 12345678 the problem is that in some time I have id number that with 5 or 6 number like 12345 and I wont perner 1234 (cut the last number) how can I do that I try it with 3 solution but it not work well u can see it with asterisk. Thanks for your answeres
DATA : v_strlen TYPE i.
DATA : w_length TYPE i.
w_length = STRLEN( itab-id_number ).
w_length = w_length - 1.
DATA: i_stell TYPE i , n_stell(8) TYPE n.
*--
LOOP AT itab1.
SPLIT itab1 AT ',' INTO:
itab-id_number
itab-hagbla
itab-date_open_hagbla
itab-date_start_hagbl
itab-date_stop_hagbla
itab-date_open_hamora
itab-date_close_hamor.
i_stell = itab-id_number.
n_stell = i_stell.
itab-pernr = n_stell. <b>solution1</b>* this bring zero before number ex.id 12345 perner 00012345
itab-pernr = itab-id_number+0(8). <b>solution2</b>
itab-pernr = itab-id_number+0(w_length). <b> solution3</b>
APPEND itab.
ENDLOOP.
<b></b>
‎2006 Dec 18 8:14 AM
The following statements should be right before the assigning statement.
Move them to inside the loop.
w_length = STRLEN( itab-id_number ).
w_length = w_length - 1.
itab-pernr = itab-id_number+0(w_length).
Regards,
Ravi
‎2006 Dec 18 8:14 AM
The following statements should be right before the assigning statement.
Move them to inside the loop.
w_length = STRLEN( itab-id_number ).
w_length = w_length - 1.
itab-pernr = itab-id_number+0(w_length).
Regards,
Ravi
‎2006 Dec 18 8:20 AM
Hi Antonio,
I guess solution 3 should work for you, what are you getting values of itab-id_number and w_length. You are keeping w_length out side the loop , keep that w_length inside the loop and check.
Hope that will work and will solve your problem.
reward points if it is solved your problem.
DATA : v_strlen TYPE i.
DATA : w_length TYPE i.
w_length = STRLEN( itab-id_number ).
w_length = w_length - 1.
DATA: i_stell TYPE i , n_stell(8) TYPE n.
*--
LOOP AT itab1.
SPLIT itab1 AT ',' INTO:
itab-id_number
itab-hagbla
itab-date_open_hagbla
itab-date_start_hagbl
itab-date_stop_hagbla
itab-date_open_hamora
itab-date_close_hamor.
i_stell = itab-id_number.
n_stell = i_stell.
itab-pernr = n_stell. solution1* this bring zero before number ex.id 12345 perner 00012345
itab-pernr = itab-id_number+0(8). solution2
<b>
w_length = STRLEN( itab-id_number ).
w_length = w_length - 1.</b>
itab-pernr = itab-id_number+0(w_length). solution3
APPEND itab.
ENDLOOP.
Use code with bolded in side the loop.
Regards,
Kiran I
Message was edited by:
kiran i
‎2006 Dec 18 8:22 AM
string1 contains the input string.
compute n = strlen( string1 ).
n = n - 1.
string2 = string1(n).
now string2 contains your required value.
regards
shiba dutta
‎2006 Dec 18 8:24 AM
Hi Antonio
Use the following
SHIFT itab-id_number RIGHT by 0 PLACES.
Write itab-id_number TO itab-pernr.
Write itab-pernr.
Reward points if this helps.
Best
Meera
‎2006 Dec 18 8:27 AM
Hi,
LOOP AT itab1.
SPLIT itab1 AT ',' INTO:
itab-id_number
itab-hagbla
itab-date_open_hagbla
itab-date_start_hagbl
itab-date_stop_hagbla
itab-date_open_hamora
itab-date_close_hamor.
<b>unpack itab-id_number to itab-id_number.
itab-pernr = itab_id_number+0(8).</b>...
‎2006 Dec 18 8:29 AM
LOOP AT itab1.
SPLIT itab1 AT ',' INTO:
itab-id_number
itab-hagbla
itab-date_open_hagbla
itab-date_start_hagbl
itab-date_stop_hagbla
itab-date_open_hamora
itab-date_close_hamor.
i_stell = itab-id_number.
n_stell = i_stell.
itab-pernr = n_stell. solution1* this bring zero before number ex.id 12345 perner 00012345
<b> w_length = STRLEN( itab-id_number ).
w_length = w_length - 1.</b>
<b>move itab-id_number+0(w_length) to itab-pernr.</b>
itab-pernr = itab-id_number+0(8). solution2
itab-pernr = itab-id_number+0(w_length). solution3
APPEND itab.
ENDLOOP.
-
logic
data : id_num type num9,
pernr type num8,
cnt type i .
id_num = 123456789. "is ur input
* id_num = 123456.
cnt = strlen( id_num ).
cnt = cnt - 1.
move id_num+0(cnt) to pernr.
write:/ pernr. "is ur outputregards,
vijay