‎2007 Feb 09 4:27 AM
Anyone please tell me how I can code this...
I must read the value from a field QTY with data type CHAR 40 from the table zqt83.
Its value will have number+text..
Ex: 4.012 Kg G
I must show
f1 = 4.012
f2 = Kg G.
How do I do this?
I must bring 4 fields f1 , f2, f3 & qty using a select statement.
Now I must devide Qty = f4 + f5
and write all the fileds together f1....f5
I was not able to do this ..as I had some confusion with the ITAB.
Please help me out of this problem
‎2007 Feb 09 4:40 AM
Hi Ramana,
select f1 f2 f3 qty from dbtable into table itab where ....
split qty at space into f4 f5.
Hope this helps,
keerthi
‎2007 Feb 09 4:30 AM
data: str(100) type c.
data: str_n type string.
data: str_c type string.
data: len type i.
data: ofst type i.
str = '4.012 Kg G'.
len = strlen( str ).
do.
if ofst = len.
exit.
endif.
if str+ofst(1) co sy-abcde.
concatenate str_c str+ofst(1) into str_c.
else.
concatenate str_n str+ofst(1) into str_n.
endif.
ofst = ofst + 1.
enddo.
write:/ str_n.
write:/ str.
‎2007 Feb 09 4:35 AM
Hi,
var1 = 4.012 Kg G.
f1 = var1+0(5).
f2 = var1+5(4).
this will split the '4.012' and 'Kg G' into f1 an f2.
‎2007 Feb 09 4:40 AM
Hi Ramana,
select f1 f2 f3 qty from dbtable into table itab where ....
split qty at space into f4 f5.
Hope this helps,
keerthi
‎2007 Feb 09 4:42 AM
No I think I am not able explain my problem properly
I am pulling data from a z table using select statement
<b>select un_no qty pname pack pclass
from zqt83 into corresponding fields of table lt_zqt83
for all entries in lt_lips
where part_no = lt_lips-matnr.</b>
Now I need to devide this qty into 2 parts and put all this data into another ITAB.My confusion was when I am trying to put it into the ITAB.
‎2007 Feb 09 4:51 AM
Hi,
data: begin of itab occurs 0,
f1 like zqt83-f1,
f2 like zqt83-f2,
f3 like zqt83-f3,
f4 type p decimals 3,
f5 type string,
end of itab.
loop at itab.
itab-f1 = lt_zqt83-f1.
itab-f2 = lt_zqt83-f2.
itab-f3 = lt_zqt83-f3.
itab-f4 = num.
itab-f5 = unit.
endloop.
regards,
keerthi.
‎2007 Feb 09 4:54 AM
DATA: begin of itab occurs 0,
un_no
qty1( ) type c,
qty2(4) type c,
pname
pack
pclass
end of itab.
select un_no qty pname pack pclass
from zqt83 into corresponding fields of table lt_zqt83
for all entries in lt_lips
where part_no = lt_lips-matnr.
LOOP AT li_zqt83.
SPLIT it_zqt83-qty AT SPACE INTO
itab-qty1 itab-qty2.
itab-un_no = it_zqt83-un_no.
itab-pname = it_zqt83-pname.
itab-pack = it_zqt83-pack.
itab-pclass = it_zqt83-pclass.
APPEND itab.
clear itab.
clear it_zqt83.
ENDLOOP.
‎2007 Feb 09 5:07 AM
but I have an example of data
qty = 4.023 Kg G
I need to put like this
f4 = 4.023
f5 = Kg G
there will be 2 spaces in the second part.
Jessie ..please solve my problem ..I'll give points for both the forums..it is very important for me
‎2007 Feb 09 5:15 AM
If u split at SPACE taht is enough it will work, I tried it in an example.
DATA: string(20) TYPE c VALUE 'st ri ng120',
string1(10) TYPE c ,
string2(10) TYPE c .
SPLIT string AT space INTO string1 string2.
Write string2.