‎2006 Jul 26 4:09 PM
Hi Gurus,
cau you help me how to write logic for below problem
BOTTLEAMOUNT CAUFVD-MATNR CHAR 18
BUT LAST TWO DIGITS OF THE MATERIAL SHOULD BE CONVERTED TO A SINGLE DIGIT WHERE APPLICABLE AND CONCATENATED WITH A "C"
EX: 0986-03456-01
01 = 1C THEN
BOTTLE AMOUNT = 1C (IF ITS ZERO HERE )
IF ITS NOT ZERO THERE THEN WHTS THE LOGIC I HAVE WRITE FOR ABOVE 2 CONDITIONS
PLZ REVERT BACK ME
THANKS & REGARDS
DIVYA
‎2006 Jul 26 5:21 PM
Check this sample code
data:
bottleamount like caufvd-matnr,
v_whole_length type i,
v_substring_length type i,
material_1(16),
material_2(2).
data:
begin of i_material_split occurs 0,
material(18) type c,
end of i_material_split.
move '0986-03456-01' to bottleamount.
v_whole_length = strlen( bottleamount ).
if v_whole_length gt 2.
v_substring_length = v_whole_length - 2.
material_2 = bottleamount+v_substring_length(2).
material_1 = bottleamount+0(v_substring_length).
write 😕 material_1, material_2.
endif.
*-another alternative using SPLIT
split bottleamount at '-' into table i_material_split.
loop at i_material_split.
write:/ i_material_split-material.
endloop.
*-you can then concatenate
‎2006 Jul 26 5:21 PM
Check this sample code
data:
bottleamount like caufvd-matnr,
v_whole_length type i,
v_substring_length type i,
material_1(16),
material_2(2).
data:
begin of i_material_split occurs 0,
material(18) type c,
end of i_material_split.
move '0986-03456-01' to bottleamount.
v_whole_length = strlen( bottleamount ).
if v_whole_length gt 2.
v_substring_length = v_whole_length - 2.
material_2 = bottleamount+v_substring_length(2).
material_1 = bottleamount+0(v_substring_length).
write 😕 material_1, material_2.
endif.
*-another alternative using SPLIT
split bottleamount at '-' into table i_material_split.
loop at i_material_split.
write:/ i_material_split-material.
endloop.
*-you can then concatenate
‎2006 Jul 26 8:13 PM
check this sample code..
data: matnr like mara-matnr,
var type i,
var1 type i.
matnr = '000000000045608'.
var = strlen( matnr ).
var1 = var - 2.
if matnr+var1(1) = 0.
var1 = var1 + 1.
concatenate matnr+var1(1) 'C' into matnr.
write:/ matnr.
else.
*- write ur logic here
endif.