2013 Mar 04 6:19 PM
Hello Experts,
I'm working with a piece of code but having short dump when moving values in between structures. In one structure I've value from configuration and all of them are in TYPE C.
zzgrossweight(30) TYPE c,
zznetweightitem(30) TYPE c,
zzgrossweightitem(30) TYPE c,
I'm coping the above 3 with other fields in the output structure but theses fields in output structure are defined as QUAN. Therefore then the code reaches at the following line then SAP throws a short dump (Unable to interpret "1,500.000 " as a number.).
p_pv_getshipmentitemdetails-pch_item_weight = p_lwa_item_config-zzgrossweight.
QUAN CHAR
Please advice how to resolve/cast the above issue and move value from CHAR to QUAN
Many thanks in advance.
2013 Mar 05 3:22 PM
Many thanks for both of your input guys. I've been able to resolve the issue by writing the following piece of code.
form Z_CHECK_VALUE changing pv_weightfield.
Data: i TYPE i,
gv_length TYPE i,
stest(30),
sakt(1),
str1(30).
"Check length
gv_length = strlen( pv_weightfield ).
WHILE i < gv_length.
"sakt = stest(1).
sakt = pv_weightfield+i(1).
if sakt = ','.
sakt = ''.
endif.
SHIFT stest.
CONCATENATE str1 sakt into str1.
i = i + 1.
ENDWHILE.
pv_weightfield = str1.
endform. " Z_CHECK_VALUE
Hello Experts,
I'm working with a piece of code but having short dump when moving values in between structures. In one structure I've value from configuration and all of them are in TYPE C.
zzgrossweight(30) TYPE c,
zznetweightitem(30) TYPE c,
zzgrossweightitem(30) TYPE c,
I'm coping the above 3 with other fields in the output structure but theses fields in output structure are defined as QUAN. Therefore then the code reaches at the following line then SAP throws a short dump (Unable to interpret "1,500.000 " as a number.).
p_pv_getshipmentitemdetails-pch_item_weight = p_lwa_item_config-zzgrossweight.
QUAN CHAR
Please advice how to resolve/cast the above issue and move value from CHAR to QUAN
Many thanks in advance.
2013 Mar 04 8:40 PM
Hi,
you could translate your value to integer first:
DATA: lc_text TYPE c LENGTH 30,
lc_quant TYPE p DECIMALS 2.
lc_text = '1.500,00'.
TRANSLATE lc_text
USING ', . '.
CONDENSE lc_text NO-GAPS.
lc_quant = lc_text / 100.
Hope it helps,
Guilherme Frisoni
2013 Mar 04 9:11 PM
Hello,
Use FM. CHAR_PACK_CONVERSION like this:
CALL FUNCTION 'CHAR_PACK_CONVERSION'
EXPORTING
INPUT = p_lwa_item_config-zzgrossweight
IMPORTING
DECSTRING = p_pv_getshipmentitemdetails-pch_item_weight.
Hope this help.
Jose.
2013 Mar 05 3:22 PM
Many thanks for both of your input guys. I've been able to resolve the issue by writing the following piece of code.
form Z_CHECK_VALUE changing pv_weightfield.
Data: i TYPE i,
gv_length TYPE i,
stest(30),
sakt(1),
str1(30).
"Check length
gv_length = strlen( pv_weightfield ).
WHILE i < gv_length.
"sakt = stest(1).
sakt = pv_weightfield+i(1).
if sakt = ','.
sakt = ''.
endif.
SHIFT stest.
CONCATENATE str1 sakt into str1.
i = i + 1.
ENDWHILE.
pv_weightfield = str1.
endform. " Z_CHECK_VALUE
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |