WebServer does not update parameter and looses objects

- Please struggle through my loooong explanation - THANKS
Hi all,
I've got a problem with my servlets/JSPs.
I try to build a homepage where the content is displayed dynamically and the start-page is for each link the same.
The content of the pages are stored in HTMLs and XMLs --> the HTMLs contain the static content and also contains identifier for the XMLs which contain the dynamic content. Problem is, that there can be more than one XML. So I've cretaed a properties-file which maps 1-HTML to n-XMLs. So I've generated code which parses (with SAX) through the XMLs and takes the information and stores these information to an object. This object itself is stored with an ID in a hashmap.
Then I go through the HTML (read in a String) and replace the keys (HTML) with the matching value from the Hashmap.
When a page is displayed and the client clicks on a link the same page should be called with parameter http://..../start?lang=de&page=link then I should get the information and the HTML for the "link".
- When I call the "start"-page the first time it is displayed correct. But when I refresh the page it seems as if an object is lost - the information of the Hashmap (which is stored in another object) is lost. I cannot get the information although I got the information before.
Also the parameters are not updated if I change them, there is always the same exception shown, that the key is not available.
I've also changed the parameters (for lang) and just displayed them. But they did not change...
- I'm absolutely helpless
here the servlet:
import java.io.*;
import java.util.HashMap;
import javax.servlet.http.*;
import javax.servlet.*;
public class Start extends HttpServlet {
     private String mPathOfPropertiesFile=IConstants.PROPERTIES_ROOT;
     private String mLanguage;
     private String mIdentifier;
     private String mHtmlAsString;
//class created on my own reads the XML-file and stores all files in a Collection
     private PropertiesXmlReader vXmlPropertiesForIdentifier;
     private HashMap vMapOfFilenames;
     private HashMap vTransUnitId;
     //cretaed on my own. Parses the Collection of XMLfiles and puts necessary information on the FileDisc as Hashmap
private XmlPageParser vParseXmls;
     private FileDesc vFileDesc;
* Implements the HTTP GET method.
* @param request the request object, containing
* data from the browser
* @param repsonse the response object to send
* data to the browser
public void Service (HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException{
          mLanguage = request.getParameter("lang");
          if (mLanguage == null){
               mLanguage = "";
          mIdentifier = request.getParameter("page");
          if (mIdentifier == null){
               mIdentifier = "";
               try {
                    // get the relevant Filenames from the Parser
                    vXmlPropertiesForIdentifier = new PropertiesXmlReader(
                              mPathOfPropertiesFile, mLanguage, mIdentifier);
                    // get Filenames
                    vMapOfFilenames = vXmlPropertiesForIdentifier
                              .getFielnames();
                    // parse all XML-Files found in the Properties
                    vParseXmls = new XmlPageParser(vMapOfFilenames);
                    vFileDesc = vParseXmls.getDesv();
                    vTransUnitId = vFileDesc.getMTransUnit();
                    FileReader reader = null;
                    int c;
                    File file = new File(IConstants.HTML_ROOT + mIdentifier);
                    try {
                         // cretae new StringBuffer and read content of the File to the
                         // StringBuffer
                         StringBuffer vHtmlFileBuffer = new StringBuffer();
                         reader = new FileReader(file);
                         while ((c = reader.read()) != -1) {
                              vHtmlFileBuffer.append((char) c);
                         // cretae String to modify
                         String vHtmlAsString = vHtmlFileBuffer.toString();
                         // if not available (-1) = returnvalue
                         boolean vNoMoreReplacements = false;
                         while (!vNoMoreReplacements) {
                              int indexOfStart = vHtmlAsString.indexOf(IConstants.HTML_COMMENT_START);
                              int indexOfEnd = vHtmlAsString.indexOf(IConstants.HTML_COMMENT_END);
                              if (indexOfEnd != -1 && indexOfStart != -1) {
                                   String key = vHtmlAsString.substring(indexOfStart + 3,
                                             indexOfEnd);
                                   TransUnit testUnit = vFileDesc.getTransUnitById(key);
                                   vHtmlAsString = vHtmlAsString.replaceAll(IConstants.HTML_COMMENT_START + key
                                             + IConstants.HTML_COMMENT_END, testUnit.getMSource());
                              } else {
                                   vNoMoreReplacements = true;
                         mHtmlAsString = vHtmlAsString;
                    } catch (FileNotFoundException fileNotFound) {
                         mHtmlAsString = "The HTML-file could not be found, please control root:" + IConstants.HTML_ROOT;
                    } catch (IOException ioErr) {
                         mHtmlAsString = "Exception during output: " + ioErr.getMessage();
                    } finally {
                         if (reader != null) {
                              try {
                                   reader.close();
                              } catch (IOException e) {
                                   e.printStackTrace();
               } catch (Exception e) {
                    mHtmlAsString = "Unexpected exception with text: " + e.getMessage();
          // Returns a writer to write to the browser
     PrintWriter out = response.getWriter();
     // Writes the string to the browser.
     out.print(mHtmlAsString);
     out.close();
Hopefully someone can help me out.
by the way - I'm using a Resin WebbApp Vers 3.0.17
Thanks for help, in advance,
brgds, Steffen

Since you didn't post the XML parser class, I'm not sure exactly what your problem is but I see lots of things that should be changed.
First of all, get rid of the empty Service() method. Fortunately, you named it wrong so it isn't overriding the service() method in the HttpServlet class. If it were overriding the service() method, your servlet wouldn't even work the first time since there would be nothing to invoke doGet().
You shouldn't be using instance variables for processing requests (i.e. mLanguage, mIdentifier) because your servlet needs to be thread-safe. Essentially, there is usually one instance of your servlet around (this is up to the application server) and that one instance must be capable of handling multiple requests simalteously. This isn't causing your problem right now because you are just testing but once the application goes live, this will be a big problem.
Now for what might be causing your problem. Since you didn't post the XML parsers, I suspect that they might be leaving the files open so the second time through, it can't do the parsing. Anyway, your design isn't right because you seem to be reparsing the XML files for each request. All servlets can have an init() method which is invoked when the application server first loads the servlet. You should do all your XML parsing in the init() method. This is much more efficient since it will only be done once (usually when the application server first starts up) not each time the user requests a page. The only potential drawback to this is if you frequently add new XML files, you will have to recycle the server to get the servlet to pick up the new files.

Similar Messages

  • Can't add music my iPhone from iTunes.  When I try to drag a song over to my phone, I get the circle w/ the syncing line through it, but it does not update/load.  [Manually manage music and videos] is checked. And, this is the only Mac I have ever used to

    Can't add music my iPhone from iTunes.
    When I try to drag a song over to my phone, I get the circle w/ the syncing line through it, but it does not update/load.
    [Manually manage music and videos] is checked. And, this is the only Mac I have ever used to add music to my phone.
    Also, just updated the phone's software today, and iTunes' software is already up to date.

    Hi Gregg,
    Have you tried resetting the device (nothing will be lost): Hold down the Home and Power buttons at the same time and continue to hold them down until the Apple appears (up to 30 seconds). Once the Home screen redisplays, see if your Music app is behaving normally.
    Cheers,
    GB

  • HT1277 Mail on my Mac computer does not update when I update my mail on my phone and iPad.  Can anyone help me with this?  Is there a setting I need to check?

    Mail on my Mac computer does not update when I update my mail on my iPhone and iPad. Can anyone help me with this?  Is there a setting that I need to check?

    All that you had to do was to sign into the old account in order to update those apps. What I mean is that you just needed to sign into that account in the store settings like I described and that should have worked. You didnt need to enter the credit card information again - you justed needed to use the old ID and password.
    Anyway, I think the good news is that if everything else is OK with the new account, just download iBooks with the new ID - it's a free app so its not like you have to pay for it again. I'm not sure what the other App is that you are talking about - but if it is the Apple Store App - that is free as well.
    Try this anyway, when you try to update iBooks, just use the old password if the old ID still pops up.
    Did you try signing into the store settings with your new ID and see what happens with the updates then?

  • Can I move my iWeb from mac-mini to my new macbook pro ? iLife 11 does not have iWeb and I really want to use it to update my website on my new macbook Pro instead of Mac mini

    Can I move my iWeb from mac-mini to my new macbook pro ? iLife 11 does not have iWeb and I really want to use it to update my website on my new macbook Pro instead of Mac mini

    There is no license required for iWeb.  Just do a Wyodor suggested and you'll be ready to go. If you're running Lion however, consider the following:
    In Lion the Library folder is now invisible. To make it permanently visible enter the following in the Terminal application window: chflags nohidden ~/Library and hit the Enter button - 10.7: Un-hide the User Library folder.
    To open your domain file in Lion or to switch between multiple domain files Cyclosaurus has provided us with the following script that you can make into an Applescript application with Script Editor. Open Script Editor, copy and paste the script below into Script Editor's window and save as an application.
    do shell script "/usr/bin/defaults write com.apple.iWeb iWebDefaultsDocumentPath -boolean no"delay 1
    tell application "iWeb" to activate
    You can download an already compiled version with this link: iWeb Switch Domain.
    Just launch the application, find and select the domain file you want to open and it will open with iWeb. It modifies the iWeb preference file each time it's launched so one can switch between domain files.
    WARNING: iWeb Switch Domain will overwrite an existing Domain.sites2 file if you select to create a new domain in the same folder.  So rename your domain files once they've been created to something other than the default name.
    OT

  • E52 Date Display does not update and reflect the c...

    Right from day 1 the display date of my E52 does not update and reflect correct the correct date. Got the phone replaced once still the same issue. Called the customer service and they say there is no such problem with E52. They asked me to go to the repair center...(isnt that ridiculous to ask a customer of a new phone to do so?). I went to the repair center with a hope that they will replace it for me but all in vain. They also gave me a ridiculous answer that Nokia does not have a replacement policy...and I was like so is it Nokia's policy to sell broken and faulty mobiles? I was utterly dejected. The electronic store where I bought also refuse to replace because they think there is a problem and no matter I get it changed it will recur. I still do not have a solution as all my ways of getting this problem resolved are exhausted. Anyone has a solution or came across this issue which can be solved without repairing?

    Ok let me state my problem. There is a date display and at midnight the date should automatically change to the next date. However that does not happen. The dealer makes the following changes Control Panel>Settings>General>Date and time> Automatic time update> On and this does not solve the problem. Then I get the mobile replaced and that too has the same problem. after going through all permutations and combinations the problem persists. To quote the email from the Contact center for Nokia in HK this was what was suggested
    Menu→Ctrl. panel→Settings→General→Date and time→Time zone→please select Hong Kong→Automatic time update→please select Off
    However, if the situation still occurred by following the above settings, please be advised to bring your Nokia E52 along with the valid sales invoice to one of our Hong Kong Nokia Care Centres for the handset checking since we do not have such arrangement of replacing a new phone to you.
    Please help!!!

  • I tried to update my nephew iphone 4 version 4.3.4 (8k2), I did back-up everything before attempting to update and the result when I click down-load and update, it does not update instead it says,  itunes could not contact the iphone software update etc.

    Hi to all,
    I tried to update my nephew iphone 4 version 4.3.4 (8k2), I did back-up everything before attempting to update and the result when I click down-load and update, it does not update instead it says,  itunes could not contact the iphone software update server because you are not connected to the internet. I did check my wire-less connections and the connection from my PC to wire-less is hundred percent okay. I did search using google.com to confirm and my connections is good. Is there any problem regardings my firewalls or any help will be appreciated. Thanks

    Hi bosefire,
    Thanks for visiting Apple Support Communities.
    You can use the steps in this article to troubleshoot your iTunes connection:
    Can't connect to the iTunes Store
    http://support.apple.com/kb/TS1368
    Regards,
    Jeremy

  • HT5824 my contact list does not update to its current state. After I sync to Itunes or after I back up to I cloud  Also I did a doccuments and data restore and it still didnt change. How do I fix this?

    My contact list does not update to its current state after I sync it to itunes or back it up to icloud  I did a documents and data reset and the contact list still didnt change.. How do I fix this?

    Welcome to the Apple Community.
    First check that all your settings are correct, that contact syncing is checked on all devices (system preferences > iCloud on a mac and settings > iCloud on a iPhone, iPad or iPod).
    Make sure the contacts you are adding are added to your 'iCloud' group and not an 'On My Mac', 'On My Phone' or other non iCloud group (you can do this by checking in groups), non iCloud contacts will not sync.
    If you are sure that everything is set up correctly and your contacts are in the iCloud group, you might try unchecking contact syncing in the iCloud settings, restarting your device and then re-enabling contact syncing.

  • I have iCloud on my iMac, macbook and iPhone.  However, when I update my contacts on one, it does not update on any of the other devices.  The calendar seems to be working.  Any suggestions?

    I have iCloud on my iMac, macbook and iPhone.  However, when I update my contacts on one, it does not update on any of the other devices.  The calendar seems to be working.  Any suggestions?

    On the iMac and MacBook open System Preferences > iCloud
    Deselect the box next to Contacts, then reselect it then restart the Macs.
    On the iPhone tap Settings > iCloud
    Switch Contacts off then back on then restart the iPhone.
    Hold the On/Off Sleep/Wake button down until the red slider appears. Slide your finger across the slider to turn off iPhone. To turn iPhone back on, press and hold the On/Off Sleep/Wake button until the Apple logo appears.

  • Problem - I input a new event into my iPhone calendar and it does not update on my iMac or iPad. I have loaded the latest software on all devices and have switched over to iCloud. Suggestions?

    Problem - I input a new event into my iPhone calendar and it does not update on my iMac or iPad calendars. I have loaded the latest software on all devices and have switched over to iCloud. Suggestions?

    On the iMac open System Prerferences > iCloud
    Deselect the box next to Calendars then reselect then restart the iMac.
    On the iPad, tap Settings > iCloud
    Switch Calendars off then back on then reset the iPad.
    Hold the On/Off Sleep/Wake button and the Home button down at the same time for at least ten seconds, until the Apple logo appears.
    Hopefully the event synced over all the devices.

  • I delete my emailson computer or iPad and it does not update on my 4s. Is there something I am missing?

    If I delete my e-mails on my computer or iPad, it does not update my 4s.  Any suggestions?

    Wow.  That's weird.
    Is your iPad jailbroke?  If it is, all bets are off.  If it is not jailbroke, keep reading.
    First, try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  It could take well over an hour!  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    At the end of the basic Restore, you will be asked if you wish to sync the iPad/iPod.  As before, say "yes."  Note that that sync selection will disappear and the Restore will end if you do not respond within a reasonable time.  If that happens, only the apps that are part of the IOS will appear on your device.  Corrective action is simple -  choose manual "Sync" from the bottom right of iTunes.
    If you're unable to do the Restore, go into Recovery Mode per the instructions here.

  • Numbers doc on my iPhone does not update on my iPad and vice versa.  Why?

    I have the same Numbers doc on my iPhone and my iPad.  iCloud backup is turned "on" for both devices.  Whenever I update the document on one device, it does not update on the other device.  Is there something else that I need to do to make automatic updates happen?  Many thanks, Mark

    This solved the problem.  "Use iCloud" was turned on in one device but not in the other.   Many, many, thanks!!!

  • My iPod does not update it self in iTunes. I click on the "update the latest version for your iPod" and it fails. Please help me.

    My iPod does not update it self in iTunes. I click on the "update the latest version for your iPod" and it fails. Please help me.

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try on another computer
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • I cleared the cache and my site does not update!  What's the secret?

    I cleared the cache and my site does not update! What's the secret? I created a second website and bought a domain name. You can get to the site by it's mac name or the purchased domain name. I linked the domain name and with my server and it works. The site comes up wither way. BUT, either way, I cannot get my changes to appear. I had realized that my links were not working because I had placed them within the header. So, I moved the links out of the header, republished, and now the new pages (with links in body of website) will not load. Here are the two ways to get to see the site. Both show the old way (links in header). What is up with me not being able to see the changes in either Firefox or Safari?
    http://www.frankysoldiesbutgoodies.com/
    http://web.mac.com/musbegin/iWeb/OldiesButGoodies/OldiesButGoodies.html
    Thanks,
    musicalbeginnings

    hello mccormick.lee, please try downloading the full setup file for the current firefox version from https://www.mozilla.org/firefox/all/ and install it on top of your current installation.

  • Yahoo finance portfolio does not update in firefox but is fine in Chrome and IE9

    This problem did not exist under the previous version of Firefox. One can access Yahoo finance my portfolio ok but even with streaming quotes on the portfolio does not update.
    Problem now solved. It was an issue of the Kaspersky root kit certificate

    I don't know if it matters, try this url instead, which is a secured one (https):
    https://twitter.com/

  • BAPI_ACC_DOCUMENT_POST does not update BKPF/BSEG tables

    Hello,
    I used bapi_acc_document_post to post a accounting document The following routine says that the document is successfully posted, however, does not update the acccounting tables. I read several messages on the SDN and unable to get the correct answer.
    Your help is appreciated.
    Regards
    William
    REPORT ze_bapi_acc_document_post .
    SELECTION-SCREEN BEGIN OF BLOCK bl01 .
    SELECTION-SCREEN ULINE.
    PARAMETERS:
      ref_key LIKE bapiache01-obj_key DEFAULT 'TEST000001BAPICALL',
      dest    LIKE bdi_logsys-logsys  DEFAULT '          '.
    SELECTION-SCREEN END   OF BLOCK bl01 .
    DATA:
      gd_documentheader    LIKE bapiache09,
      gd_customercpd       LIKE bapiacpa09,
      gd_fica_hd           LIKE bapiaccahd,
      it_accountreceivable LIKE TABLE OF bapiacar09 WITH HEADER LINE,
      it_accountgl         LIKE TABLE OF bapiacgl09 WITH HEADER LINE,
      it_accounttax        LIKE TABLE OF bapiactx09 WITH HEADER LINE,
      it_criteria          LIKE TABLE OF bapiackec9 WITH HEADER LINE,
      it_valuefield        LIKE TABLE OF bapiackev9 WITH HEADER LINE,
      it_currencyamount    LIKE TABLE OF bapiaccr09 WITH HEADER LINE,
      it_return            LIKE TABLE OF bapiret2   WITH HEADER LINE,
      it_receivers         LIKE TABLE OF bdi_logsys WITH HEADER LINE,
      it_fica_it           LIKE TABLE OF bapiaccait WITH HEADER LINE,
      it_accountpayable    LIKE TABLE OF bapiacap09 WITH HEADER LINE,
      it_paymentcard       LIKE TABLE OF bapiacpc09 WITH HEADER LINE,
      it_ext               LIKE TABLE OF bapiacextc WITH HEADER LINE.
    PERFORM fill_internal_tables.
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
      DESTINATION dest
      EXPORTING
        documentheader    = gd_documentheader
        customercpd       = gd_customercpd
        contractheader    = gd_fica_hd
      TABLES
        accountgl         = it_accountgl
        accountreceivable = it_accountreceivable
        accountpayable    = it_accountpayable
        accounttax        = it_accounttax
        currencyamount    = it_currencyamount
        return            = it_return.
    WRITE: / 'Result of check all:'.                            "#EC NOTEXT
    PERFORM show_messages.
      DATA: l_type LIKE gd_documentheader-obj_type,
            l_key  LIKE gd_documentheader-obj_key,
            l_sys  LIKE gd_documentheader-obj_sys.
      CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
        EXPORTING
          documentheader    = gd_documentheader
          customercpd       = gd_customercpd
          contractheader    = gd_fica_hd
        IMPORTING
          obj_type          = l_type
          obj_key           = l_key
          obj_sys           = l_sys
        TABLES
          accountgl         = it_accountgl
          accountpayable    = it_accountpayable
          accounttax        = it_accounttax
          currencyamount    = it_currencyamount
          return            = it_return
        EXCEPTIONS
          OTHERS  = 1.
      WRITE: / 'Result of post:'.                               "#EC NOTEXT
    PERFORM show_messages.
    REFRESH IT_RETURN.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
       WAIT          = 'X'.
    IMPORTING
      RETURN        = IT_RETURN.
        COMMIT WORK.     .
    BREAK-POINT.
         Form  fill_internal_tables
    FORM fill_internal_tables.
      PERFORM fill_header.
      PERFORM fill_accountgl.
      PERFORM fill_accountap.
      PERFORM fill_accounttax.
      PERFORM fill_currencyamount.
    ENDFORM.                               " fill_internal_tables
         Form  Show_messages
    FORM show_messages.
      IF it_return[] IS INITIAL.
        WRITE: / 'no messages'.
      ELSE.
        SKIP 1.
        LOOP AT it_return.
          WRITE: /    it_return-type,
                 (2)  it_return-id,
                      it_return-number,
                 (80) it_return-message,
                      it_return-message_v1,
                 (20) it_return-parameter,
                 (3)  it_return-row,
                      it_return-field.
        ENDLOOP.
      ENDIF.
      ULINE.
    ENDFORM.                               " Show_messages
          FORM fill_accountgl                                           *
    FORM fill_accountgl.
    Actual invoice line
      CLEAR it_accountgl.
      it_accountgl-itemno_acc     = 2.
      it_accountgl-gl_account     = '0000009223'.
      it_accountgl-item_text      = 'Line Iten'.  "#EC NOTEXT
      it_accountgl-profit_ctr     = 'DNDDUMMY'.
      it_accountgl-comp_code      = '0180'.
      it_accountgl-tax_code       = 'IG'.
      it_accountgl-FUNDS_CTR      = '1985BA'.
      it_accountgl-COSTCENTER     = '1985BA'.
      it_accountgl-FUND           = 'C113'.
      it_accountgl-TAXJURCODE     = 'CAON'.
      APPEND it_accountgl.
    ENDFORM.                    "fill_accountgl
          FORM fill_header                                              *
    FORM fill_header.
    CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
       IMPORTING
         own_logical_system = gd_documentheader-obj_sys.
    OBJ_TYPE has to be replaced by customers object key (Y* or Z*)
    gd_documentheader-obj_type   = 'BKPFF'.
    gd_documentheader-obj_key    = ref_key.
    gd_documentheader-BUS_ACT    = 'RMRP'.
      gd_documentheader-username   = sy-uname.
      gd_documentheader-header_txt = 'BAPI Test'.               "#EC NOTEXT
    gd_documentheader-obj_key_r  =
    GD_DOCUMENTHEADER-reason_rev =
      gd_documentheader-comp_code  = '0180'.
    GD_DOCUMENTHEADER-AC_DOC_NO  =
      gd_documentheader-fisc_year  = '2008'.
      gd_documentheader-doc_date   = sy-datum.
      gd_documentheader-pstng_date = '20070901'.
    GD_DOCUMENTHEADER-TRANS_DATE = SY-DATUM.
    GD_DOCUMENTHEADER-VALUE_DATE =
    GD_DOCUMENTHEADER-FIS_PERIOD =
      gd_documentheader-doc_type   = 'RE'.
      gd_documentheader-ref_doc_no = '6000009268'.
    GD_DOCUMENTHEADER-COMPO_ACC  = 'FI'.
      gd_documentheader-bus_act    = 'RFBU'.
    ENDFORM.                    "fill_header
          FORM fill_ap                                                  *
    FORM fill_accountap.
    vendor line
      CLEAR it_accountpayable.
      it_accountpayable-itemno_acc = 1.
      it_accountpayable-comp_code = '0180'.
      it_accountpayable-pmnttrms = '0006'.
      it_accountpayable-TAX_CODE = 'IG'.
      it_accountpayable-vendor_no  = '0001200051'.
      it_accountpayable-item_text  = 'Vendor Line'. "#EC NOTEXT
      APPEND it_accountpayable.
    ENDFORM.                    "fill_accountap
          FORM fill_tax                                                 *
    FORM fill_accounttax.
    tax line
      CLEAR it_accounttax.
      it_accounttax-itemno_acc = 3.
      it_accounttax-gl_account = '0000081710'.
      it_accounttax-tax_code   = 'IG'.
      it_accounttax-acct_key   = 'VST'.
      it_accounttax-TAXJURCODE     = 'CA00'.
      APPEND it_accounttax.
    ENDFORM.                    "fill_accounttax
          FORM fill_currencyamount                                      *
    FORM fill_currencyamount.
      CLEAR it_currencyamount.
      it_currencyamount-itemno_acc   = 1.
      it_currencyamount-curr_type    = '00'.
      it_currencyamount-currency     = 'CAD'.
      it_currencyamount-amt_base     = '106.00'.
      APPEND it_currencyamount.
      CLEAR it_currencyamount.
      it_currencyamount-itemno_acc   = 2.
      it_currencyamount-curr_type    = '00'.
      it_currencyamount-currency     = 'CAD'.
      it_currencyamount-amt_base     = '100.00'.
      APPEND it_currencyamount.
      CLEAR it_currencyamount.
      it_currencyamount-itemno_acc   = 3.
      it_currencyamount-curr_type    = '00'.
      it_currencyamount-currency     = 'CAD'.
      it_currencyamount-amt_base     = '6.00'.
      APPEND it_currencyamount.
    ENDFORM.                    "fill_currencyamount

    U have to implement the BADI for this.. ‘AC_DOCUMENT’
    Add source code into Method: CHANGE_INITIAL & CHANGE_AFTER_CHECK,
    *---<SAPLBPFC> is for Posting      with BAPI: BAPI_ACC_DOCUMENT_POST
      *---<SAPCNVE > is for Posting(Tax) with BAPI: BAPI_ACC_DOCUMENT_POST
      *---<SAPMSSY1> is for Test(Check)  with BAPI: BAPI_ACC_DOCUMENT_CHECK
    DATA: wa_header TYPE acchd.
        IF sy-xprog NE ' SAPMSSY1 '.
          CLEAR wa_header.
          wa_header = im_document-header.
          ex_document-header-bktxt = wa_header-bktxt.
          CLEAR wa_header.
        ENDIF.

Maybe you are looking for