Carrying some calculations in ABAP

Dear Friends,
We are having two ztables. One table which is quantity table is hving fields Co Code, Bus Area, Item & Quantity. In this table mainly Items are of 4 types. In the other ztable which is rates table we are having fields like Year, Product 1, Product 2, Product 3, Product4 , Product 5, Product 6 in which we are maintaing rates.
Now, we want if the Itam is like Product 1 then it should take the quantity from the table 1 for that particular combination of Co Code & Bus Area then multiply it with the unit rate given in othr table.
Plz guide me in this in writing the code.
Thanx
nishu

Hi Nishu,
You can execute this code.
REPORT zkun_sdntable .
TABLES: zkun_quanttab, zkun_ratetab.
DATA: BEGIN OF itab1 OCCURS 0.
        INCLUDE STRUCTURE zkun_quanttab.
DATA: END OF itab1.
DATA: BEGIN OF itab2 OCCURS 0.
        INCLUDE STRUCTURE zkun_ratetab.
DATA: END OF itab2.
DATA : val TYPE zkun_quanttab-my_qty,
       rate TYPE zkun_ratetab-p1.
DATA : BEGIN OF itab3 OCCURS 0,
       value TYPE zkun_quanttab-my_qty,
       my_ccode TYPE zkun_quanttab-my_ccode,
       my_barea  TYPE zkun_quanttab-my_barea,
       my_item TYPE zkun_quanttab-my_item,
       my_year TYPE zkun_ratetab-my_year,
       END OF itab3.
SELECT * FROM zkun_quanttab INTO TABLE itab1.
SELECT * FROM zkun_ratetab INTO TABLE itab2.
val = 0.
rate = 0.
LOOP AT itab1.
  LOOP AT itab2.
    CASE itab1-my_item.
      WHEN 'P1'.
        rate = itab2-p1.
      WHEN 'P2'.
        rate = itab2-p2.
    ENDCASE.
    val = val +  rate * itab1-my_qty.
  ENDLOOP.
  itab3-value = val.
  itab3-my_ccode = itab1-my_ccode.
  itab3-my_barea = itab1-my_barea.
  itab3-my_item = itab1-my_item.
  itab3-my_year = itab2-my_year.
  APPEND itab3.
  val = 0.
ENDLOOP.
LOOP AT itab3.
WRITE : / itab3-my_ccode, itab3-my_barea, itab3-my_year , itab3-my_item,
    itab3-value.
ENDLOOP.
Hope this solves your query.
Regards,
Kunal.
Note :
The structure of table <b>zkun_quanttab</b> contains
my_ccode for company code, my_barea for business area, my_item for item and my_qty for quantity.
The structure of table <b>zkun_ratetab</b> contains
my_year for year, p1 for product1, p2 for product2 etc.

Similar Messages

  • Some Calculations are not working in Discoverer 10g after upgrade from 4.1

    Hi Gurus,
    We are recently upgraded Oracle Discovere 10g from 4.1, some calculations are not working in Discoverer 10g. I appreciate if you could fix below calculation(s) in 10g.
    CASE WHEN TRUNC("Expenditure Item Month") = '31-JAN2007' THEN SUM(Wtd Qty A) WHEN TRUNC("Expenditure Item Month") = '28-FEB-2007' THEN SUM(Wtd Qty A) WHEN TRUNC("Expenditure Item Month") = '31-MAR-2007' THEN SUM(Wtd Qty A) END
    Thanks & Regards
    Vikram

    Sabra,
    Not sure exactly what this might be... there could be an issue there.
    Please make sure that you review the upgrade.log. Are there any errors / warnings?
    Also, you might wanna peek the Metalink Note:262623.1 - Master Note for OracleAS Portal Upgrade Issues, where you'll find some nice things where to start looking at.
    Later you may wanna open a Service Request into the Oracle Support.
    I hope it helps...
    Cheers,
    Pedro.

  • Plz suggest some documents for ABAP in ECC 6.0.

    Hello,
    Could u plz suggest some documents for ABAP in ECC 6.0.
    Regards,
    Vibhuti

    Hi,
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5ac31178-0701-0010-469a-b4d7fa2721ca
    Thanks,
    Sankar M

  • Mathematical calculations in ABAP Query

    Dear gurus
    Can I perform mathematical calculations in ABAP Query?
    Kingly guide
    MK

    Hi
    You would need tables - AFPO, AUFM, MSEG, MAKTX (if you need mtl description).
    Use AFPO table to pass your FERT material number, then read the order numbers for this order.
    Now in AUFM there is an Index on AUFNR field, so you can pass all the order nos. of the FERT to this field.
    If you want to limit for a certain period, then use AUFM-BUDAT which is the posting date.
    Now add all the 261 movements for which there is no 262 movement, you can check for reversals in MSEG table. This you can do per component & display the data as per your need.
    Regards,
    Vivek
    Added
    You can get this info in COOIS report as well, by selecting List option as Documented Goods Movement & by using suitable filter options.

  • Array calculation in ABAP

    hi gurus,
    I have to use array for some calculations. I begin new project and have to calculate distance with using array. I searched forums but I found nothing. please help me?
    thanks,

    #include <stdio.h>
    int main()
    int m,n,mat[100][100],i,j,l;
    int a,b,top,max=50000;
    char k1='c';
    printf("total country = ");
    scanf(" %d", &n);
    printf(" total direction = ");  // total road: A-C is a road B-G is another road
    scanf(" %d", &m);
         for(i=1;i<=n;i++){
              for(j=1;j<=n;j++){
                   mat<i>[j]=max;
    for(i=1;i<=n;i++)
        mat<i><i>=0;
    for(i=1;i<=m;i++)
    printf("enter first country ");
    scanf("%d", &a);
    printf("enter second country",i);
    scanf(" %d", &b);
    printf("intervals of countries");
    scanf("%d", &mat[a]<b>);
    mat<b>[a]=mat[a]<b>;
    for(l=1;l<=n;l++)
         for(i=1;i<=n;i++)
                              for(j=1;j<=n;j++)
                                        top=mat<i>[l] + mat[l][j];
                                              if(top < mat<i>[j]){
                                                 mat<i>[j]=top;
    while(k1 != 'q')
    printf(" enter to find interval of 2 countries = ");
    scanf(" %d", &a);
    scanf(" %d", &b);
    printf(" min interval = %d \n",mat[a]<b>);
    printf(" q for quit any key for continue = ");
    scanf(" %c", &k1);
    intervals: 1) A-B = 600
    2) A-C=50 C-F=150 F-G= 200 G-B=50 (that is A-B = 450)
    3) A-D=100 D-H=200 H-G=50 G-B=50. (that is A-B = 400)
    example records in my table
         A   | B    | C  | D    | F    | G | H
    A | 0   | 600 | 50 | 100 | -     | -   | - 
    B |600 | 0    | -   | -      | -     | 50| -
    C | 50 |  -    | 0   | -      | 150| -   | -
    D |100 | -    | -    | 0     | -    | -   |200
    F |-     | -     |150|  -     | 0   |200|-
    G |-    | 50   |-    | -      | 200| 0  |50
    H |-    |-      | -    | 200 | -     | 50| 0
    after program run
         A   | B     | C   | D    | F    | G    | H
    A | 0    | 400 | 50  | 100 | 200 |350  | 300 
    B |400 | 0     | 400| 300 | 250 | 50   | 100
    C | 50  | 400 | 0    | 150 | 150 | 350 | 400
    D |100 |300  | 150 | 0    | 300 | 250 |200
    F |200 |250  |150  |300  | 0    | 200 |250
    G |350 | 50  |350  | 250 | 200 | 0    |50
    H |300 |100 | 400 | 200 | 250 | 50   | 0
    I dont update my table. I just want find direction and min interval to go from A to B.
    I think not hard for gurus.
    thank all for help.

  • Carry some values to the next page

    Hi Friends,
    i do have urgent problem, below is my requirement -
    1)i have a search page, in that i have delete, update , detail icons to navigate pages.here delete and update OK.
    2)when i click the detail icon in search page , i want carry some fields to detail page.i have a Eo based VO. in that Vo , i am making some fields to join with the other table-these fiedls i want carry to detail page.
    Thanks
    vamshi

    Hi Pratap,
    "I am getting values in log window- where as values are not rendering at application." - means down of the jdeveloper window please observe we have (Message,Embeded OC4J Server, Compiler)
    Process request code:
    String ProgId = pageContext.getParameter("ProgId");
    String ProgName = pageContext.getParameter("ProgName");
    System.out.println("proganme"+ProgName );// this value is coming down of the jedeveloper in my case log window.
    String Product = pageContext.getParameter("Product");
    String BusinessUnit = pageContext.getParameter("BusinessUnit");
    String Region = pageContext.getParameter("Region");
    String ComponentType = pageContext.getParameter("ComponentType");
    String Category = pageContext.getParameter("Category");
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    Serializable [] parameters = {ProgId,ProgName,Product,BusinessUnit,Region,ComponentType,Category};
    am.invokeMethod("initSupDetails",parameters);
    Process FormRequest:NO code.
    I think you got my point.
    Thanks
    vamshi

  • HT1338 In order to some calculator functions on the "Bankrate" website I need to enable the Java Browser function.  I can I accomplished that task?

    In order to some calculator functions on the "Bankrate" website I need to enable the Java Browser function.  I can I accomplished that task?

    In recent versions of Lion, Java is automatically disabled (for security reasons) if it goes unused for a certain amount of time.  You can re-enable it in the General pane of the Java Preferences app, found in /Applications/Utilities.  (Check the box at the top of that pane.)  If trying to open Java Preferences results in a message asking if you want to install Java, you don't actually have Java yet.  Click the install button to install it.
    Note that having Java turned on in your web browser is dangerous, due to recent proliferation of malware that uses Java to install itself.

  • Key Figure calculation in Abap is not working correctly - Overlooping

    Hi,
    I wrote a logic to calculate the ratio of key figure but it is not working correctly
    For example I have a requirement to split 1 Product into Several new Products and also the Net Amount will be splitted to these several new products as well. The total Amount of the new product will be equivalent to the Net Amount.
    So far my Logic is splitting the product to several new products but the amount is incorrect as the calculation is over looping.
    Sample
    A PRODUCT has Net Amount 1000. And this product needs to be splitted into 3 new products. Each of this new product is assigned a ratio of 0.3, 0.2 and 0.7 respectively. total sum of the ratio is 1.
    PRODUCT1 0.3 = 1000 * 0.3 = 300
    PRODUCT2 0.2 = 1000 * 0.2 = 200
    PRODUCT3 0.7 = 1000 * 0.7 = 700
    The total amount of this new products is 1000.
    Now my logic is working this way.
    PRODUCT1 0.3 = 1000 * 0.3 = 300
    PRODUCT2 0.2 = 1000 * 0.2 * 0.3 = 60
    PRODUCT3 0.7 = 1000 * 0.2 * 0.3 * 0.7 = 42
    Only the PRODUCT1 is working correctly and there is overlooping for the remaining products
    Logic used
    DATA: t_data TYPE data_package_structure OCCURS 0 WITH HEADER LINE.
    DATA: t_newdso LIKE /bic/newdso OCCURS 0 WITH HEADER LINE.
    DATA: t_olddso LIKE /bic/olddso OCCURS 0 WITH HEADER LINE.
    DATA: amount LIKE data_package-netamount.
    DATA: zidx LIKE sy-tabix.
    REFRESH t_data.
    LOOP AT data_package.
      zidx = sy-tabix.
      MOVE-CORRESPONDING data_package TO t_data.
      REFRESH t_newdso.
      SELECT * FROM newdso INTO TABLE t_newdso WHERE prod =
      data_package-prod.
      SORT t_newdso BY prod.
    *LOOP AT T_NEWDSO.
      READ TABLE t_newdso WITH KEY prodh4 = t_data-prod.
      IF sy-subrc EQ 0.
        LOOP AT t_newdso.
          t_data-prod = t_newdso-/bic/znew_mp.
          t_data-material = t_newdso-material.
    *T_DATA-NETAMOUNT = T_DATA NETAMOUNT * T_NEWDSO-/BIC/ZSP_RATIO.*
          APPEND t_data.
        ENDLOOP.
      ELSE.
        REFRESH t_olddso.
        SELECT * FROM olddso INTO TABLE t_olddso WHERE prod =
        data_package-prod.
        SORT t_olddso BY prod.
        READ TABLE t_olddso WITH KEY prodh4 = t_data-prod.
        t_data-prod = t_olddso-prod.
        t_data-material = t_olddso-material.
        APPEND t_data.
      ENDIF.
      MODIFY data_package INDEX zidx.
    ENDLOOP.
    REFRESH data_package.
    data_package[] = t_data[].
    thanks
    Edited by: Matt on Sep 27, 2010 2:25 PM - added  tags

    Hi,
    I am not really good at debugging Abap code since I am a newbie. however  I have tried to add CLEAR T_DATA before the first loop.
    REFRESH T_DATA.
    LOOP AT DATA_PACKAGE.
    ZIDX = SY-TABIX.
    MOVE-CORRESPONDING DATA_PACKAGE TO T_DATA.
    and before the second loop and select statement and at the end of the loop.
    REFRESH T_NEWDSO.
    SELECT * FROM NEWDSO INTO table T_NEWDSO WHERE PROD =
    DATA_PACKAGE-PROD.
    SORT T_NEWDSO BY PROD.
    READ TABLE T_NEWDSO WITH KEY PROD = T_DATA-PROD.
    IF sy-subrc EQ 0.
    LOOP AT T_NEWDSO.
    but then not all data are being fetched.
    thanks
    Edited by: Bhat Vaidya on Sep 28, 2010 8:33 AM

  • How to hide some fields in ABAP Query

    Hi,
    My ABAP Query has a long list of extracted fields. I wanted to set some of these output to "HIDE".
    This allow User the flexibility to decide what fields to show.
    How can I set the field to "HIDE" in my query?
    Thanks
    bye

    Hi Tim,
    You can do this by setting the Report layout variant in following steps:
    1. First define the parameter on selection screent for report variant.
    2. Data decelaration for variant.
    3. Value request to get already present variants on report:
    4. If doesn't choose the layout take out the default report layout.
    5. Initialize the report variant.
    6. Apply the variant to the REUSE_ALV_GRID_DISPLAY funtion module.
             Here to generate report variant first to open report output and then as per according to user set the layout of report using the layout icon of ALV with summation on value fields (as required) and create layout name.
    *Data Deceleration as below:
    Data :g_save(1) TYPE c,
    **      g_default(1) TYPE c,
    g_exit(1) TYPE c,
    gx_variant TYPE disvariant,
    g_variant TYPE disvariant.
    *First Define the parameter to give layout of Report variant.
    SELECTION-SCREEN BEGIN OF BLOCK 3 WITH FRAME TITLE text-003.
    PARAMETERS: p_vari TYPE disvariant-variant.
    SELECTION-SCREEN END OF BLOCK 3.
    * Process on value request
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
    PERFORM f4_for_variant.
    * Selection-Screen Checking
    AT SELECTION-SCREEN.
    PERFORM pai_of_selection_screen.
    INITIALIZATION.
    w_repid = sy-repid.
    PERFORM variant_init.
    * Get default variant
    gx_variant = g_variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
    i_save     = g_save
    CHANGING
    cs_variant = gx_variant
    EXCEPTIONS
    not_found  = 2.
    IF sy-subrc = 0.
    p_vari = gx_variant-variant.
    ENDIF.
    FORM f4_for_variant .
    CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
    is_variant = g_variant
    i_save     = g_save
    IMPORTING
    e_exit     = g_exit
    es_variant = gx_variant
    EXCEPTIONS
    not_found  = 2.
    IF sy-subrc = 2.
    MESSAGE ID sy-msgid TYPE 'S'      NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    **  ELSE.
    **    IF g_exit = space.
    **    ENDIF.
    ENDIF.
    ENDFORM.                    " f4_for_variant
    FORM pai_of_selection_screen .
    IF NOT p_vari IS INITIAL.
    MOVE g_variant TO gx_variant.
    MOVE p_vari TO gx_variant-variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
    EXPORTING
    i_save     = g_save
    CHANGING
    cs_variant = gx_variant.
    g_variant = gx_variant.
    ELSE.
    PERFORM variant_init.
    ENDIF.
    ENDFORM.                    " pai_of_selection_screen
    FORM variant_init .
    CLEAR g_variant.
    g_variant-report = w_repid.
    ENDFORM.                    " variant_init
    **While Showing report pass the variant :::
    g_save = 'A'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = w_repid
    i_structure_name   = 'IT_MAIN'
    is_layout          = i_layout
    is_print           = i_print
    it_fieldcat        = i_fieldcat[]
    it_events          = i_events[]
    i_save             = g_save
    is_variant         = g_variant
    TABLES
    t_outtab           = it_main
    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.
    Many Thanks / Himanshu Gupta

  • Unable to carry out calculation of keyfigure with it's total summation taken on keyfigure

    Hi,
    For a requirement, we are trying to calculate division of a keyfigure with it's total summation of key figure.
    For example:
    Sales Office
    Order Reason
    Invoice Volume
    MRV Volume
    % of MRV Volume to total invoice volume
    % of MRV Volume to total MRV volume
    1504
    A1
    10
    2
    (2/90) = 2.22
    (2/27) = 7.40
    A2
    5
    3
    3.33
    11.11
    A3
    20
    10
    11.11
    37.03
    A4
    30
    5
    5.55
    18.51
    A5
    25
    7
    7.77
    25.92
    Total
    90
    27
    30
    100
    Here, Sales office and order reason are dimensions.
    Invoice volume and MRV volume are key figures.
    Following are the formula used to calculate other two keyfigures.
    % of MRV Volume to total invoice volume =  MRV Volume / Total ( Invoice Volume ) * 100
    % of MRV Volume to total   = MRV Volume / Total ( MRV Volume) * 100
    Kindly help us to get calculation of above two keyfigures to be carried out through BEx query designer.
    I tried out aggregation at order reason on Invoice volume, MRV Volume by creating two new formula keyfigures with the aggregation, but couldn't get desired output.
    Regards,
    Antony Jerald.

    Hi Antony,
    Use the same formula for these two keyfigures in BEx with SUMGT instead of Total.
    % of MRV Volume to total invoice volume =  MRV Volume / SUMGT ( Invoice Volume ) * 100
    % of MRV Volume to total   = MRV Volume / SUMGT ( MRV Volume) * 100
    Regards,
    Srilakshmi B

  • How to use mathematical calculations in abap

    Hi!
                                In my program,
                                 I declared one variable as w_h(2) type n.
    i am doing calculation as,
    w_h = 100 /60.
    its giving the o/p as 2(1.66...). but in 1.6 i want that 1 alone as my o/p.normally math function floor() is there to bring the o/p as 1. in abap how to use this floor function. or any other possible is there to get the o/p as 1.could anybody plz help me.

    define w_h  as i.
    data: w_h  type i.
    Edited by: mayank jain on Sep 8, 2009 9:42 AM

  • Where some (near) real ABAP OO programming  application?

    Hi OO programmers,
    I am reading about concepts, theory, syntax etc. of ABAP programming - this stuff is enough everywhere - BUT nowhere I can find (near) real application, where are dynpros, selecting data from database, reporting, etc. written (near) 100% in OO programming. I mean something, what is really working in production. Not some ridiculous demos (meaning in range). In SAP R/3 4.6 I can not find them(?) Have I wait on next upgrades?
    This does not mean, that using OO ABAP for the GUI Controls does not work - it is nice, and I am sure to use them - but this is all?
    Thanks,
    Alexander Talac.

    I think, ME21N (Purchase Order Enjoy) Transaction is pure OO, if I am not mistaken.
    Regards,
    Subramanian V.

  • Carry-forward Calculating Data, but not Updating

    Currently having difficulty in getting results to generate for the Balance Carryforward in BPC 7.0M version.  Receiving the following in the log message after the logic is executed:
    Executing SPCOPYOPENING  [FINANCE], [ACTUAL], [LC], [SPSCOPE_808950], [SPLOG_926445]
    SPCopyOpening Version 7.0.112
    336 Rows Calculated
    0 Rows Updated
    Questions:
    - Why only 336 rows Calculated?
    - Why 0 rows Updated?
    Background:
    -     Loaded 453 records of data into Time member 2007.012 for Actual category u2013 all records are related to balance sheet accounts.
    -     Added DIMLIST property to Account dimension and specified u2018BSu2019 for all base level balance sheet accounts and u2018ISu2019 for all income statement accounts.
    -     Actual category dimension member has OPENING_YEAR property with value of u20182007u2019 and OPENING_PERIOD property with value of u20182007.012u2019
    -     Configured Carry-forward Business Rules for the following:
    o     Source Account: u2018BSu2019 (in reference to all balance sheet accounts via the DIMLIST property of account)
    o     Source Flow: u2018TotalActivityu2019
    o     Destination Account: I left this blank as help documentation suggests that by doing so, the account will remain the same once carried forward
    o     Destination Flow: u2018OpenBalu2019
    o     Reverse Sign: I left this as unchecked
    o     Data Source Type: Input only (data was loaded into an Input data source)
    o     Same Period: I left this as unchecked
    o     Apply to YTD: I left this as unchecked (have also tried to run with this checked and obtain the same results as above)
    -     Input the following logic into Default.lgx:
    *SysLib Stored_Procedure_wrapper.lgl
    RunCopyOpening (FINANCE, LC, ACTUAL, 2008.001, 1001)
       (Have also tried RunCopyOpening (FINANCE, LC, ACTUAL, [%SCOPETABLE%], [%LOGTABLE%]) and received the same results)
    -     Executed the logic via Data Manager package and selected the following parameters:
    o     Category: Actual
    o     Entity: 1001 (the only entity for which data was loaded)
    o     Period: 2008.001
    I have reviewed the ['How-To'|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b026be43-40cf-2b10-6cae-ed8900ace7f9] document on setting up the Carryforward and also a few other postings on this board related to carry-forward and have tried suggestions in those threads to no avail.
    I would be grateful for any assistance you can provide and please let me know if you need any further details.
    Regards,
    Jim Link

    Kranthi,
    Thank you for the reply.  I understand what you are saying; however, when I run a report for 2008.Total, the balances that were loaded in 2007.012 and subsequently carried-forward are not showing up in the report.  I'm assuming that the beginning balances should be showing up on this report, correct?  I am running the report for all members of each dimension in the application, so I don't believe its an issue with my current view. 
    Regards,
    Jim

  • Some Questions regarding ABAP

    Hi All,
    1. What is the exact diffrence Between Diffrent Update Modes in BDC Process.
    What is the Diffrence B/N Synchronous[S] & Asynchronous[A] processing in Update mode. Ans Also what is the purpose of Local[L] Mode.
    2. What is meant by work processes in ABAP.
    3. In SAP Script in NACE when we connect Print Program[SE38] & Layout Set[SE71] there will be some common routine B/N them like ENTRY.
    WHat it actually does - FORM ENTRY.
                            ....ENDFORM.
    4. In ALV Output i want to change the color of particular row dynamically how can i change the same.
    Suppose i am having one row with one field (-)Negative Value that should be displayed in diffrent color, If Positive value need to be in diffrent color, Zero value need to be in diff color. how can i achieve this dynamically.
    5. I Have one issue in BDC I am running a CALL Transaction Method for one BDC program.
    In that if the process is successful or not i am creating a error Log in SM35.
    If the above CALL Transaction for BDC is successful i am updating 2 Z-Tables and if it unsuccessful i am creating a session[Error Log] in SM35 through Session Method.
    Now what i want is when if above CALL Transaction fails then Z-Tables will not be updated.
    Then user will go to SM35 and modify the log and Re-Process BDC from SM35. But here Z-Tables will not get updated though now process will run successfully.
    Means if the BDC fails, these updates to the Z-tables never happen even if we re-process the BDC & then we have an out of Sync condition.
    Can anybody give the solutions for the above issues.
    Thanks in advance.
    Thanks & Regards,
    Prasad.

    1.
    The main update technique for bundling database changes in a single database LUW is to use CALL FUNCTION ... IN UPDATE TASK. This section describes various ways of updating the database.
    A program can send an update request using COMMIT WORK
    ·        To the update work process, where it is processed asynchronously. The program does not wait for the work process to finish the update (Asynchronous Update).
    ·        For asynchronous processing in two steps (Updating Asynchronously in Steps.)
    ·        To the update work process, where it is processed synchronously. The program waits for the work process to finish the update (Synchronous Update).
    ·        To its own work process locally. In this case, of course, the program has to wait until the update is finished (Local Update.)
    http://help.sap.com/saphelp_nw04s/helpdata/en/41/7af4d7a79e11d1950f0000e82de14a/frameset.htm
    Local Update : In a local update, the update program is run by the same work process that processed the request. The dialog user has to wait for the update to finish before entering further data. This kind of update is useful when you want to reduce the amount of access to the database. The disadvantage of local updates is their parallel nature. The updates can be processed by many different work processes, unlike asynchronous or synchronous update, where the update is serialized due to the fact that there are fewer update work processes (and maybe only one).
    http://help.sap.com/saphelp_nw04s/helpdata/en/41/7af4d7a79e11d1950f0000e82de14a/frameset.htm
    2.
    Work process is a process that as a component of an application server executes an ABAP application.
    To process SAP requests from several front ends, an SAP application server has a dispatcher, which collects the requests and forwards them to work processes for execution.
    There are the following types of work process:
    Dialog
    For executing dialog programs
    Update, Upd2
    For asynchronous database updates
    Background (batch)
    For executing background jobs
    Enqueue
    For executing lock operations
    Spool
    For print formatting
    Work processes can be assigned to dedicated application servers. In the service overview (SM51), you can see which work process types are provided by the individual servers.
    Each work process is logged onto the database system as a user for the entire runtime of the SAP system.
    Each work process is assigned for the duration of a dialog step to an ABAP program.
    Check this link too.
    http://help.sap.com/saphelp_bw30b/helpdata/en/69/c24e104ba111d189750000e8322d00/frameset.htm
    3. Form entry in the driver program is the main sub-routine from which the execution of the driver program starts.
    You have to mention the from entry sub-routine in the NACE transaction where you will mention the program name, from name or in the TNAPR table
    The form ENTRY routine is present in your print program.
    In this routine you write your whole code of print program(like opening of your form, trigerring your form and closing your form and fetching data) and this routine is dynamically called by RSNAST00 program
    4. It is possible to paint some cells, rows, and columns through the ALV Grid control. Basically, with no additional effort, if you set a column to be a key column it is automatically colored. To paint we have the following procedures. 
    Cxyz
    C.6.1. Coloring an Entire Column
    To make an entire column be painted with the color you want, you can use the “emphasize” option of the field catalog. Simply assign a color code to this field of the row added for your column. Color codes are constructed as follows:
    Color numbers are:
    x      Color      Intended for
    1      gray-blue      headers
    2      light gray      list bodies
    3      yellow      totals
    4      blue-green      key columns
    5      green      positive threshold value
    6      red      negative threshold value
    7      orange      Control levels
    The “key setting” made via the field “key” of the field catalog overrides this setting. So if you want this color to be colored different than the key color, you should set the “key” field to space while generating the field catalog. However, then there may be some side effects on column orders. You can set the column order as you want at the frontend. But if this is not suitable for you, then unset all key settings and do all coloring and ordering as you want. Be careful that the function module generating the field catalog will always set the key properties of key fields.
    C.6.2. Coloring an Entire Row
    Coloring a row is a bit (really a bit) more complicated. To enable row coloring, you should add an additional field to your list data table. It should be of character type and length at least 4. This field will contain the color code for the row. So, let’s modify declaration of our list data table “gt_list”.
    Code Part 13 – Adding the field that will contain row color data
    As you guess, you should fill the color code to this field. Its format will be the same as explained before at section C.6.3. But how will ALV Grid know that you have loaded the color data for the row to this field. So, you make it know this by
    1/0:intensifiedon/off
    1/0:inverseon/off
    Colornumbers
    *--- Internal table holding list data
    DATA BEGIN OF gt_list OCCURS 0 .
    INCLUDE STRUCTURE SFLIGHT .
    DATA rowcolor(4) TYPE c .
    DATA END OF gt_list . 
    passing the name of the field containing color codes to the field “INFO_FNAME” of the layout structure.
    e.g.
    ps_layout-info_fname = . “e.g. ‘ROWCOLOR’
    You can fill that field anytime during execution. But, of course, due to the flow logic of screens, it will be reflected to your list display as soon as an ALV refresh occurs.
    You can color an entire row as described in the next section. However, this method is less time consuming.
    C.6.3. Coloring Individual Cells
    This is the last point about coloring procedures for the ALV Grid. The procedure is similar to coloring an entire row. However, since an individual cell can be addressed with two parameters we will need something more. What is meant by “more” is a table type structure to be included into the structure of the list data table. It seems strange, because including it will make our list data structure deep. But anyhow ALV Grid control handles this.
    The structure that should be included must be of type “LVC_T_SCOL”. If you want to color the entire row, this inner table should contain only one row with field “fname” is set to space, some color value at field “col”, “0” or “1” at fields “int” (intensified) and “inv” (inverse).
    If you want to color individual cells, then for each cell column, append a line to this inner table which also contains the column name at field “fname”. It is obvious that you can color an entire column by filling this inner table with a row for that column for each row in the list data table. But, it is also obvious that, this will be more time consuming than the method at section C.6.1.
    Again key field coloring will override your settings. That’s why, we have another field in this inner table called “nokeycol”. For each field represented in the inner table, set this field to ‘X’ to prevent overriding of key color settings.
    In this procedure, again we must tell the control the name of the inner table containing color data. The field “CTAB_FNAME” of the layout structure is used for this purpose.
    Code Part 14 – Adding inner table that will contain cell color data
    Code Part 15 – A sample code to make the cell at row 5 and column ‘SEATSOCC’ colored
    *--- Internal table holding list data
    DATA BEGIN OF gt_list OCCURS 0 .
    INCLUDE STRUCTURE SFLIGHT .
    DATA rowcolor(4) TYPE c .
    DATA cellcolors TYPE lvc_t_scol .
    DATA END OF gt_list .
    DATA ls_cellcolor TYPE lvc_s_scol .
    READ TABLE gt_list INDEX 5 .
    ls_cellcolor-fname = 'SEATSOCC' .
    ls_cellcolor-color-col = '7' .
    ls_cellcolor-color-int = '1' .
    APPEND ls_cellcolor TO gt_list-cellcolors .
    MODIFY gt_list INDEX 5 . 
    what happens if all these three procedures applied for coloring at the same time. The answer is given as there is a priority among them. The priority order is: cell setting - row setting - column setting. Beside these, key field setting must be handled.
    Cheers,
    Susmitha.
    Message was edited by: Susmitha Thomas
    Message was edited by: Susmitha Thomas

  • Need Help by some % calculation

    Hi Guys,
    i need some help calculating something.
    I have 5 boxes; "boxA" - "boxB" - "boxC" - "boxD" and "boxE". Box A–C are sums coming from other fields.
    "boxD" represent the VTA – and can be just 19% ore 0%.
    This means that "boxE" = ("boxA" + "boxB" + "boxC") * "boxD" ("box D" is equal with 0,19  – if the customer types 19% in the field – ore "0" (zero) – by leaving the "boxD" empty or typing the value "0" inside. A multiplication with 0 would be false, so it had to be ignored if the content of the "boxD" is 0)
    I suppose it will be something with "if" and "else" but how i say, I'm a greenhorn in this domain.
    Actually i found something that could help but i thing some parts – the definition of var v4, if v4 get the value 19% ore 0% – are missing.
    (function() {
       // Get the field values, as numbers
       var v1 = +getField("boxA").value;
       var v2 = +getField("boxB").value;
       var v3 = +getField("boxC").value;
       var v4 = +getField("boxD").value;
        // I suppose here comes some "if" "else" stuff for the definitoon of var4
       // Perform the calculation; the result is the content of the "boxE"
       var result = v4 * (v1 + v2 + v3);
       // Set the value of this field to the result
       event.value = result;

    I would make sure you are not having a problem with using the "," as the decimal separator.
    What problem are you having?
    Is there an error in the JavaScript console?
    If so, what is the exact wording?
    Have you examined the values within the script to make sure you are getting the value you are expecting?

Maybe you are looking for