If statment

Hi,
not sure what I'm missing with the below
for (int i=0; i<list.getLength(); i++){
Node inode = list.item(i);
NamedNodeMap att = inode.getAttributes();
Node idnode = att.item(0);
String attid = idnode.getNodeValue();
System.out.println(attid);
if (attid != "4") {
System.out.println(attid+"if");
else {
System.out.println(attid+"else");
the above code is giving this
4
4if
So it is printing attid as 4 but then the if else statement is executing as if attid doesnot equal 4?

Use equals() method for String comparison.

Similar Messages

  • If statment in sap script

    hi,
    IF ( &STAX3& = '4.00' OR &STAX3& = '12.50' )
    XXXXXX,,  ,,&text3& &STAX1&%   ,,,,  &TOT_STAX1(C.0)&
    XXXXXX,,  ,,&text3& &STAX2&%   ,,,,  &TOT_STAX2(C.0)&
    ,,,,&text51&,,,,&tot_tcost&
    ,,,,,,,,&TOT_FINAL(C.0)&
    ELSE
    XXXXXX,,  ,,&text3& &STAX&%   ,,,,  &TOT_STAX(C.0)&
    ,,,,&text51&,,,,&tot_tcost&
    ,,,,,,,,&TOT_FINAL(C.0)&
    ENDIF
    i am using this code.
    i have one doubt in if statment we can use this syntax
    IF ( &STAX3& = '4.00' OR &STAX3& = '12.50' )
    this is correct or not.
    if i use this code if statment is not excuting.
    pls clarify my doubt.

    Hi Venkat,
    Usually we'll write all the logical ABAP statements in Subroutine pool, instead of writing them in the script form directly.
    Use PERFORM statement in the script form as shown below & write the code u want in that....
    /:   PERFORM GET_MERCANTIL IN PROGRAM cust_invoice
    /:   USING &RKWA-BUKRS&
    /:   USING &RKWA-LIFNR&
    /:   USING &BKPF-GJAHR&
    /:   CHANGING &V_MERCANTIL&
    /:   ENDPERFORM
    GT   Insc.Reg.Mercantil    &V_MERCANTIL&
    GT is the paragraph format.
    Go to SE38 & create the program,cust_invoice ( called as Subroutine pool ) & write the FORMs in that....
    U can use the normal ABAP coding in that....
    Hope this will work.
    Try this out & let me know if there are any issues.
    Reward points, if useful.
    Pavan.

  • Primary key index not working in a select  statment

    Hi ,
    I'm doing a :
    select *
    from my_table
    where B = v1 and
    A = v2 ;
    where A and B are the primary key of the table, in that table the primary key index is there and the order of the primary key definition is A first and then B.
    While testing this statment in my database the Explain Plan shows that it is using the index ok but when
    runninng in client database it is not using it becasue of the order (i think), is this something configurable that I need to ask to my DBA ?
    The solution I found was to do the select with a hint wich fix the problem , but I'm curious about why is working in my dadabase and not in the client database
    thanks in advance .
    oracle version 11g

    This is the forum for SQL Developer (Not for general SQL/PLSQL questions). Your question would be better asked in the SQL and PL/SQL forum.
    Short answer: The execution plan used will depend on optimizer settings and table/index statistics. For example if the table has very few rows it may not bother using the index.

  • Performace problem in a select statment how to imporve the performance

    fist select statment
    SELECT    a~extno
              a~guid_lclic       " for next select
              e~ctsim
              e~ctsex
    *revised spec 3rd
              f~guid_pobj
              f~amnt_flt
              f~amcur
              f~guid_mobj
              e~srvll     "pk
              e~ctsty     "PK
              e~lgreg  "PK
      INTO TABLE gt_sagmeld
      FROM /SAPSLL/LCLIC  as a
      INNER JOIN /sapsll/tlegsv as e on elgreg = algreg
    * revised spec 3rd
      inner join /sapsll/legcon as f on fguid_lclic = aguid_lclic   " for ccngn1 selection
      inner join /sapsll/corcts as g on gguid_pobj = fguid_pobj
                               where   a~extno in s_extno.
      sort gt_sagmeld by guid_lclic guid_pobj.
    lgreg ctsty srvll
      delete adjacent duplicates from gt_sagmeld comparing guid_lclic guid_pobj.
    it selects about 20 lakh records
    belos select statment whichs is taking time as it is based on the entreis of gt_sagmeld
    select /sapsll/corpar~guid_mobj
                /sapsll/corpar~PAFCT
                but000~bpext
                but000~partner
                /sapsll/corpar~parno
                into table gt_but001
        from    /sapsll/corpar
        INNER join but000  on  but000partner = /sapsll/corparparno
        for all entries in gt_sagmeld
        where  /sapsll/corpar~guid_mobj = gt_sagmeld-guid_mobj
        and    /sapsll/corpar~PAFCT = 'SH'.
       SELECT /sapsll/cuit~guid_cuit         " PK
              /sapsll/cuit~QUANT_FLT         " to be displayed
              /sapsll/cuit~QUAUM             " to be displayed
              /sapsll/cuit~RPTDT             " to be displayed
             /sapsll/cuhd~guid_cuhd         " next select
              /sapsll/cuit~guid_pr           " next select
      INTO table gt_sapsllcuit
      FROM  /sapsll/cuit
    inner join /sapsll/cuhd on /sapsll/cuitguid_cuhd = /sapsll/cuhdguid_cuhd
      FOR all entries in gt_sagmeld
      WHERE /sapsll/cuit~guid_cuit = gt_sagmeld-guid_pobj.
      Delete adjacent duplicates from gt_sapsllcuit[].
           if not gt_sapsllcuit[] is initial.

    hi navenet
    that didnt worked
    we need to try ur range options
    but not sure what you told in the last mail as not clear with range can u pls eloboragte more i am pasting the full code here
    SELECT     a~extno
               a~guid_lclic       " for next select but000
               e~ctsim
               e~ctsex
               e~srvll
               e~ctsty
               e~lgreg
      INTO TABLE gt_sagmeld
      FROM /SAPSLL/LCLIC  as a
      INNER JOIN /sapsll/tlegsv as e on elgreg = algreg
                               where   a~extno in s_extno.
    sort gt_sagmeld by guid_lclic.
    delete adjacent duplicates from gt_sagmeld comparing all fields.
      IF not gt_sagmeld[] is initial.
      SELECT  /sapsll/legcon~guid_lclic
              /sapsll/legcon~guid_pobj
              /sapsll/legcon~amnt_flt
              /sapsll/legcon~amcur
               but000~bpext
               *revised spec
               /sapsll/corpar~PAFCT
              /sapsll/legcon~guid_mobj
             /sapsll/cuit~guid_cuit
      INTO TABLE gt_but000
      FROM /SAPSLL/LEGCON
      for all entries in gt_sagmeld
      where /SAPSLL/legcon~guid_lclic = gt_sagmeld-guid_lclic.
            IF NOT GT_BUT000[] IS INITIAL.
           sort gt_but000 by guid_mobj.
           delete adjacent duplicates from gt_but000 comparing guid_mobj.
         select /sapsll/corpar~guid_mobj
                /sapsll/corpar~PAFCT
                /sapsll/corpar~parno
                into table gt_but001
        from    /sapsll/corpar
        for all entries in gt_but000
        where  /sapsll/corpar~guid_mobj = gt_but000-guid_mobj.
       and    /sapsll/corpar~PAFCT = 'SH'.
    DELETE gt_but001 where PAFCT <> 'SH'.
    *sort gt_corpar by parno.
    *delete adjacent duplicates from gt_corpar comparing parno.
    *select gd000~partner
          gd000~bpext
         from gd000 into table gt_but001
    for all entries in gt_corpar
    where  gd000~partner = gt_corpar-parno.
    my ultimat aim is to select bpext from gd000
    can u please explain how to use ranges here and what is the singnificance and how ill i read the data from the final  table if we use ranges
    regards
    Nishant

  • REJECT statment to break GET event is Obsolete in ECC 6.0 - Alternative?

    Hi Developers,
    REJECT statment is used to break from GET event (say GET PERNR event in Logical Database) used to process for an Employee.
    This REJECT statement is Obsolete . Is there any alternative for this ?
    If so, please reply at the earliest as it is very Urgent.
    Regards,

    Hi Suma,
    The REJECT statement was specially developed for leaving GET event blocks. Unlike CHECK and EXIT, REJECT always refers to the current GET event block. If CHECK and EXIT occur in a loop, they refer to the loop, and in a subroutine, they always refer to the subroutine. The REJECT statement, on the other hand, allows you to exit a GET event block directly from a loop or a called subroutine.
    The statement
    REJECT [dbtab].
    always terminates the processing of the current line of the node of the logical database. Without the optional dbtabspecification, the logical database automatically reads the next line of the same node, and the next GET event at the same hierarchy level is triggered. If you use the optional dbtab specification, the logical database reads the next line of the node dbtab. The node dbtab  must occur above the current node in the logical database hierarchy.
    Example
    The following executable program is connected to the logical database F1S.
    REPORT EVENT_DEMO.
    NODES: SPFLI, SFLIGHT, SBOOK.
    GET SFLIGHT.
      SKIP.
      WRITE: / 'Carrid:', SFLIGHT-CARRID,
               'Connid:', SFLIGHT-CONNID,
               'Fldate:', SFLIGHT-FLDATE.
      ULINE.
    GET SBOOK.
      PERFORM SUB.
    FORM SUB.
      WRITE: / 'Bookid:', SBOOK-BOOKID.
      REJECT 'SFLIGHT'.
    ENDFORM.
    This program reads and displays only the first booking for each flight, since the logical database reads the next line of SFLIGHT after the REJECT statement.

  • EC-CS Cons Chart of Accounts & Financial Statment Version

    Hi Experts,
    I need your valid input on this issue. We have 6 company codes and wanted to have a consolidation P&L and BS. I have implemented EC-CS and have done all the all necessary configuration and the data is flowing to EC-CS without any problems. My concern here is whether i have done right in Cons chart of accounts or not. I have created one consolidated chart of accounts in FI which as 1:1 relationship with operational coa and also copied Financial statment version. But for some reason the FSV is not copied correctly to EC-CS in FS hierarchy for example under assets->current assets->cash i just get the group as cash but it doesnt bring all the FS items or GL accounts under it, where as FI i can see all the GL accounts under cash. My question here is how to copy the same FSV from FI to EC-CS as FS hierarchy.
    Since I am using 1:1 relationship between consolidated coa and operation coa, what's the best way bring all the GL accounts in FI to EC-CS as FS item including the financial statment version. I went to CX16 and transfered automatically from FSV, it just brought in the higher level groups and not the lower level FS item.
    Could somebody suggest me the better way of doing it or am i doing something wrong? Another question is how does the retained earnings work, does it work the same way as FI, transfering net income/loss from p&l to BS, since the data is transfered from FI on real time update?
    Thanks in advance
    Best Regards,
    gj

    Hi Dan,
    Thanks again. I did figured it out and i was able to post the retaining earning account. Simultenously I was trying to post a reclassification  and i am getting error message GK897 (Auto posting item 0000330000 contains wrong value (cons unit 000000000000003200). Basically in the reclassification rule, i specified the percentage rate in further settings and in trigger i had given the P&L retained earning account, source as RE account and destination as another FS item. The reason behind doing this to take certain percentage of RE account and to reclassify to another account. but im getting this error message, im not sure what i am missing here.
    thanks
    Best Regards,
    gj

  • Need help in insert statment query

    Hi,
    I have a table T1 with values like
    col1
    1
    2
    3
    4
    I need to write insert statment for t2 as
    insert into t2(col1,col2) values ('AA',select col1 from t1);
    The output of T2 should be
    col1 col2
    AA 1
    AA 2
    AA 3
    AA 4
    Any help in modifying the query.
    Ashish

    What is wrong with this?
    INSERT INTO id_own_dw.id_t_dw_org_dq_tgt
           (cost_center_cod_vc_old,
            cost_center_cod_vc_new
         SELECT '3016052',<<<_-- this you can replace with your varibale in pl/sql block
                cost_center_cod_vc
           FROM id_own_dw.id_t_dw_msl_org_cctr2mkdiv
          WHERE busi_unit_cod_vc = '3016496'

  • Query in select statment

    Hi ,
        what is the difference between,select single and
    select upto one row .
    In a select statment .
    Thanks ,
    shankar.

    According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not
    using all the primary key fields.
    select single is a construct designed to read database records with primary key. In the absence of the primary key,
    it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key
    supplied and will try to find most suitable index.
    The best way to find out is through sql trace or runtime analysis.
    Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s)
    you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the
    second or the third record has the value you are looking for.
    The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional
    level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS.
    The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause
    If this results in multiple records then only the first one will be returned and therefore may not be unique.
    Mainly: to read data from
    The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that
    are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns
    the first record of the result set.
    Mainly: to check if entries exist.
    You can refer to the below link..
    http://www.sap-img.com/abap/difference-between-select-single-and-select-upto-one-rows.htm

  • Need help in SQl statment

    this SQL statment work in oracle database :
    SELECT TO_DATE('20080627','YYYYMMDD') - TO_DATE('20080526','YYYYMMDD') FROM dual
    But didn'twork on Timesten Database and this error is appear
    2789: An interval data type must be specified for a datetime arithmetic result
    The command failed.

    SELECT extract (day from TO_DATE('20080627','YYYYMMDD') - TO_DATE('20080626','YYYYMMDD')) FROM dual;
    See
    http://download.oracle.com/otn_hosted_doc/timesten/703/TimesTenDocumentation/wwhelp/wwhimpl/js/html/wwhelp.htm?&accessible=true
    for details.

  • Calling a Report Program In Web Dynpro Using Submit statment

    Hi all,
             Can any one suggest how can i call a report program form Web Dynpro using Submit statment. I tried to call it its showing Field symbols not defined error. Is their any other ways to call Report in a Web Dynpro?. I have posted the error message when i tried using SUBMIT ZRR AND RETURN CONTROL
    Field symbol has not yet been assigned.
    The error occurred on the application server mnghcmsap_HRS_00 and in the work process 1 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Form: CHECKBOX_OUT of program SAPLKKBL
    Form: GEN_LINE_OUT of program SAPLKKBL
    Form: DATA_OUT_SIMPLE of program SAPLKKBL
    Form: LIST_OUTPUT_NEW of program SAPLKKBL
    Form: FIRST_LIST_DISPLAY of program SAPLKKBL
    Module: LIST_DISPLAY of program SAPLKKBL
    Function: K_KKB_LIST_DISPLAY of program SAPLKKBL
    Method: PRINT_BACKEND of program CL_GUI_ALV_GRID===============CP
    Method: SET_TABLE_FOR_FIRST_DISPLAY of program CL_GUI_ALV_GRID===============CP
    Form: PBO of program SAPLSLVC_FULLSCREEN
    Edited by: VINMANO on Jul 22, 2009 2:54 PM

    HI,
    Its possible to call report program from Web dunpro...
    chk out dis link,
    calling report(se38) in webdynpro abap
    By the way are using field symbol anywhere and left it unassigned?
    Thanks,
    Divya.S

  • Dynamic If Statment

    Is it possible to create an if statment with dynamic logical tests?  For example, I have a .csv file that has a file name in the first column, and the columns after that have random tag data.  The first row of the .csv is a header (so it's pretty much just ignored), the second row is the file and tags to be compared to the others, the third row is the header for the file name column and all of the tag category columns after that, and below that are all the files and their tags to be compare row 2 to.  The problem is, not every category of files has the same number of tags, and not all tags may be necessary for the comparison, so I was going to have a dialog window of checkboxes come up listing the header row's non-null tag columns as individual checkboxes.  The if statement would then need to compare all of the selected columns to the other listed files (the on row 4 and below) to find any that contain the exact same tags as the source file (the one in row 2).
    Below is kind of a rough mock-up of what I'm trying to do.
    var baseTag = [];
    baseTag = data[1].split(','); //the comparison row's columns loaded to the baseTag array
    if(checkbox1.value) tag1 = true;
    if(checkbox2.value) tag2 = true;
    if(checkbox3.value) tag3 = true;
    ///etc. etc.///
    //check for any files that match
    for(i=3;i<data.length;i++) { //data being the array containing all the rows of the .csv
         var tag = [];
         tag = data[i].split(',');
         if(baseTag[1] == tag[1] && baseTag[2] == tag[2] && baseTag[3] == tag[3] /*etc*/) { //this needs to be set up so that if tag2 = false, it doesn't do the "baseTag[2] == tag[2]" check; but if it's true, it does check it
              open(tag[0]);
    Anyway, any ideas on how to do this?  I have the feeling it's something simple, but just can't seem to figure it out.  Thanks in advance for any help!
    dgolberg

    Hey Michael, thanks for the reply.  The array labelled "baseTag" holds the data for a single row in a .csv file (for simplicity, we'll say it's the very first row).  The array labelled "tag" holds the data for all the remaining rows of the .csv file.  So for example, the .csv might look something like below when opened with a spreadsheet program:
    File Name
    Tag1
    Tag2
    Tag3
    FileName1.format
    wood
    dark
    strong
    FileName2.format
    wood
    light
    strong
    FileName3.format
    wood
    medium
    light
    FileName4.format
    wood
    dark
    strong
    FileName1.format is the file we're doing the check on using the tag columns to the right, and if it finds a match using those tags, it opens the file listed in column 1.  So the script would need to make sure all tags match the first row's tags (in this example, only FileName4.format would match FileName1.format's tags).  However, there may be instances where I wish to exclude one of the columns from the check (for example, only check for matches of tag 1 and 3).  So this would require that the if statement's check only look for matches of the tag1 and tag3 columns while ignoring Tag2 (so now FileName2.format would also match).  Essentially, instead of being:
    if(baseTag[1] == tag[1] && baseTag[2] == tag[2] && baseTag[3] == tag[3]) {
              open(tag[0]);
    it would then be:
    if(baseTag[1] == tag[1] && baseTag[3] == tag[3]) {
              open(tag[0]);
    if I decide to have it exclude the tag2 column.
    The issue I'm having is making this change to the if statement be dynamic (without a huge mess of inefficient code).  Your mention of a switch statement sounds interesting.  I'm not the greatest programmer yet (pretty much just the really basic stuff) so I hadn't heard about this statement yet; but I'll certainly be looking it up now.  Anyway, hope the info helps clarify it a little better.

  • SALES Analysis  and profit loss statment

    Hi All ,
    Dear Experts,
                                 My Sales Analysis and profit loss statement Value is deferent .  i want to know that which entry show in sales analysis and which entry show in profit loss statment .
    Thanks & Regard
    AREEBA ALI

    Aree,
    Both report are different. The sales analysis will use document of sales orders, delivery order, invoice and credit memo.
    The P&L use journal entry of invoice and credit memo. Can you be more specific about the different ?
    JimM

  • Using 'dbms_obfuscation_toolkit.md5' in my insert statment itself

    Hi all,
    I am trying to use 'dbms_obfuscation_toolkit.md5' in my insert statment itself as : insert into TEST_USERS values('username', dbms_obfuscation_toolkit.md5('password'));
    But i get this : ORA-06553: PLS-307: too many declarations of 'MD5' match
    Can you please help me on how can i insert a string (not raw) as MD5 hash to a table???
    The password column i have is 'varchar(20)'. I dont mind changing it to something else. I am also struggling to find this package definition/help, to check what db type this function returns :-)
    Thanks for the help.

    Hello,
    Try posting this to the General Database Discussions forum.
    This forum is for SQLJ & JDBC.

  • Problem with DBMS_OUTPUT and SQL statment with a function

    I am using SQL Developer version 3.0.04 and I have a function that has a dbms_output statment in it. I am running the following SQL to select the output of that statment.
    select A.A_FUCTION('TEST') from dual;
    The output works fine but the dbms_output line does not show in the dbms_output window. I turned on the output window etc. and i can get the select to print out the output if i wrap it in a declare begin end wrapper... and then change the query to insert the return value into variable.
    just wondering if there is way to get the dbms_output to flush out with just an SQL statment instead of in a begin end wrapper etc.

    just wondering if there is way to get the dbms_output to flush out with just an SQL statment instead of in a begin end wrapper etc.works fine in sql*plus, so I guess it must be a preference or sth. in sql*developer:
    SQL> set serverout on
    SQL> create or replace function f1 (r int)
      2    return int
      3  as
      4  begin
      5    dbms_output.put_line ('Hello World ' || r);
      6    return r;
      7  end f1;
      8  /
    Function created.
    SQL>
    SQL> select f1 (rownum) f1 from dual connect by level <= 3
      2  /
            F1
             1
             2
             3
    3 rows selected.
    Hello World 1
    Hello World 2
    Hello World 3
    SQL>

  • Bank statment

    Hi,
    At the time of manual bank statment what all steps need to be configured,As i haveCreated and Assign Business Transactions,and next i have  Defined Posting Keys and Posting Rules for Manual Bank Statement,and also defined Variants for Manual Bank Statement,and also created three bank accounts one is main account,incoming account,outgoing account.
    What are the next steps in FEBA and FF67
    thanks &regards,
    SAntosh kumar

    Hi,
    Kindly follow the following steps one by one:
    1 Create and Assign Business Transactions (OT52)
    2 Define Variants for Manual Bank Statements (OT43)
    3. Define Posting Keys and Posting Rules for Manual Bank Statement (T033)
    3.1. Create Account Symbols
    3.2. Assign Accounts to Account Symbol
    3.3. Create Keys for Posting Rules
    3.4. Define Posting Rules
    4. Define Posting Keys and Posting Rules for Check Deposit (T033)
    4.1 Create Account Symbols
    4.1.1 Assign Accounts to Account Symbol
    4.1.2. Create Keys for Posting Rules
    4.1.3 Define Posting Rules
    4.2 Create and Assign Business Transactions (OT53)
    4.3 Define Variants for Check Deposit (OT45)
    Testing:
    Manual Bank Reconciliation Statement: FF67
    Manual Check Deposits: FF68
    Hope this helps.
    Regards,
    Kannusamy S

  • Modify statment is not working.

    Hi Experts,
    I have a small query, modify statment is not working properly, Maybe my syntax wrong. Kindly suggest me.
          DESCRIBE TABLE it_marc1 LINES count.
          IF count = 1.
            LOOP AT it_marc INTO wa_marc where sernp ne space.
              READ TABLE it_stpo INTO wa_stpo WITH KEY idnrk = wa_marc-matnr.
              IF sy-subrc = 0.
                wa_stpo-potx2 = c_primary.
                MODIFY table it_stpo FROM wa_stpo TRANSPORTING potx2.
              ENDIF.
            ENDLOOP.
          ENDIF.
    Mohana

    Hello,
    Add the index addition and check
    DESCRIBE TABLE it_marc1 LINES count.
          IF count = 1.
            LOOP AT it_marc INTO wa_marc where sernp ne space.
              READ TABLE it_stpo INTO wa_stpo WITH KEY idnrk = wa_marc-matnr.
              IF sy-subrc = 0.
                wa_stpo-potx2 = c_primary.
                MODIFY table it_stpo FROM wa_stpo TRANSPORTING potx2 INDEX sy-index.  " here
              ENDIF.
            ENDLOOP.
          ENDIF.
    Vikranth

Maybe you are looking for