Explain me this code

var fields = xfa.layout.pageContent(xfa.layout.page(this)-1, "field", 0);
var total = 0;
for (var i=0; i <= fields.length-1; i++) {
if (fields.item(i).name == "PRICE") {
total = total + fields.item(i).rawValue;
this.rawValue = total;

Hi Ankesh,
Basically this code is calculating the SUM of the PRICE fields contained in the Previous Page.  Please see my comments in the code below:
//Get all fields contained in the Previous page (xfa.layout.page(this)-1   means previous page)
var fields = xfa.layout.pageContent(xfa.layout.page(this)-1, "field", 0);
var total = 0;
//Loop through all the fields
for (var i=0; i <= fields.length-1; i++) {
//If the field name is PRICE
if (fields.item(i).name == "PRICE") {
//Then add the value of the field to the Total
total = total + fields.item(i).rawValue;
//Set the calculated Total value in "this" field.  "This" field is referring to the field that is actually calling this code.
this.rawValue = total;
Hope this helps,
harman

Similar Messages

  • Can someone explain me this code?

    Hi... pls explain me this code if possible.
    try {
    wdContext.nodeStateList().bind( (Z_Hress_P0006_State_Input)model.createModelObject(Z_Hress_P0006_State_Input.class));
    wdContext.currentStateListElement().setI_Withemptyline(true);
    wdContext.currentStateListElement().setI_Countrykey(
                        wdContext.currentCountryRecordsElement().getLand());
                   wdContext.currentStateListElement().modelObject().execute();

    Pankak,
    wdDoInit is a method in Web Dynpro controllers that ie executed when controller code is executed first time (initialized) its never run again in the lifespan of that controller (view controller, component controller, custom controller).
    You can get some more introductory material about Web Dynpro here
    https://www.sdn.sap.com/irj/sdn/developerareas/webdynpro?rid=/webcontent/uuid/063bc942-0a01-0010-e7ae-d138e97acb5a [original link is broken]
    Also I would suggest you to buy the Inside Web Dynpro book.
    http://www.sappressbooks.com/product.cfm?account=&product=H983
    This book will help to make your web dynpro concepts solid. I am assuming you know java.
    Regarding the point, i don't have much idea how to give the points, I assume when you close the question you can assign the points.
    Regards,
    Anand

  • Can anyone explain what this code does.

    <b>Below is the FM for a  SAP Exit Variable ( 0FPER - Fiscal Period Variable ) , I would really appreciate if someone can give some explanation what does the code do.</b>
    FUNCTION RSVAREXIT_0F_FPER.
    ""Lokale Schnittstelle:
    *"       IMPORTING
    *"             VALUE(I_VNAM) LIKE  RSZGLOBV-VNAM
    *"             VALUE(I_VARTYP) LIKE  RSZGLOBV-VARTYP
    *"             VALUE(I_IOBJNM) LIKE  RSZGLOBV-IOBJNM
    *"             VALUE(I_S_COB_PRO) TYPE  RSD_S_COB_PRO
    *"             VALUE(I_S_RKB1D) TYPE  RSR_S_RKB1D
    *"             VALUE(I_S_RKB1F) TYPE  RRO01_S_RKB1F
    *"             VALUE(I_THX_VAR) TYPE  RRO01_THX_VAR
    *"       EXPORTING
    *"             VALUE(E_T_RANGE) TYPE  RSR_T_RANGESID
    *"       EXCEPTIONS
    *"              UNKNOWN_VARIABLE
    *"              UNEXPECTED_VARTYPE
    *"              INVALID_PERIV
    *"              VARIABLE_INITIAL
    *"              NO_REPLACEMENT
      data:
      l_s_range   type rs_s_range,
      ld_periv    type rro01_s_rkb1f-periv,
      ld_curdate  like sy-datum,
      ld_poper    like t009b-poper,
      ld_fiscyear like t009b-bdatj.
      refresh e_t_range.
      clear l_s_range.
      l_s_range-sign = 'I'.
      l_s_range-opt  = 'BT'.
      case i_vartyp.
        when rro04_c_vartyp-formula.
    *--- Determine fiscal year variant
          call function 'BWCO_FISCVARNT_GET'
               exporting
                    i_s_rkb1d        = i_s_rkb1d
                    i_s_rkb1f        = i_s_rkb1f
                    i_thx_var        = i_thx_var
               importing
                    e_periv          = ld_periv
               exceptions
                    no_replacement   = 1
                    unknown_variable = 2
                    others           = 3.
          case sy-subrc.
            when 0.
            when 2.
              raise unknown_variable.
            when others.
              raise no_replacement.
          endcase.
          if ld_periv is initial.
            raise invalid_periv.
          endif.
    *--- Determine current fiscal year
          ld_curdate = sy-datum.
          call function 'DATE_TO_PERIOD_CONVERT'
               exporting
                    i_date         = ld_curdate
                    i_periv        = ld_periv
               importing
                    e_buper        = ld_poper
                    e_gjahr        = ld_fiscyear
               exceptions
                    input_false    = 1
                    t009_notfound  = 2
                    t009b_notfound = 3
                    others         = 4.
          if not sy-subrc is initial.
            raise invalid_periv.
          endif.
    *--- Determine the highest fiscal period in the current fiscal year
          CALL FUNCTION 'GET_ACCOUNT_OF_PERIODS'
               EXPORTING
                    I_GJAHR         = ld_fiscyear
                    I_PERIV         = ld_periv
               IMPORTING
                    E_ANZBUPER      = ld_poper
               EXCEPTIONS
                    INPUT_FALSE     = 1
                    T009B_NOTFOUND  = 2
                    T009_NOTFOUND   = 3
                    OTHERS          = 4
          IF SY-SUBRC <> 0.
                raise invalid_periv.
          ENDIF.
    *--- fill value ranges
          l_s_range-low = ld_poper.
          append l_s_range to e_t_range.
        when others.
          raise unexpected_vartype.
      endcase.
    endfunction.

    1) Fiscal year variant is determined using Function Module - 'BWCO_FISCVARNT_GET'
    2) With Fiscal variant & Current Date as input to Function Module - 'DATE_TO_PERIOD_CONVERT' gets Fiscal Year.
    3) With Fiscal year & variant as input to 'GET_ACCOUNT_OF_PERIODS' gets 
    the highest fiscal period in the current fiscal year

  • Could any one explain me this code pls

      IF sy-subty O print.
        CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
              mode                   = 'BATCH'
             no_dialog              =  'X'
            IMPORTING
                 out_archive_parameters =  arcpar
                 out_parameters         =  pripar
            EXCEPTIONS
                 archive_info_not_found = 1
                 invalid_print_params   = 2
                 invalid_archive_params = 3
                 OTHERS                 = 4
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        SUBMIT zhterot1 TO SAP-SPOOL
                             WITHOUT SPOOL DYNPRO
                             SPOOL PARAMETERS pripar
                             ARCHIVE PARAMETERS arcpar
    *                   SPOOL PARAMETERS %_print
    *                   ARCHIVE PARAMETERS %_archive
                       WITH pchplvar        =   pchplvar
                       WITH pchotype        =   pchotype
                       WITH pchobjid        IN  pchobji3
                       WITH pchseark        =   pchseark
                       WITH pchobeg         =   pchobeg
    *                    with PCHZTR_D        =   PCHZTR_D
    *                    with PCHZTR_M        =   PCHZTR_M
    *                    with PCHZTR_Y        =   PCHZTR_Y
    *                    with PCHZTR_A        =   PCHZTR_A
    *                    with PCHZTR_P        =   PCHZTR_P
    *                    with PCHZTR_F        =   PCHZTR_F
                       WITH pchbegda        =   pchbegda
                       WITH pchendda        =   pchendda
                       WITH pchwegid        =   pchwegid
                       WITH kurs            =   kurs
                       WITH kurst           =   kurst
                       WITH kugrp           =   kugrp
                       WITH pchobji2        IN  pchobji2
                       WITH expand          =   expand
                       WITH  s_shwfld       IN  s_shwfld
                       AND RETURN
      ELSE.
        SUBMIT zhterot1  WITH pchplvar        =   pchplvar
                          WITH pchotype        =   pchotype
                          WITH pchobjid        IN  pchobji3
                          WITH pchseark        =   pchseark
                          WITH pchobeg         =   pchobeg
    *                    with PCHZTR_D        =   PCHZTR_D
    *                    with PCHZTR_M        =   PCHZTR_M
    *                    with PCHZTR_Y        =   PCHZTR_Y
    *                    with PCHZTR_A        =   PCHZTR_A
    *                    with PCHZTR_P        =   PCHZTR_P
    *                    with PCHZTR_F        =   PCHZTR_F
                          WITH pchbegda        =   pchbegda
                          WITH pchendda        =   pchendda
                          WITH pchwegid        =   pchwegid
                          WITH kurs            =   kurs
                          WITH kurst           =   kurst
                          WITH kugrp           =   kugrp
                          WITH pchobji2        IN  pchobji2
                          WITH expand          =   expand
                          WITH  s_shwfld       IN  s_shwfld
                          AND RETURN
      ENDIF.
    In the above code the Pirnt is having the Default '02'
    Now when we place 0 comparision it is going to validate by converting into binary mode ...
    So what is expecting is to
    when the condition will come true?
    what is the use of submit program name calling those spool ?
    Could any one having any idea pls revert back asap!
    Regards
    Sas

    Hi Friend,
    The operator O is a byte logical opertaor, it checks after converting into bit.
    In your case if SY-SUBTY field contains value 0 or 2 will be true.
    After that it is taking the current client's printer setting and other parameters, which is used to pass in submit program.The submit program having some output which is generating the spool.
    Hope it will help you.
    Regards
    Krishnendu

  • Explain me this Code  , bold one to explain me detail

    form get_structure.
          data : idetails type abap_compdescr_tab,
               xdetails type abap_compdescr.
          data : ref_table_des type ref to cl_abap_structdescr.
    Get the structure of the table.*
          ref_table_des ?=
              cl_abap_typedescr=>describe_by_name( p_table ).
          idetails[] = ref_table_des->components[].
            loop at idetails into xdetails.
            clear xfc.
            xfc-fieldname = xdetails-name .
            xfc-datatype = xdetails-type_kind.
            xfc-inttype = xdetails-type_kind.
            xfc-intlen = xdetails-length.
            xfc-decimals = xdetails-decimals.
            append xfc to ifc.
          endloop.
      endform.
    Thanks

    Hi,
    here you can find the information that you need:
    [Determining the Attributes of Data Objects|http://help.sap.com/saphelp_nw70/helpdata/EN/fc/eb3145358411d1829f0000e829fbfe/frameset.htm]
    And take also a look at the class documentation of the classes CL_ABAP_*DESCR. The classes are documentated very well.
    Regards Rudi

  • What does this code do

    hi friends, i came across this code, and i am struck at understanding this code,
    usually loop keyword will be followed by itab, but here there is nothing, same with sort.
        SORT.
      LOOP.
        AT NEW MSEG-WERKS.
    some code
        ENDAT.
        AT NEW MSEG-MATNR.
    some code
          NEW-PAGE.
        ENDAT.
        AT DETAIL.
          WRITE:
          / MSEG-LGORT,
            MSEG-BWART,
            MSEG-MBLNR,
            MSEG-ZEILE.
        ENDAT.
        AT END OF MSEG-MATNR.
          SKIP 1.
          WRITE: 'x y z..'
        ENDAT.
        AT END OF MSEG-WERKS.
          SKIP 1.
         WRITE: 'x y z..'
        ENDAT.
      ENDLOOP.
    an some one please explain me this code, little briefly.
    thank you.

    sorry friends, i forgot to tell that the following piece of code was above this code:
    INSERT
    MSEG-WERKS                             "Plant
    MSEG-MATNR                             "Material
    MSEG-MBLNR                             "Material document
    MSEG-ZEILE                             "Material item
    INTO HEADER.
    INSERT
    LIPS-VBELN                             "Delivery
    LIPS-POSNR                             "Delivery item
    MSEG-LGORT                             "Storage location
    MSEG-BWART                             "Movement type
    MSEG-MENGE                             "Quantity
    MSEG-SHKZG                             "Debit/credit
    MSEG-MEINS                                                  "UoM
    INTO DETAIL.

  • Can anyone please explain this code to me?

    I am a new (junior)programmer?Can anyone please explain this code to me in lame terms? I am working at a client location and found this code in a project.
    _file name is AtccJndiTemplate.java_
    Why do we use the Context class?
    Why do we use the properties class?
    package org.atcc.common.utils;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.Properties;
    import java.util.logging.Logger;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import org.springframework.jndi.JndiTemplate;
    public class AtccJndiTemplate extends JndiTemplate
      private static Logger logger = Logger.getLogger(AtccJndiTemplate.class.getName());
      private String jndiProperties;
      protected Context createInitialContext()
        throws NamingException
        Context context = null;
        InputStream in = null;
        Properties env = new Properties();
        logger.info("Load JNDI properties from classpath file " + this.jndiProperties);
        try
          in = AtccJndiTemplate.class.getResourceAsStream(this.jndiProperties);
          env.load(in);
          in.close();
        catch (NullPointerException e) {
          logger.warning("Did not read JNDI properties file, using existing properties");
          env = System.getProperties();
        } catch (IOException e) {
          logger.warning("Caught IOException for file [" + this.jndiProperties + "]");
          throw new NamingException(e.getMessage());
        logger.config("ENV: java.naming.factory.initial = " + env.getProperty
    ("java.naming.factory.initial"));
        logger.config("ENV: java.naming.factory.url.pkgs = " + env.getProperty
    ("java.naming.factory.url.pkgs"));
        logger.info("ENV: java.naming.provider.url = " + env.getProperty
    ("java.naming.provider.url") + " timeout=" + env.getProperty("jnp.timeout"));
        context = new InitialContext(env);
        return context;
      public String getJndiProperties()
        return this.jndiProperties;
      public void setJndiProperties(String jndiProperties)
        this.jndiProperties = jndiProperties;
    }

    Hi,
    JNDI needs some property such as the
    java.naming.factory.initial
    java.naming.provider.url
    which are needed by the
    InitialContext(env);
    where env is a properties object
    Now if you can not find the physical property file on the class path
    by AtccJndiTemplate.class.getResourceAsStream(this.jndiProperties);
    where the String "jndiProperties" get injected by certain IOC ( inverse of control container ) such as Spring framework
    if not found then it will take the property from the system which will come from the evniromental variables which are set during the application start up i.e through the command line
    java -Djava.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory -Danother=value etc..
    I hope this could help
    Regards,
    Alan Mehio
    London,UK

  • Please explain this code,this is regarding to ODS activation.

    Hi,
        Please I am unable to understand this code,this exists initial activation of ODS,please can anyone please explain me this
    ob started
    Step 001 started (program RSPROCESS, variant &0000000055152, user ID ALEREMOTE)
    Activation is running: Data target ZYL_O82, from 1.165.349 to 1.165.349
    Data to be activated successfully checked against archiving objects
    SQL: 20.06.2007 05:34:26 ALEREMOTE
    ANALYZE TABLE "/BIC/AZYT_O6240" DELETE STATISTICS
    SQL-END: 20.06.2007 05:34:26 00:00:00
    SQL: 20.06.2007 05:34:26 ALEREMOTE
    BEGIN DBMS_STATS.GATHER_TABLE_STATS ( OWNNAME =>
    'SAPR3', TABNAME => '"/BIC/AZYT_O6240"',
    ESTIMATE_PERCENT => 1 , METHOD_OPT => 'FOR ALL
    INDEXED COLUMNS SIZE 75', DEGREE => 1 ,
    GRANULARITY => 'ALL', CASCADE => TRUE ); END;
    Thanks & Regards,
    Mano

    Hi,
        Please I am unable to understand this code,this exists initial activation of ODS,please can anyone please explain me this
    ob started
    Step 001 started (program RSPROCESS, variant &0000000055152, user ID ALEREMOTE)
    Activation is running: Data target ZYL_O82, from 1.165.349 to 1.165.349
    Data to be activated successfully checked against archiving objects
    SQL: 20.06.2007 05:34:26 ALEREMOTE
    ANALYZE TABLE "/BIC/AZYT_O6240" DELETE STATISTICS
    SQL-END: 20.06.2007 05:34:26 00:00:00
    SQL: 20.06.2007 05:34:26 ALEREMOTE
    BEGIN DBMS_STATS.GATHER_TABLE_STATS ( OWNNAME =>
    'SAPR3', TABNAME => '"/BIC/AZYT_O6240"',
    ESTIMATE_PERCENT => 1 , METHOD_OPT => 'FOR ALL
    INDEXED COLUMNS SIZE 75', DEGREE => 1 ,
    GRANULARITY => 'ALL', CASCADE => TRUE ); END;
    Thanks & Regards,
    Mano

  • Please explain what does this code does exactly

    Can any one explain me what does the below code does.
    This is the code written in one of the BADI (ME_PO_PRICING_CUST) .This badi will be triggered when a sales order delivery address is changed and while saving it this will be triggered. Over all what i come to know is they re trigerring a new version in this code. Can anyone explain me what exactly they are doing in this.Thanks...
    METHOD IF_EX_ME_PO_PRICING_CUST~PROCESS_KOMK.
      FIELD-SYMBOLS: <EKKO> TYPE ANY,
                     <PROCSTAT> TYPE MEPROCSTATE,
                     <FRGKE> TYPE FRGKE,
                     <YNAST> TYPE TABLE,
                     <WA_YNAST> TYPE NAST.
      IM_EKKO-PROCSTAT = 02.
    *break-point.
      ASSIGN ('(SAPLMEPO)EKKO') TO <EKKO>.
      ASSIGN ('(SAPLMEPO)YNAST[]') TO <YNAST>.
      IF <EKKO> IS ASSIGNED.
        ASSIGN COMPONENT 'PROCSTAT' OF STRUCTURE <EKKO> TO <PROCSTAT>.
        ASSIGN COMPONENT 'FRGKE' OF STRUCTURE <EKKO> TO <FRGKE>.
        IF <FRGKE> = 'R'.
          <PROCSTAT> = '02'.
        ENDIF.
      ENDIF.
      IF <YNAST> IS ASSIGNED.
        IF <FRGKE> = 'R'.
          LOOP AT <YNAST> ASSIGNING <WA_YNAST>.
            <WA_YNAST>-AKTIV = 'X'.
          ENDLOOP.
        ENDIF.
      ENDIF.
    ENDMETHOD.

    r_htkl must be a range table. check the declaration part of it.
    p_htkl is a parameter on selection screen i hope.
    so, there are four fields on a range table.(range table are similar to your select options)
    1. SIGN ( I or E  - Inclusive or Exculsive)
    2. OPTION(options like EQ = euqal, BT = Between, CP = contains pattern etc)
    3. LOW (value)
    4. HIGH (value)
    so..
    IF NOT p_htkl IS INITIAL. " checks if some thing is being passed to the parameter
    r_htkl-sign='I'. " give the sign a value I i.e it make inclusive sign
    r_htkl-option='EQ'. " EQ to option means you value will be checked for a equal to condition
    r_htkl-low=p_htkl. " the low field in now assigned the same value of the parameter p_hktl
    APPEND r_htkl. " the range table is appended.
    endif.
    so this range table can be used in select statements as :
    select * from abcd into gt where xyz in r_hktl. ==> this will check for a EQ condition with value in r_hktl-low in database or
    in if statements like : if abc in r_hktl. ==> this will check the EQ condition of abc with the r_hktl-low.
    Had it been
    r_htkl-sign='E'.
    then the condition is same but with a NOT.. that means NOT EQ or NOT BT etc.
    as exclusive of the option.
    etc.
    hope this is clear.
    AND PLEASE CLOSE THE OTHER THREAD (duplicate)

  • Can soemone explain this code to me

    can someone explain this code to me
    import javax.swing.*;
    import BreezySwing.*;
    import java.util.Random;
    public class PennyPinch extends GBFrame
         private JButton enterButton;
         private JTextArea outputArea;
         private int[][] board = {{1,1,1,1,1},{1,2,2,2,1},{1,2,3,2,1},{1,2,2,2,1},{1,1,1,1,1}};
         private boolean[][] landing = new boolean[5][5];
         private int total;
         public PennyPinch()
         enterButton = addButton ("Pitch",2,1,1,1);
         outputArea = addTextArea("",4,1,3,4);
         public void pitch()
              Random generator = new Random();          
              int randomRow = generator.nextInt(5);
              int randomColumn = generator.nextInt(5);
              total += board[randomRow][randomColumn];
              landing[randomRow][randomColumn] = true;
         public void buttonClicked (JButton buttonObj)
              pitch();
              displayList(board, outputArea);
         private void displayList(int a[][], JTextArea output)
    output.setText("");
              for (int row = 0; row < 5; row++)
    for (int col = 0; col < 5; col++){
    if(landing[row][col] ==true)
                                  output.append(Format.justify('r',"P", 3) + " ");
                                  if (col == 4)
    output.append("\n");
                             else
                             output.append(Format.justify('r', a[row][col], 3) + " ");
                             if (col == 4)
    output.append("\n");                    }
              output.append("the total is " + total);
         public static void main (String[] args)
    PennyPinch theGUI = new PennyPinch();
    theGUI.setSize (300, 300);
    theGUI.setVisible(true);
    }

    Knowing toilets or studying under George?What kind pervert are you?
    What is written in public toilets o/c!Ah yes I see, I found example questions.
    2:3.4 please complete the following well known saying
    by filling in the blank
    Whilst you are reading what I put
    You are blank on your foot
    2:3.5 Upon seeing the announcement 'Toilet
    tennis' and following the instruction ' please
    see other wall for details' what is the standard
    message on the other wall.2:3.4. is the correct answer 'micturating' ?
    2:3.5. I believe the answer is Ibidem.

  • Can anyone explain this code snippet

    I'm revising for my exams and this is one of the question that came up in the previous exams. Can someone help answe the questions at the end. Also what object is 'time_t' and how why do they use 'input_time -= 24*60*60;'?
    Read the following code carefully before answering the questions.
    time_t normalise(time_t input_time)
         bool finished;
         // This produces a formatted time string like:
         // Thu_Nov_24_18:22:48_1986
         string str_time = format_time( input_time );
         while( str_time.substr(1,3) != "Sun")
              input_time -= 24*60*60;
              str_time = format_time( input_time );
         while( str_time.substr(11,2) != "00" )
              input_time -= 60*60;
              str_time = format_time( input_time );
         while( str_time.substr(14,2) != "00")
              str_time = format_time( input_time );
              input_time -= 60;
         while( str_time.substr(17,2) != "00")
              input_time -= 1;
              str_time = format_time( input_time );
         return input_time;
    1) Briefly explain what you think the overall purpose of this function is (do not describe each line of code).
    2) There are two bugs in this code that prevent it from functioning correctly; circle them.
    3) What would actually happen when this code is run?
    (a) as originally written
    (b) with the first bug fixed?
    4) Discuss the efficiency of the code assuming the bugs have been fixed.

    Looks like it is trying to increment the time parameter back to represent midnight of the previous Sunday.

  • CAN SOMEONE EXPLAIN THIS CODE

    HI,
    CAN SOMEONE EXPLAIN TO ME THIS CODE:
    FUNCTION DISP_QATD return VARCHAR2 is
    BEGIN
         SRW.REFERENCE(:P_CURRENCY_CODE);
         SRW.REFERENCE(:P_QATD1);
         SRW.USER_EXIT('FND FORMAT_CURRENCY
              CODE     = ":P_CURRENCY_CODE"
         DISPLAY_WIDTH     = "19"
              AMOUNT     = ":P_QATD1"
              DISPLAY     = ":DISP_QATD"
         PRECISION     = "STANDARD"');
         RETURN(:DISP_QATD);
    END;

    Hello,
    For details about SRW.REFERENCE :
    http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/plsql/builtins/srw/srw_reference.htm?tp=true
    Regards

  • Please explain loop in this code

    in this below code,what more is to be added as i am getting the values from the fields of table eban in the output but not from ekko,ekpo,eket.
    where to put the loop or what else is reqd?
    please suggest as i m new to this and not understanding.
    LOOP AT IT_EBAN.
        WA_FINAL-PURREQ   = IT_EBAN-BANFN.
        WA_FINAL-RITEM    = IT_EBAN-BNFPO.
        WA_FINAL-CRTDBY   = IT_EBAN-ERNAM.
        WA_FINAL-REQDT    = IT_EBAN-BADAT.
        WA_FINAL-REQSR    = IT_EBAN-AFNAM.
        WA_FINAL-SHTXT    = IT_EBAN-TXZ01.
        WA_FINAL-QTYREQ   = IT_EBAN-MENGE.
        WA_FINAL-UNITS    = IT_EBAN-MEINS.
        WA_FINAL-VALPR    = IT_EBAN-PREIS.
        WA_FINAL-CURR     = IT_EBAN-WAERS.
        WA_FINAL-PER      = IT_EBAN-PEINH.
        WA_FINAL-TPRICE   = IT_EBAN-RLWRT.
        WA_FINAL-TPRICE$  = IT_EBAN-RLWRT.
        WA_FINAL-DELRQ    = IT_EBAN-LFDAT.
        WA_FINAL-REQREL   = IT_EBAN-FRGDT.
        WA_FINAL-PO       = IT_EBAN-EBELN.
        WA_FINAL-ITEM     = IT_EBAN-EBELP.
        WA_FINAL-PODATE   = IT_EBAN-BEDAT.
        WA_FINAL-QTYORD   = IT_EBAN-BSMNG.
       CLEAR IT_EKPO.
       read table it_ekpo into wa_ekpo  with key meins = wa_final-UNITS1
                                     binary search.
        WA_FINAL-UNITS1   = IT_EKPO-MEINS.
        WA_FINAL-VALPR1   = IT_EKPO-NETPR.
        WA_FINAL-PER1     = IT_EKPO-PEINH.
        WA_FINAL-TPRICE1  = IT_EKPO-NETWR.
        CLEAR IT_EKKO.
        READ TABLE IT_EKKO WITH KEY waers  = WA_FINAL-CURRPO
                                    BINARY SEARCH.
        WA_FINAL-CURRPO   = IT_EKKO-WAERS.
        CLEAR IT_EKET.
        READ TABLE IT_EKET WITH KEY EINDT = WA_FINAL-DELPO
                                BINARY SEARCH.
        WA_FINAL-DELPO    = IT_EKET-EINDT.
         APPEND WA_FINAL TO IT_FINAL.
         CLEAR WA_FINAL.
    endloop.

    CLEAR IT_EKPO.
    read table it_ekpo into wa_ekpo with key meins = wa_final-UNITS1
    binary search.
    WA_FINAL-UNITS1 = IT_EKPO-MEINS.
    WA_FINAL-VALPR1 = IT_EKPO-NETPR.
    WA_FINAL-PER1 = IT_EKPO-PEINH.
    WA_FINAL-TPRICE1 = IT_EKPO-NETWR.
    In this code it_ekpo never gets populated.  wa_ekpo gets filled if the read is succcessfull but wa_ekpo is not used..
    CLEAR IT_EKKO.
    READ TABLE IT_EKKO WITH KEY waers = WA_FINAL-CURRPO
    BINARY SEARCH..
    In this read WA_FINAL-CURRPO never has a value so the read will always fail
    WA_FINAL-CURRPO = IT_EKKO-WAERS.
    CLEAR IT_EKET.
    READ TABLE IT_EKET WITH KEY EINDT = WA_FINAL-DELPO
    BINARY SEARCH..
    In this read WA_FINAL-DELPO never has a value so the read will always fail
    Regards
    Greg Kern

  • Would you explain this code

    I do not understand the following code. Especially, why this code use v_status_date(unassigned variable value)?
    First, IF V_TSS.STATUS_DATE > V_STATUS_DATE OR V_STATUS_DATE IS NULL THEN
    Second, ELSIF V_TSS.STATUS_DATE = V_STATUS_DATE THEN
    How come compare v_status_date with v_tss.status_date?
    I couldn't find any assigned value for v_status_date in this code.
    ----------original code----------
    FUNCTION GET_TS_STATUS(P_ETS_ID NUMBER)
              RETURN VARCHAR2 IS
              CURSOR C_TSS IS
                   SELECT TSS.STATUS_CODE, TSS.STATUS_DATE
                   FROM STATUS TSS, SHEETS ETS
                   WHERE ETS.ID = P_ETS_ID
                   AND ETS.ID = TSS.ID;
              V_STATUS_CODE VARCHAR2(10) := NULL;
              V_STATUS_DATE DATE;
         BEGIN
              FOR V_TSS IN C_TSS LOOP
              IF V_TSS.STATUS_DATE > V_STATUS_DATE OR V_STATUS_DATE IS NULL THEN
                   V_STATUS_CODE := V_TSS.STATUS_CODE;
                   V_STATUS_DATE := V_TSS.STATUS_DATE;
              ELSIF V_TSS.STATUS_DATE = V_STATUS_DATE THEN
                   IF V_TSS.STATUS_CODE = 'APPROVED' THEN
                        V_STATUS_CODE := 'APPROVED';
                   ELSIF V_TSS.STATUS_CODE = 'VERIFIED' AND V_STATUS_CODE <> 'APPROVED' THEN
                        V_STATUS_CODE := 'VERIFIED';
                   ELSIF V_TSS.STATUS_CODE = 'SUBMIT' AND V_STATUS_CODE NOT IN ('APPROVED', 'VERIFIED') THEN
                        V_STATUS_CODE := 'SUBMIT';
                   ELSIF V_TSS.STATUS_CODE = 'WORKING' AND V_STATUS_CODE NOT IN ('SUBMIT', 'APPROVED', 'VERIFIED') THEN
                        V_STATUS_CODE := 'WORKING';
                   END IF;
              END IF;
              END LOOP;
              RETURN NVL(V_STATUS_CODE, 'NONEXIST');
         END;

    The function returns the status for a given id with the highest priority for the maximum date
    As far as I can see, you could simplify this code to something like this
    FUNCTION GET_TS_STATUS(P_ETS_ID in SHEETS.ID%type) RETURN STATUS.STATUS_CODE%type
    IS
      CURSOR C_TSS IS
        SELECT TSS.STATUS_CODE,
               TSS.STATUS_DATE
        FROM   STATUS TSS,
               SHEETS ETS
        WHERE  ETS.ID = P_ETS_ID
        AND    ETS.ID = TSS.ID
        ORDER BY TSS.STATUS_DATE desc,
                 decode( TSS.STATUS_CODE, 'APPROVED', 4
                                          'VERIFIED', 3
                                          'SUBMIT'  , 2
                                          'WORKING' , 1
                                                    , 0) asc
      V_STATUS_CODE STATUS.STATUS_CODE%type;
    BEGIN
      OPEN  c_tss;
      FETCH c_tss_ INTO v_status_code;
      CLOSE c_tss;
      RETURN NVL(V_STATUS_CODE, 'NONEXIST');
    END GET_TS_STATUS;

  • Could someone explain what this piece of codes means

    The code section is below there are few things I don't get about this code:
    1:What does all that stuff that the string data equals means
    // Construct data
            String data = URLEncoder.encode("key1", "UTF-8") + "=" + URLEncoder.encode("value1", "UTF-8");
            data += "&" + URLEncoder.encode("key2", "UTF-8") + "=" + URLEncoder.encode("value2", "UTF-8");2: The second thing is that I'm wondering what is the URL definining part mean, more specifically what's the 80 for and why is there that cgi line.
    URL url = new URL("http://hostname:80/cgi");This is the full code that I'm getting the questions from
        try {
            // Construct data
            String data = URLEncoder.encode("key1", "UTF-8") + "=" + URLEncoder.encode("value1", "UTF-8");
            data += "&" + URLEncoder.encode("key2", "UTF-8") + "=" + URLEncoder.encode("value2", "UTF-8");
            // Send data
            URL url = new URL("http://hostname:80/cgi");
            URLConnection conn = url.openConnection();
            conn.setDoOutput(true);
            OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
            wr.write(data);
            wr.flush();
            // Get the response
            BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String line;
            while ((line = rd.readLine()) != null) {
                // Process line...
            wr.close();
            rd.close();
        } catch (Exception e) {
        }

    The code section is below there are few things I
    don't get about this code:
    1:What does all that stuff that the string data
    equals means
    // Construct data
    String data = URLEncoder.encode("key1",
    "UTF-8") + "=" + URLEncoder.encode("value1",
    "UTF-8");
    data += "&" + URLEncoder.encode("key2",
    "UTF-8") + "=" + URLEncoder.encode("value2",
    "UTF-8");
    Looks like data is a query string for an HTTP GET request. It has two key/value pairs encoded as UTF-8.
    : The second thing is that I'm wondering what is the
    URL definining part mean, more specifically what's
    the 80 for and why is there that cgi line.
    URL url = new
    URL("http://hostname:80/cgi");
    The code is making the HTTP GET request to a server named hostname via port 80 to a CGI script that will consume the request and send a response back.
    This is the full code that I'm getting the questions
    from
        try {
    // Construct data
    String data = URLEncoder.encode("key1", "UTF-8") +
    "=" + URLEncoder.encode("value1", "UTF-8");
    data += "&" + URLEncoder.encode("key2",
    "UTF-8") + "=" + URLEncoder.encode("value2",
    "UTF-8");
    // Send data
    URL url = new URL("http://hostname:80/cgi");
    URLConnection conn = url.openConnection();
    conn.setDoOutput(true);
    OutputStreamWriter wr = new
    OutputStreamWriter(conn.getOutputStream());
    wr.write(data);
    wr.flush();
    // Get the response
    BufferedReader rd = new BufferedReader(new
    InputStreamReader(conn.getInputStream()));
    String line;
    while ((line = rd.readLine()) != null) {
    // Process line...
    wr.close();
    rd.close();
    } catch (Exception e) {
    Very bad code. An empty catch block? Terrible.
    %

Maybe you are looking for

  • Spotlight behavior in Leopard

    Can someone explain this to me: If you create a folder in Leopard on the desktop and call it "12345678" and then search for 2345678 in Spotlight, why doesn't the folder appear in the search results? This worked in Tiger. It worked in Win95 for that m

  • Jumpy photos in ios7 photo gallery on 4s?

    Anyone with an iPhone 4s and ios7 having this issue? It happens while in the camera roll gallery. While holding my iphone vertically, and swiping through vertical (portrait format) pictures, each photo will stop and jump to the left before it comes t

  • Podcasts in iTunes library

    I can't figure out all of the icons and their meaning regarding the podcasts I have downloaded into my library. Also, when I delete a podcast, if I "retain the files" what does that mean? 30 gb Video   Windows XP  

  • ExecuteUpdate error with mysql

    Dear All: i have a wierd error right here, the code is working correctly for the first call to this jsp page but the error come out when second call to this page. the field was update wrongly, credit=credit-1 become credit=credit-2 and Point=Point+1

  • The company code OMPL does not exist or has not been fully maintained

    hi friends i did in obyc setting also fi posting are happens but the think is mm posting are not happen and not able work on transation code-mmo1i seen  transation code:omsy but company code is not mantain properly this is happen in mm module please