How can I convert an existing table to IOT

Hi,
My Oracle version is 10.2.0.4
Below is my structure of my test_table .
It has 1141580 rows.
I want to convert this into index Organized table. It has no secondary indexes.
How can I convert an existing table to IOT.
CREATE TABLE test_table (
   Column1             NUMBER        NOT NULL,
   Column2             DATE          NOT NULL,
   Column3             VARCHAR2(100) NOT NULL,
   Column4             VARCHAR2(8)   NULL,
   Column5             VARCHAR2(40)  NOT NULL,
   Column6             VARCHAR2(3)   NULL,
   Column7             NUMBER        NOT NULL,
   Column8             NUMBER        NULL,
   Column9             VARCHAR2(32)  NULL,
ALTER TABLE test_table
  ADD CONSTRAINT test_table_pk2 PRIMARY KEY (
    Column1,
    Column2
  USING INDEX
    STORAGE (
      INITIAL   30720 K
ALTER TABLE test_table
  ADD CONSTRAINT test_table_cons1 FOREIGN KEY (
    Column1
  ) REFERENCES test_table2 (
    Column1
/

alter table doesn't allow to change the organization of a table.
So the logical answer to your question is
You can not
and your question
redundant.
As most other questions here.
So the answer should have been
- create a new table
- insert all rows
- drop the old table
- rename the new table
Oracle is not about rocket science.
Oracle is about reading documentation and using brains.
If you do that, maybe, one day, you will be a bigboy.
If you keep asking redundant questions you will remain a littleboy.
Sybrand Bakker
Senior Oracle DBA

Similar Messages

  • How can I convert my existing tunes to work on an MP3 player?

    I have purchased a CBC radio show from Itunes and want to put it on an MP3 player. It appears the file format is not compatable. How can I convert the existing files to MP3 format??
    Thanks.

    If it has Apple FairPlay DRM on it, you can't simply "convert it" to MP3. You must first burn it to a CD, then import it again into iTunes. Make sure your import settings have MP3, and match the native bit-rate of the original track.
    If it's a regular AAC audio file, then simply change your import settings to MP3, then right-click the file and choose "Create MP3 Version."
    Bryan

  • How can I convert an existing account into a "special account" with no identies associated?

    I have an old email address that I no longer use but I want to be able to access the old emails

    You would create folders under Local Folders and move any messages from the old account that you want to keep into those folders.
    Right click Local Folders and select New Folder. Name the new folder and create sub-folders under that if you want to sort the messages further. Then drag and drop the messages or select the messages and select Move To to get the messages into the new folders.
    When you have moved the messages and confirmed that they are moved and you can still read them you can remove the old account.

  • How can i convert the data from mutiple-table to the other database(MSSQL)?

    Dears,
    How can i convert the data from mutiple-table to the other database such as MS-SQL?
    I have a third party system based on MS-SQL 2000.
    Now we want to make a integration between SAP R/3(Oracle) and SQL server.
    When my user releases the purchase order in R/3, the application we coded will convert the releated data to the temp database on the SQL server.
    But i don't know which tools will help me reach the purpose.  BAPI, LSMW, IDoc... ???
    Would anybody tell me which way is better and how to do?
    Thanks a lot!
    Kevin Wang

    Hello Kevin,
    The question to use which method depend on your detail requirements. If you use BAPI, you need to find which Bapi can provide the data you want. Bapi normally use as a function called by external system. So you need to develop an external program like VB/Java to call this Bapi and move it to SQL. LSMW is use when you want to upload data from an external system to SAP. So it does not serve your requirement. Idoc can be use to export data to an external system. Again like Bapi, you need to find what Idoc can provide the data you want. However, it does not any programming from the external system. If I were you, based on your requirements, I think writing an Abap program that read the data you want and download it to NT/SQL server will be faster and easier.

  • How can i convert the quantity of one unit to other unit in BI 7?

    Hi ,
    I have developed an RFC function module in SAP BW (BI 7.0).
    For this function module I have to populate material  number and  Quantity required and UNIT.Every thing working good. If the user forgets to enter unit  or enters other unit  where Quantity in ODS is not mentioned in terms of that unit.WE have to Convert the Quantity requested into the Qunantity that exist in ODS or DATA BASE  based on the unit of measure .
    Please suggest me how can I convert the UNIT of measure of quantity?
    Thanks,
    Suresh.

    I have to do this with conversion table /BIO/PMAT_UNIT.
    IN THIS TABLE I DON'T KNOW HOW CAN I CONVERT?
    REGARDS,
    SURESH.

  • How do I convert my existing iTunes account to a .mac account?

    I am trying to convert my existing iTunes account which uses an Earthlink address. The following is the INSTRUCTIONS from the Apple web site on how to do this.
    "I just signed up for .Mac. How do I convert my existing iTunes account to
    my new .Mac account?
    We'll be happy to convert your account for you. Please provide your old account name, your new .Mac account name and your billing address in your email. We will also need your explicit permission to reset your password to complete the conversion."
    This is the URL where I found those INSTRUCTIONS:
    http://www.apple.com/support/itunes/musicstore/email/
    I FOLLOWED THE INSTRUCTIONS ABOVE!
    I am now on my fifth exchange of emails with iTunes support.
    HAS ANYBODY SUCCESSFULLY EXECUTED THESE INSTRUCTIONS? I don't want to lose the ability to play my existing purchased music, but I want to close down Earthlink as my ISP.
    17" G4 Powerbook   Mac OS X (10.4.6)  
    17" G4 Powerbook   Mac OS X (10.4.6)  

    On any page in the iTunes Store, click the flag icon at the lower right.  This brings up a page saying "Choose your country or region."  Click Canada.
    Before you can buy anything, you will need to enter your Canadian credit card.

  • How can I create a new table in a MySQL database in MVC 5

    I have an MVC 5 app, which uses MySQL hosted in Azure as a data source. The point is that inside the database, I want to create a new table called "request". I have already activated migrations for my database in code. I also have the following
    code in my app.
    Request.cs: (inside Models folder)
    public class Request
    public int RequestID { get; set; }
    [Required]
    [Display(Name = "Request type")]
    public string RequestType { get; set; }
    Test.cshtml:
    @model Workfly.Models.Request
    ViewBag.Title = "Test";
    <h2>@ViewBag.Title.</h2>
    <h3>@ViewBag.Message</h3>
    @using (Html.BeginForm("SaveAndShare", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
    @Html.AntiForgeryToken()
    <h4>Create a new request.</h4>
    <hr />
    @Html.ValidationSummary("", new { @class = "text-danger" })
    <div class="form-group">
    @Html.LabelFor(m => m.RequestType, new { @class = "col-md-2 control-label" })
    <div class="col-md-10">
    @Html.TextBoxFor(m => m.RequestType, new { @class = "form-control", @id = "keywords-manual" })
    </div>
    </div>
    <div class="form-group">
    <div class="col-md-offset-2 col-md-10">
    <input type="submit" class="btn btn-default" value="Submit!" />
    </div>
    </div>
    @section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    HomeController.cs:
    [HttpPost]
    public ActionResult SaveAndShare(Request request)
    if (ModelState.IsValid)
    var req = new Request { RequestType = request.RequestType };
    return RedirectToAction("Share");
    The point is that, I want the user to fill the form inside the Test view and click submit, and when the submit is clicked, I want a new entry in the new table to be created. But first of course I need to create the table. Should I create it using SQL query
    through MySQL workbench? If yes, then how can I connect the new table with my code? I guess I need some DB context but don't know how to do it. If someone can post some code example, I would be glad.
    UPDATE:
    I created a new class inside the Models folder and named it RequestContext.cs, and its contents can be found below:
    public class RequestContext : DbContext
    public DbSet<Request> Requests { get; set; }
    Then, I did "Add-Migration Request", and "Update-Database" commands, but still nothing. Please also note that I have a MySqlInitializer class, which looks something like this:
    public class MySqlInitializer : IDatabaseInitializer<ApplicationDbContext>
    public void InitializeDatabase(ApplicationDbContext context)
    if (!context.Database.Exists())
    // if database did not exist before - create it
    context.Database.Create();
    else
    // query to check if MigrationHistory table is present in the database
    var migrationHistoryTableExists = ((IObjectContextAdapter)context).ObjectContext.ExecuteStoreQuery<int>(
    string.Format(
    "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '{0}' AND table_name = '__MigrationHistory'",
    // if MigrationHistory table is not there (which is the case first time we run) - create it
    if (migrationHistoryTableExists.FirstOrDefault() == 0)
    context.Database.Delete();
    context.Database.Create();

    Hello Toni,
    Thanks for posting here.
    Please refer the below mentioned links:
    http://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-deploy-aspnet-mvc-app-membership-oauth-sql-database/
    http://social.msdn.microsoft.com/Forums/en-US/3a3584c4-f45f-4b00-b676-8d2e0f476026/tutorial-problem-deploy-a-secure-aspnet-mvc-5-app-with-membership-oauth-and-sql-database-to-a?forum=windowsazurewebsitespreview
    I hope that helps.
    Best Regards,
    Sadiqh Ahmed

  • How can I insert values from table object into a regular table

    I have a table named "ITEM", an object "T_ITEM_OBJ", a table object "ITEM_TBL" and a stored procedure as below.
    CREATE TABLE ITEM
    ITEMID VARCHAR2(10) NOT NULL,
    PRODUCTID VARCHAR2(10) NOT NULL,
    LISTPRICE NUMBER(10,2),
    UNITCOST NUMBER(10,2),
    SUPPLIER INTEGER,
    STATUS VARCHAR2(2),
    ATTR1 VARCHAR2(80),
    ATTR2 VARCHAR2(80),
    ATTR3 VARCHAR2(80),
    ATTR4 VARCHAR2(80),
    ATTR5 VARCHAR2(80)
    TYPE T_ITEM_OBJ AS OBJECT
    ITEMID VARCHAR2(10),
    PRODUCTID VARCHAR2(10),
    LISTPRICE NUMBER(10,2),
    UNITCOST NUMBER(10,2),
    SUPPLIER INTEGER,
    STATUS VARCHAR2(2),
    ATTR1 VARCHAR2(80),
    ATTR2 VARCHAR2(80),
    ATTR3 VARCHAR2(80),
    ATTR4 VARCHAR2(80),
    ATTR5 VARCHAR2(80)
    TYPE ITEM_TBL AS TABLE OF T_ITEM_OBJ;
    PROCEDURE InsertItemByObj(p_item_tbl IN ITEM_TBL, p_Count OUT PLS_INTEGER);
    When I pass values from my java code through JDBC to this store procedure, how can I insert values from the "p_item_tbl" table object into ITEM table?
    In the stored procedure, I wrote the code as below but it doesn't work at all even I can see values if I use something like p_item_tbl(1).itemid. How can I fix the problem?
    INSERT INTO ITEM
    ITEMID,
    PRODUCTID,
    LISTPRICE,
    UNITCOST,
    STATUS,
    SUPPLIER,
    ATTR1
    ) SELECT ITEMID, PRODUCTID, LISTPRICE,
    UNITCOST, STATUS, SUPPLIER, ATTR1
    FROM TABLE( CAST(p_item_tbl AS ITEM_TBL) ) it
    WHERE it.ITEMID != NULL;
    COMMIT;
    Also, how can I count the number of objects in the table object p_item_tbl? and how can I use whole-loop or for-loop to retrieve values from the table object?
    Thanks.

    Sigh. I answered this in your other How can I convert table object into table record format?.
    Please do not open multiple threads. It just confuses people and makes the trreads hard to follow. Also, please remember we are not Oracle employees, we are all volunteers here. We answer questions if we can, when we can. There is no SLA so please be patient.
    Thank you for your future co-operation.
    Cheers, APC

  • How can I convert a POP account to IMAP

    I have a POP account in the form [email protected], and I have just changed my hosting company from one that handles POP accounts only to one where accounts can be either POP or IMAP. The question is: how do I convert my existing POP account to IMAP? My main reason for wanting to do that is to keep the "Sent" folder synchronized so that Mail's sent item folder automatically gets stuff I send through web mail just like it does with my Dot Mac account.
    I tried removing the existing POP account; this causes any email associated with this account that has not been moved to an "On my Mac" folder to vanish. When I create an IMAP account, these mails don't reappear, even though the email address is the same. Recreating the POP account, though, brings these emails back to life.
    Of course, I can have both account definitions with the POP one having it's "include when automatically checking for new mail" checkbox unchecked, but that's really inelegant. Is there a way to convert the POP account into an IMAP account?
    Daniel

    Ernie Stamper wrote:
    If the Inbox for this account only is revealed, is there any triangle beside it?
    Ah, yes, I see! Silly me to be looking for Sent mail under "Sent"! Indeed, there's a disclosure triangle next to the account name under "Inbox", and wen you open it, it shows Drafts, Sent, spam, and Trash. The sent items are indeed there.
    Mind you, my Dot Mac accounts show up normally, i.e., their sent mail goes under "Sent". Wish all IMAP accounts did that. It sure isn't logical to show sent mail inside an inbox...
    But to answer your question: In addition to having the "Sent" folder for the account under "Inbox", I also have a folder for the account under "Sent". This folder disappears when I check the box to store messages on the server. There were emails in it (the ones I placed there myself). I have now moved those emails to the sent sub-folder under the account under "Inbox". Even with the "store on server" option UNchecked, the emails were instantly duplicated to the server, so that they were present both locally and remotely. I then checked the "store on server box"; this made the mailbox for the account under "Sent" vanish.
    To summarize: things appear to work normally now, except that I find it very inconvenient to have to look in two separate "Sent" folders to find emails I've written.
    Daniel

  • How can I convert iWeb page to html with NO javascript for email campaign?

    I have a holiday greeting I made in iWeb '09 for my business. The service I'm using to use to manage my mailing list wants me to strip all javascript code from the page so it is not seen as spam when it is emailed.
    How can I convert the page made in iWeb to an html page with no javascript?
    Thanks

    How can I convert the page made in iWeb to an html page with no javascript?
    You cannot. There will be nothing left. iWeb pages rely a lot on JavaScript.
    Use a template from Mail.app. Or create such template. These are simple TABLES and have no JavaScript in it.
    Do Cmd-Shift-G in the finder and type :
    /Library/Application Support/Apple/Mail/Stationery/Apple/Contents/Resources/
    Open one of the folders and open each successive folder until you see files like Picnic.mailstationery.
    Right-click to show the package content.
    Then navigate thru Contents, Resources until you see the files and images you need.
    Edit them to your hearts content.
    Double-click the file Picnic.mailstationery and it will open in Mail.app for further processing.

  • How can I convert a space from ABAP to CSV data?

    Hello guys,
    how can I convert a string like
    "This is a%test%"
    to
    "This is  a test "
    into CSV data?
    I try to with   REPLACE ALL OCCURRENCES OF '%' IN string_above WITH space,
    but I got the string without space, like
    "This is  atest"
    I read some posts that CSV will ignore space.
    But which kind of symbol in CSV represents space?
    Thanks for any suggestion!
    Regards,
    Liying

    USE THE CODE AS SHOWN BELOW...
    TYPES : BEGIN OF tp_data,
              line(4096),
            END   OF tp_data.
    *&      Form  gui_upload
          Upload the data from the input file to the internal table
    FORM gui_upload.
    *--Local data declaration
      DATA: l_filename_ip TYPE string,
            tl_data       TYPE STANDARD TABLE OF tp_data WITH HEADER LINE.
      l_filename_ip = p_input.
    *--Upload Data
      CALL FUNCTION 'GUI_UPLOAD'
           EXPORTING
                filename                = l_filename_ip
                filetype                = 'ASC'
                has_field_separator     = ''
           TABLES
                data_tab                = tl_data
           EXCEPTIONS
                file_open_error         = 1
                file_read_error         = 2
                no_batch                = 3
                gui_refuse_filetransfer = 4
                invalid_type            = 5
                no_authority            = 6
                unknown_error           = 7
                bad_data_format         = 8
                header_not_allowed      = 9
                separator_not_allowed   = 10
                header_too_long         = 11
                unknown_dp_error        = 12
                access_denied           = 13
                dp_out_of_memory        = 14
                disk_full               = 15
                dp_timeout              = 16
                OTHERS                  = 17.
      IF sy-subrc <> 0.
        MESSAGE ID   sy-msgid TYPE 'S' NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        IF sy-subrc = 1.
          MESSAGE e000 WITH text-e04.
        ENDIF.
      ELSE.
        LOOP AT tl_data FROM 2.
    *--Taking the contents of the input file leaving the header part
          PERFORM split_and_save USING tl_data-line.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " gui_upload
    *&      Form  split_and_save
          Splitting the contents from the input file and saving them into
          an internal table
         -->P_TL_DATA_LINE  text
    FORM split_and_save USING fp_data.
    *--Local data declaration
      DATA : tl_data TYPE STANDARD TABLE OF tp_data WITH HEADER LINE,
             l_type  TYPE c,
             c_space(1) TYPE c VALUE ' '.
    *--Split at the Comma
      SPLIT fp_data AT c_space INTO TABLE tl_data.
      CLEAR inputtab.
    *--Move it to the target fields
      DO.
        ASSIGN COMPONENT sy-index OF STRUCTURE inputtab TO <fs_field>.
        IF NOT sy-subrc IS INITIAL.
          EXIT.
        ENDIF.
    *--Extract source data
        CLEAR tl_data.
        READ TABLE tl_data INDEX sy-index.
    *--Populate the target
        <fs_field> = tl_data-line.
      ENDDO.
    *--Append this record
      APPEND inputtab.
    ENDFORM.                    " split_and_save
    In the above code u can use make inputtab like tp_data and get the result as requires in an internal table as space seperated fields.
    In place of space u can also use any other symbol.
    And after that u can replace all occurences of space with the comma by using the statement that u have written below.

  • How can I write into a table cell (row, column are given) in a databae?

    How can I write into a table cell (row, column are given) in a database using LabVIEW Database Toolkit? I am using Ms Access. Suppose I have three columns in a table, I write 1st row of 1st column, then 1st row of 3rd column. The problem I am having is after writing the 1st row 1st column, the reference goes to second row and if I write into 3rd column, it goes to 2nd row 3rd column. Any suggestion? 
    Solved!
    Go to Solution.

    When you do a SQL INSERT command, you create a new row. If you want to change an existing row, you have to use the UPDATE command (i.e. UPDATE tablename SET column = value WHERE some_column=some_value). The some_column could be the unique ID of each row, a date/time, etc.
    I have no idea what function to use in the toolkit to execute a SQL command since I don't use the toolkit. I also don't understand why you just don't do a single INSERT. It would be much faster.

  • How can I convert Float numbers which are represented as 'E-05' to full precision

    I have over 6,000 records which all have 'E-05' in the field.
    It should actually be full precision, such as:  0.000046793055472781
    How can I convert all of these?  There are around 600,000 records in the whole table, so I only want to convert the 'E-05' records.  For some reason these are incorrect, but all the others are totally fine.
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    If they are float values, they have the full precision you can get with a float value.
    Keep in mind that what you see in management studio is a textual representation of the value. It is not the value itself. A float value is stored as 53 bits of mantissa and an 11-bit exponent which is a power of 2.
    To view the value without the exponent, you can cast to decimal, although this will give you a slightly different value. You can also use the str function:
    DECLARE @f float
    SELECT @f = 0.000046793055472781
    SELECT str(@f, 20, 18)
    However, formatting of the value is best done in the presentation layer. You should not change the data you have in the table. But if the source is actually exact decimal values, maybe you should use a decimal data type instead.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How can I convert a report/ ALV in PDF format?

    Can you tell me how can I convert a report or ALV in PDF format?
    Regards,
    Subhasish

    hi ,
    check this..
    *& Report  ZSPOOLTOPDF                                                 *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program must be run as a background job in-order for the write *
    *& commands to create a Spool request rather than be displayed on      *
    *& screen                                                              *
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_sender LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_delspl  AS CHECKBOX.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Write statement to represent report output. Spool request is created
    if write statement is executed in background. This could also be an
    ALV grid which would be converted to PDF without any extra effort
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    Alternative way could be to submit another program and store spool
    id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
           to sap-spool
           spool parameters   %_print
           archive parameters %_print
           without spool dynpro
           and return.
    Get spool id from program called above
    IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
        PERFORM convert_spool_to_pdf.
        PERFORM process_email.
        if p_delspl EQ 'X'.
          PERFORM delete_spool.
        endif.
        IF sy-sysid = c_dev.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
        ENDIF.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      ENDIF.
          FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
          FORM get_job_details                                          *
    FORM get_job_details.
    Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
          FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
          FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    perform send_email using p_email2.
    ENDFORM.
          FORM send_email                                               *
    -->  p_email                                                       *
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
          FORM delete_spool                                             *
    FORM delete_spool.
      DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
      ld_spool_nr = gd_spool_nr.
      CHECK p_delspl <> c_no.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                spoolid = ld_spool_nr.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    regards,
    venkat.

  • How can I convert an int to a string?

    Hi
    How can I convert an int to a string?
    /ad87geao

    Here is some the code:
    public class GUI
        extends Applet {
      public GUI() { 
        lastValue = 5;
        String temp = Integer.toString(lastValue);
        System.out.println(temp);
        showText(temp);
      private void showText(final String text) {
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            tArea2.setText(text + "\n");
    }

Maybe you are looking for

  • How to find out the most used objects and rarely used objects?

    Hello all,               Can somebody please guide me on the procedure to separate frequently used transactions or reports or tables from rarely used ones on the production server? Is there any special transaction to find this out? hope to hear from

  • Interconnect 10g problem with XML which has mixed contents

    I'm having problem to receive a XML message which contains PCDATA and other child element Mixed. Here is the sample DTD. I'm able to create the CV and AV by importing this DTD. But at runtime, if the inbound XML contains PCDATA and other element mixe

  • Billing is not flowing from CRM to R/3(in Lease asset accounting)

    Dear all, We are working on Lease Asset Management. In our operations CRM is the Front End and R/3 is the back end. The billing flows from CRM to R/3 through a background job. The problem is, Some of the billing document got stuck in G error, that is

  • Problem with Database Server

    Hi, Our Erp is running on oracle 8.1.7 database on sun platform, and it is a dedicated db server. Recently we started facing problem with our Server/ database. Am not able to identily from where it starts. Whether an any problem in the db can make th

  • Sudden severe lag in World of Warcraft

    There are pages and pages of BT customers suffering the same thing.  It started a couple of hours ago and it seems to be only effecting BT customers. http://eu.battle.net/wow/en/forum/topic/2313684718?page=1 [code] Tracing route to 213-248-127-130.cu