How to subtract two fields

Hi,
All,
I want to calculate balence quota. by usingdifference of  two fields.   ITAB-ANZHL and ITAB-ABWTG .
. i have taken a variable A FOR balence Quota. in itab i have defined A TYPE C,  in field catalog i have written
'A'    'ITAB'   'BALENCE QUOTA'. so how need to perform coding for calcualte balence quota.
A is for balence quota.
Thanks,
Regards,
Saurabh

DATA : BEGIN OF ITAB OCCURS 0 ,
       PERNR LIKE PA2006-PERNR,
       KTART LIKE PA2006-KTART,
       KTEXT LIKE T556B-KTEXT,
       ANZHL LIKE PA2006-ANZHL, " Quota number
       BEGDA LIKE PA2006-BEGDA,
       ENDDA LIKE PA2006-ENDDA,
       KVERB LIKE PA2006-KVERB,
       AWART LIKE PA2001-AWART,
       ATEXT LIKE T554T-ATEXT,
       STDAZ LIKE PA2001-STDAZ,
       ABWTG LIKE PA2001-ABWTG,
       KALTG LIKE PA2001-KALTG,
       A TYPE I,
      END OF ITAB.
      DATA : B TYPE I.
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : PERNR FOR  PA2006-PERNR NO-EXTENSION NO INTERVALS .
SELECT-OPTIONS : BEGDA FOR  PA2006-BEGDA NO-EXTENSION NO INTERVALS.
SELECT-OPTIONS : ENDDA FOR  PA2006-ENDDA NO-EXTENSION NO INTERVALS.
SELECTION-SCREEN : END OF BLOCK B1.
'PERNR'  'ITAB'  'Personnel no',
*'GJAHR'  'ITAB'  'Year',
'KTART'  'ITAB'  'Absence Quota type',
'KTEXT'  'ITAB'  'Text',
'ANZHL'  'ITAB'  'Quota Number',
'KVERB'  'ITAB'  'Quota Deduction',
'BEGDA'  'ITAB'  'Start',
'ENDDA'  'ITAB'  'T0',
'AWART'  'ITAB'  'Absence Quota Type',
'ATEXT'  'ITAB'  'Text',
'STDAZ'  'ITAB'  'Absence hours',
'ABWTG'  'ITAB'  'Absence Days',
'KALTG'  'ITAB'  'Calender Days',
'ABWTG' 'ITAB'   'Quota Used',
'A'      'ITAB'  'Balence Quota'.
SELECT   M1~PERNR
         M1~KTART
         M1~ANZHL
         M1~BEGDA
         M1~ENDDA
         M1~KVERB
         M2~AWART
         M2~STDAZ
         M2~ABWTG
         M2~KALTG  INTO CORRESPONDING FIELDS OF TABLE ITAB
                   FROM PA2006 AS M1
                   INNER JOIN PA2001 AS M2
                   ON M1PERNR = M2PERNR
                     AND M1BEGDA = M2BEGDA
                     AND M1ENDDA = M2ENDDA
                   WHERE M1~PERNR IN PERNR AND
                         M1~BEGDA IN BEGDA AND
                         M1~ENDDA IN ENDDA .
     IF SY-SUBRC <> 0 .
     MESSAGE 'DATA NOT FOUND' TYPE 'W' .
     ENDIF .
LOOP AT ITAB .
SELECT SINGLE KTEXT FROM T556B INTO (ITAB-KTEXT)  WHERE KTART = ITAB-KTART.
SELECT SINGLE ATEXT FROM T554T INTO (ITAB-ATEXT) WHERE AWART = ITAB-AWART.
MODIFY ITAB INDEX SY-TABIX TRANSPORTING KTEXT ATEXT.
ENDLOOP.

Similar Messages

  • How do I subtract two fields in a form?

    I am working on an expense form and I have everything working except one thing.
    We have to subtract any over payments from previous expense reports on the current expense report. I am looking at the calculate tab of the Text Field Properties.  But I do not see a way to subtract my two fields.
    I then setup a field that contains a negative one, except when I display the field on the form, the negative one is a positive one.  I did enter -1 as the default value to my "subtraction" field.  I was then going to multiple negative 1 against the the over payment amount so I could get a negative over payment amount.  I was then going to add the negative over payment amount to the total due and arrive at a net due,  But this does not work.
    Here is the calculation I am trying to do:
    Total Expenses     (calculated field from all of the preceding fields.)
    Deductible Expense       (user entered)
    Net Expense check          (Total Expense - Deductible expense).
    Can anyone tell me how to do this?
    thanks,
    Dennis

    With Acrobat there are 3 calculations options.
    "The field is the ____ of the following fields:" options are for sum, product, average, min, and max operations or for actions that could be repeated over multiple fields. One does not usually subtract or divide multiple fields in on action.
    "Simplified field notation" uses only field names and values. Field names must start with an alphabetic character and should not have any spaces or special characters. Cannot perform conditional control statements or functions. Special characters or spaces can be in field names if the JavaScript escape character precedes the special character or space. The 4 arithmetic operations can be performed.
    "Custom JavaScript calculation" has no restrictions on field names, control statements, functions or mathematical operations. One needs to access the field object and the value property of the field object.

  • How to separate two fields in Text element of Smartform??

    Hi,
    I am trying to separate two fields by a space, for example &WA_ACC-G_L_ACCT& &GV_ACCT_TXT&, but evry time I save the smartform the space disappears and output is continous like 56000Product Materials.
    The desired Output I am looking for is something like 
    56000  Product Materials.
    How do I do this ??
    Thanks

    Hi ,
      U can try what Narendra has said ,if u are not able achieve then do this :
    Create constant c_space type char1 value space
    and try printing it between ur variables, ur problem is solved this way
    Reward if u find it useful
    Regards
    Sapsurfer

  • How to get two fields with same tech name in LIS Extractors?

    Hi Experts,
    I need "ERDAT" field from two structures (QMSM & QMFE) in 2LIS_18_IOTASK extractor.
    In LBWE first I moved ERDAT from QMSM. When I moved ERDAT from QMFE it gives an error:
    "Field with same technical name is already available in the Extract Structure".
    I don't want to create Append Structure as we need to write User exit.
    Can any one tell me how to get this field added in the extractor from QMSM and QMFE?
    Thanks for your help.
    Regards,
    Sree

    this is not possible as the all those fields are put in one structure. per definition you can't put the same field name twice in a structure, table in the data dictionary...
    hence, you really need to use an append and fill via user exit
    M.

  • How to compre two fields: one whith Decimal and other without decimal?

    Hi all,
    I am doing a file to IDOC scenario.
    In file strcture I have to compare two fields.
    ActiveHSCode and Decree166HSCode where
    ActiveHSCode comes with decimal values like for eg 1234.56.789.0 and Decree166HSCode comes with values like for eg 1234567890 or 4567891230 etc.
    I have to ignore decimal point from ActiveHSCode and compare with Decree166HSCode,
    If both of them are equal I have set ActiveIndicator as'Y' else 'N' and map this field to IDOC's field.
    How to achieve this?
    Please suggest.
    Regards,
    Sachi

    Hi,
    Since all the fields in mapping comes by default as a  string ....
    you first extract the value from ActiveHSCode using the string functions.
    Then compare the
    ActiveHSCode and  Decree166HSCode.
    Since u want to check only for the equality dont convert them to numbers.
    Directly check as a string.
    The code for extracting the value without decimal value is..
        String s = "12345.6789";   
        s=s.substring(0,s.indexOf(".")) s.substring(s.indexOf(".")1);    
        System.out.println(s);
    result:123456789
    Babu.

  • How to check two fields are matching in a validator?

    I have a "Password" field and a "Conform password" field. I like to check whether these two fields are matching in the password_validate(FacesContext context, UIComponent component, Object value) method. How to do that?
    Thanks.

    The actual problem is you can't get the value of one
    component into the next component's validator
    method.I do not find this to be true. For example, in the blog that I gave the URL to, you can see this code
    public void endCalendar_validate(FacesContext context, UIComponent component, Object value) {
    Date endDate = (Date)value;
    Date startDate = startCalendar.getSelectedDate();
    Here the validator for the endCalendar component is getting the value from a different component, the startCalendar component.

  • How to use two "field separator" in the same Comunication Channel

    Hi experts,
    I  upload flat files with XI, and my Comunication Channel is configured to use the field separator "~".
    FILA.fieldSeparator     ~
    Is posible to configure that Comunication Channel to accept two field separator. I want that upload flat files that has as separator "~" and flat files that has "|" .
    thanks
    regards

    IT IS not possible to have 2 fieldseparator to identify the fields of a record.

  • VL01NO : how to add two fields

    Hi,
    Is there any possibility to add two fields (Format text) for Tcode : VL01NO because i want to enter two other informations ?
    Please help
    Regards.

    Hi jehade el aoumari  ,
    We can add the fields with the help of screen exits (BAdis) provided that , SAP has giving the feature to add to this particular transaction. This is work of ABAPer and they will add the fields , and they will popullate the appropriate database table as well.
    But pls tell me what exactly is your requirement so that we will let you know whether the option is available or not.
    Regards,
    Vvieks

  • How to switch two fields with one of them OBLIGATORY

    Hi everyone,
    i have two radio button on the screen: RD_A  and RD_B, while there are two fields corresponding to them: P_A and P_B, P_A is OBLIGATORY.
    i want to implment: when i click RD_A, field P_A is enable and field p_B is disable. when i click RD_B, field P_B is enable and field P_A is disable.
    i tried using LOOP AT SCREEN ...screen-input = '0' and screen-required = '0' ....MODIFY SCREEN...statements, but it cannot work fine. when i switch from A to B, it always popup error message 'Fill in all required entry fields'.
    can anyone help me? thanks in advance!

    you can try this approach, instead of using Obligatory Addition.
    REPORT  ztest_radio.
    TABLES: sflight.
    SELECT-OPTIONS: carrid FOR sflight-carrid,
                    connid FOR sflight-connid.
    PARAMETERS: r1 RADIOBUTTON GROUP g1 USER-COMMAND abc DEFAULT 'X',
                r2 RADIOBUTTON GROUP g1.
    AT SELECTION-SCREEN OUTPUT.
      IF r1 = 'X'.
        LOOP AT SCREEN.
          IF screen-name CS 'CONNID'.
            screen-input = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ELSE.
        LOOP AT SCREEN.
          IF screen-name CS 'CARRID'.
            screen-input = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
    AT SELECTION-SCREEN.
      IF sy-ucomm = 'ONLI'.   "This triggers only when you press execute button
        IF r1 = 'X'.
          IF carrid IS INITIAL.
            MESSAGE 'Enter Carrid' TYPE 'E'.
          ENDIF.
        ELSE.
          IF connid IS INITIAL.
            MESSAGE 'Enter Connid' TYPE 'E'.
          ENDIF.
        ENDIF.
      ENDIF.

  • How to concatenate two fields CSKS-KOSTL & CSKT-LTXT in BEx Query?

    Hi,
    I have a requirement to concatenate two fields CSKS-KOSTL (Cost Center) and CSKT-LTXT (Cost Center Text) and show them as one field in the BEx query.
    I do not know what to do, so please help me out.
    Thanks in advance.
    Regards
    Harman

    Hi Harman,
    If cost center is a masterdata, it can have its own text..i doubt why do u have 2 different fileds..
    Anyways if its a masterdata object maitaining its own text, then in the query properties under Display tab select Key&Text option this give you both key and text values in the output.
    If its two different fileds then its better to use concatenate in the transformation.
    Regards,
    Geetha

  • How to combine +two fields without submitting page (via AJAX/HTMLDB_Get)?

    Hi all,
    After my last contribution "Request for Scott Spendolini" I was able to create the scripts to update fields in forms without having to refresh the page. Thanks again to Scott, Carl and the others who helped me solving my problem.
    I have another question regarding this however. How do I combine two (or more) values on a form to fill a field with the values, for instance to create a unique Primary-key field?
    This is the example: combine the postcode and the house-number (and maybe an extension to the housenumber) in one field 'adrescode'. This uniquely identifies an adress in the Netherlands. I can 'get' the postcode to fill the first part of the adrescode, but how do I modify the scripts to 'get' the housenumber (huisnummer) and - if not left null - the extension to the housenumber?
    Here are the scripts I created to far:
    in the region source of the page I have the following Javascript:
    <script language="JavaScript1.1" type="text/javascript">
    function f_P52_getAdrescode ()
    var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=P52_getAdrescode',0);
    get.add('P52_POSTCODE',html_GetElement('P52_POSTCODE').value)
    gReturn = get.get();
    if(gReturn)
    {  html_GetElement('P52_ADRESCODE').value = gReturn  }
    else
    {  html_GetElement('P52_ADRESCODE').value = 'null'  }
    get = null;
    </script>
    and in the shared components of the application I have created an process P52_getAdrescode as follows:
    declare
      l_adrescode varchar2(16);
    begin
        l_adrescode := :P52_POSTCODE || :P52_HUISNR ;
        if :P52_HUISNRTOEVOEGING is null then
              NULL ;
        else
              l_adrescode := l_adrescode ||':'||:P52_HUISNRTOEVOEGING ;
        end if ;
        htp.prn(l_adrescode);
    -- dbms_output.put_line(l_adrescode);
    end;
    I ran this PL/SQL in the SQL-section of HTMLDB and it does what a expect: combine the values in a new string.
    In my page however, it only gets the value of postcode and puts this into the adrescode field.
    So my question is: how do I modify the Javascript (I Guess) so that also the fields 'huisnummer' and 'huisnummertoevoeging' end up in the adrescode field?
    Thanks for your help,
    Jan.

    Carl, Scott,
    I have two pages with exact the same fields and codings (as described before in this Post.
    I now have two different named functions and application processes, a javascript an process for each page. They both do the same thing, use the same code except for the page-number (:P52_ and :P92). I tried to make one process to replace both, but ran into problems when I changed the name in the get.add statement.
    Changing the get.add from: get.add('P52_POSTCODE',html_GetElement('P52_POSTCODE').value) to: get.add('POSTCODE',html_GetElement('P52_POSTCODE').value) always ends up in what looks like a complete html-(source)dump of the page in the field that has to be updated. Even when I replace the :P52_POSTCODE in the application process as well Changing back the application process and the javascript to so that both javascript and process use the :P52_ again and the function returns the correct value again. What am I doing wrong?
    I requested an online-workspace to post the application to it, but have no answer to my request yet, so I can't provide a working example at the moment....
    Thanks for your help again,
    Jan.

  • How to map two fields to one field

    Hi, All,
    I have three datastore objects (three data fields): Year, term, and period key. Their relationship is like this:
    If year = 2010, term = '010', period key will be "1010".  In selection screen, I want users to input year (2010) and term (010), but get the report with period key = '1010'. Does anybody can tell me how to do that?
    Thanks.
    Marea

    Hi,
    Here two options as our experts said  through customer exit
    By creating the project with ompnets EXIT_SAPLRSAP_001
    Then write code when first two varibleas are entered means ( user entry varibles year and term) then execute the third varible  period key
    for that a smaall code is required  u can write it .
    when the customer exit varibles executes it fetches data form bith user entry varibles and update last 2char from year and last 2 char from period that is concept u can ask ur abaper fro small help.
    If not
    if you are willing to do at tranformations level just add one more field as period key  and activate it ,in transformations level u can assign both year and term to period key and write a small routien as below
    result  = source_fields-year 2(4) + source_fields-term1(3).
      choice is urs as per ur flexibility u can aceive the above requirement.
    Thanks & Regards,
    sathish

  • How to compare two fields from different list sharepoint designer?

    hi All,
    I need to add a value to a field using SharePoint designer workflow. The value is from another column.
    for example list A has the field has loginID,  and another list B has loginID  amd another column called Desig.
    i need to compare both and get the Desig field and store it to a column. how do i do that in sharePoint Designer workflow.

    Hi, 
    you can create a workflow variable ex.Test. and add an action set Workflow variable. Then you have to set this variable value using lookUps. something like(in look up window)
    Data source: Choose List B
    Field from source: Choose Desig
    Then under find the list item
    Field: Choose login Id
    Value :(Again open lookup window by clicking "fx") and in this window choose 
        data Source: List A
      field from source :LoginId
    and click ok.
    attached is the image for your reference. (I am using other lists,you can change appropriately )

  • How to hide two fields in SharePoint list when a dropdown value selected?

    Hi all,
    I have a SharePoint list which have four columns 1 Title 2.Type (Dropdown: option1:Issues Option2:Risk) 3.Risk Name and 4.Risk type. If 'type' value is 'Issues' then I need to hide field 3 and 4. In other words, default value in dropdown should be 'Issue'
    and want to hide field 3 and 4 are onload without using InfoPath.
    How to achieve this? Thanks in advance!

    You can make use of jquery for the same. Add script editor webpart on the page and access the dropdown value and based on the value you get, show or hide the fields. Below are some pointers.
    http://sachinvkatkar.blogspot.in/2013/02/hide-fields-from-sharepoint-newform.html
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/50aa6f8d-f742-4400-82f3-7949ab1c215e/need-help-manipulating-form-fieldsrows-using-jquery?forum=sharepointdevelopmentprevious#802d9d4d-c19b-4752-a4fb-e38f40f50c51
    http://social.technet.microsoft.com/wiki/contents/articles/21730.sharepoint-2010-conditionally-hide-fields-on-standard-list-forms-using-jquery.aspx
    http://sharepointnadeem.blogspot.in/2013/09/sharepoint-showhide-list-column-based.html
    Geetanjali Arora | My blogs |

  • How to subtract two time?

    How to do TimeA-TimeB=TimeC?
    Solved!
    Go to Solution.
    Attachments:
    Time.jpg ‏44 KB

    I think NI need to improve subtract.
    lol!!!!
    Wait a minute. Are you seriuos?

Maybe you are looking for

  • IDoc Error

    Hi there I am getting the below error at the time of generating an IDoc No account for cash management payment advice; FI payment advice: 1000 D 0000100023 06007576 I thought this must be due to the ''Open item management' being supressed on the GL M

  • OS 10.4 clients cannot access Shared Mac folder on W2k Server - URGENT

    We have a network of about 25 computers, 10 or so of them are Mac OS 10.4, the rest are Win XP Pro PCs. We have a server dedicated to file sharing. We basically have one main shared folder called "FILES". This is shared for PCs and Macs. Recently aft

  • I use preview for my work and since switching to Lion it's unusable.

    Preview has become useless to me. I have to resize photos to upload them at my newspaper. Sometimes, for some God-known reason, I have to switch formats and switch back to make them upload on my website. In the old Preview, I could simply do a screen

  • What is a good free app for presentations or notes in iPad?

    Hey I am looking for free app for presentations on iPad like to put and read my presentations or notes so which app do you advice me with? thanks

  • Nothing is moving

    Since I upgraded to Icloud nothing is moving even when I sync.  Used to be when I added contact to my phone or Ipad it was on my mac, that was with mobile me.  Since I upgraded to Icloud - can't even get stuff from my Iphone contacts to show up on my