Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Issue on output structure

former_member295881
Contributor
0 Likes
727

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.

1 ACCEPTED SOLUTION
Read only

former_member295881
Contributor
0 Likes
695

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

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

3 REPLIES 3
Read only

guilherme_frisoni
Contributor
0 Likes
695

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

Read only

Former Member
0 Likes
695

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.

Read only

former_member295881
Contributor
0 Likes
696

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