on 02-20-2010 9:39 AM
Dera All,
I have field REGUD-WRBTR which is Type CURR in my Print Program and Form.
I want to Display the value as -96 but I am getting value as 96-.
I have tried ®UD-WRBTR(15) (<)& , Not working.
Used SET SIGN LEFT Command ,Not working.
It's an issue with CURR field , Please suggest how to resole this issue. Find below my Code for reference.
IF WA_REGUP-SHKZG = 'S'.
WA_REGUP-WRBTR = WA_REGUP-WRBTR * '-1'.
MOVE: WA_REGUP-WRBTR TO REGUD-WRBTR.
ELSE.
MOVE: WA_REGUP-WRBTR TO REGUD-WRBTR.
ENDIF.
Regards,
Vikas Badhan
about the initial question, < is ignored if the domain behind REGUD-WRBTR has sign option disabled (SE11, domain).
To combine several formatting options, just concatenate them:
®UD-WRBTR(15<)&
Last thing, be careful with number of decimals of &AMOUNT& according to the currency: do a test with a currency which has a number of decimals different from 2.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I dont think this approach will ever work, since you are playing around with a character field here. As per my understanding when you CONCATENATE '-' to a character field I dont think it will be considered as a sign. So formating options to handle signs will never work in this scenario.
What you can try here is in the subroutine pool after concatenation you can do a SHIFT LEFT, but then it can't be right aligned with
decimal places anymore.
What I still suggest here is to keep working on a currency field, instead of using a character field and doing a concatenation.
Make regup-wrbtr and negative field by either multiplying it with a -1 or minus it from zero ( regup-wrbtr = 0 - regup-wrbtr )
in your subroutine pool. and assign it back to regup-wrbtr. Then you can use regup-wrbtr(<).
> I dont think this approach will ever work, since you are playing around with a character field here. As per my understanding when you CONCATENATE '-' to a character field I dont think it will be considered as a sign. So formating options to handle signs will never work in this scenario.
I guess Vikas didn't use any formatting option for the character field &AMOUNT&, so it should work. In fact, I made a test, and there are 2 issues when executing the code: the numeric fields are passed right aligned (as you passed ®UD-WRBTR& without formatting option) so assigning it to a 15 characters field will truncate the value (so remove left spaces before the assignment), and you return IT_OUTPUT without mentioning the parameter name! Here are the changes Vikas has to do:
FORM PUT_MINUS_SIGN TABLES IT_INPUT STRUCTURE ITCSY
IT_OUTPUT STRUCTURE ITCSY.
DATA LV_WRBTR(15) TYPE C.
READ TABLE IT_INPUT INDEX 1.
CHECK SY-SUBRC EQ 0.
LV_WRBTR = IT_INPUT-VALUE.
CONDENSE LV_WRBTR. "<<<<<<<< ADD
CONCATENATE '-' LV_WRBTR INTO LV_WRBTR.
*CONDENSE LV_WRBTR. "<<<<<<<< delete
READ TABLE IT_OUTPUT INDEX 1. "<<<<<<<< ADD
CHECK SY-SUBRC EQ 0. "<<<<<<<< ADD
IT_OUTPUT-VALUE = LV_WRBTR.
MODIFY IT_OUTPUT INDEX 1.
ENDFORM.
> What I still suggest here is to keep working on a currency field, instead of using a character field and doing a concatenation.
I agree.
> Make regup-wrbtr and negative field by either multiplying it with a -1 or minus it from zero ( regup-wrbtr = 0 - regup-wrbtr ) in your subroutine pool. and assign it back to regup-wrbtr. Then you can use regup-wrbtr(<).
As REGUP-WRBTR refers to an unsigned number, regup-wrbtr(<) won't display the sign (as regup-wrbtr alone won't display the sign either). Instead, refer to REGUD-WRBTR (with or without formatting options, it's not the problem) which refers to a signed number (as you can see in the domain).
Edited by: Sandra Rossi on Feb 22, 2010 11:22 AM (CORRECTIONS ADDED)
Hi,
In your pring program, use below command to shift '-' to left.
SHIFT v_peramt1 UP TO '-' LEFT CIRCULAR.
It worked in my case.
Hope it helps.
Thanks,
Archana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
s
Edited by: Antony Paul on Feb 20, 2010 11:13 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
®UD-WRBTR(15)(<)&
This may not work
but I guess the below should work
®UD-WRBTR(<)&
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Antony,
I have appied the logic below, I have called a subroutine from script to insert the '-' infront of the value. Somehow getting error when activating the Script, please see the code am i missing something in this, pls revert.
/: IF WA_REGUP-SHKZG = u2018Su2019.
/: PERFORM PUT_MINUS_SIGN IN PROGRAM ZTEST
/: USING REGUD-WRBTR
/: CHANGING &AMOUNT&
/: ENDPERFORM
/ ®UP-BLDAT& ®UP-XBLNR(16)& &AMOUNT&
/: ELSE
/ ®UP-BLDAT& ®UP-XBLNR(16)& ®UD-WRBTR(15)&
/: ENDIF
In ZTEST program
FORM PUT_MINUS_SIGN TABLES IT_INPUT STRUCTURE ITCSY
IT_OUTPUT STRUCTURE ITCSY.
DATA LV_WRBTR(15) TYPE C.
READ TABLE IT_INPUT INDEX 1.
CHECK SY-SUBRC EQ 0.
LV_WRBTR = IT_INPUT-VALUE.
CONCATENATE '-' LV_WRBTR INTO LV_WRBTR.
CONDENSE LV_WRBTR.
IT_OUTPUT-VALUE = LV_WRBTR.
MODIFY IT_OUTPUT INDEX 1.
ENDFORM.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.