2012 Jul 28 11:15 PM
Hello Folks,
I know this question has been asked many times, but i could not find my answer anywhere.
Iam using BAPI 'CSAP_MAT_BOM_READ' which returns the field COMP_QTY in table T_STPO.
When this field greter than or equal to 1000, it contains a comma in it like 1,000.
And later when i use this field for my calculcations, it gives me an error (dump)saying unable to interpret this as a number.
I know this is because this number contains the comma in it.
All the solutions i found so far is to replace the commas with space and condense it.
But what if the user has the different decimal notation settings. All the decimals will be displayed as commas.
And that time replacing the commas with space doenst work.
For eq: 1000.33 will be displayed as 1000,33
And replacing the commas with space becomes 100033.
Please let me know if there is any other way in sap we can handle this with.
2012 Jul 29 3:05 AM
Nevermind,
table USR01 got the user settings.
and i used following logic
CASE USR01-DCPFM.
WHEN ''.
REPLACE ALL OCCURRENCES OF '.' IN WA_STPO-COMP_QTY WITH ' '.
REPLACE ALL OCCURRENCES OF ',' IN WA_STPO-COMP_QTY WITH '.'.
WHEN 'X'.
REPLACE ALL OCCURRENCES OF ',' IN WA_STPO-COMP_QTY WITH ' '.
WHEN 'Y'.
REPLACE ALL OCCURRENCES OF ',' IN WA_STPO-COMP_QTY WITH '.'.
ENDCASE.
Hello Folks,
I know this question has been asked many times, but i could not find my answer anywhere.
Iam using BAPI 'CSAP_MAT_BOM_READ' which returns the field COMP_QTY in table T_STPO.
When this field greter than or equal to 1000, it contains a comma in it like 1,000.
And later when i use this field for my calculcations, it gives me an error (dump)saying unable to interpret this as a number.
I know this is because this number contains the comma in it.
All the solutions i found so far is to replace the commas with space and condense it.
But what if the user has the different decimal notation settings. All the decimals will be displayed as commas.
And that time replacing the commas with space doenst work.
For eq: 1000.33 will be displayed as 1000,33
And replacing the commas with space becomes 100033.
Please let me know if there is any other way in sap we can handle this with.
2012 Jul 29 3:05 AM
Nevermind,
table USR01 got the user settings.
and i used following logic
CASE USR01-DCPFM.
WHEN ''.
REPLACE ALL OCCURRENCES OF '.' IN WA_STPO-COMP_QTY WITH ' '.
REPLACE ALL OCCURRENCES OF ',' IN WA_STPO-COMP_QTY WITH '.'.
WHEN 'X'.
REPLACE ALL OCCURRENCES OF ',' IN WA_STPO-COMP_QTY WITH ' '.
WHEN 'Y'.
REPLACE ALL OCCURRENCES OF ',' IN WA_STPO-COMP_QTY WITH '.'.
ENDCASE.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |