07-05-2012 2:31 AM
I've an ABAP report where it will populate the result in an .TXT file
In SAP, it has indicate whether the Amount is H or S.
IF gw_regup-shkzg NE 'H'. | |
gw_inv-wrbtr = gw_regup-wrbtr * -1. | |
ELSE. | |
gw_inv-wrbtr = gw_regup-wrbtr. | |
ENDIF. |
When i debug it, it does show it has negative sign behind
But when it got printed out in the TXT, there is no negative sign. Does the P(7) DECIMALS 2 might be causing it?
07-05-2012 2:42 AM
Dear Chin,
Did you modify your internal table after you change the sign?
For example,
MODIFY gt_inv FROM gw_inv INDEX n TRANSPORTING wrbtr.
07-05-2012 2:57 AM
Hi Michael,
Upon further debugging, there are ABAP codes as below
LOOP AT gt_inv INTO gw_inv
WHERE vblnr = gw_trans-vblnr.
CLEAR: gw_output, lv_wrbtr, lv_line.
lv_wrbtr = gw_inv-wrbtr.
lv_tot = lv_tot + gw_inv-wrbtr.
lv_line(10) = gw_inv-belnr.
lv_line+11(16) = gw_inv-xblnr.
lv_line+27(10) = gw_inv-bldat.
lv_line+35(15) = lv_wrbtr.
CONCATENATE
gw_inv-prod_code
lv_line
INTO gw_output-line
SEPARATED BY '|'.
APPEND gw_output TO gt_output.
ENDLOOP.
Upon checking the Internal Table of gw_output, the negative sign is gone...
07-05-2012 6:35 AM
Can you please paste the entire code (if it is not that big)? Might be something to do with the data types of variables/fields.
Regards
Vivekananda Rao
07-05-2012 6:45 AM
Instead of lv_wrbtr = gw_inv-wrbtr.
try WRITE gw_inv-wrbtr to lv_wrbtr.
Declare lv_wrbtr(15) TYPE c.
Thanks,
Shambu
07-05-2012 6:47 AM
Hi Vive,
I managed to solve it.
First i increase the lv_line length.
DATA: lv_rwbtr(16),
lv_wrbtr(16),
lv_prtnm(35),
lv_brcod(3),
* lv_line(51).
lv_line(52). "Increase total size by 1 to show negative sign from WRBTR
Next i also increase the length of the lv_line when passing the variable from WRBTR
* lv_line+35(15) = lv_wrbtr.
lv_line+35(16) = lv_wrbtr. "Increase output size to show negative sign