IF CONDTION

HI HERE I HAVE INSERT THE RECORDS BY USING VERSION . AND I ALSO HAVE TO CHECK IF VERSION =''ACTUAL'' FOR SOME EXTRA CODING... CAN YOU PLEASE HELP ME?INSERT INTO [dbo].tblCALPLA(ACCOUNT,DATASRC,VERSION)
SELECT ACCOUNT,DATASRC,VERSION FROM [dbo].TBLFACT
WHERE VERSION in (SELECT ID FROM [dbo].VERSION)
UNION
SELECT ACCOUNT,DATASRC,VERSION FROM [dbo].TBLFACT1
WHERE VERSION in (SELECT ID FROM [dbo].VERSION)
UNION
SELECT ACCOUNT,DATASRC,VERSION FROM [dbo].TBLFACT2
WHERE VERSION in (SELECT ID FROM [dbo].VERSION)

you can do with where condition as below: But, not sure what you are looking for...
SELECT ACCOUNT,DATASRC,VERSION
FROM [dbo].TBLFACT1
WHERE VERSION in
(SELECT
ID FROM [dbo].VERSION
WHERE ID ='ACTUAL')
If you have more question, please post with more details.

Similar Messages

  • How to delete header condtion line of sales order by BAPI

    Hi,
    I want to delete the condtion line of sales order header using BAPI "BAPI_SALESORDER_CHANGE",
    it is work well in item level condition type, but it is not work for header condition type. show error message "missing item number" since of pass item number "000000" for header condition line.
    Below is reference source code, thanks in advance.
    *& Report  ZTEST_BAPI_SO_DELETECONDLINE
    *& Sample program to call BAPI_SALESODRER_CHANGE to
    *& delete condition line of so line item
    REPORT  ZTEST_BAPI_SO_DELETECONDLINE.
    ***--- Structures for create BAPI
    DATA: SALESDOCUMENT LIKE BAPIVBELN-VBELN.
    DATA: ORDER_HEADER_INX LIKE BAPISDH1X,
          BEHAVE_WHEN_ERROR LIKE BAPIFLAG-BAPIFLAG,
          SIMULATION LIKE BAPIFLAG-BAPIFLAG.
    DATA: BEGIN OF ORDER_ITEM_IN OCCURS 2.
            INCLUDE STRUCTURE BAPISDITM.
    DATA: END OF ORDER_ITEM_IN.
    DATA: BEGIN OF ORDER_ITEM_INX OCCURS 2.
            INCLUDE STRUCTURE BAPISDITMX.
    DATA: END OF ORDER_ITEM_INX.
    DATA: BEGIN OF SCHEDULE_LINES OCCURS 2.
            INCLUDE STRUCTURE BAPISCHDL.
    DATA: END OF SCHEDULE_LINES.
    DATA: BEGIN OF SCHEDULE_LINESX OCCURS 2.
            INCLUDE STRUCTURE BAPISCHDLX.
    DATA: END OF SCHEDULE_LINESX.
    DATA: BEGIN OF ORDER_CFGS_REF OCCURS 2.
            INCLUDE STRUCTURE BAPICUCFG.
    DATA: END OF ORDER_CFGS_REF.
    DATA: BEGIN OF ORDER_CFGS_INST OCCURS 2.
            INCLUDE STRUCTURE BAPICUINS.
    DATA: END OF ORDER_CFGS_INST.
    DATA: BEGIN OF ORDER_CFGS_VALUE OCCURS 2.
            INCLUDE STRUCTURE BAPICUVAL.
    DATA: END OF ORDER_CFGS_VALUE.
    DATA: BEGIN OF CONDITIONS_IN OCCURS 2.
            INCLUDE STRUCTURE BAPICOND.
    DATA: END OF CONDITIONS_IN.
    DATA: BEGIN OF CONDITIONS_INX OCCURS 2.
            INCLUDE STRUCTURE BAPICONDX.
    DATA: END OF CONDITIONS_INX.
    DATA: BEGIN OF EXTENSIONIN OCCURS 2.
            INCLUDE STRUCTURE BAPIPAREX.
    DATA: END OF EXTENSIONIN.
    DATA: BEGIN OF RETURN OCCURS 2.
            INCLUDE STRUCTURE BAPIRET2.
    DATA: END OF RETURN.
    DATA: TMP_POSNR  LIKE VBAP-POSNR,
          L_KNUMV    LIKE VBAK-KNUMV,
          L_KSCHL    LIKE KONV-KSCHL,
          L_STUNR    LIKE KONV-STUNR,
          L_ZAEHK    LIKE KONV-ZAEHK.
    ***--- Selection
    PARAMETERS: P_VBELN LIKE VBAK-VBELN OBLIGATORY MEMORY ID AUN DEFAULT '7000510', "'0001007443', " SO
                P_POSNR LIKE VBAP-POSNR OBLIGATORY DEFAULT '000000' , " so item
                P_CONDN LIKE  KONV-KSCHL  DEFAULT 'ZOSP',    " condition type
                P_CONDI LIKE  KONV-ZAEHK  DEFAULT '01',      " Condition item number
                P_TEST  AS CHECKBOX DEFAULT 'X'.             " test mode
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          INPUT         = P_VBELN
        IMPORTING
          OUTPUT        = P_VBELN.
      CLEAR: L_KNUMV.
      SELECT SINGLE KNUMV INTO L_KNUMV
      FROM VBAK
      WHERE VBELN  = P_VBELN.
      IF SY-SUBRC = 0.
        CLEAR: L_KSCHL,L_ZAEHK,L_STUNR.
        SELECT SINGLE KSCHL ZAEHK STUNR INTO (L_KSCHL, L_ZAEHK, L_STUNR)
        FROM KONV
        WHERE KNUMV = L_KNUMV
          AND KPOSN = P_POSNR
          AND ZAEHK = P_CONDI
          AND KSCHL = P_CONDN.
        IF SY-SUBRC <> 0.
          WRITE:/ 'Condition type or condition item is not exist.'.
          EXIT.
        ENDIF.
      ELSE.
        WRITE:/ 'Sales order number is not exist'.
        EXIT.
      ENDIF.
    IF L_ZAEHK IS INITIAL.
          WRITE:/ 'Condition type or condition item is not exist.'.
          EXIT.
    ENDIF.
    SALESDOCUMENT = P_VBELN.     " Sales order number
    ORDER_HEADER_INX-UPDATEFLAG = 'U'.   "U = change sales order
    ***Item Data
    ORDER_ITEM_IN-ITM_NUMBER = P_POSNR.
    APPEND ORDER_ITEM_IN.
    ORDER_ITEM_INX-UPDATEFLAG = 'U'.   "I = add, U= update, D=delete
    ORDER_ITEM_INX-ITM_NUMBER = P_POSNR.
    APPEND ORDER_ITEM_INX.
    ***--- Begin delete a condition line
    ***--- Make sure to use update flag 'D'. Here I = add, U= update, D=delete
    CLEAR: CONDITIONS_IN,CONDITIONS_INX.
    REFRESH: CONDITIONS_IN,CONDITIONS_INX.
    CONDITIONS_IN-ITM_NUMBER = P_POSNR.
    CONDITIONS_IN-COND_ST_NO = L_STUNR.
    CONDITIONS_IN-COND_COUNT = L_ZAEHK.
    CONDITIONS_IN-COND_TYPE  = L_KSCHL.
    APPEND CONDITIONS_IN.
    CONDITIONS_INX-UPDATEFLAG = 'D'.
    CONDITIONS_INX-ITM_NUMBER  = P_POSNR.
    CONDITIONS_INX-COND_ST_NO  = L_STUNR.
    CONDITIONS_INX-COND_COUNT  = L_ZAEHK.
    CONDITIONS_INX-COND_TYPE   = L_KSCHL.
    APPEND CONDITIONS_INX.
    ***--- End delete a condition line
    BEHAVE_WHEN_ERROR = 'P'.
    SIMULATION = P_TEST.   " Test mode or not
    "=== call BAPI
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        SALESDOCUMENT               = SALESDOCUMENT
        ORDER_HEADER_INX            = ORDER_HEADER_INX
        LOGIC_SWITCH                = '    U'
      TABLES
        RETURN                      = RETURN
        ORDER_ITEM_IN               = ORDER_ITEM_IN
        ORDER_ITEM_INX              = ORDER_ITEM_INX
        CONDITIONS_IN               = CONDITIONS_IN
        CONDITIONS_INX              = CONDITIONS_INX .
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    WRITE: / 'Return code =', SY-SUBRC.
    SKIP 1.
    LOOP AT RETURN.
      WRITE: / RETURN-MESSAGE.
    ENDLOOP.
    Edited by: hank jiang on May 21, 2010 5:07 AM
    Edited by: hank jiang on May 21, 2010 5:25 AM
    Edited by: hank jiang on May 21, 2010 5:27 AM

    SALESDOCUMENT = P_VBELN.     "Sales order number
    ORDER_HEADER_INX-UPDATEFLAG = 'U'.   "U = change sales order
    ORDER_ITEM_IN-ITM_NUMBER = P_POSNR.
    APPEND ORDER_ITEM_IN.
    ORDER_ITEM_INX-UPDATEFLAG = 'U'.   "I = add, U= update, D=delete
    ORDER_ITEM_INX-ITM_NUMBER = P_POSNR.
    APPEND ORDER_ITEM_INX.
    "Begin delete a condition line
    "Make sure to use update flag 'D'. Here I = add, U= update, D=delete
    CLEAR: CONDITIONS_IN,CONDITIONS_INX.
    REFRESH: CONDITIONS_IN,CONDITIONS_INX.
    CONDITIONS_IN-ITM_NUMBER = P_POSNR.
    CONDITIONS_IN-COND_ST_NO = L_STUNR.
    CONDITIONS_IN-COND_COUNT = L_ZAEHK.
    CONDITIONS_IN-COND_TYPE  = L_KSCHL.
    APPEND CONDITIONS_IN.
    CONDITIONS_INX-UPDATEFLAG = 'D'.
    CONDITIONS_INX-ITM_NUMBER  = P_POSNR.
    CONDITIONS_INX-COND_ST_NO  = L_STUNR.
    CONDITIONS_INX-COND_COUNT  = L_ZAEHK.
    CONDITIONS_INX-COND_TYPE   = L_KSCHL.
    APPEND CONDITIONS_INX.
    "End delete a condition line
    BEHAVE_WHEN_ERROR = 'P'.
    SIMULATION = P_TEST.   " Test mode or not
    "=== call BAPI
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        SALESDOCUMENT               = SALESDOCUMENT
        ORDER_HEADER_INX            = ORDER_HEADER_INX
        LOGIC_SWITCH                = '    U'
      TABLES
        RETURN                      = RETURN
        ORDER_ITEM_IN               = ORDER_ITEM_IN
        ORDER_ITEM_INX              = ORDER_ITEM_INX
        CONDITIONS_IN               = CONDITIONS_IN
        CONDITIONS_INX              = CONDITIONS_INX .
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    WRITE: / 'Return code =', SY-SUBRC.
    SKIP 1.
    LOOP AT RETURN.
      WRITE: / RETURN-MESSAGE.
    ENDLOOP.

  • How to inventorize the value of a condtion of a PO during GR

    Hi,
    I have a senario where a value of a customized condition of a PO has to be inventorized while doing GR. Example
    Base value 100
    XYZ condtion 10
    GR Entries should be:-
    Invenotry Stores & spares Dr 110
    Gr/IR Clearing Goods Cr 110
    Please help to provide the step by step process to achive the required senario's.
    Regards,
    Mohar

    copy  freight condition(frb1,frc1),own condition & create it will be inventorized during MIGO
    See that there is no acct key & accrual key field is empty in calculation schema

  • Withholding Tax all Condtion table not appearing in Rebate Credit memo

    Hi
    I am finding issue in rebate credit memo.
    Issue: In Acces sequence I have table 397 and extended 397 with additional fields.
    In normel credit memo I am able to find all these table in sales order Pricing Analysis tab.
    But in rebate credit memo, I am not able to find all table. Credit memo is showing 397 table but not showing ztable.
    Please check below screen shot for details
    1. 397 and 988 are identical and its appearing in rebate credit memo.
    I created 988 just to verify if any thing wrong in ztable generation or any thing missing to map.
    987 is extended table with addtional field sales doc. Type, Item category and its not appearing in Rebate credit memo.
    2. Rebate credit memo showing 988 and 397 table
    3. Normel credit memo showing all three table
    Question : How to get all three table in Rebate Credit memo?
    If 988 is appearing than why 987 is not populating.
    Both are Ztable and created together.
    I tried many combination but extended ztable not coming in rebate credit memo
    Regards
    Neeraj

    Hi JP,
    Thanks
    Routine 923 created as per SAP note 178824. And I am finding this issue only for rebate credit memo request.
    This condtion type (withholding tax ) is not part of rebate condtion. It is part of standard pricing procedure same like MWST.
    In Normel credit Memo (CR) all access assigned to this access sequnce is visible in sales order pricing analysis.
    But rebate credit memo request (B3) not showing all access (as in above screen shot). It shows only 2 access out of 3 access.
    One more addition
    If I am maintaining condtion record for visible access in rebate Credt memo request i.e. country / Tax relevant classifcation.
    SAP disble it in rebate credit memo request order.
    But normel Tax (MWST) is appearing in rebate credim memo request.
    I am not sure if this is due to standard sap.
    For Thailand we require withholding tax for Rebate credit memo.
    Please advice if any one can give some input on this.
    Regads
    Neeraj

  • Update the price related to condtions in Sales Order

    Hi all,
    I want to update the price related to condtions in Sales Order from input file. I am using bapi 'BAPI_SALESORDER_CHANGE' to for this.
    the code for this
        wa_conditions-itm_number = wa_itab-itm_number.
        wa_conditions-cond_value = wa_itab-kbetr.
        wa_conditions-cond_type  = 'ZPSV'.
        wa_conditions-cond_count = wa_itab-kwmeng.
        APPEND wa_conditions TO it_conditions.
        wa_conditionsx-itm_number =  wa_itab-itm_number.
        wa_conditionsx-cond_count = wa_itab-kwmeng.
        wa_conditionsx-cond_value = 'X'.
        wa_conditionsx-cond_type  = 'ZPSV'.
        wa_conditionsx-updateflag = 'U'.
        APPEND wa_conditionsx TO it_conditionsx.
    But this is creating a new line in conditions instead of updating the existing line, I want to update the exsting line with new condition rate instead of creating a new line.
    i have tried by   lv_logic-pricing = 'B'.
    But it works when values are maintained in vk11.
    Please help me if you have any soultion for this.

    hi siya,
    plz refer to the following threads
    Re: problem using Bapi_Salesorder_Change
    http://www.sapfans.com/forums/viewtopic.php?p=160339&sid=bf9e3219db318d89596f7e911462416f
    i hope it helps.
    arjun

  • Pricing condtion PR00 is inactive in sales order item.

    Hi,
    I have issue in sales order all the pricing condtions become inactive for one line items .For PR00 it is Inactive with "W" The document item is statistical ans also the other condtions also with same .
    please let me know how to activate in Sales order for that line item.
    Thanks

    hi,
    t.code OVKK (pricing procedure determination),  please check whether you maintained condition type (PR00) 
    sales area / doc pri pro / cust pri pro / pricing procedure / condition type
    (sales area) / (doc pri pro) / (cust pri pro) / (pricing procedure) / (pr00)
    regards
    senya
    Edited by: senya_1111 on Sep 11, 2009 12:54 PM

  • In PO - Header & Item condtion tab usage

    HI,
    Pls explain, why there are condtion tab is maintained in header and item in PO ??? what's the exact purpose to maintain at two levels??
    Edited by: sapjj jk on Sep 4, 2008 7:06 AM

    hi,
    I would like to make to understand with a small example:
    Suppose there is textile manufacturing industry, where they produce yarn, fabric etc....
    We suppose that the total tax, other tax is common for all these items ...but the other conditions like freight, discount etc are different for each item....
    Then insuch condition, you enter tax, other tax at the header, so that it'll be applied to all the items...while..
    For each item separately your enter conditions at the items details individually as per your requirement....
    Hope it helps....
    Regards
    Priyanka.P
    AWARD IF HELPFULL

  • PO header condtion value

    Hi Gurus
    How to fetch the value from PO header condtion for layout purpose? &
    How to fetch the value from subtotals (ex: Asseable value) value from header condtions tab?
    Thanks with anticipation
    Raju

    Thanku
    Please let me know detail.
    Got the condtion record number by passing PO no. to EKKO. then condtion record no. entered in KONP and KONH but there was message that "no table enteries found"
    I would like capture value against particular condtion type from header.
    Raju

  • Bapi or FM to delete Pricing condtion from sales order

    Hi,
    I have a requiremnet where i need to delete the pricing condition .The sales order is changed by one proxy program and then the pricing condtion record is appearing twice in order this because of the condition origin is automatic.
    one entry is for automatic and one entry ( changed manually ) is which we are passing to the bapi 'BAPI_SALESORDER_CHANGE' FM in the proxy program  .
    I need to delete the record for automatic .
    I have checked the bapi 'BAPI_SALESORDER_CHANGE'  but not working...
    can anyone let me know any bapi available to delete the procing condition.
    Regards,
    raj

    Hi,
    Any one please.
    Regards,
    raj
    Edited by: kumar raj on Apr 28, 2009 2:25 PM

  • Condtion table name of (VBN1 transaction ) free goods SD

    Hi all
    can any one tell me the condtion table name for <b>transaction VBN1</b> for <b>free goods SD</b>.its very urgent.
    Best Regards
    Bunty.

    hi bunty.,
    check this tables
    KONDN : Conditions: Free goods - Data section
    KONDNS : Conditions: Free goods determination - scales
    KONDNVB : Free goods determination - Posting structure
    N000  : Condition table for free goods determination
    TVAK  : Sales Document types
    <b><i>Reward points if useful</i></b>
    Chandra
    Message was edited by:
            Chandra

  • PIR Net Price & Effective Price different from Condtion price

    Hi,
    PIR has been created on 19/05/2009 with validity of 19/05/2009 to 27/07/2009 for Amt 78.5 USD and one more condition has been created with validity of 28/07/2009 to 31/12/2009 for amt 76.93 USD
    But Net price and effective price on PIR shown as old amt that is 78.5 USD which is wrong..it should show the current price that is 76.93 USD
    When tried creating PO, its picking up correct price of 76.93 USD
    Please help me to understand why net price and effective price is not changed though the condtion effective date price is different?

    Hi
    If you maintain multiple validity period than the PIR will show the price which you created first.
    But the during the transactions the price will be picked based on the price date category which you can maintain in Vendor master or PIR. Based on the price date category system will pick the price automatically from the PIR to PO or GR posting etc.,
    Hope it helps.
    Thanks / Karthik

  • Tax Code and Condtion Record

    HI,
    I know the tax procedure of TAXINN, but i have small doubt about Tax Code and Conditon Record.
    If we maintain the Tax Percentage i n the Tax Code and Condtion Record also.  What is the use maintain the Tax Percentage in two menctioned placess.  
    Thanks,

    Dear,
    If you are using tax procedure TAXINN then maintain percentage in FV11, there is no need to maintain the same at Tax code level.
    Br,Vivek

  • About condtion tables

    hai gurus can any one tell how the condition tables are access
    i mean , how to see which tables are access during script printing , any fucntion modules are used or select condtions are used , i want to know exactly how the application data is passed to script if any material helpful
    thanx and regards
    afzal

    Hi,
    Go through RSNAST00 Program.
    Regards
    Sandipan

  • If condtion checking in doGet()

    Hello techies,
    Iam very new to servlets.
    My problem is I want take 2 arguments from htm file.
    If i did not give the arguments from html file it will show " uhave to pass the following arguments"
    Iam able to get connection with the database server and retrieving results.
    I am attaching the code where actual logic i had written
    Here is my code:
    public void doGet(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    Connection conn = null;
    ResultSet rs = null;
    try {
         String url = "jdbc:odbc:testDSN";
         Properties p = new Properties();
         p.put("user", "ramu");
         p.put("password", "ramu");
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         conn = DriverManager.getConnection(url, p);
         System.out.println("connection established");
         String subjectName = request.getParameter("subject");
         String httpAddress = request.getParameter("Address");
         if(subjectName == null && httpAddress == null)
         System.out.println("inside else condition");
              out.println("no arguments u supllied");
         else
         response.setContentType("text/html");
         System.out.println("inside if condtion");
         Statement stmt = conn.createStatement();
         rs = stmt.executeQuery("select *from test.emp;");
         out.println("statment xcuted");
         // Print start of table and column headers
         outelse.println("<TABLE CELLSPACING=\"0\" CELLPADDING=\"3\" BORDER=\"1\">");
         out.println("<TR><TH>Hostaddr</TH><TH>subject</TH><TH>M_date</TH></TR>");
                   // Loop through results of query.
                   while (rs.next()) {
                        out.println("<TR>");
              out.println("<TD>" + rs.getString("Hostaddr") + "</TD>");
              out.println("<TD>" + rs.getString("Subject") + "</TD>");
              out.println("<TD>" + rs.getString("M_date") + "</TD>");
              out.println("</TR>");
              out.println("</TABLE>");
              } catch (SQLException e) {
                   out.println("SQLException: " + e.getMessage() + "<BR>");
                   while ((e = e.getNextException()) != null)
                        out.println(e.getMessage() + "<BR>");
              } catch (ClassNotFoundException e) {
                   out.println("ClassNotFoundException: " + e.getMessage() + "<BR>");
              } finally {
                   // Clean up resources, close the connection.
                   if (conn != null) {
                        try {
                             conn.close();
                        } catch (Exception ignored) {
              out.println("</CENTER>");
              out.println("</BODY>");
              out.println("</HTML>");
    Iam not entering into if condition.
    i.e if i did not pass any arguments from the html file
    I want , If any arguments i did not give i has to say that "u had given wrong number of arguments."
    can any body tell where iam making mistake.
    thanks(inadvance)
    ramu

    Check both the variables for null as well as their length
    if (str==null || str.length()<=0)
    "No parameter passed"
    else
    parameters are there
    }

  • CIN Higher Education cess condtion type for service

    Dear All
    SD CIN Experts Pls let me know the Tax condtion type for Higher Education Cess for service
    thank
    mujju

    There is no condition type for Higher edn cess in the standard system. SAP suggests creation of a neew one and assiging it to AT1. So go ahead and create a condition type by copying the ECS condition type and renaming it. Ensure that you tick the laible for At1 to be ticked  and also in the deafault condition types put the Condition type in the AT1 field. Also do the account detemination for AT1 accounts for Rg23A,C and PLA. This will configure the S&H ECS.
    regards
    Jude

  • Condtion value is set from next step

    Hi,
    There is acceess Sequence Z230 with access no 10,20,25,30,40 all are set exclusive in t code V/07
    I expect access 30 to be found for condition type Z260 in the Billing price determination for. There are no condition records registered for the accesses 10,20,25 , but there are record both for access 30 and access 40. All access level steps are set to exclusive which means that if a condition record is found then only this value should be used and next access level should not be checked.
    'Getting message condtion record exist but not set' and result for condition record in analysis tab shows the value from 40
    instead of 30.
    /P
    Edited by: PKUPADHYAY on Oct 26, 2010 11:44 AM

    Hi,
    You get this error sometimes if the condition record was created during the creation of sales order. Exit the order and try to create the order again, it may help.
    Regards,
    Palani

Maybe you are looking for