Unwanted ABAP Code Block Triggering - IF condition not working

Friends,
I am facing weird issue in my production system i.e. one of the code block which was bounded in IF condition is getting triggered. However, as per the data that I have in my system this IF condition should skip that code block.
Let me give you code and execution flow here:
I have Program A in which I am submitting Program B in background mode to selected server. This Program A will be executed by end user in Background mode.
call function 'JOB_OPEN'
     exporting
       jobname          = job_name
     importing
       jobcount         = job_number
     exceptions
       cant_create_job  = 01
       invalid_job_data = 02
       jobname_missing  = 03.
if sy-subrc = 0.
     submit program B
              via job job_name number job_number
              with p_sched  = sched
              with period_p = period
              with fyear_p  = fyear
              with username = ruser
and return.
call function 'JOB_CLOSE'
     exporting
       jobcount             = job_number
       jobname              = job_name
       sdlstrtdt            = start_date
       sdlstrttm            = start_time
      targetserver          = l_targetserver          "V05++
     exceptions
       cant_start_immediate = 01
       invalid_startdate    = 02
       jobname_missing      = 03
       job_close_failed     = 04
       job_nosteps          = 05
       job_notex            = 06
       lock_failed          = 07.
endif.
As you can see in code, I am passing job to run on l_targetserver. This program also releases some other jobs on other programs.
In Program B, I have code like this:
Top Include.
start-of-selection.
perform routine1 using p_fyear. "THIS HAS SOME SELECT QUERIES  AND  OTHER CODE and THERE IS NO ISSUE WITH IT. THIS ROUTINE IS
ALSO HAVING ONE AND ONLY 'CLEAR' statement on DELTA_FLAG.
perrform routine2.
form routine2.
loop itab into wa.  " This itab was populated in routine1
  perform get_flag." WE ARE PASSING VALUE TO DELTA_FLAG VARIABLE HERE. YOU CAN CHECK CODE BELOW.
perform process_data. "CHECK THIS ROUTINE
peform update_records.
endloop.
endform.
Form Get_FLag.
select * from dbtable into localtable where <condition>. " THIS QUERY RETURNS SOME DATA AND MY FLAG WILL BE SET AS 'X'.
if sy-subrc = 0.
delta_flag = 'X'. "THis one declared in top include.
endif.
EndForm.
Form Process_Data.
Perform get_dataset1.
while counter <> 0. " Variable Counter declared in top include and default value is 20. Value will be decreased in side this loop. No issues with it.
if wa-fld1 = '1'. "Check value of one of the field.
  continue.
endif.
perform get_delta_data. " We have Unwanted ABAP code (for my scenario) here.
endwhile.
Endform.
form update_records.
call function 'FUNCTION' in update task exporting par1 = itab.
commitwork
endform.
form get_delta_data.
if delta_flag is initial.
select data from BSEG into i_bseg where <condition>. " This query is getting triggered in my system.
endif.
endform.
All my data objects were declared in Top include of the program. Subroutines with their parameters were same as above code. I am not using any sub-routine second time or out-side of this program. As shown, this program updates records to one of the table with UPDATE function module IN UPDATE TASK and there is COMMITWORK after that. This task is part of
As you could understand, DELTA_FLAG is having 'X' but query on BSEG is getting triggered. We are not clearing this variable after populating 'X' to it. I can see this query from Program B captured in ST12 trace results. (Verified it multiple times)
I did this analysis:
1. Ran this process in foreground with debugging, then there is no issue.
2. Debugged 'Finished' job of my production system, but I dont see this code triggered in Debug mode.
3. Replicated same execution process in our non-production environments, but there is no issue.
Let me know if you need any other details.
Thanks for your time.
Regards,
Naveen

I forgot the one bit, which might actually have been useful: I'd be moving the if delta_flag is initial. out of form get_delta_data, before perform get_delta_data.Since you are calling in nested loops there, every little bit of run-time counts, and "philosophically" I feel - procedure should do what its name promises it will, and not check whether it's "appropriate time" to do it
cheers and good luck
Jānis

Similar Messages

  • Abap code Logic for splitting is not working

    Hi,
    I have a requirement to split a single amount and product into several parts. so far my logic is not working as only the first row is being fetched.
    TYPES: BEGIN of map_tab,
             ZPRODH4 TYPE NEWMAPPINGTABLE-/BIC/ZNEW_MP,
             ZSPRATIO TYPE NEWMAPPINGTABLE-/BIC/ZSP_RATIO,
             ZMATERIAL TYPE NEWMAPPINGTABLE-MATERIAL,
           END OF map_tab.
    Data:IT_MAP_TAB TYPE HASHED table of MAP_TAB with unique Key ZPRODH4,
         wa_it_map_tab like line of IT_MAP_TAB.
    Data rp TYPE _ty_s_TG_1.
    LOOP AT RESULT_PACKAGE into rp.
    Clear wa_it_map_tab.
    read table IT_MAP_TAB into wa_it_map_tab with table key ZPRODH4 =
    rp-prodh4.
    IF sy-subrc EQ 0.
    select SINGLE /BIC/ZNEW_MP /BIC/ZSP_RATIO MATERIAL into corresponding
    fields of wa_it_map_tab from NEWMAPPINGTABLE
    where  PRODH4 = rp-PRODH4.
    IF sy-subrc EQ 0.
      rp-PRODH4 = wa_it_map_tab-ZPRODH4.
      rp-AMOUNT = rp-AMOUNT * wa_it_map_tab-Zspratio.
      rp-MATERIAL = wa_it_map_tab-ZMATERIAL.
    ENDIF.
    ENDIF.
    MODIFY RESULT_PACKAGE FROM rp.
    ENDLOOP.
    <br><br>
    This is how my tables looks like
    Source Table
    PROD                                       AMOUNT
    900006600999                          1000
    400004400000                           500
    NEW MAPPING TABLE
    PROD                                      NEWPROD                      MATERIAL                             SPLITRATIO
    900006600999                         1000066001111                    7000                                         0.5
    900006600999                         1000066002222                    7001                                         0.4
    900006600999                         1000066003333                    7002                                         0.1
    OLD MAPPING TABLE
    PROD                              MATERIAL
    4000044000000               7100
    TARGET TABLE
    PROD                        PROD3               MATERIAL        AMOUNT
    1000066001111         100006600            7000                 500            
    1000066002222         100006600            7001                 400          
    1000066003333         100006600            7002                 100
    4000044000000         400004400            7100                 500

    Hi,
    I rewrote the code the like this and it is still not working as the new value is not being fetched.
    {* TABLES: ...
    Defining tables
    Tables: /BIC/OLDTABLE,/BIC/NEWTABLE.
    $$ end of global - insert your declaration only before this line -
    The follow definition is new in the BW3.x
    TYPES:
    BEGIN OF DATA_PACKAGE_STRUCTURE.
    INCLUDE STRUCTURE /BIC/CS8ZSEM_TC03.
    TYPES:
    RECNO LIKE sy-tabix,
    END OF DATA_PACKAGE_STRUCTURE.
    DATA:
    DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
    WITH HEADER LINE
    WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    New Material table
    DATA: BEGIN OF I_S_NEWTAB,
    PRODH4 TYPE /BIC/NEWTABLE-PRODH4,
    /BIC/ZNEW_MP TYPE /BIC/NEWTABLE-/BIC/ZNEW_MP,
    /BIC/ZSP_RATIO TYPE /BIC/NEWTABLE-/BIC/ZSP_RATIO,
    MATERIAL TYPE /BIC/NEWTABLE-MATERIAL,
    END OF I_S_NEWTAB.
    Data: i_t_newtab LIKE TABLE OF I_S_NEWTAB.
    *Old Material table
    DATA: BEGIN OF I_S_OLDTAB,
    PRODH4 TYPE /BIC/OLDTABLE-PRODH4,
    MATERIAL TYPE /BIC/OLDTABLE-MATERIAL,
    END OF I_S_OLDTAB.
    DATA: i_t_oldtab like table of I_S_oldTAB.
    data: e_s_result type STANDARD TABLE OF DATA_PACKAGE_STRUCTURE WITH
    HEADER LINE
    WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    data: e_t_result type STANDARD TABLE OF DATA_PACKAGE_STRUCTURE WITH
    HEADER LINE
    WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    data: amount type DATA_PACKAGE_STRUCTURE-/BIC/AMOUNT.
    data: CUSTSOLD type DATA_PACKAGE_STRUCTURE-/BIC/CUSTSOLD.
    selecting data from new table
    Select PRODH4 /BIC/ZNEW_MP /BIC/ZSP_RATIO MATERIAL FROM /BIC/NEWTABLE
    into corresponding fields of table i_t_newtab.
    SORT i_t_newtab by PRODH4.
    Selecting data from old material table
    Select PRODH4 MATERIAL FROM /BIC/OLDTABLE into corresponding fields
    of table i_t_oldtab.
    SORT i_t_oldtab by PRODH4.
    LOOP AT DATA_PACKAGE INTO e_s_result.
    read table i_t_oldtab into i_s_oldtab with key PRODH4 =
    e_s_result-PRODH4.
    if sy-subrc EQ 0.
    MOVE i_s_oldtab-PRODH4 to e_s_result-PRODH4.
    MOVE i_s_oldtab-PRODH4(14) to e_s_result-PRODH3.
    MOVE i_s_oldtab-MATERIAL to e_s_result-MATERIAL.
    APPEND e_s_result to e_t_result.
    ELSE.
    LOOP AT i_t_newtab into i_s_newtab where PRODH4 = e_s_result-PRODH4.
    amount = i_s_newtab-/BIC/ZSP_RATIO * e_s_result-/BIC/AMOUNT.
    CONCATENATE DATA_PACKAGE-SOLD_TO i_s_newtab-PRODH4(10) into AMOUNT.
    MOVE i_s_newtab-/BIC/ZNEW_MP to e_s_result-PRODH4.
    MOVE i_s_newtab-MATERIAL to e_s_result-MATERIAL.
    MOVE i_s_newtab-/BIC/ZNEW_MP(14) to e_s_result-PRODH3.
    MOVE amount to e_s_result-/BIC/AMOUNT.
    MOVE ZASTUOTE to e_s_result-/BIC/CUSTSOLD.
    APPEND e_s_result to e_t_result.
    ENDLOOP.
    ENDIF.
    ENDLOOP.
    REFRESH DATA_PACKAGE.
    MOVE e_t_result to DATA_PACKAGE[].}

  • OR condition not working correctly in SQL

    I am adding the folling condition to a sql statement and
    AND (status_code IS NULL or status_code <> 'T'
    or (status_code IN ('A','B','C','D') and TRIM(order_type) NOT LIKE '%9999')
    or (status_code IN ('A','B','C','D') and order_type IS NOT NULL)
    or (status_code NOT IN ('A','B','C','D')))
    but the or condition work...
    if i change it too
    AND ( (status_code IN ('A','B','C','D') and order_type IS NOT NULL) )
    then this portion of the OR condition work but when I use the OR condition something weird is happening that the condition not working... and i dont see a record that meets that condition...

    Hi,
    It's not the "trim" that implies "not null", but rather the fact that:
    - "not like" operator works only on non-null values and
    - "not like" operator disregards null values.
    Consider this:
    test@ORA92>
    test@ORA92>
    test@ORA92> l
      1  with x as (
      2    select null as y from dual union all
      3    select 'a9999' from dual union all
      4    select 'bxx' from dual
      5  )
      6  select * from x
      7* where y not like '%9999'
    test@ORA92>
    test@ORA92> /
    Y
    bxx
    1 row selected.
    test@ORA92>
    test@ORA92>Here, trim function was not used, but still the first row (that had null for y) was not returned. That's because Oracle disregarded the first row for comparison and out of the next two rows, it returned the third row because it satisfied the condition.
    As for your query, do the following conditions hold true:
    1. if status_code is null      - show the row regardless of order_type
    2. if status_code <> 'T'       - show the row regardless of order_type
    3. if status_code in (a,b,c,d) and order_type is not null and order_type ends with something other than 9999 - show the row
    4. if status_code in (a,b,c,d) and order_type is null                           - do not show the row
    5. if status_code in (a,b,c,d) and order_type is not null and it ends with 9999 - do not show the row
    6. if status_code is anything other than (a,b,c,d)                              - do not show the rowpratz

  • CD-DVD Reader gives me an eror code 39. It wil not work at all.

    CD-DVD raeder does not work. I have done every thing posssibel and  all I get is error code 39.
    What do i need to do to get it corected.
    This question was solved.
    View Solution.

    I have no idea what you are referring to about paying anything.
    That is a free official microsoft supported troubleshooting website, and it refers specifically for the troubleshooting steps to fix a code 39 error.
    I refer forum members this site all the time.
    Your CD or DVD drive is not seen in File Explorer (called Windows Explorer in Windows 7 and earlier versions of Windows), and the device is marked with a yellow exclamation point in Device Manager. Additionally, after you open the device's Properties dialog box, one of the following errors is listed in the Device statusarea:
    Windows cannot start this hardware device because its configuration information (in the registry) is incomplete or damaged. (Code 19)
    The device is not working properly because Windows cannot load the drivers required for this device. (Code 31)
    A driver (service) for this device has been disabled. An alternate driver may be providing this functionality. (Code 32)
    Windows cannot load the device driver for this hardware. The driver may be corrupted or missing. (Code 39)
    Windows successfully loaded the device driver for this hardware but cannot find the hardware device. (Code 41)
    If none of the steps worked for you then I do not have any other suggestions you  can try.

  • My adobe presenter redemption code (creative cloud) membership does not work.

    my adobe presenter redemption code (creative cloud) membership does not work.  Each time I input my presenter code at creativecloud/redeem it returns a message 'ooops, this code has been redeemed.'

    I got both installed but on installing Presenter keeps giving errors that a previous version is installed on the computer and cannot proceed.  I verified that there is no previous version and keep redoing the install and get stuck AGAIN and AGAIN at this point.
    I also verified that I have the latest version of Flash on Chrome and I have the latest version.  Why is Adobe so all over on downloading/installing their products.  I (and other paying customers)  cannot waste more time on this very simple procedure just because the software packages are not packaged properly or. the teams in charge of ensuring the products DID NOT correctly package the products securely (with the updates included) and more importantly, ensured that the products were linked to user accounts who purchased them.

  • Unwanted source code appears in browser but not in Dreamweaver Code Window

    I am using templates and css, and Dreamweaver to build a new website of about 20 pages. With the first several pages, everything was working well. Then as I continued to add pages, I started to notice some code appearing at the bottom of web pages (under the footer), and then, a page duplicating the footer, and then, the drop-down function on the index page not working (pulls down and pops right back up) while headers on other pages work fine. I viewed the source code in the browsers (IE and Firefox) and I see the extra code at the bottom. However, this code doesn't show up in Dreamweaver, or, when I open the files in Notepad.
    Following is an example of the different bottom-most lines of code in the Firefox browser compared to what I see in Dreamweaver or Notepad (note the highlighted line that is not showing up in Notepad or Dreamweaver).
    Firefox Browser:
    </div>
          </div>
          <div class="clear"></div>
        </div>
      </div>
    </div>
    <!-- InstanceEndEditable --><script src="http://brandbar.oit.duke.edu/footer/videos_podcasts_full.php" type="text/javascript"></script>
    <script type="text/javascript"  src="http://brandbar.oit.duke.edu/header/js/jquery.min.js"></script>
    <script type="text/javascript" src="http://brandbar.oit.duke.edu/header/js/globalHeader.js"></script> 
    <script type="text/javascript"  src="http://brandbar.oit.duke.edu/footer/js/footer.js"></script>
    </body>
    <!-- InstanceEnd --></html>ript> 
    <script type="text/javascript"  src="http://brandbar.oit.duke.edu/footer/js/footer.js"></script>
    </body>
    <!-- InstanceEnd --></html>
    Notepad or Dreamweaver code screen:
    </div>
          </div>
          <div class="clear"></div>
        </div>
      </div>
    </div>
    <!-- InstanceEndEditable --><script src="http://brandbar.oit.duke.edu/footer/videos_podcasts_full.php" type="text/javascript"></script>
    <script type="text/javascript"  src="http://brandbar.oit.duke.edu/header/js/jquery.min.js"></script>
    <script type="text/javascript" src="http://brandbar.oit.duke.edu/header/js/globalHeader.js"></script> 
    <script type="text/javascript"  src="http://brandbar.oit.duke.edu/footer/js/footer.js"></script>
    </body>
    <!-- InstanceEnd --></html>

    this answer is a bit late, but i think i have figured this problem out and it is probably still bugging someone out there.
    i was having the same issues through many dreamweaver upgrades and kept running into the same problem (only on my Mac though - PC never gave me trouble). anyway, my hard drive recently died and i had a brand new one installed and then i installed a fresh version of CS5. started building a page and ran into the same problem. now that this is happening on a new drive with a fresh OS and reinstalled software, i needed to look elsewhere.
    the problem is so simple you will more than likely cry at the amount of time you have wasted on it. more than likely if this is happening to you, you are working off of a network drive or a server. all my files are stored on a server locally, so when i make a change it is saving to the server. either a bad or slow connection to the server and/or a server going bad will cause this issue.
    take the same file that you are having problems with and save down to your desktop - then preview in a browser. so the solution is to build the entire site on your local drive and then FTP up to the live site when complete.
    hope this helps.

  • Process chain - After error ABAP - trigger a metachain start does not work.

    Hi,
    I have a process chain, where after an ABAP runs into red (ERROR MESSAGE triggered), another process type, like start a new meta-chain, or start an infopackage starts.... But is does not work. After i go to logs, it asks me whether i want to trigger the following jobs, if i choose yes, it works. But i need to start it automatically, when the ABAP Routine has an error message (RED) in the chain.
    Any idea, because I tried to solve it all the day, but i did not manage to get itwork...
    Many Thanks,
    L.

    Hi,
    the problem is not the ABAP Program.
    I have the following situation:
    A Metachain contains as second step a call of local chain. After the local chain, according to the status of it (green o red), we have other different steps. So we have two different link (red and green) starting from the local process chain step.
    Inside the local process chain there is the ABAP program that check several parameters and if something is not as expected fails with status red. if this situation happens, the local process chain becomes red and in SM37 inside the job i see the error that i forced, but the status is not triggered to the first metachain , so the corresponding following steps are not triggered.
    This issue happens only if fails the ABAP program because, for example, a Infopackages loading fails every thing works and the corresponding steps in the metachain are executed.
    In the ABAP program in order to force the status red we have the following code:
    MESSAGE e162(00) WITH 'Status' 'Red'.
    Any idea?
    Thanks,
    Veronica

  • Condition not working

    Hi all the is code i have used
    DECLARE     
         CURRENTRECORD NUMBER;     
    BEGIN
    DECLARE
                   CURRENT_DISCOUNT NUMBER;
                   CURRENT_REASON VARCHAR2(100);
    BEGIN
    CURRENT_DISCOUNT:=:XXSY_DISCOUNT_MANAGER_V.DISCOUNT_RATE;
                   CURRENT_REASON:=:XXSY_DISCOUNT_MANAGER_V.DISCOUNT_REASON;     
                   CURRENTRECORD :=:SYSTEM.CURSOR_RECORD;
                   IF :XXSY_DISCOUNT_MANAGER_V.DISCOUNT = 'Y' THEN
                   FIRST_RECORD;
                   WHILE TRUE LOOP
              :XXSY_DISCOUNT_MANAGER_V.DISCOUNT_RATE:= CURRENT_DISCOUNT;
              :XXSY_DISCOUNT_MANAGER_V.DISCOUNT_REASON:= CURRENT_REASON;
                   IF :System.Last_Record = 'TRUE' THEN     
              :XXSY_DISCOUNT_MANAGER_V.DISCOUNT_RATE:=CURRENT_DISCOUNT;
              :XXSY_DISCOUNT_MANAGER_V.DISCOUNT_REASON:=CURRENT_REASON;
    EXIT;
    ELSE
         NEXT_RECORD;
    END IF;
    END LOOP;
    END IF;                
         END;
    END;
    it is not working properly,for record to record values is changing.for 1st record it is ok ,2nd record itis dispalying 1st record like that..
    plss help me in this condition
    Rgards
    Siva

    DECLARE
    CURRENTRECORD NUMBER;
    CURRENT_DISCOUNT NUMBER;
    CURRENT_REASON VARCHAR2(100);
    BEGIN
    CURRENT_DISCOUNT:=:XXSY_DISCOUNT_MANAGER_V.DISCOUNT_RATE;
    CURRENT_REASON:=:XXSY_DISCOUNT_MANAGER_V.DISCOUNT_REASON;
    CURRENTRECORD :=:SYSTEM.CURSOR_RECORD;
    IF :XXSY_DISCOUNT_MANAGER_V.DISCOUNT = 'Y' THEN
    FIRST_RECORD;
    LOOP
    :XXSY_DISCOUNT_MANAGER_V.DISCOUNT_RATE:= CURRENT_DISCOUNT;
    :XXSY_DISCOUNT_MANAGER_V.DISCOUNT_REASON:= CURRENT_REASON;
    EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
    NEXT_RECORD;
    END LOOP;
    END IF;
    END;
    Is the condition ":XXSY_DISCOUNT_MANAGER_V.DISCOUNT " true for more than 1 record....??????
    Is there any error....?????
    Are there displayed in your block more than one record...?????
    Transform the above code and execute it in sql plus..... as db procedure..... Are the results as expected....?????
    Greetings,
    Simon

  • "If"  condition not working

    Hi all,
    Here i want to put condition like when BELRT field of BKPF table get 'RE' type data this time condition is fire and program will termineted. for this i put code like below.
    SELECT * FROM BKPF INTO TABLE IT_BKPF WHERE BELNR IN P_DOCNO          " DOCUMENT NO.
                                            AND   GJAHR IN P_FYEAR.         " FISCAL YEAR.
        if it_bkpf-blart = 'RE'.
          MESSAGE 'Please Enter Correct Doc.No and Financial Year' TYPE 'I'.
          SUBMIT ZFI_MM_DEBIT_VENDOR1 VIA SELECTION-SCREEN AND RETURN.
          LEAVE PROGRAM.
        endif.
    But it will not working. So please help me out..
    Thanks in Advance.
    keyur chauhan
    Code Formatted by: Alvaro Tejada Galindo on Jan 4, 2010 5:28 PM

    please correct you code
    SELECT * FROM BKPF
    INTO TABLE IT_BKPF
    WHERE BELNR IN P_DOCNO    and                  " DOCUMENT NO.
               GJAHR IN P_FYEAR    and               " FISCAL YEAR.
                blart  ='RE'.
    if sy-subrc = 0.
    "  do what ever you want here further processsing
    else.
       message 'No Data Found' type 'I'.
       LEAVE-LIST PROCESSING.
    ENDIF.
    ( or )
    SELECT * FROM BKPF
    INTO TABLE IT_BKPF
    WHERE BELNR IN P_DOCNO    and                  " DOCUMENT NO.
               GJAHR IN P_FYEAR .                            " FISCAL YEAR
    if sy-subrc = 0.
       loop at it_bkpf in wa_bkpf.
          if wa_bkpf-blart = 'RE'.
              "  Do you logic what you want
         else.
       "   here you can do many things
         "     a) use CONTINUE statment to move to next loop pass
           "   b) you can raise an  message
         endif.
    Let me know if you need further information
    Regards
    Satish Boguda

  • Date Condition Not Working ,Value not cming in to item.

    Hi Friends,
    i have create a form for palce order and i have create a MASTER table for fixed item Rate between two date with price code like A,B,C,D .
    In Form i have for Item
    :P1_ORDER_DATE
    :P1_ITEM_CODE
    :P1_PRICE_CATEGORY Select List With Submit
    :P1_ITEM_RATE
    In Item rate i have put in Source ,
    Source Type --SQL Quary
    Source Vale
    select RATE_1 from SAM_ITEM_MAS where ITEM_CODE =:P1_ITEM_CODE and  PRICE_CATEGORY=:P1_PRICE_CATEGORY and :P1_ORDER_DATE
    between FROM_DATE and TO_DATEMy Table
    CREATE TABLE  "SAM_ITEM_MAS"
       (     "ID" NUMBER NOT NULL ENABLE,
         "ITEM_CODE" NUMBER,
         "PRICE_CATEGORY" VARCHAR2(5),
         "FROM_DATE" DATE,
         "TO_DATE" DATE,
         "RATE_1" NUMBER,
         CONSTRAINT "SAM_ITEM_MAS_PK" PRIMARY KEY ("ID") ENABLE
    /that code's not working but if i run this code in to SQL Command Then it's work fine.but not in to ITEM :P1_ITEM_RATE .
    i want when i select P1_PRICE_CATEGORY Like A,B,C,D then Respective Rate from Table SAM_ITEM_MAS should come in to item :P1_ITEM_RATE .
    Oredr date condition is not working.
    Thanks
    Edited by: 805629 on Dec 28, 2010 11:32 PM

    Hi,
    Have you tried casting the item values as dates using TO_DATE():
    select RATE_1
    from SAM_ITEM_MAS
    where ITEM_CODE =:P1_ITEM_CODE
    and  PRICE_CATEGORY=:P1_PRICE_CATEGORY
    and TO_DATE(:P1_ORDER_DATE,'DD/MM/YYYY') between "FROM_DATE" AND "TO_DATE"(change the date format string to match the format of the P1_ORDER_DATE page item)
    You should probably change the name of the field to something other than TO_DATE as this is an Oracle function name - try DATE_FROM and DATE_TO or START_DATE and END_DATE or something like that. Otherwise you may have to use the double-quotes as I have shown above
    Andy

  • Select condition not work, possible mistake

    I have simple select like
    String sStatus=req.getParameter("processStatus")==null?"":req.getParameter("processStatus");
    I can get the value of
    sStatus
    but my else is not working, what is the possible mistake?
    if(sStatus.equals("#"))
    Sql+=" and basicStatus=1 order by family_income asc ";                              
    else
    Sql+=" and basicStatus=1 and ProcessStatus='"+sStatus+ "' order by family_income asc ";                         
    I try sql in db db like and basicStatus=1 and ProcessStatus='"New' order by family_income asc      it work fine, so??
    Thank you

    Hi jverd,
    thank you fot the reply, but before I only nedd to executeQuery my sql once, but, if I use PreparedStatement, then I have to
    executeQuery as many as the conditions I have , any way, right now I change my code to
    String Sql="SELECT * FROM student2 as s, student_financial_info2 as f where s.student_id=f.student_id ";
                    //search for Id, so we don't care about status and how many row in one page
                    if (university_ID !=""){                   
                              Sql+=" and s.student_id=? order by family_income asc ";
                              ps = conn.prepareStatement(Sql);
                              ps.setString(1,university_ID );
                              ps.executeUpdate();
                              connectionPool.returnConnection(conn);
                    //for group search
                    else{
                       if(search.equals("All")){              
                            if(basicStatus.equals("basicStatus"))                     
                                 Sql+=" and ProcessStatus=? and basicStatus=? order by family_income asc ";
                                          Sql+=" limit " + currentRow + ",100"; 
                                          ps = conn.prepareStatement(Sql);
                                             ps.setString(1, FStatus);
                                             ps.setInt(2,1);
                                             ps.executeUpdate();
                                             connectionPool.returnConnection(conn);        
                       //for department search
                        else{
                            if(basicStatus.equals("basicStatus")){
                              Sql+=" and faculty =? and ProcessStatus=? and basicStatus=? order by family_income asc";
                              ps = conn.prepareStatement(Sql);
                              ps.setString(1,  search);
                               ps.setString(2, FStatus);
                               ps.setInt(3,1);
                               ps.executeUpdate();
                                connectionPool.returnConnection(conn);}
                            else{
                              Sql+=" and faculty ='"+search+ "' order by family_income asc";
                              ps = conn.prepareStatement(Sql);
                              ps.setString(1,  search);
                              ps.executeUpdate();                 
                                connectionPool.returnConnection(conn);
                    }// out elseI get error on String Sql="SELECT * FROM student2 as s, student_financial_info2 as f where s.student_id=f.student_id ";
              //search for Id, so we don't care about status and how many row in one page
              if (university_ID !=""){                   
                        Sql+=" and s.student_id=? order by family_income asc ";
                        ps = conn.prepareStatement(Sql);
                        ps.setString(1,university_ID );
                        ps.executeUpdate();
                        connectionPool.returnConnection(conn);
              //for group search
              else{
              if(search.equals("All")){              
                   if(basicStatus.equals("basicStatus"))               
                        Sql+=" and ProcessStatus=? and basicStatus=? order by family_income asc ";
    *                    Sql+=" limit " + currentRow + ",100";*
    *                    ps = conn.prepareStatement(Sql);*
    *                                   ps.setString(1, FStatus);*
    *                                   ps.setInt(2,1);*
    *                                   ps.executeUpdate();*
    *                                   connectionPool.returnConnection(conn);*
              //for department search
              else{
                   if(basicStatus.equals("basicStatus")){
              Sql+=" and faculty =? and ProcessStatus=? and basicStatus=? order by family_income asc";
                   ps = conn.prepareStatement(Sql);
                   ps.setString(1, search);
                        ps.setString(2, FStatus);
                        ps.setInt(3,1);
                        ps.executeUpdate();
                        connectionPool.returnConnection(conn);}
                   else{
                   Sql+=" and faculty ='"+search+ "' order by family_income asc";
                   ps = conn.prepareStatement(Sql);
                   ps.setString(1, search);
                   ps.executeUpdate();           
                        connectionPool.returnConnection(conn);
              }// out else
    I got error on the blod part JDBC error:Parameter index out of range (1 > number of parameters, which is 0).
    java.sql.SQLException: Parameter index out of range (1 > number of parameters, w
    hich is 0). How com the index is start on 0?
    Thank you

  • Additional Results Condition Not Working Correctly For Parameters

    TestStand 2014
    Trying to log a parameter only if the step status is "Failed" won't log the parameter when the step actually fails.  However, variables with the same condition will log just fine.
    The attached sequence demonstrates this.  Basically I have a subsequence that returns a random number and a string as parameters.  I use the random number to evaluate against my limits for the test call.  I want to log the string parameter only if the step fails.  So I set it as an additional result and set the condition to
    Step.Result.Status == "Failed"
    The data never shows on the report.
    But when I put an explicit additional result with the same local variable and put the exact same condition it shows on the report when the step fails.
    I'm baffled as to why parameters won't log with this condition but explicit additional results work just fine with the same condition.
    Any thoughts?
    Thanks,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~
    Solved!
    Go to Solution.
    Attachments:
    ParameterWontLog.seq ‏7 KB

    The condition for the parameter's additional result is evaluted before the sequence call's status is set to failed. The 'out' parameter additional results are probably being evaluated right after the code module call, so if the the step's status isn't changed by the code module call, then it will still be "Running".
    I can see how it would be nice if it worked the way you are asking, but keep in mind for in/out parameters it's typically the same expression/variable in both the 'in' and 'out' additional result, so the time at which the result is logged is important. It has to be done before the code module call for 'in' parameters and after the code module call for 'out' parameters in order to accurately reflect the state of the variables at those points in time. I think the intent is that the additional result for parameters should reflect the state of the variables at the point in time immediately right before the call for 'in' parameters and immediately after the call for 'out' parameters. Thus if you want to conditionally log a value based on the status (where the status is not changed directly by the code module), then using a regular additional result like you discovered is probably the best way to go.
    Perhaps for out parameters we could delay logging until the very end, but that might result in a change in behavior if the variable state changes again before that. If you would like for us to consider that or have another idea for how to handle this better please let us know or perhaps post something to the Idea Exchange.
    Another possibility is that we could temporarily log the results before and after the code module call, but then not evaluate the condition until the very end and throw out the logged result if the condition is false. That might still cause a change in behavior though if the "Value to Log" expressions have side-effects.
    Hope this helps clarify things.
    -Doug

  • IF-condition not working in sap script??????

    hi,
       i am trying to chk one condition in sap script using if statement....but it is not working at all.
      statement i am writing is :-
    /:   IF &IST_ITEM-SAD_PRINT& <>  0
    p7 ,,,,,,,,,,,,,,,,SAD,, 4.00  &IST_ITEM-SAD_PRINT&
    /:   ENDIF
    value for IST_ITEM-SAD_PRINT is coming as it is shown while debuging .
    eventhen control is going inside if statement independent from the value of IST_ITEM-SAD_PRINT
    how to use if statement properly....
    regards
    Deepak

    Hi,
    Declare a dummy variable of type IST_ITEM-SAD_PRINT and then use that variable in sapscript..
    Ex..
    <b>Print program</b>
    DATA: V_DUMMY LIKE IST_ITEM-SAD_PRINT.
    <b>Sap script</b>
    /: IF &IST_ITEM-SAD_PRINT& <> <b>&V_DUMMY&</b>
    p7 ,,,,,,,,,,,,,,,,SAD,, 4.00 &IST_ITEM-SAD_PRINT&
    /: ENDIF
    Thanks,
    Naren

  • Validation-code of a view is not working in portal

    my validation code is working fine when testing in local view's application. the same view is attached to portal through fpm. while testing the same view in srm portal it is not working.can anybody suggest me why it is happening so. i will be thankful.

    have you checked in debugging.....

  • HT2693 I bought an itunes gift card but when i try to redeem my account it says invalid code. I put in the code perfectly but its still not working. The shop wont take it back either, What should i do?

    I need help, i bought an itunes gift card but when i try to redeem my account it says invalid code. I even checked the code and i had it 100% right but its still not working. The shop in which i bought it wont take it back so i dont know what to do. Please help.

    iTunes Store: Invalid, inactive, or illegible codes

Maybe you are looking for