10-16-2013 10:08 PM
Good day friends, i can help erase the zeros of this structure of code:
SELECT SUM( ntgew ) SUM( brgew ) INTO (st_texto-pes_net, st_texto-pes_bru)
FROM vbap
WHERE vbeln EQ <fs_data>-vbeln.
<fs_data>-ntgew = st_texto-pes_net. "21,402,720.000" Erase HERE
<fs_data>-brgew = st_texto-pes_bru. "21,822,230.400" Erase HERE
CLEAR gs_fcat.
gs_fcat-col_pos = 17 .
gs_fcat-fieldname = 'NTGEW'. Are displayed here
gs_fcat-tabname = 1.
gs_fcat-datatype = 'QUAN'.
gs_fcat-inttype = 'P'.
gs_fcat-domname = 'MENG15'.
gs_fcat-outputlen = gs_fcat-intlen.
APPEND gs_fcat TO gt_fcat.
CLEAR gs_fcat.
gs_fcat-col_pos = 18 .
gs_fcat-fieldname = 'BRGEW'. Are displayed here
gs_fcat-tabname = 1.
gs_fcat-datatype = 'QUAN'.
gs_fcat-inttype = 'P'.
gs_fcat-domname = 'MENG15'.
gs_fcat-outputlen = gs_fcat-intlen.
APPEND gs_fcat TO gt_fcat.
They can guide me with some example.....
Thanks for everything
Regards
10-17-2013 5:19 AM
Hi Brujo Brujo P ,
You are using the two fields in your report
ntgew, " Net Weight
brgew. " Gross Weight
for this two files
Domin - MENG13
DATA type - QUAN
Default having 3 Decimals Places
Example 1
DATA : ntgew TYPE ntgew, " Net Weight
brgew TYPE brgew. " Gross Weight
ntgew = '21402720'.
brgew = '21822230'.
WRITE : / ntgew,
/ brgew.
Out put
Default we will get 3 decimals
if you try like this
DATA : ntgew TYPE p length 16, " Net Weight
brgew TYPE p length 16. " Gross Weight
ntgew = '21402720'.
brgew = '21822230'.
WRITE : / ntgew,
/ brgew.
Output
Example 2
DATA : ntgew TYPE ntgew, " Net Weight
brgew TYPE brgew. " Gross Weight
Data: ntgew_c(17) TYPE c,
brgew_c(17) type c.
ntgew = '21402720.000'.
brgew = '21822230.400'.
ntgew_c = ntgew.
brgew_c = brgew.
CALL FUNCTION 'FTR_CORR_SWIFT_DELETE_ENDZERO'
CHANGING
c_value = ntgew_c.
CALL FUNCTION 'FTR_CORR_SWIFT_DELETE_ENDZERO'
CHANGING
c_value = brgew_c.
WRITE : / ntgew_c,
/ brgew_c.
Output
10-16-2013 10:52 PM
Brujo ,
use this following code before appending in itab.
data: v_char type char25,
v_char1 type char25.
SELECT SUM( ntgew ) SUM( brgew ) INTO (st_texto-pes_net, st_texto-pes_bru)
FROM vbap
WHERE vbeln EQ <fs_data>-vbeln.
move st_texto-pes_net to v_char.
move st_texto-pes_bru to v_char1.
condense v_char no-gap.
SHIFT v_char RIGHT DELETING TRAILING '0'.
condense v_char1 no-gaps.
SHIFT v_char1 RIGHT DELETING TRAILING '0'.
* use character values to display the results of <fs_data>-ntgew and
* <fs_data>-brgew. I will resolve
* your problem. Don't use the quantity values in field catalog.
<fs_data>-ntgew = v_char.
<fs_data>-brgew = v_char1.
regards,
10-17-2013 2:07 AM
Hi,
Looking by your code I think you are trying to do an ALV output. Check the field DECIMALS_O in LVC_S_FCAT structure if you are using it. This field controls number of decimal places for output at ALV. should be ok if your requirement is for display only.
Cheers,
Arindam
10-17-2013 4:29 AM
Hi Brujo,
If I understand your requirement of removing zeros at the end of the number. You can use the below code.
DATA : l_string1 TYPE string,
l_string2 TYPE string.
l_string1 = st_texto-pes_net.
l_string2 = st_texto-pes_bru.
condense string1 no-gaps.
condense string2 no-gaps.
FIND '.' IN l_string1 IN CHARACTER MODE.
IF sy-subrc EQ 0.
SHIFT l_string1 RIGHT DELETING TRAILING: '0','.'.
ENDIF.
FIND '.' IN l_string2 IN CHARACTER MODE.
IF sy-subrc EQ 0.
SHIFT l_string2 RIGHT DELETING TRAILING: '0','.'.
ENDIF.
<fs_data>-ntgew = l_string1. "21,402,720.000" Erase HERE
<fs_data>-brgew = l_string2. "21,822,230.400" Erase HERE
output :
21,402,720
21,822,230.4
Regards,
Shruti
10-17-2013 4:41 AM
Hi,
Try using the FMs.
CONVERSION_EXIT_ALPHA_INPUT
CONVERSION_EXIT_ALPHA_OUTPUT
Or
Use TRUNC statment.
Regards.
10-22-2019 4:53 PM
10-17-2013 5:19 AM
Hi Brujo Brujo P ,
You are using the two fields in your report
ntgew, " Net Weight
brgew. " Gross Weight
for this two files
Domin - MENG13
DATA type - QUAN
Default having 3 Decimals Places
Example 1
DATA : ntgew TYPE ntgew, " Net Weight
brgew TYPE brgew. " Gross Weight
ntgew = '21402720'.
brgew = '21822230'.
WRITE : / ntgew,
/ brgew.
Out put
Default we will get 3 decimals
if you try like this
DATA : ntgew TYPE p length 16, " Net Weight
brgew TYPE p length 16. " Gross Weight
ntgew = '21402720'.
brgew = '21822230'.
WRITE : / ntgew,
/ brgew.
Output
Example 2
DATA : ntgew TYPE ntgew, " Net Weight
brgew TYPE brgew. " Gross Weight
Data: ntgew_c(17) TYPE c,
brgew_c(17) type c.
ntgew = '21402720.000'.
brgew = '21822230.400'.
ntgew_c = ntgew.
brgew_c = brgew.
CALL FUNCTION 'FTR_CORR_SWIFT_DELETE_ENDZERO'
CHANGING
c_value = ntgew_c.
CALL FUNCTION 'FTR_CORR_SWIFT_DELETE_ENDZERO'
CHANGING
c_value = brgew_c.
WRITE : / ntgew_c,
/ brgew_c.
Output
10-17-2013 5:21 PM
Thanks Ramesh, use this:
In the select enter these variables
Types: Begin of ....
......
......
ntgew TYPE p length 16, " Net Weight
brgew TYPE p length 16.
End of.....
DATA : ntgew TYPE p length 16, " Net Weight
brgew TYPE p length 16. " Gross Weight
SELECT SUM( ntgew ) SUM( brgew ) INTO (st_texto-pes_net, st_texto-pes_bru)
FROM vbap
WHERE vbeln EQ <fs_data>-vbeln.
MOVE st_texto-pes_net to ntgew.
MOVE st_texto-pes_bru to brgew.
<fs_data>-ntgew = ntgew.
<fs_data>-brgew = brgew.
10-17-2013 5:34 AM
10-17-2013 7:30 AM
Hi,
First remove the space in your variable,
Then use the following code
SHIFT <variable_name> RIGHT DELETING TRAILING '0'.
Regards,
Riju Thomas.
10-17-2013 12:47 PM
Hello
Please find the logic below:
DATA: brgew_c_yo TYPE string.
DATA: str1 TYPE string,
str2 TYPE string.
DATA gt_tab TYPE STANDARD TABLE OF string.
DATA : brgew TYPE brgew.
brgew = '20822300.400'.
brgew_c_yo = brgew.
SPLIT brgew_c_yo AT '.' INTO : str1 str2 , TABLE gt_tab.
replace all OCCURRENCES OF '0' in str2 WITH ' '.
CONDENSE str2 NO-GAPS.
CONCATENATE str1 '.' str2 INTO brgew_c_yo.
WRITE brgew_c_yo.
OUTPUT:
Thanks and Kind Regards,
Yovish.
10-22-2019 4:51 PM