2009 Aug 06 5:01 AM
hi all,
i' m using the following FM to get data
CALL FUNCTION 'LIST_TO_TXT'
EXPORTING
LIST_INDEX = -1
TABLES
listtxt = it_mess_att
listobject = i_abaplist
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3
in it_mess_att, the content looks like the following (all the content is in one column in the itab,The structure of the itab is SOLISTI1-line.).
May i know how to move those minus sign to the front. I have to do this in the it_mess_att, not before the data come in.
eg. from 2,080.00- to -2,080.00 before i call this FM. thank you so much
OX10M | 94015789 | 01/25/2007 | 02/24/2007 | 3000 | 60033430 | sdfsdfsfsf | 2,080.00- | 690 | 2,080.00- | EWLETT ACKARD (OMAHA) | 2300000008 |
| OX10M |94015790
01/25/2007 | 02/24/2007 | 3000 | 60033432 | sdfsifduoisufoisufd7777 | 39.52- | 690 | 39.52- | EWLETT ACKARD (OMAHA) | 2300000009 | |||
OX10M | 96005639 | 02/08/2007 | 03/10/2007 | 3000 | 60033434 | dgfdgdgdgf 7777 | 100.00- | 676 | 100.00- | ACKARD (OMAHA) | 2300000013 | |
OX10M | 90789296 | 03/13/2008 | 04/12/2008 | 3000 | 776180 | fewfewgrew | 293.30 | 277 | 293.30 |
EWLETT ACKARD (OMAHA) | 1100000068 |
| OX10M |94015857 | |03/13/2008|04/12/2008|3000 |60033545 |test | 117.32-| 277 | 117.32-| |EWLETT ACKARD (OMAHA) |2300000003
Edited by: Reetha Pitchee Maridas on Aug 6, 2009 6:02 AM
2009 Aug 06 5:11 AM
Hi Reetha,
Try using SET SIGN LEFT.Hoping your query resolved.
Link:[SIGN|http://help.sap.com/saphelp_nw70/helpdata/en/d1/803445454211d189710000e8322d00/content.htm]
Have a best day ahead.
Edited by: Srivastava.G on Aug 6, 2009 6:11 AM
Edited by: Srivastava.G on Aug 6, 2009 6:29 AM
hi all,
i' m using the following FM to get data
CALL FUNCTION 'LIST_TO_TXT'
EXPORTING
LIST_INDEX = -1
TABLES
listtxt = it_mess_att
listobject = i_abaplist
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3
in it_mess_att, the content looks like the following (all the content is in one column in the itab,The structure of the itab is SOLISTI1-line.).
May i know how to move those minus sign to the front. I have to do this in the it_mess_att, not before the data come in.
eg. from 2,080.00- to -2,080.00 before i call this FM. thank you so much
OX10M | 94015789 | 01/25/2007 | 02/24/2007 | 3000 | 60033430 | sdfsdfsfsf | 2,080.00- | 690 | 2,080.00- | EWLETT ACKARD (OMAHA) | 2300000008 |
| OX10M |94015790
01/25/2007 | 02/24/2007 | 3000 | 60033432 | sdfsifduoisufoisufd7777 | 39.52- | 690 | 39.52- | EWLETT ACKARD (OMAHA) | 2300000009 | |||
OX10M | 96005639 | 02/08/2007 | 03/10/2007 | 3000 | 60033434 | dgfdgdgdgf 7777 | 100.00- | 676 | 100.00- | ACKARD (OMAHA) | 2300000013 | |
OX10M | 90789296 | 03/13/2008 | 04/12/2008 | 3000 | 776180 | fewfewgrew | 293.30 | 277 | 293.30 |
EWLETT ACKARD (OMAHA) | 1100000068 |
| OX10M |94015857 | |03/13/2008|04/12/2008|3000 |60033545 |test | 117.32-| 277 | 117.32-| |EWLETT ACKARD (OMAHA) |2300000003
Edited by: Reetha Pitchee Maridas on Aug 6, 2009 6:02 AM
2009 Aug 06 5:11 AM
Hi Reetha,
Try using SET SIGN LEFT.Hoping your query resolved.
Link:[SIGN|http://help.sap.com/saphelp_nw70/helpdata/en/d1/803445454211d189710000e8322d00/content.htm]
Have a best day ahead.
Edited by: Srivastava.G on Aug 6, 2009 6:11 AM
Edited by: Srivastava.G on Aug 6, 2009 6:29 AM
2009 Aug 06 5:19 AM
1. Use function module..
CLOI_PUT_SIGN_IN_FRONT
this will move the negative sign from the left hand side of a number, to the right hand side of the number. Note that The result will be left justified (like all character fields), not right justifed as numbers normally are.
chck this example..
data: a1 type i value 56 ,
a2 type i value 60,
res type i.
res = a1 - a2.
data: res1(10).
res1 = res.
CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
CHANGING
VALUE = res1
write res1.
IMPORTANT:
You can use this FM CLOI_PUT_SIGN_IN_FRONT.
But you need to declare the amount field as char.
You can follow the below code as well:
data int type i.
data char(10).
int = -4.
int = int * -1.
write int to char.
concatenate '-' char into char.
Rgds
Raj
2009 Aug 06 6:26 AM
hi all,
Actually my question is in this itab with one column only, how to locate the number with minus sign. Then only use the function suggested by you to put the sign in front. The number with minus sign can be coming at any place any row.
I'm thinking how to loop through the it_mess_att, locate it , and convert it.
thanks.
2009 Aug 06 6:39 AM
Hi ,
You can try this,
1) Split the column of it_mess_att seperated by space and '|' and assign the seperated fields in to a internal table
2) Loop at the internal table and perform 'SET SIGN LEFT' to each of the field, so where ever the sign is identified it will be left assigned
3) concatenate all the fields of this internal table and assign it back to it_mess_att.
Regards,
Vik
2009 Aug 06 6:44 AM
If the minus sign is always on the right of the number something like this should work. Kinda messy but would do the job?
LOOP AT IT_MESS_ATT.
SEARCH IT_MESS_ATT-FIELD FOR '-'.
IF SY-SUBRC = 0.
IT_MESS_ATT-FIELD+SY-FDPOS = SPACE.
SHIFT IT_MESS_ATT-FIELD RIGHT BY 1 PLACES.
V_FIELD(1) = '-'.
ENDIF.
ENDLOOP.
2009 Aug 06 7:22 AM
hi all,
Thanks for the very informative suggestion. For my case i think it is not possible due to some constraint.
thank you all.
2009 Aug 06 7:42 AM
Hi Reetha,
the following logic to move the sign to the left of a string in an internal table would help....
types:
begin of type_s_sign,
col1 type string,
col2 type string,
col3 type string,
col4 type string,
col5 type string,
col6 type string,
col7 type string,
col8 type string,
col9 type string,
col10 type string,
col11 type string,
end of type_s_sign.
data:
t_sign type table of type_s_sign with header line.
data:
" itab is ur it_mess_att table taken with a single record..
itab type table of SOLISTI1 with header line,
w_str type string value 'OX10M 94015789 01/25/2007 02/24/2007 3000 60033430 sdfsdfsfsf 2,080.00- 690 2,080.00- EWLETT ACKARD (OMAHA) 2300000008 '.
itab = w_str.
append itab.
// instead of itab take it_mess_att.
loop at itab.
condense itab.
split itab at space into t_sign-col1 t_sign-col2 t_sign-col3 t_sign-col4 t_sign-col5 t_sign-col6 t_sign-col7 t_sign-col8 t_sign-col9 t_sign-col10 t_sign-col11.
replace '-' with space into t_sign-col8 .
concatenate '-' t_sign-col8 into t_sign-col8.
condense t_sign-col8.
replace '-' with space into t_sign-col10 .
concatenate '-' t_sign-col10 into t_sign-col10.
condense t_sign-col10.
append t_sign.
concatenate t_sign-col1 t_sign-col2 t_sign-col3 t_sign-col4 t_sign-col5 t_sign-col6 t_sign-col7 t_sign-col8 t_sign-col9 t_sign-col10 t_sign-col11 into itab separated by space.
modify itab.
* write: itab.
endloop.
finally in itab the sign is to the left of the specified value.. thn u can pass this table to the required func module..
Regards.