BAPI_GOODSMVT_CREATE for GM code 03 mov. 261

Is there anybody who had experience on BAPI
BAPI_GOODSMVT_CREATE in order to simulate transaction MB1A?
GM code is 03 and movement type is 261.
I'm looking for the bapi fields that have to be filled to simulate the behaviour of the above mentioned transaction. The GI context is a goods out using as reference a production order.
Thanks in advance.
F.

Hello
Try with this code.
  DATA: l_wa_hdin      TYPE bapi2017_gm_head_01,
        l_wa_pos       TYPE bapi2017_gm_item_create,
        l_wa_code      TYPE bapi2017_gm_code,
        l_wa_mbew      TYPE mbew,
        l_wa_uebrigmat TYPE z48m_uebrigmat,
        l_wa_matpr     TYPE z48m_price_set_mbew,
        l_wa_ret       TYPE bapiret2,
        l_wa_balmt     TYPE balmt,
        l_wa_msg       TYPE z48s_msg.
  DATA: l_it_pos   TYPE TABLE OF bapi2017_gm_item_create,
        l_it_ret   TYPE TABLE OF bapiret2,
        l_it_balmt TYPE TABLE OF balmt.
l_wa_hdin-ver_gr_gi_slip  = va_ver_slip.                "sc88wa2
l_wa_hdin-ver_gr_gi_slipx = co_xfeld.                   "sc88wa2
CLEAR: l_wa_hdin-ver_gr_gi_slip.                        "sc88wa2
l_wa_hdin-ver_gr_gi_slipx = co_xfeld.                   "sc88wa2
wahdin-pstng_date = va_budat.
wahdin-doc_date   = va_bldat.
<b>l_wa_code-gm_code    = '03'.</b>
    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
         EXPORTING
              goodsmvt_header  = l_wa_hdin
              goodsmvt_code    = l_wa_code
              testrun          = pi_test
         IMPORTING
              goodsmvt_headret = wa_hdout
         TABLES
              goodsmvt_item    = l_it_pos
              return           = l_it_ret.
if useful reward.
Vasanth

Similar Messages

  • Assigning to differenet consumption a/c for same Raw Mat 261 MOV-Diff FG

    Dear Experts,
    We have the Current Settings in the same plant 5160:-
    Raw             Valuation          Mov         Finished Product
    Material        Class               Type     
    MOP                9000              261        NPK
    MOP                9000              261        MOP-Traded
    We have OBYC Settings:-
    Valuation Modifier 0002
    General Modification VBR
    Valuation Class 9000
    GL Code (605001-Raw Material Consumption)
    Now when we are doing MFBF in same plant 5160
    both the consumption entry posted to Raw Material Consumption (605001).
    We want for Producing NPK with 261 movement it should hit Raw material Consumption A/c(605001) but for producing MOP-Traded it should hit some other GL code Say - 606001 with same 261 movement.
    Please advise if it is possible, then where to make changes.
    Regards,
    Alok Parida

    Use diff vauation calss becuase you are asking the solution for the same plant that can be done using valuation class only.
    you should have diff valuation calss for raw material and trading items

  • BAPI_GOODSMVT_CREATE for movement 971 (TCode MB1B)

    Dear all,
    I try to use the BAPI_GOODSMVT_CREATE to create a good movement 971 but nothing seems to be created..
    Below the parameters used :
    Header
            wa_goodsmvt_header-doc_date   = sy-datum.
            wa_goodsmvt_header-pstng_date = sy-datum.
            wa_goodsmvt_header-pr_uname   = sy-uname.
    Code Movement       
            wa_goodsmvt_code-gm_code = '04'.
    Items
            wa_goodsmvt_item-material   = .    "Material
            wa_goodsmvt_item-plant      = .    "Plant
            wa_goodsmvt_item-stge_loc   = .    "Sotrage Location
            wa_goodsmvt_item-entry_qnt  = .   "Quantity
            wa_goodsmvt_item-entry_uom  = .   "Unity
            wa_goodsmvt_item-move_type  = '971'.  "Code movement
            wa_goodsmvt_item-move_stloc = .  "Receiving Storage Location
            CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
              EXPORTING
                goodsmvt_header      = wa_goodsmvt_header
                goodsmvt_code         = wa_goodsmvt_code
              TABLES
                goodsmvt_item          = t_goodsmvt_item
                return                        = t_return.
    When I use the transaction M1B1 with this parameters, the document is created. Do you know if something missing?
    Thank you very much in advance.
    Best regards,
    Robin

    First read my answers at Re: "BAPI_GOODSMVT_CREATE" for delivery
    - Look in table T158B for transaction(s) allowed to movement '971' (is this a customer specific movement type, transaction OMJJ)
    - Look in table T158G to find gm_code (MB1B is '04')
    I hope you don't forget the COMMIT_WORK/BAPI_TRANSACTION_COMMIT and that you looked in table RETURN for error messages.
    Regards,
    Raymond

  • BAPI_GOODSMVT_CREATE  for code 04 and special ind E

    Hi Everybody
    My requirement is like when we create sales order and put Item category ZXLC local branch transfer and save the sale order..It creates purchase requisation and we pass supply plant there. It shold create document through MB1B. We are using BAPI  BAPI_GOODSMVT_CREATE for that but it is not creating document.
    We are passing code 04 goods movement code and special indicator  E.
    My problem is that where I have to call this BAPI. I mean user exit or enhancement and what are the parameter we should pass. Can any body send me the piece of code for that...

    I m calling this BAPI thru user exit USEREXIT_SAVE_DOCUMENT in the include program MV45AFZZ. I m passing posting date, doc date, user name movement type 412 at header level. I passed GOODSMVT_CODE as '04'.
    LT_GOODSMVT_ITEM-material = xvbap-matnr.
      LT_GOODSMVT_ITEM-plant    = eban-RESWK.
      if xvbap-lgort is initial.
        LT_GOODSMVT_ITEM-stge_loc = '0001'.
      else.
        LT_GOODSMVT_ITEM-stge_loc = xvbap-lgort.
      endif.
      LT_GOODSMVT_ITEM-spec_stock = 'E'.
      LT_GOODSMVT_ITEM-SALES_ORD  = xvbap-vbeln.
      LT_GOODSMVT_ITEM-S_ORD_ITEM = xvbap-POSNR.
      LT_GOODSMVT_ITEM-VAL_SALES_ORD     = xvbap-vbeln.
      LT_GOODSMVT_ITEM-VAL_S_ORD_ITEM      = xvbap-POSNR.
    *quantity
      LT_GOODSMVT_ITEM-entry_qnt = xvbap-KWMENG.
      LT_GOODSMVT_ITEM-entry_uom = xvbap-meins.
    AT ITEM LEVEL.
    Is this the right place for calling this BAPI and for code 04 and special ind E r these the sufficient parameters. It shows error msg
    pass the sales order number whereas I m passing the sales order no. correctly even I tested this with existing sales order in debug mode..

  • BAPI for T.cod-MB11 using movement type 631

    Hi Friends,
                     what BAPI can be used for T.code-MB11 with movement type 631. Need your help.
    Regards
    preet

    Hi,
    BAPI_GOODSMVT_CANCEL           Reverse Goods Movements with MB_CANCEL_GOODS_MOVEMENT
    BAPI_GOODSMVT_CREATE           Post goods movements with MB_CREATE_GOODS_MOVEMENT
    BAPI_GOODSMVT_GETDETAIL        Display Details for Material Document
    BAPI_GOODSMVT_GETITEMS         Display Detailed List of Material Documents

  • Blocking Movement type 122 for T code MBRL

    All SAP Gurus,
    I want to block the movement type 122 for T code MBRL.
    For this I used T code OMJJ, but here it is not showing MBRL as used T code.
    If MBRL is not specified in OMJJ for 122, then how MBRL T- code is allowed for movement type 122.
    Please give ur valuable inputs.
    Regards,
    Edited by: Rajan R. on May 19, 2008 10:22 AM
    Edited by: Rajan R. on May 19, 2008 10:59 AM

    Check the all authorization roles you have created for inventory management. In there you can take out MBRL from the list. Then, create a new role for transaction MBRL only, and then you can allow other movement types for this role except 122. Assgin this role to your users.
    This is what I have done at two client locations.

  • Block Movement type 122 for T code MBRL

    All SAP Gurus,
    I want to block the movement type 122 for T code MBRL.
    For this I used T code OMJJ, but here it is not showing MBRL as used T code.
    If MBRL is not specified in OMJJ for 122, then how MBRL t code is allowed for movement type 122.
    Please give ur valuable inputs.
    Regards,
    Edited by: Rajan R. on May 17, 2008 3:22 PM

    Hi
    Thanks for the reply
    Now I want to block movement type 122 so that it can not be used throuh MRRL, is it posssible and how to do that?
    I have alredy blocked MIGO for movement type 122
    Edited by: Rajan R. on May 17, 2008 3:51 PM

  • Bapi_goodsmvt_create for 961 mov. type

    hi all,
    can i use bapi_goodsmvt_create function module for 961 movement type?
    Edited by: vinil aturi on Jun 11, 2008 11:10 AM

    dear aturi,
    what is the 961 movement type for ?
    Yes you can definitley use BAPI_GOODSMVT_CREATE for 961 Movement Type
    as i had used it for 101 and 301 movement types in my program.
    Hope this helps you out.
    Do reward if useful.
    Thanks
    Venugopal

  • TS1424 I download movies and when I reach the full size, like 4.01 GB for an HD movie, it does not say "done" but Error Code= -36

    I download movies and when I reach the full size, like 4.01 GB for an HD movie, it does not say "done" but Error Code= -36

    What do you think about turning File Vault off?
    I'd first make a copy or backup of that Home folder first, then I'd never use Filevault again.
    Is it possible the disk could be failing but Disk Utility not pick anything up?
    Yes, DU just checks Directory structure, and not all that well at that, it is possible that there are bad blocks/sectors on the HD right where that Home Folder is located.
    And finally, where is a good place to find interpretations of those cryptic error codes?!
    For error -36, might try this...
    http://docs.info.apple.com/article.html?artnum=301580
    Well, in pure Apple File System talk... -36 ioErr I/O error (bummers)
    Not very helpful, but generally means a Drive quit being Readable or Writable since starting the operation...
    http://fuzzy.wordpress.com/2006/12/10/ioerror-36/
    Terminal for one...
    Find error code...
    /usr/bin/grep "36" /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonC ore.framework/Headers/MacErrors.h
    Or open this file in Text Edit if you have it...
    System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCor e.framework/Versions/A/Headers/MacErrors.h

  • BDC for Goods Issue for movement 261 MIGO, Capturing Mat Doc No.

    Hi All
    I want to post Goods Mvmt for order fir mvmt 261 using BDC ( transaction MIGO ). However I need to get back the material Document no. which is generated after this posting and store it in Z table.
    Can I get that material in BDC recording or do I need to add a select statement for this. Material document no is displayed just on status line below. How to get that ?
    Amol

    capture the MESSAGE after the BDC , there u will get the MAT.DOC.
    <b>  call transaction 'MIGO' using bdctab
                                        mode 'E'
                                        update 'S'
                                      messages into msgtab .</b>
    Regards
    Prabhu

  • BAPI_GOODSMVT_CREATE for GRN posting

    Hi Experts,
    I am using BAPI_GOODSMVT_CREATE for posting GRN against Purchase Order.
    I want to post Quantity in Delivery note(LSMNG) and Unit of Measure From Delivery Note(LSMEH) also.
    I used itab-QUANTITY = '1'.
    itab-BASE_UOM = 'L'.
    but it is not getting updated properly.
    I am getting document number and GRN has been done against Purchase Order using this BAPI.All other fields are properly getting updated except these 2 fields Qty in delivery note and unit of delivery note. Can i pass these 2 field values using this BAPI or do I need to use any other BAPI. Is there any BAPI for MIGO instead of MB01?
    Can any one help me to pass these values through BAPI
    Regards,
    Sam

    Hi,
    you can update LSMNG quantity using EXTENSIONIN structures of BAPI_GOODSMVT_CREATE.
    The steps are the following:
    Add LSMNG field in BAPI_TE_XMSEG structure create an appending structure (char field)
    By SE19 transaction create the Enhancement Spot starting from MB_GOODSMOVEMENT
    Define the Badi Implementation choosing MB_BAPI_GOODSMVT_CREATE Badi Definition implementing a new customer class.
    Remember to choose to copy the class with the source code of methods.
    In The method IF_EX_MB_Hi, you can update LSMNG quantity using EXTENSIONIN structures of BAPI_GOODSMVT_CREATE. The steps are the following: Add LSMNG field in BAPI_TE_XMSEG structure create an appending structure (char field) By SE19 transaction create the Enhancement Spot starting from MB_GOODSMOVEMENT Define the Badi Implementation choosing MB_BAPI_GOODSMVT_CREATE Badi Definition implementing a new customer class.
    Remember to choose to copy the class with the source code of methods.
    In the method IF_EX_MB_BAPI_GOODSMVT_CREATE~EXTENSIONIN_TO_MATDOC you will find the following source code:
      DATA:     c_lenstruc          TYPE i VALUE 30,    
       wa_bapi_mb_header   TYPE bapi_te_xmkpf,    
       wa_bapi_mb_item     TYPE bapi_te_xmseg,    
       wa_extension_in     TYPE bapiparex.  
       FIELD-SYMBOLS:               TYPE imseg.  
       CHECK NOT extension_in[] IS INITIAL.
      * Analyze IMSEG for document structure and assign LINE_IDs if necessary  
       CALL METHOD cl_mmim_line_id_manager=>analyze_mb_create    
              CHANGING       ct_imseg          = ct_imseg[]    
                 EXCEPTIONS       duplicate_line_id = 1      
                 OTHERS            = 2.  
      LOOP AT extension_in INTO wa_extension_in.    
         CASE wa_extension_in-structure.
    * extension of MKPF      
         WHEN 'BAPI_TE_XMKPF'.        
         MOVE wa_extension_in+c_lenstruc TO wa_bapi_mb_header.        
         MOVE-CORRESPONDING wa_bapi_mb_header TO cs_imkpf.
    * extension of MSEG      
        WHEN 'BAPI_TE_XMSEG'.        
        MOVE wa_extension_in+c_lenstruc TO wa_bapi_mb_item.        
        READ TABLE ct_imseg           WITH KEY line_id = wa_bapi_mb_item-matdoc_itm           ASSIGNING   <fs_imseg>.        
          IF sy-subrc EQ 0.          
             MOVE-CORRESPONDING wa_bapi_mb_item TO   <fs_imseg>.       
           ENDIF.   
         ENDCASE.  
        ENDLOOP.
    Then you have to call BAPI_GOODSMVT_CREATE using extensionin in the following way:
    * Fill   goodsmvt_header structures
      goodsmvt_header-........
    * Fill    goodsmvt_item-position
      Loop at it_position.
             goodsmvt_item-..........
              wf_line_id = wf_line_id + 1.
              goodsmvt_item-line_id = wf_line_id.
              APPEND goodsmvt_item.
            CLEAR extensionin.
            MOVE 'BAPI_TE_XMSEG'    TO extensionin-structure.
            MOVE wf_line_id+2(4)    TO extensionin-valuepart1+14(4).
            MOVE LSMNG              TO extensionin-valuepart1+18(16).
            APPEND extensionin.
    endloop.
            CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
            EXPORTING
              goodsmvt_header               = goodsmvt_header
              goodsmvt_code                 = goodsmvt_code
    *         TESTRUN                       = ' '
              goodsmvt_ref_ewm              = goodsmvt_ref_ewm
            IMPORTING
    *         GOODSMVT_HEADRET              =
              materialdocument              = materialdocument
              matdocumentyear               = matdocumentyear
            TABLES
              goodsmvt_item                 = goodsmvt_item
    *         GOODSMVT_SERIALNUMBER         =
              return                        = return
              extensionin                   = extensionin.
    Hope it helps
    Lorenzo

  • BAPI_GOODSMVT_CREATE for GRN against GI material document in STO

    Dear experts,
    Please advice me how to use BAPI_GOODSMVT_CREATE for goods receipt against GI material document (351) in the case of UB stock transport order.
    My requirement is to get the 101 document no. range in 49 series.
    When i use GM code 01 then PO is must.
    Please advise me which GM code/ Mov indicatot/ reference fields touse.
    Or else to use any other BAPI.
    sapmmlearner

    please share ur thoughts....

  • BAPI_GOODSMVT_CREATE for 415Q transfer posting

    Can someone comment on using this BAPI for a 415 movement type?  I am able to post a 411 and a 412 which achieves the same net effect when I want to move stock from one WBS element to another.
    However, our WM system requires a single transfer order as if we posted 415Q via transaction MB1B.
    Thanks for suggestions or code snippets if you have them.
    >Ray Mannion

    Well, it's 9:30 at night and I managed to figure it out so I thought the least I could do is to post it to the group here.
    In this code, PWA_MAIN is my main work area and lwa_items has the structure asked for in BAPI_GOODSMVT_CREATE.
      lwa_items-move_mat    =
      lwa_items-material    = pwa_main-matnr.
      lwa_items-move_plant  =
      lwa_items-plant       = pwa_main-werks.
      lwa_items-move_stloc  =
      lwa_items-stge_loc    = pwa_main-lgort.
      lwa_items-move_batch  =
      lwa_items-batch       = pwa_main-charg.
      lwa_items-move_type   = '415'.
      lwa_items-spec_stock  = c_q.
    The key is knowing how to populate the WBS elements.  In this case, I have the "old" or "from" WBS as PAPSPNR1 and the "new" or "to" WBS as PAPSPNR2.
    lwa_items-wbs_elem = papspnr2. lwa_items-val_wbs_elem = papspnr1.
    lwa_items-entry_qnt = pwa_main-verme.
    lwa_items-entry_uom = pwa_main-meins.
    We use a combination of T333 and T320 to determine the storage type and storage bin.  (stge_type_pc, stge_bin_pc)
    Incidently, I tried using XSTOB = 'X' which added a 416 movement record.
    I recommend playing with it in SE37 and creating test variants until you get it right before trying to add the call to your program!
    Cheers,
    Ray

  • BAPI_GOODSMVT_CREATE for MB1C

    Hi all,
    i need the sample code for the BAPI_GOODSMVT_CREATE for Goods Receipts.
    Document Date,
    Posting Date,
    Movement Type
    Plant
    Storage Location
    GL Account
    Material and
    Quantity.
    regards
    Shareef

    Please search the forum or do a where used list for "sample code".
    Post locked.
    Rob

  • Any suggestions for my code.

    Hi,
    I wrote this little piece of code to reduce some of the work I need to do when doing database access. I intend to use if with mySQL and mostly web based applications. It'll probably use it quite a bit, and since it's my first try at writing something like this I figured I'd post the code to see if anyone can find any problems. I've already tested it and it works, so I'm mostly interested in any feedback about performance issues.
    I'd really like to know if there's any way I can get the number of rows in a result set before I start going through it. That way I could return the data in an Object[][] array (I'd assume it'd be a little faster to add values to than the ArrayList).
    Here's the code...
    * SQLGruntBean.java
    * Created on November 22, 2002, 12:37 PM
    package com.vacode.beans.sql;
    import java.sql.*;
    import java.util.*;
    /** This bean is a generic class that can be used to access any type of SQL
    *  database.  To use it with an application that accesses an SQL database
    *  do the following:
    *  <p>1. Create a new instance of SQLGruntBean.</p>
    *  <p>2. Set the SQL connection source by calling setConnection(Connection).</p>
    *  <p>3. Set the SQL query you wish to perform by calling setSqlQuery(String).
    *  <br><b>Note:</b> You may replace all values with question mark place holders
    *  as long as you also perform step 4.</p>
    *  <p>4. (OPTIONAL) Set the values that are represented by question mark place
    *  holders by calling setSqlValues.  This method requires an Object array as
    *  input.</p>
    *  <p>5. (OPTIONAL) Set the maximum number of results to be retrieved by calling
    *  setMaxRows.  If left unset it will default to 100.  This method should not
    *  be used as a replacement for the LIMIT parameter in an SQL query.  It is
    *  merely a backup in case an excessive number of results are returned
    *  erroneously.</p>
    *  <p>6. Once all the necessary variables are set you may call either
    *  executeQuery or executeUpdate to perform the intended task.</p>
    *  <p>     <b><i><u>EXAMPLE</u></i></b></p>
    *  <p>
    *  <code>
    *  <br>SQLGruntBean sgb = new SQLGruntBean();
    *  <br>Object[] values = new Object[1];
    *  <br>ArrayList data = null;
    *  <br><br>
    *  <br>sgb.setConnection(dataSource.getConnection);
    *  <br>sgb.setSqlQuery("SELECT * FROM USERS WHERE firstName = ?");
    *  <br>values[0] = "John";
    *  <br>sgb.setSqlValues(values);
    *  <br>data = sgb.executeQuery();
    *  </code>
    *  </p>
    *  <p>The necessary try / catch blocks and error handling have been left out of
    *  this example, but will need to be implemented for production code.</p>
    * @author  Vacode Web Systems
    * @version 1.0
    public class SQLGruntBean
        // Define global variables
        private Connection dbConnection = null;
        private String sqlQuery = null;
        private int maxRows = 100;  // Default to 100 in case it is not set
        private Object[] sqlValues = null;
        // End global variables
        /** A write only method for defining the connection to an SQL
         *  database
        public void setConnection(Connection sqlConnectionObject)
         this.dbConnection = sqlConnectionObject;
        /** A write only method for defining the SQL query that is to be
         *  executed.*/
        public void setSqlQuery(String sqlQuery)
         this.sqlQuery = sqlQuery;
        /** Defines the maximum number of rows that are to be retrieved from the
         *  result set.  This is more of a back up than anything as the sql query
         *  should contain a limit parameter if the query is going to return an
         *  excessive number of results. */
        public void setMaxRows(int maximumRows)
         this.maxRows = maximumRows;
        /** A write only method for defining the dynamic values that are
         *  to replace the question mark placeholders in the sql query.*/
        public void setSqlValues(Object[] values)
         this.sqlValues = values;
        /** Used to execute an sql query.  The executed query is defined by calling
         *  setSqlQuery prior to this method.  The database connection to be used
         *  is defined by calling setConnection prior to this method. */
        public ArrayList executeQuery() throws SQLException
         // Define the local variables that will be used within this method
         ArrayList data = null;
         // End local variables
         if(this.sqlValues!=null && this.sqlValues.length>0)
             /* A prepared statement needs to be executed because the
              * sqlQuery is going to contain ? placeholders rather than
              * actual values.  It is necessary to replace these place
              * holders with their corresponding values.*/
             data = executePreparedQuery();
         else
             // A regular sql query needs to be executed.
             data = executeRegularQuery();
         return(data);
        /** Used to execute an sql update.  The executed update is defined by calling
         *  setSqlQuery prior to this method.  The database connection to be used
         *  is defined by calling setConnection prior to this method. */
        public int executeUpdate() throws SQLException
         // Define the local variables that will be used in this method
         int rowsAffected = -1;
         // Done local variables
         if(this.sqlValues!=null && this.sqlValues.length>0)
             /* A prepared update needs to be executed because the
              * sqlQuery is going to contain ? placeholders rather than
              * actual values.  It is necessary to replace these place
              * holders with their corresponding values.*/
             rowsAffected = executePreparedUpdate();
         else
             // We just need to execute a regular sql query
             rowsAffected = executeRegularUpdate();
         return(rowsAffected);
        /** If a prepared statement is needed this method will be called by the
         *  executeQuery method.*/
        private ArrayList executePreparedQuery() throws SQLException
         // Define the local variables that will be used within this method
         ResultSet rs = null;
         PreparedStatement pstmt = null;
         ArrayList data = null;
         // End local variables
         try
             pstmt = this.dbConnection.prepareStatement(this.sqlQuery);
             setSqlValues(pstmt, this.sqlValues);
             rs = pstmt.executeQuery();
             /* Closing the PreparedStatement is going to cause the
              * ResultSet to be inaccessible.  Therefore it is necessary to
              * move the data that has just been aquired into an alternate
              * data storage object.*/
             data = processResult(rs);
             // Clean up all of the db resources we have opened
             rs.close();
             rs = null;
             pstmt.close();
             pstmt = null;
             this.dbConnection.close();
             this.dbConnection = null;
             /* No exceptions are caught.  They should be dealt with by the
              * calling class. */
         finally
              /* If an exception was thrown during the execution of the
               * sql query there will still be open db resources.  They need
               * to be closed. */
             if(rs!=null)
              try
              { rs.close(); } catch(SQLException sqle)
              { } // EXCEPTION IGNORED
              rs = null;
             if(pstmt!=null)
              try
              { pstmt.close(); } catch(SQLException sqle)
              { } // EXCEPTION IGNORED
              pstmt = null;
             if(this.dbConnection!=null)
              try
              { this.dbConnection.close(); } catch(SQLException sqle)
              { } // EXCEPTION IGNORED
              this.dbConnection = null;
             /* Regardless of what happens we need to return an array of Objects.
              * If the returning value is null it should be handled by the
              * calling class. */
         return(data);
        /** If a regular sql statement is required this method will be called
         *  by the executeQuery method. */
        private ArrayList executeRegularQuery() throws SQLException
         // Define the local variables that will be used within this method
         ResultSet rs = null;
         Statement stmt = null;
         ArrayList data = null;
         // End local variables
         try
             stmt = this.dbConnection.createStatement();
             rs = stmt.executeQuery(this.sqlQuery);
             /* Closing the Statement is going to cause the ResultSet to be
              * inaccessible.  Therefore it is necessary to move the data
              * that has just been aquired into an alternate data storage
              * object.*/
             data = processResult(rs);
             // Clean up all of the db resources we have opened
             rs.close();
             rs = null;
             stmt.close();
             stmt = null;
             this.dbConnection.close();
             this.dbConnection = null;
             /* No exceptions are caught.  They should be dealt with by the
              * calling class. */
         finally
              /* If an exception was thrown during the execution of the
               * sql query there will still be open db resources.  They need
               * to be closed. */
             if(rs!=null)
              try
              { rs.close(); } catch(SQLException sqle)
              { } // EXCEPTION IGNORED
              rs = null;
             if(stmt!=null)
              try
              { stmt.close(); } catch(SQLException sqle)
              { } // EXCEPTION IGNORED
              stmt = null;
             if(this.dbConnection!=null)
              try
              { this.dbConnection.close(); } catch(SQLException sqle)
              { } // EXCEPTION IGNORED
              this.dbConnection = null;
         return(data);
        /** If a prepared update is needed this method will be called by the
         *  executeUpdate method.*/
        private int executePreparedUpdate() throws SQLException
         // Define the local variables that will be used within this method
         PreparedStatement pstmt = null;
         int rowsAffected = -1;
         // End local variables
         try
             pstmt = this.dbConnection.prepareStatement(this.sqlQuery);
             setSqlValues(pstmt, this.sqlValues);
             rowsAffected = pstmt.executeUpdate();
             pstmt.close();
             pstmt = null;
             this.dbConnection.close();
             this.dbConnection = null;
             /* No exceptions are caught.  They should be dealt with by the
              * calling class. */
         finally
              /* If an exception was thrown during the execution of the
               * sql update there will still be open db resources.  They need
               * to be closed. */
             if(pstmt!=null)
              try
              { pstmt.close(); } catch(SQLException sqle)
              { } // EXCEPTION IGNORED
              pstmt = null;
             if(this.dbConnection!=null)
              try
              { this.dbConnection.close(); } catch(SQLException sqle)
              { } // EXCEPTION IGNORED
              this.dbConnection = null;
             /* Regardless of what happens we need to return an array of Objects.
              * If the returning value is -1 it should be handled by the
              * calling class. */
         return(rowsAffected);
        /** If a regular sql statement is required this method will be called
         *  by the executeQuery method. */
        private int executeRegularUpdate() throws SQLException
         // Define the local variables that will be used within this method
         ResultSet rs = null;
         Statement stmt = null;
         int rowsAffected = -1;
         // End local variables
         try
             stmt = this.dbConnection.createStatement();
             rowsAffected = stmt.executeUpdate(this.sqlQuery);
             // Clean up all of the db resources we have opened
             stmt.close();
             stmt = null;
             this.dbConnection.close();
             this.dbConnection = null;
             /* No exceptions are caught.  They should be dealt with by the
              * calling class. */
         finally
              /* If an exception was thrown during the execution of the
               * sql update there will still be open db resources.  They need
               * to be closed. */
             if(stmt!=null)
              try
              { stmt.close(); } catch(SQLException sqle)
              { } // EXCEPTION IGNORED
              stmt = null;
             if(this.dbConnection!=null)
              try
              { this.dbConnection.close(); } catch(SQLException sqle)
              { } // EXCEPTION IGNORED
              this.dbConnection = null;
         return(rowsAffected);
        /** used to iterate through the sql values and add them to the
         *  prepared statement object. */
        private void setSqlValues(PreparedStatement ps, Object[] values) throws SQLException
         for(int i=0;i<this.sqlValues.length;i++)
             Object o = this.sqlValues;
         /* SQL starts counting at 1 not 0, so this loop needs to be
         * incremented by 1 for the setObject method to interpret it
         * correctly. */
         ps.setObject(i+1, values[i]);
    /** Used to copy a result set into a persistent object so that it can
    * be used even once the connection to the database has been closed. */
    private ArrayList processResult(ResultSet rs) throws SQLException
         ArrayList data = new ArrayList();
         ResultSetMetaData rsmd = rs.getMetaData();
         int colCount = rsmd.getColumnCount();
         while(rs.next())
         Object[] currentRow = new Object[colCount];
         for(int i=0;i<colCount;i++)
              currentRow[i] = rs.getObject(i+1); //SQL starts at 1 not 0
         data.add(currentRow);
         return(data);
    Thanks for the input,
    Ryan

    I think I have an idea of what you mean. I just want to make sure before I write everything though. I could implement your idea by doing the following right?
    I haven't tried any of this, so if there's minor (syntax) errors just ignore them. I'll fix them later.
    1. Create the following Interface.
    package com.vacode.beans.sql;
    public interface GruntBeanProccessingModule
        public Object get(Object[] properties);
    }2. Force the subclasses to implement the above interface
    public class EmployeeProcessor implements GruntBeanProcessingModule
        public Object get(Object[] properties)
         //make sure the input array is the right length (+ other validation, etc.)
         //create a new EmployeeBean
         //set all the EmployeeBean properties based on the input Object[]
         //return the EmployeeBean
    }3. Make the following additions to my SQLGruntBean class
    private requestedClassType = null;
    public void setRequestedClassType(Object o) // o must be an instance of the requested class
        this.requestedClassType = o;
    //if requestedClassType isn't null then create the ArrayList like this
    while(rs.next())
             Object[] currentRow = new Object[colCount];
             for(int i=0;i<colCount;i++)
              currentRow[i] = rs.getObject(i+1); //SQL starts at 1 not 0
             Class requestedClass = Class.forName(requestedClassType.getClass().getName());
             GruntBeanProcessingModule gbpm = requestedClass.newInstance();
             Object convertedData = gbpm.get(currentRow);
             data.add(convertedData);
         }Of course I'll have to handle any possible exceptions (requestedClassType isn't an instance of GruntBeanProcessingModule, etc.). I also notice the forum replaced some of my [] with <> (I've seen it before though, so you probably already know about it).
    Did I get it right or am I out to lunch :-)
    Thank you very much for the feedback,
    Ryan

Maybe you are looking for