Calculating on Numeric Fields
It was very easy to add a calculation field in previous versions of Adobe. This one has got me. I'm trying to create a field that sums other fields. I don't know where to add the script or the language. Any assistance would be greatly appreciated.
Add the script in the calculate field of the field that you want to display the calculation, ie something like
this.rawValue = form1.blaa.rawValue + form1.foo.rawValue
(where blaa and foo are the fields that you want to sum)
make sure all the fields are decimal fields or numerical fields if you want to sum them.
(oh, and you can set the text field to be Calculated in Object, Value, Type, but this is not essential)
Similar Messages
-
How to right align a read only numeric field in a panel form layout
Hi, does anyone know how to right align a read only numeric field in a panel form layout? I am using: Style Class = AFFieldNumberMarker, but it only seems to work if the field is disabled. Disabling the field gives it a difference appearance that does not look right on our forms. These are calculated fields, which cannot be modified, so read only is necessary.
I have looked online for some answers, and it seems that others are having similar issues.
I have tried different combinations for the properties, but so far I cannot get it to work.
Thanks
Judy
I am using JDEV 11.1.1.5Sorry for the delay in my response. Here is the code
<af:inputText value="#{bindings.TotalAirlineCostEst.inputValue}"
label="#{bindings.TotalAirlineCostEst.hints.label}"
required="#{bindings.TotalAirlineCostEst.hints.mandatory}"
columns="#{bindings.TotalAirlineCostEst.hints.displayWidth}"
maximumLength="#{bindings.TotalAirlineCostEst.hints.precision}"
shortDesc="#{bindings.TotalAirlineCostEst.hints.tooltip}"
id="it20" readOnly="false"
disabled="true"
styleClass="AFFieldNumberMarker">
<f:validator binding="#{bindings.TotalAirlineCostEst.validator}"/>
<af:convertNumber groupingUsed="true"
pattern="#{bindings.TotalAirlineCostEst.format}"
type="number"
maxFractionDigits="0"/>
</af:inputText>
thank you,
Judy -
Need code for calculation of amount field(DMBTR)of BSEG table conditionally
Hi all,
I am selecting data for fields belnr(A/c doc.), dmbtr(Amount), hkont(G/L acc) from bseg cluster table giving the particular value for hkont in the selection screen.now there are some records fetched out of which there are few records in which same A/c no.(belnr) .So my requirement is to collect those same belnr records and do following calculation:
1. suppose for some record of same belnr , if all the value for field SHKZG is 'H' then summing up the values of field DMBTR.
2. suppose for some record of same belnr , if few value for the field SHKZG is 'H' and few are 'S' then the (summation the values of field DMBTR for all 'H' in field SHKZG -summation the values of field DMBTR for all 'S') and both the case the single record will fetched with belnr, sum(DMBTR) according to the condition, and hkont. Please provide me the reqd. code for the above problem.Thanks in advance.
regards
Anand.Hi Anand,
We can do like this.
This will take into account 'S', 'H' (debit/credit indicator) and BELNR wise sum.
1. Create new internal table, STAB with only two fields. (with header line)
BELNR "<------- refer below statement
HKONT "<------ Whatever unique combination of field(s) you want, you can put here 1,2,
DMBTR "<----
Numeric field
If you want only HKONT wise SUM, then remove BELNR
2. Now write this code.
Loop at Itab.
Clear STAB.
IF ITAB-SHKZG = 'H'.
STAB-DMBTR = ITAB-DMBTR.
else.
STAB-DMBTR = - ITAB-DMBTR. "<----- Negative Sign
endif.
STAB-BELNR = ITAB-BELNR.
STAB-HKONT = ITAB-HKONT.
COLLECT STAB. "<------ Important.
Endloop
Note:
Based upon the alphanumeric fields combination (BELNR and HKONT), the sum will be done.
Similar to group by in a select query
regards,
amit m.
Edited by: Amit Mittal on Jan 22, 2010 2:14 PM -
Populate text in field 1 based on calculation in another field
Hello,
Currently, I have a calculated field that is the sum of 7 numeric fields. I then have a text field that I would like to populate based on the calculation.
For example, if the value in the calculated field (Total) is "27", textfield should read "Great Job". If Total is >27, the textfield should read "Keep Trying".
I have two questions... What script should I try? and Where should the script reside?
I have tried to add script in the 'change' section of the Total field, but since the user is not changing this field (it is calculated), the script is not being triggered. I have tried the script in the 'change' section of each of the 7 numeric fields, but am having trouble referencing the Total field value.
Any help would be appreciated.
Thanks
EEric,
I added 8 Numeric Fields named MonTotal, TueTotal, WedTotal, ThurTotal, FriTotal, SatTotal, SunTotal and WeekTotal.
I added a FormCalc script to the calculate event of the WeekTotal Numeric Field shown below:
form1.#subform[0].MonTotal + form1.#subform[0].TueTotal + form1.#subform[0].WedTotal + form1.#subform[0].ThuTotal
+ form1.#subform[0].FriTotal + form1.#subform[0].SatTotal + form1.#subform[0].SunTotal
Once I saw the calculation was working I inserted a new text field named "Comment" and a standard button (Labeled "Click on Completion" and added a FormCalc script to the click event of the standard button shown below:
if (form1.#subform[0].WeekTotal == 27) then
form1.#subform[0].Comment = "Great Job!!!"
elseif (form1.#subform[0].WeekTotal > 27) then
form1.#subform[0].Comment = "Keep Trying!!!"
endif
Hopefully this is helpful.
Have a great day!
Pam -
How to model a non key figure numeric field
I am new to SAP BI, so please acceopt my apologies if I am asking a very basic question.
I have some numeric fields which are attributes of master data. These fields are not key figures and will not be aggregated. How can I model this in BI? I have to keep them as numeric fields because they may be used in some calculations at reporting.
Thanks!You can display them as display attribute along with your main infoobject in query.
or
Model it using replacement formula variable by using attribute value as in this [Help|http://help.sap.com/saphelp_nw04s/helpdata/en/03/6ba03cc24efd1de10000000a114084/content.htm] doc.
Hope this helps. -
How do I take two separate non numeric fields in a acrobat form and combine the data to display in a third separate field?
You have to use custom JavScripting to concatenate the first 2 fields. You cannot use the first 2 calculation options because they force the values of the fields to a numeric value or ignore string values.
Possible scripts for the 3rd field are:
event.value = this.getField("Text1").valueAsString + " " + this.getField("Text2").valueAsString;
or
event.value = this.getField("Text1").valueAsString.concat( " ", this.getField("Text2").valueAsString);
If you do not want change the separator or not show the separator when on or the other field is empty, you will need to add more code to adjust for change.
The above scripts will also concatenate number because the field values are read as strings and not numbers.
There is also a generalized user written function to concatenate up to 3 fields with a separator that adjust for missing data. -
How do I add auto text based on value in numeric field?
Need help... I'm trying to add auto text to a text field based on a value in a numeric field. I want my text field (summary box) to say "Passed" if the value (score box) is equal to 10 and the field to say "Not Passed" if the value is equal to less than 10. My numeric field is being calculated by selecting drop-down lists.
Thanks in advance for your help.
Ed Watson
Here's a link to the document I created...
https://files.acrobat.com/?trackingid=KGLIT#folder/c3106c32-2e69-4a5f-8ef2-94d25623dbfbI think I figured it out. I used the following script:
if(NumericField1.rawValue ==1){TextField1.rawValue = "Did Not Pass"}
if(NumericField1.rawValue ==2){TextField1.rawValue = "Did Not Pass"}
if(NumericField1.rawValue ==3){TextField1.rawValue = "Did Not Pass"}
if(NumericField1.rawValue ==4){TextField1.rawValue = "Did Not Pass"}
if(NumericField1.rawValue ==5){TextField1.rawValue = "Did Not Pass"}
if(NumericField1.rawValue ==6){TextField1.rawValue = "Did Not Pass"}
if(NumericField1.rawValue ==7){TextField1.rawValue = "Did Not Pass"}
if(NumericField1.rawValue ==8){TextField1.rawValue = "Did Not Pass"}
if(NumericField1.rawValue ==9){TextField1.rawValue = "Did Not Pass"}
if(NumericField1.rawValue ==10){TextField1.rawValue = "Passed"}
There's probably a cleaner way to do the same thing but at least this works for now. Hope this helps someone else. -
How Do You Change A Numeric Field To Blank When Zero?
I'm using Adobe Acrobat 6.0 Professional, version 6.0.6.
Can anyone help me with the code to change a numeric field to blank, when "0.00"?"no success" does not provide much to go on.
With your scripts, I get the concatenation of the sting values, so one has to force JavaScript to convert strings to numbers.
Make sure your field names are exact including case.
Make sure the calculation order is correct.
The following scripts all work:
var fa = 1 * this.getField("FeeN01").value;
var fb = 1 * this.getField("FeeN02").value;
var fc = 1 * this.getField("FeeN03").value;
event.value = fa + fb + fc;
if ((event.value == 0)) {
event.value = ""
// or
var fa = this.getField("FeeN01").value / 1;
var fb = this.getField("FeeN02").value / 1;
var fc = this.getField("FeeN03").value / 1;
event.value = fa + fb + fc;
if ((event.value == 0)) {
event.value = ""
// or
var fa = Number(this.getField("FeeN01").value);
var fb = Number(this.getField("FeeN02").value);
var fc = Number(this.getField("FeeN03").value);
event.value = fa + fb + fc;
if ((event.value == 0)) {
event.value = ""
The "sum of" also works with the "Custom validation script" of:
if (event.value == 0) event.value = ""; -
I think I've run into a bug with Designer. Can anyone confirm this? Or have I overlooked something?
Situation:
I have 5 numeric fields* in my form that use simple FormCalc calculations. All of them have the Object Field Display Pattern set as $z,zz9.99.
All calculations work perfectly. However, when I was testing the form I discovered something quite odd. The display is perfect until the dollar amount exceeds $9,999.99. Once over this amount the format disappears leaving just the correct result (e.g. What should be $12,345.67 is displaying as 1234567.). I tried editing the display pattern to $zzz,zzz,zz9.99 but this did not work.
Is there a JavaScript that will give me the formatting and calculations I need? Or do I need switch something else on in Designer? Thanks.
* Calculations used:
1) sum(BlackInkCost, ColourInkCost)
2) sum(WhitePaperCost, ColourPaperCost, CardStockCost, TabCost, TransparencyCost)
3) sum(CerloxCost, SpiralCost)
4) sum(ImpressionsSubTotal, PaperSubTotal, BinderySubTotal)
5) (CostSubtotal * NoDocumentsReqd)This would be the expected behaviour in the case of data entered into fields which do not match the pattern. This is not a bug, since you applied a pattern to display a certain number of characters and you entered something different, the pattern will fail and the form processor will leave the display as it is.
As for increasing the number of characters in the pattern, it should work. Make sure you dont have a conflict between the edit, display and binding patterns. If they are different, you may get unexpected results.
Also, if you do have a small pattern and can enter large numbers, then you should really apply some script to make sure your value is within legal limits. The rawValue of the field will always give you the pre-display pattern value. -
Why is a time/attendance form with many numeric fields slow to fill out?
A form created in LiveCycle 9 and saved as PDF has a table with many numeric fields to fill in number of hours under days of the week and type of activity. The bottom row of the table has total numeric foelds that calculate the total hours. I tried removing the totals thinking that it would speed up filling in the document but it didn't. Is there some limit to the number of fioelds a documents can have without slowing it down? What can be done to speed it up?
I have this issue as well. I created an expense tracking form using the Acrobat X basic calculation tool (not javascripts) and it takes 10 - 15 seconds to move to the next field on an iPad or Android device. On my PC it works great. HELP!
I also tried using a trial version of Acrobat XI with the same result. -
How do I put a permanent dollar value in a numeric field?
I'm setting up a simple order form in Adobe Livecycle Designer with UnitPrice, Qty and Total columns.
I need to have permanent dollar values show in the UnitPrice numeric field. When they enter a qty, it will be calculated by the unitprice and give a total. I have already figured out the other calculations, just can't work out how to put the dollar values in the unitprice field. They must be showing when the person opens the pdf file. Can someone pls help, I have looked thru all the posts and couldn't find an answer.
thanks in advance
KerryDunI need the numeric field to show the actual price eg $3.50 and it needs to stay there, it's not editable. To get around this I have put a text field column next to the unitprice column, to show this value, but the filler will have to type the unitprice in again, in the unitprice column so it will make the calculation of unitprice x qty = total(when the price is already sitting there.)There must be a better way to do this. Any help is greatly appreciated.
thanks
KerryDun -
Regd: Calculation of TOTAL field in ALV report
Hi All,
We have a scenario that we are not getting the total value for numeric fields in ALV report.
Below i have given the code used for it.
G_KEY = 'X'.
G_NOKEY = SPACE.
G_SUM = 'X'.
G_NOSUM = SPACE.
PERFORM BUILD_FIELDCAT USING 'VBELN' G_KEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'BLDAT' G_NOKEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'VGBEL' G_KEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'POSNR' G_KEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'MATNR' G_KEY G_NOSUM..
PERFORM BUILD_FIELDCAT USING 'LFIMG' G_NOKEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'VRKME' G_NOKEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'NETPR' G_NOKEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'BRTWR' G_NOKEY G_NOSUM.
PERFORM BUILD_FIELDCAT USING 'VALUE_INR' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'B_DUTY' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'S_TOTAL1' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'CV_DUTY' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'C_CVD' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'S_TOTAL2' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'C_DUTY' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'S_TOTAL3' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'A_DUTY' G_NOKEY G_SUM.
PERFORM BUILD_FIELDCAT USING 'T_DUTY' G_NOKEY G_SUM.
PERFORM BUILD_LAYOUT.
PERFORM BUILD_DISPLAY.
*& Form DISPLAY
text
FORM BUILD_DISPLAY.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ' '
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = TEXT-000
I_GRID_SETTINGS =
IS_LAYOUT = IG_LAYOUT
IT_FIELDCAT = IG_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'A'
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IG_INBOUND
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "DISPLAY
*& Form BUILD_FIELDCAT
text
-->G_FIELDNAME text
-->L_KEY text
-->L_SUM text
FORM BUILD_FIELDCAT USING L_FIELDNAME LIKE DD03L-FIELDNAME L_KEY TYPE C L_SUM TYPE C.
CLEAR WG_FIELDCAT_LN.
ADD 1 TO G_COL_POS.
WG_FIELDCAT_LN-REF_TABNAME = 'IG_INBOUND'.
WG_FIELDCAT_LN-FIELDNAME = L_FIELDNAME.
WG_FIELDCAT_LN-KEY = L_KEY.
WG_FIELDCAT_LN-DO_SUM = L_SUM.
WG_FIELDCAT_LN-COL_POS = G_COL_POS.
WG_FIELDCAT_LN-NO_OUT = SPACE.
WG_FIELDCAT_LN-QFIELDNAME = SPACE.
WG_FIELDCAT_LN-HOTSPOT = SPACE.
APPEND WG_FIELDCAT_LN TO IG_FIELDCAT.
ENDFORM. "BUILD_FIELDCAT
*& Form BUILD_LAYOUT
text
FORM BUILD_LAYOUT.
IG_LAYOUT-TOTALS_TEXT = 'Total Amount'.
*IG_LAYOUT-SUBTOTALS_TEXT = 'A'.
IG_LAYOUT-ZEBRA = 'X'.
ENDFORM.
Help and Sugesstions will be much appreciated.
Thanks & Regds.
Ramesh.This is sample program for the same
REPORT Z_50657_ALV_EX2
NO STANDARD PAGE HEADING
LINE-COUNT 65(3)
LINE-SIZE 220
MESSAGE-ID ZZ.
* Type Pools *
TYPE-POOLS: SLIS, ICON.
* Tables *
TABLES: VBAK. "Sales Document Data
* Internal Tables *
* TABLE TO HOLD DATA OF SALES DOCUMENT
DATA: BEGIN OF IT_VBAK OCCURS 0,
VBELN LIKE VBAK-VBELN, "Sales Document
VBTYP LIKE VBAK-VBTYP, "SD document category
AUDAT LIKE VBAK-AUDAT, "Document date (date received/sent)
AUGRU LIKE VBAK-AUGRU, "Order reason (reason for the business)
AUART LIKE VBAK-AUART, "Sales Document Type
NETWR LIKE VBAK-NETWR, "Net Sales Order in Doc. Currency
WAERK LIKE VBAK-WAERK, "SD document currency
ICON TYPE ICON-ID, "traffic lights
END OF IT_VBAK.
* Work Areas *
*WORK AREAS DEFINED FOR ALV'S
DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV, "field catalog
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, "field catalog ITAB
WA_SORT TYPE SLIS_SORTINFO_ALV, "SORT work area
IT_SORT TYPE SLIS_T_SORTINFO_ALV, "SORT ITAB
LAYOUT TYPE SLIS_LAYOUT_ALV, "LAYOUT
WA_FCODE TYPE SLIS_EXTAB, "FUN CODE
I_FCODE_EXTAB TYPE SLIS_T_EXTAB,
WA_EVENTS TYPE SLIS_ALV_EVENT,
IT_EVENTS TYPE SLIS_T_EVENT.
* Selection-Screen *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
PARAMETERS: P_VBTYP LIKE VBAK-VBTYP DEFAULT 'C'.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
PARAMETERS: LIST RADIOBUTTON GROUP G1,
GRID RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B2.
* At Selection-Screen *
*VALIDATION
* Start of Selection *
START-OF-SELECTION.
*POPULATION OF DATA INTO INTERNAL TABLE ITAB
PERFORM GET_DATA.
*DEFINE USER DEFINED FIELDCATALOG
PERFORM DEFINE_FIELDCATALOG.
*SUBTOTALS AND TOTALS DISPLAY USING SORT
PERFORM SORT_LIST.
*CHANGE FCODE OF STATUS
PERFORM CHANGE_FCODE.
*CHECK RADIOBUTTON OPTION AND ACCORDINGLY FINAL DISPLAY
PERFORM CHECK_OPTION.
*& Form GET_DATA
* text
FORM GET_DATA.
SELECT VBELN
VBTYP
AUDAT
AUGRU
AUART
NETWR
WAERK FROM VBAK INTO TABLE IT_VBAK
WHERE VBELN IN S_VBELN AND VBTYP = P_VBTYP
AND ERDAT > '01.01.2004' AND NETWR > 0.
LOOP AT IT_VBAK.
IF IT_VBAK-NETWR < 10000.
IT_VBAK-ICON = '@08@'.
ELSEIF IT_VBAK-NETWR > 100000.
IT_VBAK-ICON = '@0A@'.
ELSE.
IT_VBAK-ICON = '@09@'.
ENDIF.
MODIFY IT_VBAK INDEX SY-TABIX.
ENDLOOP.
ENDFORM. "GET_DATA
*& Form CHECK_OPTION
* text
FORM CHECK_OPTION.
WA_EVENTS-NAME = 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'TOP'.
APPEND WA_EVENTS TO IT_EVENTS.
CLEAR WA_EVENTS.
WA_EVENTS-NAME = 'END_OF_LIST'.
WA_EVENTS-FORM = 'END_LIST'.
APPEND WA_EVENTS TO IT_EVENTS.
CLEAR WA_EVENTS.
IF LIST = 'X'.
PERFORM LIST_DISP.
ENDIF.
IF GRID = 'X'.
PERFORM GRID_DISP.
ENDIF.
ENDFORM. "CHECK_OPTION
*& Form DEFINE_FIELDCATALOG
* text
FORM DEFINE_FIELDCATALOG.
WA_FIELDCAT-COL_POS = 1.
WA_FIELDCAT-FIELDNAME = 'ICON'.
WA_FIELDCAT-SELTEXT_L = 'ICON'.
WA_FIELDCAT-ICON = 'X'.
WA_FIELDCAT-OUTPUTLEN = 8.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 2.
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-SELTEXT_L = 'SALES DOC NO.'.
WA_FIELDCAT-OUTPUTLEN = 10.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 3.
WA_FIELDCAT-FIELDNAME = 'AUDAT'.
WA_FIELDCAT-SELTEXT_L = 'CREATED ON'.
WA_FIELDCAT-OUTPUTLEN = 10.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 4.
WA_FIELDCAT-FIELDNAME = 'VBTYP'.
WA_FIELDCAT-SELTEXT_L = 'CATEGORY'.
WA_FIELDCAT-OUTPUTLEN = 1.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 6.
WA_FIELDCAT-FIELDNAME = 'AUGRU'.
WA_FIELDCAT-SELTEXT_L = 'REASON'.
WA_FIELDCAT-OUTPUTLEN = 3.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 5.
WA_FIELDCAT-FIELDNAME = 'AUART'.
WA_FIELDCAT-SELTEXT_L = 'DOC TYPE'.
WA_FIELDCAT-OUTPUTLEN = 4.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 7.
WA_FIELDCAT-FIELDNAME = 'NETWR'.
WA_FIELDCAT-SELTEXT_L = 'NET VALUE'.
WA_FIELDCAT-OUTPUTLEN = 17.
WA_FIELDCAT-DECIMALS_OUT = 2.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 8.
WA_FIELDCAT-FIELDNAME = 'WAERK'.
WA_FIELDCAT-SELTEXT_L = 'UNIT'.
WA_FIELDCAT-OUTPUTLEN = 50.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "DEFINE_FIELDCATALOG
*& Form DEFINE_LAYOUT
* text
FORM DEFINE_LAYOUT.
LAYOUT-ZEBRA = 'X'.
LAYOUT-SUBTOTALS_TEXT = 'SUBTOTAL SUM'.
LAYOUT-WINDOW_TITLEBAR = 'EXERCISE 2'.
LAYOUT-TOTALS_TEXT = 'TOTAL'.
ENDFORM. "DEFINE_LAYOUT
*& Form SORT_LIST
* text
FORM SORT_LIST.
WA_SORT-FIELDNAME = 'VBELN'.
WA_SORT-TABNAME = 'IT_VBAK'.
WA_SORT-SPOS = 1.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'NETWR'.
WA_SORT-TABNAME = 'IT_VBAK'.
WA_SORT-UP = 'X'.
WA_SORT-SPOS = 2.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
ENDFORM. "SORT_LIST
*& Form LIST_DISP
* text
FORM LIST_DISP.
PERFORM DEFINE_LAYOUT.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = IT_FIELDCAT
IS_LAYOUT = LAYOUT
IT_SORT = IT_SORT
I_CALLBACK_PF_STATUS_SET = 'STATUS'
IT_EXCLUDING = I_FCODE_EXTAB
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_EVENTS = IT_EVENTS[]
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_VBAK
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "LIST_DISP
*& Form GRID_DISP
* text
FORM GRID_DISP.
PERFORM DEFINE_LAYOUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_SORT = IT_SORT
I_CALLBACK_PF_STATUS_SET = 'STATUS'
IT_EXCLUDING = I_FCODE_EXTAB
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_EVENTS = IT_EVENTS[]
TABLES
T_OUTTAB = IT_VBAK.
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "GRID_DISP
*& Form STATUS
* text
* -->P_EXTAB text
FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STATUS' EXCLUDING P_EXTAB.
ENDFORM. "STATUS
*& Form USER_COMMAND
* text
* -->R_UCOMM text
* -->RS_SELFIELD text
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN 'BACK' OR 'CANC' OR 'EXIT'.
LEAVE TO SCREEN 0.
WHEN '&IC1'.
SET PARAMETER ID 'AUN' FIELD RS_SELFIELD-VALUE.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. "USER_COMMAND
*& Form CHANGE_FCODE
* text
FORM CHANGE_FCODE.
WA_FCODE = 'PRNT'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&OAD'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&AVE'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&EB9'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&SUM'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&UMC'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&XPA'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&OMP'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
ENDFORM. "CHANGE_FCODE
*& Form TOP
* text
FORM TOP.
IF LIST = 'X'.
WRITE:/ SY-ULINE.
WRITE:/ 'DATE:', SY-DATUM,55 'INTELLIGROUP ASIA PVT LTD'.
WRITE:/ 'TIME:', SY-UZEIT.
WRITE:/ 'USER NAME:', SY-UNAME,60 SY-TITLE.
WRITE:/ 'PAGE', SY-PAGNO.
WRITE:/ SY-ULINE.
ENDIF.
IF GRID = 'X'.
DATA: LS_LINE TYPE SLIS_LISTHEADER,
E04_LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
* Listenüberschrift: Typ H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = 'Summary'.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
* Kopfinfo: Typ S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Intelligroup'.
LS_LINE-INFO = ''.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
LS_LINE-KEY = 'ASIA'.
LS_LINE-INFO = 'PVT LTD'.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
* Aktionsinfo: Typ A
CLEAR LS_LINE.
LS_LINE-TYP = 'A'.
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = 'truman'.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = E04_LT_TOP_OF_PAGE
I_LOGO = 'ENJOY_SAP_LOGO'.
ENDIF.
ENDFORM. "TOP
*& Form END_LIST
* text
FORM END_LIST.
IF LIST = 'X'.
SKIP 2.
WRITE:/60 'END OF PAGE'.
ENDIF.
IF GRID = 'X'.
DATA: LS_LINE TYPE SLIS_LISTHEADER,
E04_LT_END_OF_LIST TYPE SLIS_T_LISTHEADER.
* Listenüberschrift: Typ H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = 'Summary'.
APPEND LS_LINE TO E04_LT_END_OF_LIST.
* Kopfinfo: Typ S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Intelligroup'.
LS_LINE-INFO = ''.
APPEND LS_LINE TO E04_LT_END_OF_LIST.
LS_LINE-KEY = 'ASIA'.
LS_LINE-INFO = 'PVT LTD'.
APPEND LS_LINE TO E04_LT_END_OF_LIST.
* Aktionsinfo: Typ A
CLEAR LS_LINE.
LS_LINE-TYP = 'A'.
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = TEXT-105.
APPEND LS_LINE TO E04_LT_END_OF_LIST.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = E04_LT_END_OF_LIST.
ENDIF.
ENDFORM. "END_LIST -
What is the initial value for a numeric field ??
Can someone tell me what the INITIAL VALUE FOR A NUMERIC FIELD is ?? Thank you
Rod.Using the following...
class MyClass
int myvar1; // Default initial value
int myvar2 = 3; // Default initial value and default value
MyOtherClass myclass1; // Default initial value
void doit()
int mylocal1; // No value
MyOtherClass myclass2; // No value
All number member variables, like myvar1 start off with andefault initial value which is zero. For booleans this is false. Object reference variables, like myclass1, have a null value.
All local numeric variables are considered undefined. So mylocal1 and myclass2 are undefined. Before you can use them you must explicitly provide a value.
Finally note that myvar2 will have two values during class instantiation. Initially it will have a value of zero. Sometime later it will have the value of 3. (When that happens is very definitely outside the scope of what this forum covers. If you want to know then ask in the advanced forum.) -
Functions in Calculation and Summary Fields
Hi,
I'll give a bit of background to my situation before describing the advice I'm looking for here.
I am experienced Mac user and I have used AW a fair bit in the past, but since I've been working in a job which has Windows machines and uses a complex custom-written relational database for its main tool, I use it less often than I did, so I am a little rusty. It is the shortcomings of the complex relational database (which I do not have admin rights to) that has led me back to AW and its database module.
Essentially, I am a complaints investigator, and the relational database provided by my employer is used to keep track of correspondence and various metadata associated with the investigation of the complaint. However, although it is called a Complaints Management System (CMS), it does not help me manage my caseload very well. I've previously tried to create an Excel spreadsheet that would help me manage my work, but it is not a database (or I am not sufficiently skilled with Excel) and I cannot get it to provide me with what I want.
So, my problems.
I have complaints (cases) assigned to me to investigate. These cases have differing priorities, which means differing time limits for completion of the investigation. The priorities and time limits are set out below:
J (jurisdictional issues) - time limit = 1 month
D (discretion not to investigate) - time limit = 3 months
1 - time limit = 4 months
2 - time limit = 6 months
3 - time limit = 12 months
The priority field in my AW DB is currently a 'pop-up menu' field, but I could change this to another type if this would be advisable.
I have a date-type field in which I enter the date the complaint was received. I have an calculation-type field in which I calculate the age of the complaint using the function:
=(NOW()-'DateReceived')
This returns an age in days, which I input into a separate calculation field that divides the result of 'age in days' by 30, to give a rough approximation of the number of months old the complaint is (If AW has an equivalent to Excel's 'workdays' variable, I'd love to hear about it). This latter field is the one that I display in the main data entry view of the database.
Given the priority assigned to the complaint, and the age of it, I am either 'On Target' or 'Over Target' for completing the investigation.
Each month I have a meeting with my manager to review progress, and since the reports that can be extracted from the CMS are not very useful for this purpose, I want my AW database to help me generate reports that can form the basis of discussion in these meetings.
Part A of My Query
At present, I have a manually operated field, in the form of a pop-up menu, to indicate for each record (complaint) whether I am over or on target for completion of the investigation. I would like to make this a calculated field, so that the database keeps track of this for me automatically. Unfortunately, I'm either too dense, or not good enough with the syntax of AW functions, to be able to write a function which essentially does the following:
IF 'Priority'=1 AND 'Age in Months'<4 THEN 'On Target' ELSE 'Over Target'
- and then repeats that for the other priority possibilities. It seems likely that the 'IF' function is what I'm after, but I haven't been able to get the syntax right to combine 'Priority' and 'Age in Months' in the format spelt out in the AW help, which is:
=IF(logical,true value,false value)
Getting the syntax of one part of this function right would be a good start. However, I suspect that I have a larger problem, in that I have 5 priorities to measure against and I need the overall calculation (that produces the 'On Target' or 'Over Target' results) to report in one result field. This means nesting the functions that look at the 5 priorities and 5 age limits. I've tried and failed to get the syntax of such nesting right, so advice on this is doubly welcome.
Unfortunately, I have a sneaking suspicion that unless the answer is much more concise than I imagine it to be, there will be an additional problem: AW appears to have a character limit for the length of a function string in a calculation field which may be too short for my needs. If you think this is an issue but that it can be solved through the use of intermediate fields (which don't need to be displayed in the main 'data entry' layout), I'm happy to give that a shot.
Part B of my Query
Even if the problem above cannot be solved, and I have to manually enter whether a complaint is 'On Target' or 'Over Target', I have a separate but related question for the reports I have to present to my manager.
On these reports, I would like to have a summary at the top of the first page (in a grand-summary part, I assume) which gives a count of how many complaints are 'On Target' or 'Over Target' for each priority. Below that is a sub-summary part, ordered by the type of action that must next be taken in the investigation. (Getting that right may be a subject of a separate post at a later date.) The report must, of course, only report on those complaints that are still being investigated ('open complaints') and not those which have been completed ('closed complaints'). So, I need a function in a summary field which will present an accurate count of the number of open complaints that are 'on target' for priority J (with separate summary fields that do the same thing for priorities D, 1, 2, and 3), and a separate set of summary fields that will present a count of open complaints that are 'over target' for each type of priority.
It might look a bit like this table below, with figures from the summary fields populating the cells in the third row:
Priority
J
D
1
2
3
In / Out of Target
In
Out
In
Out
In
Out
In
Out
In
Out
Number of Complaints
My guess is that it is easier to have the summary field simply count all the complaints that are on or over target for a given priority, regardless of whether they are open or closed, since the report could be based on a saved search (match) which strips out all closed complaints. But if I'm off-beam with that idea, I'm happy to have another way of cracking this nut.
Many thanks in advance to any Community members that take the time to try and help me with this.
Andrew
PS Cross posted in AWUG forum too, if people prefer to answer there.Hi Andrew,
Part A:
I've done some restating of the question, and distributed the calculations among several fields, not all of which need to be included on the visible layout. Other than formatting the Date fields and moving the 'Completed Date' field and its label, I've left this in the default "Layout 1" produced by AppleWorks.
Field List:
Priority: Popup menu with six items: 00, J, D, 1, 2, 3 Defaults to 00
TL (time limit in months): Calculation: CHOOSE('Priority',0,1,3,4,6,12)
Received: Date. Option: Automatically insert today's date (ie. Date Record created) (may be edited)
Target Date: Calculation:
DATE(YEAR('Received')+INT(MONTH('Received')+'TL')/12,MOD(MONTH('Received')+'TL', 12),DAY('Received'))
Remaining (Days): Calculation: INT('Target Date'+1-NOW()) (see revision below)
Completed: Checkbox. Set default value to Unchecked.
Completed Date: Date: Entered manually
OnTarget: Calculation: IF('Completed',IF('Completed Date'<'Target Date',"On Target","Over"),IF(INT(NOW())>'Target Date',"Over","On Target"))
The On Target field shows the current status of the case while still open, and the state on the closing date when it was closed.
Having done that, I was unhappy with the Remaining field continuing to calculate an ever larger negative number after the case had been closed. Hence this revision below:
Remaining: Calculation: IF('Completed','Target Date'-'Completed Date',INT('Target Date'+1-NOW()))
Shows the number of days remaining while the case is open, the days remaining at completion if the case has been marked Completed and the completion date entered.
Rsults (and some further formatting of the Layout) below.
Part B:
You will need Subsummary parts when sorted on Completed and on On Target. Fields can appear on a Layout only once, so each subsummary part will need a separate Summary type field for each field to be summarized.
Regards,
Barry -
Null values in Numeric fields of Datasets
I am wondering if anyone has run into this problem before and
checking to see if anyone has an elegant solution.
I have a rather large data set. (actually 5 of them on a
single page) I am sorting certain columns in a table as numbers so
i assign the variable " ds1.setColumnType("somenumbercolumn",
"number")" In most cases Spry works great and it sorts by numbers
properly. The problem is some of the fields in the XML file are
null and I am trying to sort them as a number. Spry actually
adjusts for this (as far as i can tell) and treats them like a 0
which isn't exactly ideal considering there are real zero values in
the data. I know spry doesn't currently format numbers:
So here is my question. Does anyone one have a solution to
fixing null values in a table so that it is still sortable but
doesn't display a "0" and instead displays something like "--" or
whatever. I have the option of editing the XML file as well, but I
still need the table to sort by number.
If not null values, how about non numeric fields which can
still be sorted in a numeric column?Hi,
We have an old post that raised a similar problem with yours.
The post can be found
here
For you situation, you should add an if condition for the
rows that have 0 and to add a custom string instead 0.
for (var i = 0; i < numRows; i++)
if(rows
[ "field_name"] == 0)
rows[ "field_name" ] = '--';
Hope this helps you,
Diana
Maybe you are looking for
-
Horizontal Looper not working in CS3
I recently upgraded to Dreamweaver CS3 from 8 and have been unable to get Horizontal Looper 2 (the version for ASP) to work in this new version. The extension itself and the settings dialog box appear, but the pop-up menu to select a recordset is bla
-
HI Guys I am running SAP PI 7.1, My Scenario is to Send one XML file to 3 IDocs. I have created 3 Message Mapping and mapped the each IDoc, and when testing I am getting mapping Error on the Operation Mapping. My XML file has fields from different ID
-
Dearness Allowance Based on CPI(PY-IN)
Dear Experts, I have configured VDA based on the CPI and made the changes in SPRO (V_T7IND1, V_T7IND3...) and I am updating the VDA value in IT0008 with using PC00_M40_DAB T.code also. Burt here my query is If it is normal calculation based on CPI
-
All things being equal, just what is considered the current "best common practice" in regards to font sizing for web design? I read somewhere recently that many designers prefer using the "em" measurement to set font size instead of choosing specifi
-
Gallery page download from + shadow without div tag?
Hi guys, on my site I want to upload some images that can be downloaded for use by clients - not high-res, but high enough quality for them to use in Word docs, emails, etc. I have made image galleries before but these don't allow the viewer to downl