Fetch data from table and generate attachment than mail it.

Hello Experts,
From couple of day I am searching on Google for a better database procedure that will help me to get data from tables and generate attachment and mail it but i fail.
My Scenario is:
I have a query that will fetch almost 5000 records from database tables. Each record has almost 75 characters
select a.location_code,
               a.item_code,
               b.description item_desc,
               to_char(a.manufact_date,'ddMonyy')mfg,
               to_char((a.manufact_date + nvl(b.expiry_period,0)),'ddMonyy')expr,
               to_char((a.manufact_date + nvl(b.qurantine_period,0)),'ddMonyy')qrtn,
               round(nvl (b.qurantine_period, 0) - (sysdate - a.manufact_date)) days_elapsed,
               a.closing_balance_posted quantity
          from wms_stock_current_balance_v a, wms_item_setup_mast b
         where a.closing_balance > 0
           and a.item_code = b.item_code
           and a.loc_type in ('RACKING','PICKING','QUICKA','BUNDLED')
           and nvl(b.qurantine_period,0) > 0
           and round(nvl (b.qurantine_period, 0) - (sysdate - a.manufact_date)) <= 0
      order by a.item_code, a.location_code;
Sample data of above query is
LOCATION_CODE
ITEM_CODE
ITEM_DESC
MFG
Expiry
Quarantine
Days Elapse
Quantity
13DL2
000000000000000F0487
CLEAR COOL BLACK 05ML
20-Feb-10
31-Mar-14
4-Jun-13
-122
160
14DL0
000000000000000F0487
CLEAR COOL BLACK 05ML
23-Feb-10
3-Apr-14
7-Jun-13
-119
134
14DL2
000000000000000F0487
CLEAR COOL BLACK 05ML
23-Feb-10
3-Apr-14
7-Jun-13
-119
160
14DR2
000000000000000F0487
CLEAR COOL BLACK 05ML
23-Feb-10
3-Apr-14
7-Jun-13
-119
20
14LL2
000000000000000F0487
CLEAR COOL BLACK 05ML
20-Feb-10
31-Mar-14
4-Jun-13
-122
160
17ER2
000000000000000F0487
CLEAR COOL BLACK 05ML
20-Feb-10
31-Mar-14
4-Jun-13
-122
160
17GL2
000000000000000F0487
CLEAR COOL BLACK 05ML
20-Feb-10
31-Mar-14
4-Jun-13
-122
160
17SL0
000000000000000F0487
CLEAR COOL BLACK 05ML
17-Feb-10
28-Mar-14
1-Jun-13
-125
64
18QL0
000000000000000F0487
CLEAR COOL BLACK 05ML
23-Feb-10
3-Apr-14
7-Jun-13
-119
160
19AR5
000000000000000F0487
CLEAR COOL BLACK 05ML
17-Feb-10
28-Mar-14
1-Jun-13
-125
160
19DL1
000000000000000F0487
CLEAR COOL BLACK 05ML
20-Feb-10
31-Mar-14
4-Jun-13
-122
160
19JR0
000000000000000F0487
CLEAR COOL BLACK 05ML
17-Feb-10
28-Mar-14
1-Jun-13
-125
60
19TL1
000000000000000F0487
CLEAR COOL BLACK 05ML
20-Feb-10
31-Mar-14
4-Jun-13
-122
160
20GR2
000000000000000F0487
CLEAR COOL BLACK 05ML
20-Feb-10
31-Mar-14
4-Jun-13
-122
40
36FL3
000000000000000F0487
CLEAR COOL BLACK 05ML
18-Feb-10
29-Mar-14
2-Jun-13
-124
65
19UR0
000000000000000F0591
COMFORT WHITE 24ML*300
28-Oct-09
28-Oct-11
1-May-11
-887
1
12SL1
000000000000000F0593
COMFORT PINK 24ML*300
28-Oct-09
28-Oct-11
1-May-11
-887
42
12SR1
000000000000000F0593
COMFORT PINK 24ML*300
28-Oct-09
28-Oct-11
1-May-11
-887
42
14OR1
000000000000000F0593
COMFORT PINK 24ML*300
28-Oct-09
28-Oct-11
1-May-11
-887
8
36EL4
000000000000000F0594
CLEAR HF DECRASE 5M*360
14-Feb-10
14-Feb-11
12-Oct-10
-1088
14
13VL1
000000000000000F0595
CLEAR COM SFT CRE 5*360
8-Feb-10
8-Feb-11
6-Oct-10
-1094
160
14ER0
000000000000000F0595
CLEAR COM SFT CRE 5*360
8-Feb-10
8-Feb-11
6-Oct-10
-1094
105
Database Info
Oracle 10g
Version 10.2.0.1.0

Look at the sample code for generating a CSV file that I've just posted in response to a similar question:
Re: How to execute a proc and spool files in a database job
And the use the search button in this forum to find sample code for sending a CLOB as a plain/text e-mail attachment using UTL_SMTP.

Similar Messages

  • How to fetch data from XML and store it in internal table

    Hi All,
    Can anyone help me out, in fetching data from xml and store it in an internal table. Is there any standard function module is there?
    Regards,
    Karthick

    to do this you can either develop a XSLT program and use it with CALL TRNSFORMATION key word to tranform the XML into itab .
    (search the ABAP General forum, i have posted few samples)
    or simply use the following FM which converts your XML into a itab of name value pair (name would holw the element name and value would hold the value of the element) which you can then loop and read it to your itb.
    data:             xmldata type xstring .
    data: result_xml type standard table of smum_xmltb .
    data: return type standard table of bapiret2 .
    CALL FUNCTION 'SMUM_XML_PARSE'
      EXPORTING
        xml_input       = xmldata
      TABLES
        xml_table       = result_xml
        return          = return .
    Regards
    Raja

  • How to retrieve multiple data from table and represent it in jsp page

    Hi
    The below JavaScript code is used to add row in the table when I want to add multiple row data into table for single entry no field.
      <html>  function addRow()
                i++;
                var newRow = document.all("tblGrid").insertRow();
                var oCell = newRow.insertCell();
                oCell.innerHTML = "<input name='srno"+i+"' type='text' id='srno"+i+"' size=10>";
                oCell = newRow.insertCell();
                oCell.innerHTML = "<input name='itmcd"+i+"' type='text' id='itmcd"+i+"' size='10'>";
                oCell = newRow.insertCell();
                oCell.innerHTML = "<input name='itmnm"+i+"' type='text' id='itmnm"+i+"' size='15'>";
                oCell = newRow.insertCell();
                oCell.innerHTML = "<input name='indentqty"+i+"' type='text' id='indentqty"+i+"' size='10'>";
                oCell = newRow.insertCell();
                    oCell.innerHTML = "<input name='uom"+i+"' type='text' id='uom"+i+"' size='10'><input type='hidden' name='mcode"+i+"'id='mcode"+i+"'>";
                oCell = newRow.insertCell();
                oCell.innerHTML = "<input name='packqty"+i+"' type='text' id='packqty"+i+"' size='10'>";
                oCell = newRow.insertCell();
                oCell.innerHTML = "<input name='packuom"+i+"' type='text' id='packuom"+i+"' size='10'><input type='hidden' name='pack"+i+"' id='pack"+i+"'>";
                oCell = newRow.insertCell();
                oCell.innerHTML = "<input name='rate"+i+"' type='text' id='rate"+i+"' size='10'>";
                oCell = newRow.insertCell();
                oCell.innerHTML = "<input name='dor"+i+"' type='text' id='dor"+i+"' size='0' onClick='"+putdate(this.name)+"'>";           
                oCell = newRow.insertCell();
                oCell.innerHTML = "<input name='bccode"+i+"' type='text' id='bccode"+i+"' size='10'></td><input type='hidden' name='bcc"+i+"' id='bcc"+i+"'>";
                oCell = newRow.insertCell();
                oCell.innerHTML = "<input name='cccode"+i+"' type='text' id='cccode"+i+"' size='10'></td><input type='hidden' name='ccc"+i+"' id='ccc"+i+"'>";
                oCell = newRow.insertCell();
                oCell.innerHTML = "<input name='remark2"+i+"' type='text' id='remark2"+i+"' size='20'>";           
                oCell = newRow.insertCell();
                oCell.innerHTML = "<input type='button' value='Delete' onclick='removeRow(this);' />";
               // oCell = newRow.insertCell();
               // oCell.innerHTML = "<input type='button' value='Clear' onclick='clearRow(this);' />";
            }<html>  Then this data are send to the next Servlet for adding into two table.
    My header portion data are added into one table which added only one row in table. while footer section data are added into the no of rows in another table dependent on No. of
    Rows added into jsp page.
    Here is an code for that logic.
    <html>
    ArrayList<String> mucode = new ArrayList<String>();
                                ArrayList<Integer> serials = new ArrayList<Integer>();
                                ArrayList<Integer> apxrate = new ArrayList<Integer>();
                                ArrayList<Integer> srname = new ArrayList<Integer>();
                                ArrayList<String> itcode = new ArrayList<String>();
                                ArrayList<String> itname = new ArrayList<String>();
                                ArrayList<Integer> iqnty = new ArrayList<Integer>();
                                ArrayList<String> iuom = new ArrayList<String>();
                                ArrayList<Integer> pqnty = new ArrayList<Integer>();
                                ArrayList<String> puom1 = new ArrayList<String>();
                               ArrayList<Integer> arate = new ArrayList<Integer>();
                                ArrayList<String> rdate = new ArrayList<String>();
                                ArrayList<String> bcs = new ArrayList<String>();
                                ArrayList<String> ccs = new ArrayList<String>();
                                ArrayList<String> remarkss = new ArrayList<String>();
                                //ArrayList<Integer> qtyrecs = new ArrayList<Integer>();
                                //ArrayList<String> dors = new ArrayList<String>();
                                //ArrayList<String> remarks = new ArrayList<String>();
                     String entryn = request.getParameter("entryno");       
                        String rows = request.getParameter("rows");
                        out.println(rows);  
                        //String Entryno = request.getParameter("entryno");
                       // out.println(Entryno);
                      int entryno = 0,reqqty = 0,srno = 0,deprequest = 0,rowcount = 0;
                                if(!Entryno.equals("")){
                                        entryno = Integer.valueOf(Entryno);
                                if(!rows.equals("")){
                                        rowcount = Integer.valueOf(rows);
                               for(int i=1;i<=rowcount;i++){
                                        if(request.getParameter("srno"+i)!=null){
                                                serials.add(Integer.valueOf(request.getParameter("srno"+i).trim()));
                                                out.println(serials.size());
                                for(int i=1;i<=rowcount;i++){
                                        if(request.getParameter("srno"+i)!=null){
                                                srname.add(Integer.valueOf(request.getParameter("srno"+i).trim()));
                                out.println(srname.get(0));
                                for(int i=1;i<=rowcount;i++){
                                        if(request.getParameter("itmcd"+i)!=null){
                                                itcode.add(request.getParameter("itmcd"+i).trim());
                                        } //out.println(itcode.get(i));
                                for(int i=1;i<=rowcount;i++){
                                        if(request.getParameter("itmnm"+i)!=null){
                                                itname.add(request.getParameter("itmnm"+i).trim());
                                        }//out.println(itname.get(i));
                                for(int i=1;i<=rowcount;i++){
                                        if(request.getParameter("indentqty"+i)!=null){
                                                iqnty.add(Integer.valueOf(request.getParameter("indentqty"+i).trim()));
                                for(int i=1;i<=rowcount;i++){
                                        if(request.getParameter("uom"+i)!=null){
                                                iuom.add(request.getParameter("uom"+i).trim());
                                        }//out.println(iuom.get(i));
                                for(int i=1;i<=rowcount;i++){
                                        if(request.getParameter("mcode"+i)!=null){
                                                mucode.add(request.getParameter("mcode"+i).trim());
                               for(int i=1;i<=rowcount;i++){
                                        if(request.getParameter("packqty"+i).equals("")){
                                          pqnty.add(0);
                                        }else
                                            pqnty.add(Integer.valueOf(request.getParameter("packqty"+i).trim()));
                                for(int i=1;i<=rowcount;i++){
                                        if(request.getParameter("pack"+i)!=null){
                                                puom1.add(request.getParameter("pack"+i).trim());
                                       }else
                                        puom1.add("");
                               for(int i=1;i<=rowcount;i++){
                                        if(request.getParameter("rate"+i).equals("")){                                     
                                            arate.add(0);
                                        }else
                                        arate.add(Integer.valueOf(request.getParameter("rate"+i).trim()));   
                     /* for(int i=1;i<=rowcount;i++){
                                        if(request.getParameter("rate"+i)!=null){
                                                arate.add(Integer.valueOf(request.getParameter("rate"+i).trim()));
                              for(int i=1;i<=rowcount;i++){
                                        if(request.getParameter("dor"+i)!=null){
                                                try{
                                                        rdate.add(dashdate.format(slashdate.parse(request.getParameter("dor"+i).trim())));
                                                }catch(ParseException p){p.printStackTrace();}
                                        }else
                                           { rdate.add("");}
                                   for(int i=1;i<=rowcount;i++){
                                 if(request.getParameter("bcc"+i)!=null){
                                                bcs.add(request.getParameter("bcc"+i).trim());
                                        }out.println(bcs.get(0));
                                for(int i=1;i<=rowcount;i++){
                                        if(request.getParameter("ccc"+i)!=null){
                                                ccs.add(request.getParameter("ccc"+i).trim());
                                        }out.println(ccs.get(0));
                                for(int i=1;i<=rowcount;i++){
                                    out.println("remark2");
                                        if(request.getParameter("remark2"+i)!=null){
                                                remarkss.add(request.getParameter("remark2"+i).trim());
                                        }out.println(remarkss.get(0));
                        ArrayList<String> Idate = new ArrayList<String>();
                        for(int i=1;i<=rowcount;i++){
                                        if(request.getParameter("dateindent"+i)!=null){
                                                try{
                                                        Idate.add(dashdate.format(dashdate.parse(request.getParameter("dateindent"+i).trim())));
                                                }catch(ParseException p){p.printStackTrace();}
                    String Rdate = dashdate.format(new java.util.Date());
                     String tdate = dashdate.format(new java.util.Date());    
                     // String Indentdate = dashdate.format(new java.util.Date());
                   //  String ApprovedT1 = dashdate.format(new java.util.Date());
                   //  String ApprovedT2 = dashdate.format(new java.util.Date());
                       // String ApprovedT1=" ";
                        //String ApprovedT2="";*/
                    String ApprovedT1= dashdate.format(new java.util.Date());
                   out.println (ApprovedT1);
                      String ApprovedT2=dashdate.format(new java.util.Date());
                       out.println(ApprovedT2);
                    String Indentdate=(dashdate.format(slashdate.parse(request.getParameter("dateindent").trim())));
                       out.println(Indentdate);
                        String Cocode ="BML001";  
                        out.println(Cocode);
                        String Deptcode = request.getParameter("dept1");
                        out.println(Deptcode);
                        String Empcode = request.getParameter("emp");
                        out.println(Empcode);
                        String Refno =request.getParameter("rtype"); 
                         out.println(Refno);
                        String Divcode = request.getParameter("todiv1");
                        out.println(Divcode);
                        String Usercode = "CIRIUS";    
                         String Whcode = request.getParameter("stor");
                        out.println(Whcode);
                        // String Itemgroupcode = request.getParameter("");
                         String Itemgroupcode ="120000";
                         out.println(Itemgroupcode);
                        String Supplytypecode = request.getParameter("stype");
                        out.println(Supplytypecode);
                        String Delcode = request.getParameter("deliverycode");
                        out.println(Delcode);
                        String Itemclass="WS";
                        out.println(Itemclass);
                        // String Itemclass = request.getParameter("iclass");
                       // out.println(Itemclass);
                        String unitcode = request.getParameter("uni");
                        out.println(unitcode);
                         String Todivcode = request.getParameter("todiv1");
                        out.println(Todivcode);
                        String Appxrate = request.getParameter("rate");
                        out.println(Appxrate);
                        String Srno = request.getParameter("srno");
                        out.println(Srno);                
                    /*    String Indqty = request.getParameter("indentqty");
                      out.println(Indqty);*/
                  String Itemcode = request.getParameter("itmcd");
                       out.println(Itemcode);
                       String Othersp = request.getParameter("remark1");
                        out.println(Othersp);
                        String Reqdt = request.getParameter("dor");
                        out.println(Reqdt);
                        String Munitcode = request.getParameter("mcode");
                        out.println(Munitcode);
                        String Packqty = request.getParameter("packqty");
                        out.println(Packqty);               
                        String Packuom = request.getParameter("pack");
                        out.println(Packuom);
                        String Remark2 = request.getParameter("remark2");
                        out.println(Remark2);
                        String BC = request.getParameter("bcc");
                        out.println(BC);
                        String CC = request.getParameter("ccc");
                        out.println(CC);
                        try{
                            st=connection.createStatement();
                            connection.setAutoCommit(false);
                            String sql="INSERT INTO PTXNINDHDR(COCODE,DEPTCODE,EMPCODE,APPROVEDT1,APPROVEDT2,INDDT,ENTRYNO,REFNO,REMARKS,DIVCODE,USERCODE,WHCODE,ITEMGROUPCODE,SUPTYPECODE,DELCODE,UNITCODE,TODIVCODE,ITEMCLASS)VALUES('"+Cocode+"','"+Deptcode+"','"+Empcode+"','"+ApprovedT1+"','"+ApprovedT2+"','"+Indentdate+"',"+Entryno+",'"+Refno+"','"+Othersp+"','"+Divcode+"','"+Usercode+"','"+Whcode+"','"+Itemgroupcode+"','"+Supplytypecode+"','"+Delcode+"','"+unitcode+"','"+Todivcode+"','"+Itemclass+"')";
                            out.println(sql);
                            st.addBatch(sql);
                            for(int i=0;i<serials.size();i++){
                                out.println("Inside the Statement");
                                String query3="test query for u";
                                out.println(query3);
                               String queryx="Insert into PTXNINDDTL(APXRATE,ENTRYNO,BRKNO,INDQTY,ITEMCODE,OTHERSPFCS,MUNITCODE,PACKQTY,PACKUOM,REMARKS,DIMSUBGRPCODE,DIMCODE,REQDT)VALUES("+arate.get(i)+","+entryno+","+srname.get(i)+","+iqnty.get(i)+","+itcode.get(i)+",'"+Othersp+"','"+mucode.get(i)+"',"+pqnty.get(i)+",'"+puom1.get(i)+"','"+remarkss.get(i)+"','"+bcs.get(i)+"','"+ccs.get(i)+"','"+rdate.get(i)+"')";
                               out.println(queryx);
                                st.addBatch(queryx);
                           int[] result=st.executeBatch();
                           connection.commit();
                           for(int k=0;k<result.length;k++)
                           out.println("rows updated by "+(k+1)+"insert sta:"+result[k]+"");
                        catch(BatchUpdateException bue)
                        out.println("error1;"+bue+"");
                        catch(SQLException sql)
                        out.println("error2;"+sql+"");
                        catch(Exception l)
                        out.println("error3;"+l+"");
    </html>
       Now I looking for to retrieve this footer section data available in multiple rows from footer table and present it in jsp page .
    I am finding difficulties in how to show this multiple row data for dynamic no of rows .i.e. variable no. of rows.
    I have able to show the data in Header portions of page in this ways
    here i am adding the part of code which shows the data from header part of table i.e from Header table
      <html>
    <h2 align="center"><b>Indent Preparation</b></h2>
        <div align="left">
            <table width="849" border="0" cellspacing="3" cellpadding="3" align="center">
                <tr>
                    <td ><div align="left"><b>Indent No.</b></div></td>
                    <td ><label>
                            <input name="indentno" type="text" id="indentno" size="15" value="" /><input type="hidden" name="no" id="no">
                    </label></td>
                    <td ><div align="center"><strong>Indent Date</strong></div></td>
                    <td ><label>
                            <div align="center">
                                <input name="dateindent" type="text" id="dateindent"value="<%=date1%>"/><input type="hidden" name="no" id="no">
                            </div>
                    </label></td>
                    <td> </td>
                    <td><div align="right"><strong>Entry No.</strong></div></td>
                     <%if(oper!=null && oper.equals("view") && hdrcode!=null && hdrdetails!=null){%>
            <td><input type="text" value="<%=hdrcode.get(3)%>" size="10"></td>
    <%}else{%>
                   <td><input type="text" name="entryno" id="entryno" value="<%=entryNo%>"/></td>
                             <%}%>
                            <div align="right"></div>
                </tr>
                <tr>
                    <td><b>Division</b></td>
                    <%if(oper!=null && oper.equals("view") && hdrcode!=null && hdrdetails!=null){%>
    <td><input type="text" value="<%=hdrdetails.get(9)%>" size="20"</td>
    <td><input type="hidden" name="div1" id="div1" value='<%=hdrcode.get(10)%>'></td>
    <%}else{%>
                   <td><input type="text" name="div" id="div" /></td>
                   <td><input type="hidden" name="div1" id="div1" /> </td>
              <%}%>
                    <td> </td>
                    <td> </td>
                    <td><div align="right"><strong>Unit</strong></div></td>
                   <%if(oper!=null && oper.equals("view") && hdrcode!=null && hdrdetails!=null){%>
    <td><input type="text" value="<%=hdrdetails.get(14)%>" size="20"</td>
    <td><input type="hidden" name="uni" id="uni" value='<%=hdrcode.get(12)%>'></td>
    <%}else{%>
                   <td><input type="text" name="unit" id="unit" /></td>
                   <td><input type="hidden" name="uni" id="uni" /> </td>
              <%}%>
                </tr>
                <tr>
    </html>
      Any suggestion on any above works is highly appreciated.
    Thanks and regards
    harshal

    Too much code. It's also not well intented nor formatted. I don't see a question either or it got lost in that heap of unformatted code.
    I will only answer the question in the thread's subject:
    How to retrieve multiple data from table and represent it in jsp pageTo retrieve, make use of HttpServletRequest#getParameterValues() and/or #getParameter().
    To display, make use of JSTL's c:forEach.

  • Select query taking 30 sec to fetch data from table containing BLOB column.

    Hi Friends,<o:p></o:p>
    Please help me...<o:p></o:p>
    I have 15 columns in a table, in that 2 columns containing blob (images).<o:p></o:p>
    More than 22 lakhs records are in a table.<o:p></o:p>
    While i am try to fetch data from this table it nearly takes 25~30 sec to execute that query.<o:p></o:p>
    When i deleted the two columns containing blob and i tried its executing fast .<o:p></o:p>
    I should not change the table schema.<o:p></o:p>
    Views also i created and indexes also there in a table.<o:p></o:p>
    How can i improve the query execution speed?.<o:p></o:p>

    And how large is the size of BLOB data in your table? If it's several giga bytes, then the time is simply required to read the amount of data from disk and to transfer it to the Client.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • RFC fetching data from table which is not commited

    Hi Experts,
                   I have a query regarding commit work.Below is the RFC that i have written
    FUNCTION ZBAPI_CREATE.
    *"*"Local Interface:
    *"  TABLES
    *"      IT_ZABAP_RFC STRUCTURE  ZBAPI_RFC_STR OPTIONAL
    *"      RETURN STRUCTURE  BAPIRET2 OPTIONAL
    CALL FUNCTION 'ZBO_BAPI_CREATE'
    TABLES
       IT_ZABAP_RFC       = IT_ZABAP_RFC
       RETURN             = return
    Break-point.
    DATA lt TYPE TABLE OF ZBAPI_RFC_STR_MAIN.
    CALL FUNCTION 'ZBAPI_SEARCH_RANGE'
    * EXPORTING
    *   IS_STR        =
    TABLES
       ET_TAB        = lt
    *   RETURN        =
    ENDFUNCTION.
    here in first RFC call i am creating a record in ZTABLE , and then at break-point
    i check the ZTABLE where it does not create any record because data is not commited into ZTABLE upto this point, but just after it i have written code for fetching data from ZTABLE but i am able to get this new record in lt.
    Can anybody please explain that from where this serach RFC is providing data because inside serach i am simply selecting data from ZTABLE.
    Regards,
    Abhishek Bajpai
    Edited by: ABHISHEK BAJPAI on Jan 28, 2009 1:12 PM

    Hi Thomas,
                     Thanks for reply , i checked in ZTABLE ,before search RFC call data is not there but if i commit explicitly only then it is showing data in ZTABLE. Actually my requirement is different -
    I have two RFCs 1. Create 2. Search , Now  from web dynpro user will call first Create RFCs but at this point it should not insert record in ZTABLE and just after it user will call another search RFC and in this search he should be able to get these newly created records.
    I want to have the functionality which a user gets when working with normal database front end like SQLPLus for Oracle. In these scenarios we see that whenever user does any insert or update the data sits in the table but still it is not committed. So there he fires Select query he sees the inserted data. But if he logs off from SQL PLUS and then logs in again, and fires Select query he does not see the data as it was not committed. I want a similiar functionalty in which if user inserts the data through Create RFC and fires the Select query through Search RFC then he can see the newly Created data also even though this data is not committed.
    Although if i call create RFC in update task it will not update ZTABLE but in this situation , if user will call search RFC he will not be able to get newly created records.
    So my requirement is that i should be able to get those records which are not commited in ZTABLE .If you have still any doubt regarding my question then please let me know.
    Regards,
    Abhishek

  • Fetch data from table(ET_) which is exporting parameter of function module

    Hi,
    I m new to ABAP programming.
    I have to develop a smartform that has to be filled in with fields from few tables.
    These tables have the naming convention ET_<XXX> (i.e. exporting parameter of function module).
    I m not able to directly view its contents in se11 or use select query for it.
    I have a report program which i can execute to view these parameter names.
    Now, how do i fetch data from these parameters/tables and pass it from my driver program to smartform??
    Someone pls guide me...
    Thank You.

    Hi,
    I have done that using Field-Symbols.
    Thanks,
    Preetha

  • Fetch data from Table

    Hi all,
    I am using function module through Call fucntion.
    There i am getting <b>Table Name</b> as import Parameter.
    Now i need to fetch data from that table (Which name we got througfh function module).
    Is there any point to know how can we fetch data from runtime table .
    i need some sample code for this.
    Thanks inn advance,
    Regards,
    Bhaskar

    Hello Bhaskar,
    I don't have an SCM system, so I cannot test out that FM
    However, I modified the above code to update the table as well
    *& Report  ZKRIS_DYNAMIC_TABLE_READ_MOD
    REPORT  ZKRIS_DYNAMIC_TABLE_READ_MOD LINE-SIZE 256.
    DATA : LV_FIELD_DESC TYPE STRING.
    DATA : LV_DATA1 TYPE STRING.
    DATA : LV_DETAIL(128).
    DATA : COMMA TYPE C VALUE ','.
    DATA : LV_TNAME LIKE DD02L-TABNAME.
    DATA : LV_DBTAB1 LIKE DD02L-TABNAME.
    DATA : DREF TYPE REF TO DATA.
    DATA : FLAG_MODIFIED.  " determines if database needs to be updated
    FIELD-SYMBOLS: <ITAB> TYPE ANY TABLE, " used to store dynamic tables
                   <WA>    TYPE ANY,      " used to store record data
                    <WA1> TYPE ANY .      " used to store field data
    * call Fm /SAPAPO/TS_PA_COPY_TABLE_GET here
    LV_DBTAB1 = 'ZGSTSET'. " <-- put your table name here
    DATA: IT_FIELDS TYPE X031L OCCURS 0.
    DATA: WA_FIELDS LIKE LINE OF IT_FIELDS.
    CALL FUNCTION 'DDIF_NAMETAB_GET'
      EXPORTING
        tabname           = LV_DBTAB1
    *   ALL_TYPES         = ' '
    *   LFIELDNAME        = ' '
    *   GROUP_NAMES       = ' '
    *   UCLEN             =
    * IMPORTING
    *   X030L_WA          =
    *   DTELINFO_WA       =
    *   TTYPINFO_WA       =
    *   DDOBJTYPE         =
    *   DFIES_WA          =
    *   LINES_DESCR       =
    TABLES
       X031L_TAB         = IT_FIELDS
    *   DFIES_TAB         =
    EXCEPTIONS
       NOT_FOUND         = 1
       OTHERS            = 2
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    * we do not know the sized of the table that must be generated beforehand
    * hence we use field symbols to dynamically generate the internal table
      CREATE DATA DREF TYPE STANDARD TABLE OF (LV_DBTAB1)
                                WITH NON-UNIQUE DEFAULT KEY.
      ASSIGN DREF->* TO <ITAB> .
    * selects all data
      SELECT * FROM (LV_DBTAB1) INTO TABLE <ITAB> .
      LOOP AT <ITAB> ASSIGNING <WA>.
        FLAG_MODIFIED = ''.
        LOOP AT IT_FIELDS INTO WA_FIELDS.
          ASSIGN COMPONENT WA_FIELDS-FIELDNAME OF STRUCTURE <WA>
            TO <WA1>.
          IF WA_FIELDS-FIELDNAME = 'FIRSTNAME'. " fieldname in the table you wish to modify
            IF <WA1> = 'Kris'. " old value
              <WA1> = 'NewName'. " new value
              MODIFY TABLE <ITAB> FROM <WA>.
              FLAG_MODIFIED = 'X'.
            ENDIF.
          ENDIF.
          WRITE <WA1>. " comment this line to remove the display
        ENDLOOP.
        IF FLAG_MODIFIED = 'X'. " updates database only if the record was changed
          UPDATE (LV_DBTAB1) FROM <WA>.
    *     note that if the field you choose is a key field, sy-subrc will be set to 4
        ENDIF.
    *   display
        NEW-LINE.
      ENDLOOP.

  • Function module to fetch data from table SETLEAVES

    Hi All,
    We have a requirement to fetch the data from table SETLEAVES based on the setclass,subclass and group. As the table holds hierarchical data, Please let me know a FM which fetches all the hierarchical data from the table SETLEAVES.
    Regards
    Shiva

    Try:
        exporting
          e_class                     = '0102'
          e_setid                     = setid
          e_kokrs                     = my_kokrs
          e_mandt                     = sy-mandt
          e_master_data               = 'XXX'
          e_structure                 = 'X  X0200'
          e_replace_class             = space
          e_replace_unit              = space
          e_suffix                    = space
          e_old_line_level            = 1  "l_ol_level
        tables
          t_nodes                     = it_ceg_nodes
          t_values                    = it_ceg_values
        changing
          c_info                      = c_info
          c_overwrite                 = c_overwrite
        exceptions
          no_controlling_area         = 1
          no_chart_of_account         = 2
          different_controlling_areas = 3
          different_chart_of_accounts = 4
          set_not_found               = 5
          illegal_field_replacement   = 6
          illegal_table_replacement   = 7
          fm_raise                    = 8
          convert_error               = 9
          no_overwrite_standard_hier  = 10
          no_bukrs_for_kokrs          = 11
          others                      = 12.
    Rob

  • To Fetch Data from GTS and print in R/3

    Hi,
      iam in need of help.
    the core is i have a print program in R/3.from R/3 i have to validate some field with SAPGTS.
    so that i have to apply a RFC call from R/3 ( print program ) to GTS and i have to fetch the data from GTS and print in R/3.
    help me out in finding the RFC.
    the print program is for VL02N

    Mohan:
    SAP and GTS are linked through a RFC destination and the RFC user ID is used to make the call. Once this is set up, you can call GTS through a Function Module call. The set up is normally done by BASIS team
    From the program /SAPSLL/SAPLCD_PI_R3 you can drill down to get details of the specific user-exit which you can use to call GTS tables for specific data.
    Let me know if this helps
    Siva

  • To Fetch Data from table

    Hi All,
    I have to fetch data from t005u for the filed bezei.
    based on conditions given below
    1) pass kna1-land1 and kna1-regio to t005u-land1 and t005u-bland
    and then i want to pass this to an alv filed.
    thanks in advance
    jay

    hi jay,
    try this code.
    select t005u~bezei
              kna1~land1
              kna1~regio
              into table <itab>
              from t005u join kna1
              on t005u-land1 eq kna1-land1 and
                   t005u-bland eq kna1-regio
              where <condition with selection-screen Parameters>
      After fetching the data build the field catelog using <itab> and
    pass it in the function module REUSE_ALV_GRID_DISPLAY.
    <b><i>Reward points if useful</i></b>
    Chandra
    Message was edited by:
            Chandrasekhar Velpula

  • Dynamically fetch data from database and display it in the report

    Hi,
    We have a requirement in developing a report which needs us to dynamically fetch data from the database and display it in the report.
    We have a column called WORKER in the report.
    For each worker there is a measure(PSA) associated with it.
    In the report we have to display both the WORKER and the PSA column.
    What we want is, when we display the list of the workers, the corresponding workerid_id of the worker will be passed and the value of his PSA will be fetched from the database and displayed in the report.
    Or anything similar to this.
    We also have drill applied on this WORKER column. So after any drill up or drill down also the value for PSA should change.
    Is there any way of doing this?
    Please help if possible.
    Thanks,

    hi,
    data : count type i value 0.
    data : Begin of itab occurs 0 ,
    plan_version like hrhap-plan_version,
    APPRAISAL_ID like hrhap-APPRAISAL_ID,
    AP_START_DATE like hrhap-AP_START_DATE,
    AP_END_DATE like hrhap-AP_END_DATE,
    AP_STATUS like hrhap-AP_STATUS,
    AP_STATUS_SUB like hrhap-AP_STATUS_SUB,
    OBJ_DATE_SET like hrhap-OBJ_DATE_SET,
    REVIEW_DATE_SET like hrhap-REVIEW_DATE_SET,
    AP_DATE_SET like hrhap-AP_DATE_SET,
    AP_DATE_EARLIEST like hrhap-AP_DATE_EARLIEST,
    AP_DATE_LATEST like hrhap-AP_DATE_LATEST,
    CHANGE_DATE like hrhap-CHANGE_DATE,
    CHANGE_TIME like hrhap-CHANGE_TIME,
    CHANGE_USER like hrhap-CHANGE_USER,
    end of itab.
    <b>select * from hrhap into corresponding fields of table itab.</b>
    loop at itab.
    write :/ itab-plan_version under 'plan_version',
    itab-appraisal_id under 'Appraisal Id',
    itab-AP_START_DATE under 'Start Date',
    itab-AP_END_DATE under 'End date',
    itab-AP_STATUS under 'Status',
    itab-AP_STATUS_SUB under 'Substatus',
    itab-OBJ_DATE_SET under 'Objective setting date',
    itab-REVIEW_DATE_SET under 'Review date set',
    itab-AP_DATE_SET under 'appraisal date',
    itab-AP_DATE_EARLIEST under 'Earliest appraisal date',
    itab-AP_DATE_LATEST under 'Latest Appraisal date',
    itab-CHANGE_DATE under 'Change Date',
    itab-CHANGE_TIME under 'change time',
    itab-CHANGE_user under 'change user'.
    count = count + 1.
    endloop.
    write : 'No of records' ,count.
    rgds
    anver
    if hlped mark points.

  • Fetching record from table and displaying in JSP while loading page -struts

    Hi all,
    I have a problem relating to struts .
    I am fetching records from database and I want to diaplay those records in corresponding fields in the jsp page.
    I am using Struts MVC Framework.
    I am giving the sample code below.
    In my action class i am giving the following code.
    String sql="Select empname from emp where empcode='1' ";
    ResultSet rs=S.executeQuery(sql);
    if(rs.next()){
    EditForm e=new EditForm();
    e.setEmpname(rs.getString(1));
    In my Action Form
    I gave setter and getter methods for Empname
    public String getEmpname() {
    return empname;
    public void setEmpname(String empname) {
    this.empname = empname;
    In my jsp gave
    <html:form method="POST" action="submitForm.do?action=1" >
    <html:text property="empname" />
    </html:form>
    The targets given are correct and it is being redirected.
    But the value is not displaying in the textbox while the jsp is loading.
    There is a record for the sql query.
    Anybody please help me out
    It is very urgent
    Thank You
    Parvathy

    Now in the following code, why are u creating a new form?
    Why dont you use the form which is input to the Action Class's execute methof?
    if(rs.next()){
    EditForm e=new EditForm();
    e.setEmpname(rs.getString(1));
    }Thanks and regards,
    Pazhanikanthan. P

  • Send mail by attaching a pdf fetching data from tables.

    Dear Team,
    I have a requirement to send a mail by attaching a pdf.
    Step1 : Getting the data fron tables based on some logic into internal tables. [DONE]
    Step2 : Using this internal and making a pdf  [At present I am making an excel sheet, But client requires non editable well formatted pdf]
    Step3 : Attach this PDF and send it as a mail. [At present I am sending the attched excel but want to send pdf]
    Sample code used is
    **  Body of the mail
    WA_TEXT-LINE = 'Note : This is an autogenerated mail. Please do not reply to this mail.'.
          APPEND WA_TEXT TO TEXT.
          CLEAR WA_TEXT.
    *     create document from internal table with text
          DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
                          I_TYPE    = 'RAW'
                          I_TEXT    = TEXT
                          I_LENGTH  = '12'
                          I_SUBJECT = I_SUBJECT1 ).
    **  Excel Attachemnt
    ***  Preparing the xcel
    CONCATENATE 'SNO' 'Request' 'Data1' INTO WA_TEXT-LINE SEPARATED BY CON_TAB.
                CONCATENATE CON_CRET WA_TEXT-LINE  INTO WA_TEXT-LINE.
                APPEND WA_TEXT TO TEXT.
                CLEAR WA_TEXT.
    CONCATENATE WA_SNO WA_REQUEST WA_DATA1 INTO WA_TEXT-LINE SEPARATED BY CON_TAB.
                  CONCATENATE CON_CRET WA_TEXT-LINE  INTO WA_TEXT.
                  APPEND WA_TEXT TO TEXT.
                  CLEAR : WA_TEXT, TEMP_TYPE .
    *** Attaching the excel
    DATA : COUNTER TYPE I.
          DESCRIBE TABLE TEXT LINES COUNTER.
          LOOP AT TEXT INTO WA_TEXT.
            SIZE =  255 + STRLEN( WA_TEXT-LINE ) + SIZE .
          ENDLOOP.
          CALL METHOD DOCUMENT->ADD_ATTACHMENT
            EXPORTING
              I_ATTACHMENT_TYPE    = 'XLS'
              I_ATTACHMENT_SUBJECT = I_SUBJECT
              I_ATTACHMENT_SIZE    = SIZE
              I_ATT_CONTENT_TEXT   = TEXT.
    ** Semding Mail
       CALL METHOD SEND_REQUEST->SET_DOCUMENT( DOCUMENT ).
    IF REQUESTER_MAIL IS NOT INITIAL.
    *       create recipient for cc
            RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS(
              I_ADDRESS_STRING = REQUESTER_MAIL ).
    *       add recipient with its respective attributes to send request
            CALL METHOD SEND_REQUEST->ADD_RECIPIENT
              EXPORTING
                I_RECIPIENT = RECIPIENT
                I_COPY      = 'X'
                I_EXPRESS   = 'X'.
          ENDIF.
    SEND_REQUEST->SET_SEND_IMMEDIATELY('X').
    *     ---------- send document ---------------------------------------
          CALL METHOD SEND_REQUEST->SEND(
            EXPORTING
              I_WITH_ERROR_SCREEN = 'X'
            RECEIVING
              RESULT              = SENT_TO_ALL ).
          IF SENT_TO_ALL = 'X'.
            WRITE TEXT-003.
          ENDIF.
          COMMIT WORK.
    Please help me in this regard.
    Thanks in advance.
    Sai

    Hi,
    You can convert the data into spool and then pdf,
    please go through this link in this data from an internal
    table of an script or an smartform is converted into spool
    and then sended into mail,
    https://wiki.sdn.sap.com/wiki/display/sandbox/ConversionofSpoolRequestDataintoPDFandExcelFormatandSenditintoMail
    Hope it helps
    Regards
    Mansi

  • How to fetch data from 2lis_03_bx and 2lis_03_bf

    Hello Guys,
    I have to create an inventory report for which i would have to use 2lis_03_bf and 2lis_03_bx for last consumption date and valuated stock value respectively. But when i am looking into rsa3 for these Datasource, i am finding nothing there.
    Please suggest how would i get data from there.
    Thanks & Regards,
    Dolly

    vishnu@sri wrote:
    hi,
    > Please follow these steps........
    > Loading of 0IC_C03(Material Stocks/Movements)
    >
    > R/3 Side
    > Step1:
    > Tcode: SBIW
    > Goto Settings for Application Specific Datasource
    > Logistics
    > Settings: Inventory Controlling
    > Determine Industry Sector----Select Standard(CORE)
    > Stock Initialization----Only Valued Stocks
    > 2LIS_03_BX will be activated
    >
    > Step2:
    > Tcode: MCNB
    > Filling setup tables for 2LIS_03_BX
    > Transfer Structure 2LIS_03_BX
    > Only valuated stock(with posting block)
    >
    > BW Side
    > First load 2LIS_03_BX
    > Goto Infopackage---select Generate Initial Status in Update Tab
    > Now Goto Infocube(0IC_C03)-Manage-Collapse Tab---Remove No Marker Update then click on Release
    > Load BF & UM then Goto Collapse Tab & Select No Marker Update for Initial loads of both the datasources
    > For Delta load Uncheck---No Marker Update
    >
    >
    > Regards,
    > Vishnu.
    Thanks Vishnu.
    I performed step 1 but by mistake i did it twice ..
    so now double data records are visible in rsa3 .....
    please suggest

  • How create report with data from table and some columns results function ?

    Hi,
    How can i create on apex report region with some columns (of the report) as returned from a table and the other columns as results of plsql functions ?
    for example , I want to create a report like that:
    device last_date error_msg stop/start
    kodak1 06/04/08 null >>
    kodak2 08/03/08 good msg --^--
    kodak3 08/04/08 err msg >>
    3 rows returned
    where the 3 first columns are data returned from the table and the forth column is the result of plsql function (returned for example false) and on that i want to display a button of start ( >> in this example ) or stop ( --^-- in this example)

    Thomas,
    There is no problem here -- this is fully suported scenario.
    1. Bind Table dataSource to Customers node.
    2. Bind individual cell editors to any attribute of customer or any nested node like Address, say create column with InputField as editor, then for "value" property select Customer.Address.Street.
    Your nested nodes (like Address) must be non-singleton, set singleton=false on context designer tab.
    Valery Silaev
    EPAM Systems
    http://www.NetWeaverTeam.com

Maybe you are looking for

  • HP PSC 2175 Problems....

    I am trying to set up my PSC 2175 printer through my print server on my network and am about to pull my hair out! No matter what i do i cannot seem to get it to work; here is what i have done. I downloaded the new software from HP and hooked up the p

  • Aperture 3 and importing

    Aperture 3 seems to have added a check box for selection of images to i mport. Is there any way to go back to the selection process in Aperture 2 without the check box?

  • Apple video suggestion

    I was watching a video on Youtube the other day. The contents of the video itself is irrelevant, but the quality of the video was stunning. It made me wonder what type of phone or camera it was taking with. In today's youtube era information broadcas

  • Help with configurator

    EPM configurator : I am getting this message log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter) log4j:WARN Please initialize the log4j system properly and then the configuration starts 1. not

  • Access Content Server Pos-installation Configuration

    Hello, I am new with Oracle ECM, I am starting to use it for Webcenter requirements. I have installed succesfully Oracle Content Server. I accessed http://localhost:16200/cs, and it showed me the post-installation configurations. I made some changes