UDF For Retrieving the Tax Code based on PO

Hi all,
Mine is a file to Idoc scenario.
I wrote a FM to retrieve the Tax Code based on PO .
Created the udf which directly gets the Taxcode from the r/3 with out importing in to the imported objects,is this correct i never tried this before.
Find the UDF for the Same.
final String    CHANNEL_NAME = "GeneratedReceiverChannel_RFC",
     VALNOTFOUND = "VALUE_NOT_FOUND",
     SAPRFCNS = "urn:sap-com:document:sap:rfc:functions",
     TAG_FM = "Z_P_INT012_RFC_LOOKUP",
     TAG_TAX_CODE = "T_TAX_CODE",
     TAG_TAX_CODE_P = "TAX_CODE";
AbstractTrace trace = container.getTrace();
          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          DocumentBuilder builder = null;
          factory.setNamespaceAware(false);
          factory.setValidating(false);
          try {
               builder = factory.newDocumentBuilder();
          } catch (Exception e) {
               trace.addWarning("Error creating DocumentBuilder - " + e.getMessage());
          Document docReq = null;
          try {
               // Building up RFC Request Document
               docReq = builder.newDocument();
               Node root = docReq.appendChild(docReq.createElementNS(SAPRFCNS, TAG_FM));
               Node nodeTbOpt = root.appendChild(docReq.createElement(TAG_TAX_CODE));
               for (int i = 0; i < pernr.length; i++) {
                    Node nodeTbOptItem = nodeTbOpt.appendChild(docReq.createElement("item"));
                    nodeTbOptItem.appendChild(docReq.createElement(TAG_TAX_CODE_P)).appendChild(docReq.createTextNode(TAX_CODE<i>));
          } catch (Exception e) {
               trace.addWarning("Error while building RFC Request  - " + e);
          trace.addInfo("RFC Request XML: " + docReq.toString());
                                                //trace.addWarning("RFC Request XML: " + docReq.toString());
          // Lookup
          Payload load = null;
          try {
               Channel channel = LookupService.getChannel(receiver[0], CHANNEL_NAME);
               RfcAccessor accessor = LookupService.getRfcAccessor(channel);
               InputStream is = new ByteArrayInputStream(docReq.toString().getBytes());
               XmlPayload payload = LookupService.getXmlPayload(is);
               load = accessor.call(payload);
          } catch (LookupException e) {
               trace.addWarning("Error during lookup - " + e);
          // Parsing RFC Response Document
          Document docRsp = null;
          try {
               docRsp = builder.parse(load.getContent());
          } catch (Exception e) {
               trace.addWarning("Error when parsing RFC Response - " + e.getMessage());
          trace.addInfo("RFC Response XML: " + docRsp.toString());
                                                //trace.addWarning("RFC Response XML: " + docRsp.toString());
          try {
               NodeList res = docRsp.getElementsByTagName("item");
               for(int i=0;i<res.getLength();i++){
                    NodeList itemNodes = res.item(i).getChildNodes();
                    Map itemMap = new HashMap();
                    for(int j=0;j<itemNodes.getLength();j++){
                         itemMap.put(itemNodes.item(j).getNodeName(), itemNodes.item(j).getFirstChild().getNodeValue());
                    rows.add(itemMap);
                                                        catch (Exception e) {
               trace.addWarning("Result value not found in DOM - " + e);
               result.addValue("true");
Error:
16:24:08 Start of test
Source code has syntax error:  /usr/sap/XD1/DVEBMGS30/j2ee/cluster/server0/./temp/classpath_resolver/Map283041f0edf311dd960b0003bacd2461/source/com/sap/xi/tf/_MM_INT012_INVOICE_DET_.java:598: 'class' or 'interface' expected public void TaxValues$(String[] a,String[] b,ResultList result,Container container){ ^ /usr/sap/XD1/DVEBMGS30/j2ee/cluster/server0/./temp/classpath_resolver/Map283041f0edf311dd960b0003bacd2461/source/com/sap/xi/tf/_MM_INT012_INVOICE_DET_.java:618: 'class' or 'interface' expected } ^ /usr/sap/XD1/DVEBMGS30/j2ee/cluster/server0/./temp/classpath_resolver/Map283041f0edf311dd960b0003bacd2461/source/com/sap/xi/tf/_MM_INT012_INVOICE_DET_.java:619: 'class' or 'interface' expected ^ 3 errors  Source code has syntax error:  /usr/sap/XD1/DVEBMGS30/j2ee/cluster/server0/./temp/classpath_resolver/Map283041f0edf311dd960b0003bacd2461/source/com/sap/xi/tf/_MM_INT012_INVOICE_DET_.java:598: 'class' or 'interface' expected public void TaxValues$(String[] a,String[] b,ResultList result,Container container){ ^ /usr/sap/XD1/DVEBMGS30/j2ee/cluster/server0/./temp/classpath_resolver/Map283041f0edf311dd960b0003bacd2461/source/com/sap/xi/tf/_MM_INT012_INVOICE_DET_.java:618: 'class' or 'interface' expected } ^ /usr/sap/XD1/DVEBMGS30/j2ee/cluster/server0/./temp/classpath_resolver/Map283041f0edf311dd960b0003bacd2461/source/com/sap/xi/tf/_MM_INT012_INVOICE_DET_.java:619: 'class' or 'interface' expected ^ 3 errors
16:24:11 End of test.

Hi Potharaju,
Why don't you try this, that really works:
If you are using PI 7.1:
http://help.sap.com/saphelp_nwpi71/helpdata/en/33/1ec6ced273493a993a80c2301c03da/frameset.htm
If you are using XI 3.0, PI 7.0
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1b439
Try with these.
Regards,
Juan

Similar Messages

  • User exit for ME21N for displaying the tax code from custom table

    Hi,
      I have a requirement, in our system, the inforecord is not maintain for all the material and vendor combination,  we have a custom table in which we have maintain the
    Compnay code, Pur. Org., Vendor code  Tax code,  juridiction code
    now we want that when a Po is created with ME21 or ME21N  the tax code and jurisdiction code should be come from this table  and if entry not found in this table then it should search as per the regular process like from last Po or info record.  then which user exit we can use for this.
    regards,
    zafar

    CLOSE

  • Change the Tax Code-  In Sales Order i have  Tax code for VAT

    In Sales Order i have  Tax code for VAT ( Condition type JIVP) it is reflecting "P4" instead of "A4".
    Where the "P4" Tax code is picking in Sales Order.
    How to change the Tax Code.
    Urgent

    Hi CHAKRI,
                     Check if the condition record is maintained with the appropriate taxclasssification.If yes, Go to sales order in change mode,then goto-header-billing-alternate taxcalssification and modify tax classification.It will pick up right tax code.
    Regards
    Ram Pedarla

  • The tax code entered is not defined in the country for this company code

    HI ALL
    when we relase billing document to finance i am getting this below error
    Diagnosis
        The tax code entered is not defined in the country for this
        company code.
    System Response
    Procedure
        Check and, if necessary, correct the entry.
    Procedure for System Administration
        If it is not an input error, check and possibly change the
        system settings.
        To do this, choose Maintain entries (F5).
        1.  Check whether the required tax determination procedure
            is assigned to the relevant country. the Procedure
            field is in the detail screen.
        2.  Create a new tax code if required.
    Thanks & Regards
    Aarman

    You can define the tax code for your country using the following menupath in customizing:
    IMG>Financial Accounting>Financial Accounting Global Settings>Tax on Sales and Purchases>Calculation-->Define tax codes ........... in the next screen enter your country and then the tax code you wish to create and press enter. You would be then directed to another screen, where you would maintain the description and whether it is a  Input tax or Output tax and then maintain the appropriate tax percentage and save.
    Your country should also be assigned to a calculation procedure. You check the same using the same menupath as mentioned above: .............Tax on Sales and purchases>Basic Settings>Assign country to calculation procedure........In the next screen, enter the appropriate tax procedure for your country. Eg: for country DE assign tax procedure as TAXD and save.
    Hope this helps.
    Regards
    SATYA

  • The tax code entered is not defined in the company code country.

    Dear sap guru's
    I am facing a problem while doing invoice or while cancelling the invoice or even during Subsequent Credit/Debit
    Tax code V0 in procedure  is invalid
       Message no. FF704
    Diagnosis
       The tax code entered is not defined in the company code country.
    System Response
    Procedure
       Check and, if necessary, correct the entry.
    Procedure for System Administration
       If it is not an input error, check and possibly change the system
       settings.
       To do this, choose Maintain entries (F5).
       1.  Check whether the required tax procedure has been allocated to the
           company code country. The Procedure field is on the detailed screen.
       2.  If you need a new tax code, you can create one yourself.
    For this i have checked the assignment of company code and tax code V0 in Tcode (OBCL)
    In FTXP the tax code is created in country IN, for the same tax procedure and the tax is a input tax.
    please suggest what could be the exact problem
    Regards
    Sujit

    Hi Sujit,
    1.Go to FTXP and create tax code V0 for country IN and procedure ZAXINN.
    2.In Txn: FV11, For the condition type- XXXX (You will get this in Txn: FTXP, against the tax type, you get the condition type OR in the PO-Item details- Invoice tab, next to field: Tax code, see the Tab-Taxes, click on it and will get the condition type) , maintain the country-IN, Tax code-V0 and the rate.
    3.Also things to be checked
    1> assign country to company code
    2> assign company code to tax code
    3> create tax code for country IN
    4.Under the following menu path, pls check if you have assigned your tax code to Company Code
    IMG>Logistics (General)>Tax on Goods Movement>India>Basic Settings>Determination of Excise Duty>Condition Based Excise Determination>Assign Tax Codes to Company Code
    Hope it clears,
    Rahul.

  • Any SAP standard report is used to retrieve the inventory number based Asse

    Hi all
    Any SAP standard report is used to retrieve the inventory number based Asset ID.
    Please help us to provide the standard report.
    Regards
    K.Gunasekar

    Hi,
    Create the Sort version with field Inventory no, so that you can display Inventory no details in all Asset report.
    You can get "Inventory no" details by including field "INVNR" in Sort versions for Asset reporting(T.code - OAVI).
    Hope this information helpful for you.
    Thanks & Best Regards,
    M.Ganesan

  • Multiple CST tax cond in the tax code

    hi all,
    is it possible to have multiple tax cond for CST, say JIN7 and JIN4 in the tax code  (in FTXP) so that if their of these cond is present in teh invoice pricing procedure the taxes are determined. onyl one of these conditions will be present in the invoice pricing procedure. we are using TAXINJ.
    thnx in advance
    saurabh

    for tax procedure TAXINJ you cannot (should not) make any changes or deviations from the procedure specified by SAP since the entire procedure is based on a formula, that coded through ABAP

  • Selecting appropriate tax code based on Item and Ship to Address

    In the US, there is the ability to denote an Item's tax liability on the Item master. There is also the ability to denote tax code on the ship to address. In the US, some states tax products; some states tax maintenance; and some states tax services. Currently there isn't a table to maintain this information by state. When creating a Sales document, the user is required to know when to charge tax and at which rate based on whether the item is a product, maintenance or service, based on where it is shipping to. I understand that a Formatted Search in the tax code box would be helpful, but aren't there enough US customers running into this issue to warrant the creation of table to look up state and item type?

    The situation is actually more complex than Shel indicated.  In some US states, different items are taxed at different rates for all customers (e.g., food vs non-food items), or may be taxed differently for different customer types (e.g., a customer that is a manufacturer may be taxed at one rate for capital equipment, another rate for tools, and not at all for raw materials, while a different customer may be charged at the same tax rate for all items).  If a customer sells in multiple states, they have to accomodate all of these rules.  What is needed is some kind of reference for taxing by item group/customer group/ship-to address.  It should be optional, but if used it should override the normal tax code functionality.

  • Formatted Search that will change the Tax code in SO.

    Hi All,
    I have a requirements that will allow me to change the Tax Code column via formatted search. Like for exmaple, i have 50 line items in SO and the tax code is ZO. If i want to change the tax code, i will select it for individual items. Anyone can help me to have an alternative solution that will prevent me to change it per item.?
    thanks and regards,
    vin

    Hi Melvin........
    You can have a work around for this....
    Just create a UDF say U_Tax at Header level...
    Just Create a FMS for Tax Code say..
    SELECT *  FROM OSTC T0
    Save this tax code FMS to thus UDF.
    When yo select a particular Tax Code in this Field through this saved FMS
    this Tax Code gets copied to each and every line say for 100 lines also.
    For this you have run other FMS which is below...
    SELECT $[ORDR.U_Tax.0]
    Save above FMS in tax Code field say in Sales Ordr form.
    Now when you do this you can see if you have 100 line items and you want to copy same tax code in a single click you have to just select single tax code via FMS in U_Tax as i suggested.
    The moment you select this Tax Other FMS will be fired and the same will be copied to other 100 lines....
    Hope this will help you.....
    Regards,
    Rahul

  • How can i get the tax code from Condition record number

    Hi all,
    i have the Condition record number from which i have to get the tax code as i looked inthe KNOP that Condition record number there but no tax code is maintained there.
    so is there any other way to find the tax code for particular Condition record number
    Regards
    suresh

    hi suresh,
    can u tell me the field name for condition record number and in which table it is stored.
    because i knew one condition number which is stored in table EKKO and the field name is
    KNUMV- Number of the document condition.
    from ekko take relevant details and look for  ekpo where u find the tax code
    filed name of the tax code id MWSKZ- Tax on sales/purchases code

  • Issue in MIRO for inventorized excise tax code

    Hi,
      I have created a PO with excise tax code, but the excise amount to be inventorized,
    PO price   : 100
    EXCISE         10
    ECESS          0.20
    SECESS        0.10
    VAT              13.79
    Total net amount   100  and tax amount  24.09
       now as the excise condition are mark as non deductible so after GR the material and GR account are posted with the amount 110.30, base price + excise tax amount which is OK.  But when I am doing the MIRO  I enter the total amount as 124.09  on the miro screen  then selected the tax code as per PO  then material it is showing with amount as 100 insted of 110.30,  because of this it is showing some balance differene , which i need to correct manually.
       Is there any option for this I want to create PO with same procedure with excise tax code which is to be post to inventory  but in MIRO i want to avoid this manual correction.
    regards,
    zafar

    HI,
    But when I am doing the MIRO I enter the total amount as 124.09 on the miro screen then selected the tax code as per PO then material it is showing with amount as 100 insted of 110.30, because of this it is showing some balance difference , which i need to correct manually.
    why 124.09 vat also want to inventories ?
    try this click on calculate tax icon in MIRO and check it 
    Regards
    Kailas Ugale

  • How to find out the condition type of the tax code in the PO document

    Hi friends,
    My questions is how to find out the condition type of the tax code in the PO document.
    When you use me23n to display one PO document. In the invoice tab, there is one text field named 'tax code' whose value could be T1, T2, J1, J2 and so on. Beside the text field, there is one button named taxes. When you click the button taxes, it will show you the condition type of the tax code. For example, if the tax code is 'T1', then its condition type 'mwcn'.
    I want to use the information on the PO to find out the value 'mwcn' of the tax code 'T1'. Could anybody help to describe the logic?it looks like the value is saved in the table konp. But I don't know the logic. Please describe. Thank you.

    Hi,
    Hope you have asked for select query..
    select single knumh from a003 into wa_knumh
      where mwskz = wa_itpotab-mwskz
      and kappl = 'TX'
      and aland = 'IN'.
    select single kbetr from konp into wa_kbetr
      where knumh = wa_knumh.
    cheers,
    Dep

  • Is there a way to automate the tax code assignation on non PO documents lik

    I'm looking for a way to automate the tax code assignation on purchases, I'm aware of the condition techniques for POs, but I would like to understand if it can be also applied to the other document in purchases so we can have a totally automate process on tax code assignation.
    Documents like: Contracts, Info records, RFQ, Scheduling agreements, Outline Agremments

    What you need to do is to create condition tables & access sequences for condition type NAVS for purchasing documents like RFQ, Contract & Scheduling agreement. You can use the document types and document category to differentiate these. Obviously this is required only if your tax determination scenario is different between different document type, if the tax code to be determined is not linked to purchasing document type, then you only one access sequence which can have parameteris like PORG, vendor if required etc. which are common to all document types.
    Once this configuration is done, then you need to maintain condition records using transaction MEK1 and maintain the tax codes as per the combination of parameters.
    In case of Info-record, it is different as it is a master data and this automatic tax determination will not work there.

  • How the system calculate the tax code in MIRO ?

    Hi
    I made PO in SAP  for material X and Entered the Tax Code I1 but When, i doing the MIRO in SAP, system automatically taking the another Tax code.Also i am trying to change the tax code in MIRO but s/m not allow to change the Tax code.
    I am not also maintained info record also.

    Hi,
    While doing MIRO the tax code will defaulted from PO for each line item , but to adjust the tax at last you should enter the tax code manually at header level in MIRO and post it.............
    In PO it will be defaulted if you maintain the tax code in Purchasing inforecord aor you should enter it manually.....

  • While doing ABZON,i am getting the tax code related error

    Hi,
    When i am doing the transaction ABZON,i am getting the below error.kindly help me to fix this issue.
    Tax code I0 doesnot exist for jurisdiction code LA0000000
    Note:Initially i have created the tax code with the combination of 9 digits Tax jurisdiction code.after that on client request,i have deleted those 9 digits tax jurisdiction codes and created with 10 digits tax jurisdiction codes.
    Kindly help me how to fix this issue.
    Thanks
    Supriya

    Hi Supriya,
    This is in continuation to my previous reply.
    There should not be any open items using old tax codes. This error is due to the fact that there are still old open items using those tax codes.
    Tranaction SE16. Run table BSEG and find out all entries with the old tax codes which are still open.
    Try and reverse those and post the entries with new tax codes. In case the system does not allow you to reverse. You may have to recreate these old codes, reverse the entries, delete the codes, create new codes, repost these entries and run ABZON.
    Do let me know if you have any further issues
    Rgds,
    Harmees

Maybe you are looking for

  • How can i add the status bar to the bottom of iTunes 11.4?

    In the past, on Itunes 11.0, when I opened the program, there would be  a bar on top that would read, "File, Edit, View, Controls, Store,Help"  and below , a status bar that would tell me the number of tracks in  a playlist and duration, "7 Songs, 28

  • What is the T-code to lock the VA01

    What is the T-code to lock the VA01

  • Preview goes to Homepage, not file

    When I press preview, a new instance of the browser is opened up and it defaults to the home page, not the file I am editing and trying to preview. Any solutions?

  • Games and music not showing up on my 5s

    I up graded to a 5s 3 days ago and have not been able to get to sync properly. I have synced my phone multiple times and Solitaire, Candy crush, and hill climb are not installing on my phone. Im also having a problem with music not uploading to the p

  • Incredible 2 - battery charge or lack thereof

    Our 4th incredible 2 will not charge. We had one battery and two phones replaced & now it has happened again!!! I would call but no tech after 11 pm. I do NOT recommend this phone but do give Verizon credit for making it right so far - we will see if