How to add zero at the end of a character string
Hello Experts,
I've a requirement where I need to do sum/total of various numbers and display it with $ sign as shown below.
I'm using a variable CHAR20 to display total with $ sign. The problem is if there is a 0 at the end of the total then variable doesn't display it as highlighted above in red. Can anybody please make suggestion ( a code sample will be great help ) how resolve this issue?
Many thanks in advance.
Hi,
please check this code:
REPORT ztestcurr.
DATA: xv_prval TYPE char20.
DATA: xv_val1 TYPE dmbtr VALUE '12.67'.
DATA: xv_val2 TYPE dmbtr VALUE '8.21'.
DATA: xv_val3 TYPE dmbtr VALUE '13.72'.
DATA: xv_sum TYPE dmbtr.
START-OF-SELECTION.
xv_sum = xv_val1 + xv_val2 + xv_val3.
PERFORM print_val USING xv_val1.
PERFORM print_val USING xv_val2.
PERFORM print_val USING xv_val3.
PERFORM print_val USING xv_sum.
*& Form PRINT_VAL
* Print value
* --> XF_VALUE Value to print
FORM print_val USING xf_value TYPE dmbtr.
WRITE xf_value TO xv_prval CURRENCY 'USD'.
CONCATENATE '$' xv_prval INTO xv_prval.
CONDENSE xv_prval NO-GAPS.
write /1 xv_prval using edit mask 'RR____________________'.
ENDFORM. " PRINT_VAL
Regards,
Klaus
Similar Messages
-
How to add spaces at the end of record
Hi Friends,
i am creating a file which contains more than 100 records.
In ABAP i have internal table with on field(135) type c.
some time record have length 120, somtime 130 its vary on each record.
but i would like to add space at the end of each record till 135 length.
Can you please help me how to add speace at the end of record.
regards
MalikSo why did you said that in your first posting? My glass sphere is out for cleaning...
Instead of type c use strings and add spaces until they have the appropriate length.
loop at outtab assigning <pout>.
while strlen( <pout>-val ) < 135.
concatenate <pout>-val `` into <pout>-val.
endwhile.
endloop. -
Add Zeros at the Ending to make Length 20.
Hi,
I have a Target field WBS where the length should be always 20. If the length is less than 20, I shd add Zeros at the ending to make the length as 20. I think format Number cant be used in this case. Do I need to write a UDF or Is there any standard function
Thanks & Regards,
VarunHi Varun,
use this UDF:
StringBuffer sb = new StringBuffer();
int length = 20 - a.length();
for(int i=0;i<length;i++)
sb.append("0");
return sb.insert(0,a).toString();
The difference to the solution is the use of the StringBuffer class. This is better coding practice. Strings in java are immutable and concatenation of strings therefore very expensive.
Regards Sven -
How to add totaling at the end of BI Publisher Report. ????
Dear All:
I have payment amount in BI publisher . And I want its totaling at the end of each group. How can I add. Can any body know. Thanks
ALiHi,
Think there are lots of posts on Tim's blog on totals, e.g.:
http://blogs.oracle.com/xmlpublisher/2007/03/30#a221
Regards,
Gareth
Blog: http://garethroberts.blogspot.com/ -
How to add footer at the end of every page
Hi,
I need to add some text at the bottom of every page in my application. I have made a footer region where i have put that text component. I have simply included that footer region as the last element of every jspx page. This shows the footer at the end of the content and not at the end of page(which is required).
Using css like position:absolute;bottom:0px; shows the text at the bottom of bowser window, not page(so, problem for pages having scoll).
It is not feasible to make any changes in each jspx page. So, what is the way out to achieve this by keeping the change limited to pagefooter region page and/or ss.css
Note: I am using Jdev10.1.3With JDev 11g, you can create pageTemplate however, in 10g though support for page template is not available, you can achieve basic functionalities like this through web template. See sample here:
http://www.developer.com/db/article.php/3513706/Easy-Web-Templates-with-Oracle-JDeveloper-10g.htm
And if incase you use JHeadstart tool for development, JHeadstart provides templating facilities too.
If you want to achieve using CSS, check this example:
http://www.electrictoolbox.com/html-css-footer/
regards,
~K -
How to Add barcodes at the end of a 3 page form to capture data
I am working on a multiple pages form that contain a paper form barcode I decide to put all paper form barcodes in the last page. How do I get the data fields to be assigned to different barcodes at the end of the page.
How do I remove the red x on the barcode.
I calculate that my form will have approx 2000-3000 chacracters how many barcodes will I need to put
I am using Designer 7
George WardWith Designer 7.x you will have to wrap each of the data sets on each of the pages in a subform and then with each of your barcodes, select the subform that you would like to collect data from.
Your life would be made much easier if you upgraded to Designer 8.x as you could create "collections" and then associate those collections to each of your barcodes.
With 3,000 characters of data you would more than likely be looking at 3 separate barcodes. The capacity does depend on the type of data your capturing but you should be covered with 3.
Lee -
I made a video in imovie and saved it, now i want to carry on making it from where i left but every time i try to add an image onto the end it just goes tot he wrong part of the movie, how do i just add it onto the end?
Have you seen my User Tipp here
"Movie Magic" with Stills and Dissolve
When you 'prep' your stills in any 'picture app', you can do a lot of marvel by simply applying dissolves.
In your case, I would create a white document (in Pixelmator, Keynote, Photshop, online at pixlr.com, whatever ...) and another with your logo (and further more ones with additional logos). Drag the jpgs into your iMovie Project and apply dissolves - tadahh! - logos appear on white. -
Deleting Zeros at the end of fields in ALV report
I want to make an ALV report that include both integer and decimals in same column.
for example :
1 - 1234.0000
2 - 0.0027
i dont want to see zeros at the end of value.
But the type will be decimal and integer values will be shown with zeros at the end.
For Ex.
I want to take report like this ;
1 - 1234
2 - 0.0027
How can i make this?
Thanks.
Edited by: aydnbk on May 14, 2010 3:22 PMHello aydnbk.
As far as i know, there is no way to do what you want using standard ALV-Functions. There is a field 'DECIMALS' in structure LVC_S_FCAT, but using this field you could only define ONE setting, that would affect ANY value.
Furthermore i am asking myself, if this feature is really sensible - when numbers are right-justified, a global setting for the number of decimals makes it much easier to compare the values - at least this is my personal opinion...
If i had to do this trick, i would simply add some character fields to the output-structure and write the values to the charater-fields to enforce this quite special layout.
Additionally i would set the fields 'NO_OUT' and 'TECH' for the fields of type 'P', that are holding the values - 'NO_OUT' hides the column and 'TECH' ensures, that the field can not be selected in a user-defined layout.
Hope this helps.
Regards, Jörg -
Hi,
How can I add some zeros in the end of a field in the decimal places?
I need to have 6 decimal places, so which ever decimal place is not filled, should be filled with zeros.
Example:
If the value is 11.123
I need to convert it to 12.123000
If the value is 11.1
I need to convert it to 11.100000
Please let me know how can I do this conversion or whether there is any function module available for this.
Thanks,
UmaHi,
move the value field into character field.
then do like the below.
data:num(20) type c value '11.1',len type i,len2 type i,v1(10) type c,v2(10) type c.
split num at '.' into v1 v2.
len = strlen( v2 ). <b><<holds the value after decimal point,check the length, if it is less than 6 digits,
then append the reqd. no. of zeroes at the end>></b>
len2 = 6 - len.
do len2 times.
concatenate v2 '0' into v2.
enddo.
write:/ v2.
regards,
sowjanya -
How to add zero into value prefix??
I have one reuqirement about adding zero prefix into value of Infoobject AAAA. Infoobject AAAA is the attribute of Infoobject BBBB. I need to write a ABAP code in the transfer rule of infoobject BBBB.
The length of infoobject BBBB is 10. That means system will automatically add zero if the length of the value is less than 10 after data loading.
Any body know how to write itHi Dreshof,
Try this:-
CONSTANTS: c_zeros(10) TYPE c VALUE '0000000000'.
SHIFT TRANS_STRUCTURE-aaaa RIGHT DELETING TRAILING SPACE.
OVERLAY TRANS_STRUCTURE-aaaa WITH c_zeros.
RESULT = TRANS_STRUCTURE-aaaa.
The correct code is as shown below. Please ignore the code above this.
Hi Again,
Try this:-
CONSTANTS: c_zeros(10) TYPE c VALUE '0000000000'.
DATA: wa_aaaa LIKE TRANS_STRUCTURE-aaaa,
SHIFT wa_aaaa RIGHT DELETING TRAILING SPACE.
OVERLAY wa_aaaa WITH c_zeros.
RESULT = wa_aaaa.
This will work.
Now do a syntax check. If all is ok. Save.
Hope it helps ,
Best regards,
Sunmit.
Edited by: sunmit bhandari on Jun 27, 2009 12:40 AM
Message was editted after your post below -
Convert Double to String without zeros at the end
Hello,
how can i convert a double-numeric to a string? I know how can do it but not how i can do it in a fast way.
When i use the "Number to Fractional String"-Object then a number
1,2 --> is canged to 1,200000
1,0 --> changed to 1,000000
what can i do that there are no zeros at the end?
Currently i´m reading the reversed string in a loop to remove the zeros, but this i to slow i think.
Is there a fast way?
Thanks for your helpExtract from the LV help :
Select Tools»Options to display the Options dialog box and select
Front Panel from the Category list to display
this page.
Use this page to set front panel options.
This page includes the following components:
Open the control editor with double click—Allows you to
double-click a control to display the Control
Editor window. Use the Control Editor window to customize
the appearance of a front panel object. This checkbox is unchecked by default.
Use localized decimal point—Uses the decimal separator for
the operating system instead of the period. This checkbox is checked by default.
Remove the checkmark from this checkbox if you want LabVIEW to use periods in
all cases for the decimal point. -
Reg:How to add fields to the scripts in detail
How to add fields to the scripts in detail.
Plz give me one example help me out.Hi
add fields to the scripts by sending that field between two &s.
for example if u want to add lifnr of lfa1 table then pass field like this.
&wa_lfa1-lifnr&.here wa_lfa1 is work area for internal table it_lfa1.
if name1 then &wa_lfa1-name1&
in this way you can add fields to the script under any window.
i am sending one example program for scripts.
&--structure declaration--
TYPES:BEGIN OF ST_LFA1,
LIFNR TYPE LFA1-LIFNR,
NAME1 TYPE LFA1-NAME1,
LAND1 TYPE LFA1-LAND1,
ORT01 TYPE ORT01,
REGIO TYPE REGIO,
END OF ST_LFA1.
TYPES:BEGIN OF ST_EKKO,
EBELN TYPE EKKO-EBELN,
BUKRS TYPE EKKO-BUKRS,
AEDAT TYPE EKKO-AEDAT,
ERNAM TYPE EKKO-ERNAM,
BSTYP TYPE EKKO-BSTYP,
LIFNR TYPE EKKO-LIFNR,
END OF ST_EKKO.
TYPES:BEGIN OF ST_EKPO,
EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
LOEKZ TYPE EKPO-LOEKZ,
AEDAT TYPE EKPO-AEDAT,
MATNR TYPE EKPO-MATNR,
NETWR TYPE EKPO-NETWR,
END OF ST_EKPO.
&--internal table,work area declaration--
DATA:WA_LFA1 TYPE ST_LFA1,
IT_LFA1 TYPE STANDARD TABLE OF ST_LFA1,
WA_EKKO TYPE ST_EKKO,
IT_EKKO TYPE STANDARD TABLE OF ST_EKKO,
WA_EKPO TYPE ST_EKPO,
IT_EKPO TYPE STANDARD TABLE OF ST_EKPO.
&--data declaration--
DATA:TOTAL TYPE EKPO-NETWR,
V_EBELN TYPE EKKO-EBELN.
data: v_item(20) type c.
&--parameter for purchase document number--
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS P_PURDOC LIKE V_EBELN.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
PERFORM GET_DATA_FROM_EKKO.
PERFORM GET_DATA_FROM_LFA1.
PERFORM GET_DATA_FROM_EKPO.
&--grand total--
LOOP AT IT_EKPO INTO WA_EKPO.
TOTAL = TOTAL + WA_EKPO-NETWR.
CLEAR WA_EKPO.
ENDLOOP.
&--open form--
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'PRINTER'
FORM = 'Z_50886_VENDOR'
LANGUAGE = SY-LANGU
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
&--write form for header details--
READ TABLE IT_EKKO INTO WA_EKKO INDEX 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEAD'
WINDOW = 'HEADER'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
&--write form for item details--
LOOP AT IT_EKPO INTO WA_EKPO.
concatenate wa_ekko-ebeln wa_ekpo-ebelp into v_item.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM'
WINDOW = 'MAIN'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
&--write form for vendor details--
READ TABLE IT_LFA1 INTO WA_LFA1 INDEX 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'VENDOR'
WINDOW = 'ADDRESS'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
&--write form for grand total--
CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'TOTAL'
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
&--close form--
CALL FUNCTION 'CLOSE_FORM'
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*& Form get_data_from_ekko
FORM GET_DATA_FROM_EKKO .
SELECT EBELN
BUKRS
AEDAT
ERNAM
BSTYP
LIFNR
FROM EKKO INTO TABLE IT_EKKO WHERE EBELN = P_PURDOC.
ENDFORM. " get_data_from_ekko
*& Form get_data_from_lfa1
FORM GET_DATA_FROM_LFA1 .
IF NOT IT_EKKO[] IS INITIAL.
SELECT LIFNR
NAME1
LAND1
ORT01
REGIO
FROM LFA1 INTO TABLE IT_LFA1 FOR ALL ENTRIES IN IT_EKKO WHERE
LIFNR = IT_EKKO-LIFNR.
ENDIF.
ENDFORM. " get_data_from_lfa1
*& Form get_data_from_ekpo
FORM GET_DATA_FROM_EKPO .
IF NOT IT_EKKO[] IS INITIAL.
SELECT EBELN
EBELP
LOEKZ
AEDAT
MATNR
NETWR
FROM EKPO INTO TABLE IT_EKPO
WHERE EBELN = P_PURDOC.
ENDIF.
ENDFORM. " get_data_from_ekpo -
In Photoshop Elements 7, how do I free up the ends of a crop box independently?
In Photoshop Elements 7, how do I free up the ends of a crop box independently?
I require the end points to move independently to fit am image cropThanks.
You have helped tremendously! -
Add Counter at the end of file name
Hi all,
I am using NFS protocol and trying to add counter at the end of the file. I have given the Prefix as '-'
Format : 1
Step: 1
Mode: After First File
Is the prefix is right? Am i giving the values in right way? Please help me.
The format required is: test_1.xml
Thanks,
SriHI Arun,
I m not so sure but i think prefix can not have any special character.
You can do this by giving your file name in target->file name schema as File_* while configuring your communication channel.
After that it will add automatically your required counter.
thanks. -
How to pad spaces at the end of a string
Hi All,
I am new to ABAP and need help to achieve this functionality
I have to build a string with fixed lenth . my input string
is always lesser than equal to X . I need to calculate and
add that many spaces at the end of the input string .
I tried to do this and getting the following error
please help on this :
if strlen( t_resultc ) < 525.
RFILL(t_resultc,' ',525)
endif.
Error : Comma without preceding colon(after RFILL(T_RESULTC ?)
Q: Can I use RFILL with out Select statement in a ABAP program
Thanks & Regards
KLKHi,
Try the following code but kindly make a note..
Note:-USE quote like this ` `, Instead of normal single quotes ‘ ’
WHILE strlen( T_RESULTC ) < 525. “Check the length
CONCATENATE T_RESULTC ` ` INTO T_RESULTC. ”Add spaces at the end
ENDWHILE.
Hope this helps,
Andrew
Maybe you are looking for
-
How to convert document file in PDf format through workflow using sharepoint designer
Please suggest me solution it's urgent.....please.
-
Final Cut Pro X project appears damaged
Hi. I spent hours editing a 3 minute video and went to Export into a MOV format. However, when I opened the MOV file, it was nothing like my project. It looked like bits and pieces of my video, and about 80 seconds of blank video/audio at the end. I
-
How to make the Wallet opened automatically?
Hi All, I want any wallet that I created to be opened automatically without executing an order to do it. How Plz?
-
I don't know why if I put in my url of my remote application for example : "http://localhost:8080/manipulationAS400/manipulationAS400Launcher.html" I have my application but if I replace localhost in my url by the name of my PC, I don't know to have
-
Hi need help in data extraction.
Hi everybody, I am trying to extract some ekpo table datas from R/3 and load in BW. What i did was: 1) created a char info object with a field and no attributes. 2) Created a Key fig with Target quantity-->0unit. 3) Created Info cube Assigned