Inserting PDF data in smartform? Possible?

Hi guys,
I'm very new to this but i hope i can explain it correctly.
Lets say right now l have some pdf stored in SAP(Service Contract for example) and we're reading them as binary image files right?
Is it possible to retrieve such binary image and display them in an existing smartform?
I hope i'm explaining the right way...this has something to do with DMS ??
Below are some codes to further help in my questions.
CALL FUNCTION 'SCMS_UPLOAD'
    EXPORTING
      filename       =  '/usr/sap/XXXX/XXXXXX/test.pdf'
      binary         = 'X'
      frontend       = ' '
*   MIMETYPE       =
    IMPORTING
      filesize       = size
    TABLES
      data           = file_data
* EXCEPTIONS
*   ERROR          = 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.
  DATA: BEGIN OF content_bin OCCURS 1,
          line TYPE SDOK_SDATX,
        END   OF content_bin.
  DATA: BEGIN OF content_txt OCCURS 1,
          line TYPE sdokcntasc,
        END   OF content_txt.
  CALL FUNCTION 'SCMS_DOC_READ'
    EXPORTING
      mandt                       = sy-mandt
      stor_cat                    = ' '
      crep_id                     = crep_id
      doc_id                      = doc_id
    TABLES
*   ACCESS_INFO                 =
      content_txt                 = content_txt
      content_bin                 = content_bin
* EXCEPTIONS
*   BAD_STORAGE_TYPE            = 1
*   BAD_REQUEST                 = 2
*   UNAUTHORIZED                = 3
*   COMP_NOT_FOUND              = 4
*   NOT_FOUND                   = 5
*   FORBIDDEN                   = 6
*   CONFLICT                    = 7
*   INTERNAL_SERVER_ERROR       = 8
*   ERROR_HTTP                  = 9
*   ERROR_SIGNATURE             = 10
*   ERROR_CONFIG                = 11
*   ERROR_FORMAT                = 12
*   ERROR_PARAMETER             = 13
*   ERROR                       = 14
*   OTHERS                      = 15
  IF sy-subrc  0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
Basically, If I understand correctly, what I have now is are converted binary data from the PDF document?
Is there a way to take these data and displaying it meaningfully(may be through some other processes like conversion again) in a smartform? Is this possible?
Edited by: Slow ABAPer on Mar 17, 2008 2:45 AM

...binary image and display them in an existing smartform..
1. What do you mean by image? It is not a picture you are storing, but a pdf file.
2. You want to display the smartform???? This does not really make sense you know.
Or do you want to upload the file from the server and display the PDF on the front end somehow?

Similar Messages

  • Printing pdf data for smartform

    Hi,
    I tried to convert an Smartform output data using program 'RSTXPDF4'.
    When I go to sp01 I see a new spool number being created saying 'xxxxxxx' converted to pdf data.
    Can someone tell me how do I print this spool number ?
    Also can someone tell me what exactly is the use of SP01 ?
    Thanks.

    Hi Tushar,
    You don't need to use 'RSTXPDF4'. In your program use 'SSF_FUNCTION_MODULE_NAME' to get the function module generated by the smartform. Then you call the generated function  importing job_output_info. This will be in otf format. Pass the OTF table to another function ie
      call function 'HR_IT_DISPLAY_WITH_PDF'
          tables
            otf_table = t_otf_table.
    This will let you display the output in PDF right in the same R/3 session. The User can then decide whether to print or save it to a location.
    Regards,
    Suresh Datti

  • Map binary data (PDF) to XML not possible due to non-printable chars

    Hi XI Gurus,
    we have the following issue.
    We send a PDF as binary data (as a hex string '25255044462D3' ) along with some other information from ERP within one RFC to XI , doing a message split 1:n for those two kind of messages (1. the PDF, 2. the XML) an send the split messages to file/ftp receiver adapter.
    The message split and sending of the messages is working well, but we encounter some problems with non-printable chars (hex code below 0x20) in the pdf binary. The PDF data and the dynamic file name is mapped into an XML. But the non printable characters are converted into '#' when mapped into the XML target field.
    (Due to the 1:n multi mapping, we cannot put the filename into dynamic configuration, so we have to map the pdf and the filename into an XML and extract the content with variable substitution in receiver file adapter....)
    My question is: how can binary data with non-printable chars be sent through XI and can be mapped into an XML without beeing replaced by '#' ?
    Any help will be greatly appreciated.
    Thanks and regards
    Holger

    Maybe I didn´t explained it clearly enough.
    We do not have the issue that the RFC puts the '#' into the string. We got from the RFC a hex string containing the pdf as visible hex values like:
    As you can see we have the pdf as hex string. During message mapping XI replaces some non-printable chars like '0x04' or '0x19' with '#'.
    My question is: how can we avoid those char replacement ?
    BTW: I grabbed a pdf with sender file adapter, routed through XI without any mapping and send it with ftp in binary mode. But the pdf contains more chars as the origional file and the pdf content is not visible when opening with a pdf reader like Acrobat. I guess the file adpter has problems with carriage return and linefeed chars. Some CR and LF are replaced inserted somehow.
    Best regards,
    Holger

  • Acrobat x pro crashes when I try to flatten a pdf after using typewriter to insert a date

    acrobat x pro crashes when I try to flatten a pdf after using typewriter to insert a date.
    Has anybody else seen this problem? Is there a fix?
    I wanted to download the demo of acrobat XI but it says the previous version will be removed and deactivate the license. That sucks!

    Yes it is up to date.
    I can use the stamp tool and flatten it after with no problems, but the typewriter tool crashes it upon attempting to flatten.

  • Document Not sent error while sending pdf attchments in smartforms

    Hi All,
    I am trying to send the smartforms output in the PDF format as an attachment via email but it seems to be not working for me.
    here is the piece if code i'm trying to use
    Convert smartform OTF Table data to PDF
      CALL FUNCTION 'CONVERT_OTF'
           EXPORTING
                format                = 'PDF'
                max_linewidth = 132
           IMPORTING
                bin_filesize          = pdf_size
           TABLES
                otf                   = w_job_info-otfdata
                lines                 = pdf_table
           EXCEPTIONS
                err_max_linewidth     = 1
                err_format            = 2
                err_conv_not_possible = 3
                OTHERS                = 4.
    ENDIF.
    IF P_PDF = 'X'.
      CALL FUNCTION 'DOWNLOAD'
       EXPORTING
         BIN_FILESIZE                  = pdf_size
         FILENAME                      = 'C:
    SSFPDF.PDF '
         FILETYPE                      = 'BIN'
        TABLES
          DATA_TAB                      = pdf_table
      EXCEPTIONS
        INVALID_FILESIZE              = 1
        INVALID_TABLE_WIDTH           = 2
        INVALID_TYPE                  = 3
        NO_BATCH                      = 4
        UNKNOWN_ERROR                 = 5
        GUI_REFUSE_FILETRANSFER       = 6
        CUSTOMER_ERROR                = 7
        OTHERS                        = 8
      IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDIF.
    IF P_EML = 'X'.
    Convert PDF from 132 to 255.
    LOOP AT pdf_table.
    Replacing space by ~
    TRANSLATE pdf_table USING ' ~'.
    CONCATENATE w_buffer pdf_table INTO w_buffer.
    ENDLOOP.
    Replacing ~ by space
    TRANSLATE w_buffer USING '~ '.
    DO.
    i_record = w_buffer.
    Appending 255 characters as a record
    APPEND i_record.
    SHIFT w_buffer LEFT BY 255 PLACES.
    IF w_buffer IS INITIAL.
    EXIT.
    ENDIF.
    ENDDO.
    Object with PDF.
    i_objbin[] = i_record[].
    Refresh: i_reclist,
    i_objtxt,
    i_objbin,
    i_objpack.
    clear w_objhead.
    Object with PDF.
    i_objbin[] = i_record[].
    DESCRIBE TABLE i_objbin LINES v_lines_bin.
    Object with main text of the mail.
    i_objtxt = 'Find attached the output of the smart form.'.
    APPEND i_objtxt.
    i_objtxt = 'Regards,'.
    APPEND i_objtxt.
    i_objtxt = 'J.Jayanthi'.
    APPEND i_objtxt.
    DESCRIBE TABLE i_objtxt LINES v_lines_txt.
    Document information.
    w_doc_chng-obj_name = 'Smartform'.
    w_doc_chng-expiry_dat = sy-datum + 10.
    w_doc_chng-obj_descr = 'Smart form output'.
    w_doc_chng-sensitivty = 'F'. "Functional object
    w_doc_chng-doc_size = v_lines_txt * 255.
    CLEAR i_objpack-transf_bin.
    i_objpack-head_start = 1.
    i_objpack-head_num = 0.
    i_objpack-body_start = 1.
    i_objpack-body_num = v_lines_txt.
    i_objpack-doc_type = 'RAW'.
    APPEND i_objpack.
    Packing as PDF.
    i_objpack-transf_bin = 'X'.
    i_objpack-head_start = 1.
    i_objpack-head_num = 1.
    i_objpack-body_start = 1.
    i_objpack-body_num = v_lines_bin.
    i_objpack-doc_type = 'PDF'.
    i_objpack-obj_name = 'Smartform'.
    CONCATENATE 'Smartform_output' '.pdf'
    INTO i_objpack-obj_descr.
    i_objpack-doc_size = v_lines_bin * 255.
    APPEND i_objpack.
    Document information.
    CLEAR i_reclist.
    e-mail receivers.
    i_reclist-receiver = '[email protected]'.
    i_reclist-express = 'X'.
    i_reclist-rec_type = 'U'.
    append i_reclist.
    Sending mail.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data = w_doc_chng
        put_in_outbox = 'X'
      TABLES
        packing_list = i_objpack
        object_header = w_objhead
        contents_hex = i_objbin
        contents_txt = i_objtxt
        receivers = i_reclist
      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.
    the return code is 2. Can u pls identify the mistake that i am doing? Pls suggest the solution to make this work.
    Thanks in advance,
    Rashmi

    Hi Jayanthi,
    I want to send email to internet address and not to SAP user. Like for example can I send the attachment to my yahoo id??
    If I change to
    i_reclist-receiver = give sap user id
    i_reclist-express = 'X'.
    i_reclist-rec_type = 'B'.
    this will surely work but it comes to my SAP Office Inbox but I need to send it to any address on the internet. Is it possible?
    Please do reply.
    Thanks in advance,
    Rashmi

  • Inserting images dynamically in smartform....

    Hello,
    I have couple of image files (pdf and jpeg) on application server. I have a scenario where I have to insert these images to smartform dynamically based on some pre-determined logic. Is it possible to insert iamge in smartform without uploading it using se78.
    Please help.
    Regards,
    Rajesh.

    You need to upload it using SE78 for the display.
    P.S. - You have 248 opened threads. If you can close them accordingly it will be helpful for community people to maintain.

  • Inserting pdf content to database

    Hi,
         I am working with adobe live cycle and using web service i am inserting pdf content to db , Live cycle is installed in my machine so the data insertion is possible from my machine ,but i am trying to insert data from other  systems in our network it is not working , adobe reader 9 nstalled on these machines .Is necessary to register any other dll to GAC for working with this on client machine if so pls specify the dll. I am waiting for ur reply ,pls reply as soon as possible

    Hi,
    I suspect that you also have the full version of Adobe Acrobat on your PC.That is why the data connections work on your system.
    Unless you Reader Enable your form with LiveCycle Reader Extensions Enterprise Suite, then web service calls / data connections will not work in Reader.So if your users have Reader the data connections will not work on their PCs.
    Here is a summary of functionality in Acrobat and Reader.
    Good luck,
    Niall

  • How i can display i_tab data in smartform as required

    hi all
          i have tried a lot but not able to make logic for displaying data frm i_tab to SF as required ,
         my requirement is , i have data in i_tab as given below
    field 1, 2,3,4,  are TRNTYP   CHAPID   MATNR  MAKTX  OF J_1IEXCDTL respectivly.
    GRPO     8707.00   0025F     AC92 CON ROD FORGING.
    ARE1               1315F     CONNECTING ROD      
                       1315F     CONNECTING ROD      
                       1315F     CONNECTING ROD      
    DLFC               1315F     CONNECTING ROD      
                       1315F     CONNECTING ROD      
                       1315F     CONNECTING ROD      
                       1315F     CONNECTING ROD      
                       1315F     CONNECTING ROD      
                       1315F     CONNECTING ROD      
                       1315F     CONNECTING ROD      
           now i want to display this data on SF like as :
      <b>discription of 8700.00
      export against = ARE1
                  1315F              CONNECTING ROD      
                  1315F              CONNECTING ROD      
                  1315F              CONNECTING ROD      </b>
        Way to Display :-
               1.      Chapter id in one single line
               2.      then if TRNTYP is ARE1 or ARE3 it should display in second single
                        line. <b><not any other TRNTYP></b>
               3.      then field no. 3 & 4 of i_tab should come based on TRNTYP
       please guide me and help me , if possible help me with dummy code example
      or if not then help me to make logic by give hint,
                      <b>i have all related data in one single i_tab</b>
    Message was edited by: SACHIN
            sachin sharma

    Hi
    see this and do accordingly
    How to create a New smartfrom, it is having step by step procedure
    http://sap.niraj.tripod.com/id67.html
    step by step good ex link is....
    http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
    Here is the procedure
    1. Create a new smartforms
    Transaction code SMARTFORMS
    Create new smartforms call ZSMART
    2. Define looping process for internal table
    Pages and windows
    First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)
    Here, you can specify your title and page numbering
    &SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)
    Main windows -> TABLE -> DATA
    In the Loop section, tick Internal table and fill in
    ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2
    3. Define table in smartforms
    Global settings :
    Form interface
    Variable name Type assignment Reference type
    ITAB1 TYPE Table Structure
    Global definitions
    Variable name Type assignment Reference type
    ITAB2 TYPE Table Structure
    4. To display the data in the form
    Make used of the Table Painter and declare the Line Type in Tabstrips Table
    e.g. HD_GEN for printing header details,
    IT_GEN for printing data details.
    You have to specify the Line Type in your Text elements in the Tabstrips Output options.
    Tick the New Line and specify the Line Type for outputting the data.
    Declare your output fields in Text elements
    Tabstrips - Output Options
    For different fonts use this Style : IDWTCERTSTYLE
    For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&
    5. Calling SMARTFORMS from your ABAP program
    REPORT ZSMARTFORM.
    Calling SMARTFORMS from your ABAP program.
    Collecting all the table data in your program, and pass once to SMARTFORMS
    SMARTFORMS
    Declare your table type in :-
    Global Settings -> Form Interface
    Global Definintions -> Global Data
    Main Window -> Table -> DATA
    Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
    http://sapr3.tripod.com
    TABLES: MKPF.
    DATA: FM_NAME TYPE RS38L_FNAM.
    DATA: BEGIN OF INT_MKPF OCCURS 0.
    INCLUDE STRUCTURE MKPF.
    DATA: END OF INT_MKPF.
    SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
    SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
    MOVE-CORRESPONDING MKPF TO INT_MKPF.
    APPEND INT_MKPF.
    ENDSELECT.
    At the end of your program.
    Passing data to SMARTFORMS
    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = 'ZSMARTFORM'
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    FM_NAME = FM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    if sy-subrc <> 0.
    WRITE: / 'ERROR 1'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    call function FM_NAME
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    CONTROL_PARAMETERS =
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    TABLES
    GS_MKPF = INT_MKPF
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5.
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Smartform
    you can check this link here you can see the steps and you can do it the same by looking at it..
    http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
    SMARTFORMS STEPS.
    1. In Tcode se11 Create a structure(struct) same like the Internal table that you are going to use in your report.
    2. Create Table type(t_struct) of stracture in se11.
    3. In your program declare Internal table(Itab) type table of structure(struct).
    4. Define work area(wa) like line of internal table.
    5. Open Tcode Smartforms
    6. In form Global setting , forminterface Import parameter define Internal table(Itab) like table type of stracture(t_struct).
    7. In form Global setting , Global definitions , in Global data define Work area(wa) like type stracture(struct).
    8. In form pages and window, create Page node by default Page1 is available.
    9. In page node you can create numbers of secondary window. But in form there is only one Main window.
    10. By right click on page you can create windows or Go to Edit, Node, Create.
    11. After creating the window right click on window create table for displaying the data that you are passing through internal table.
    12. In the table Data parameter, loop internal internal table (Itab) into work area(wa).
    13. In table there are three areas Header, Main Area, Footer.
    14. Right click on the Main area create table line by default line type1 is there select it.
    15. Divide line into cells according to your need then for each cell create Text node.
    16. In text node general attribute. Write down fields of your work area(wa) or write any thing you want to display.
    17. Save form and activate it.
    18. Then go to Environment, function module name, there you get the name of function module copy it.
    19. In your program call the function module that you have copied from your form.
    20. In your program in exporting parameter of function pass the internal table(itab).
    SAP Smart Forms is introduced in SAP Basis Release 4.6C as the tool for creating and maintaining forms.
    SAP Smart Forms allow you to execute simple modifications to the form and in the form logic by using simple graphical tools; in 90% of all cases, this won't include any programming effort. Thus, a power user without any programming knowledge can
    configure forms with data from an SAP System for the relevant business processes.
    To print a form, you need a program for data retrieval and a Smart Form that contains the entire from logic. As data retrieval and form logic are separated, you must only adapt the Smart Form if changes to the form logic are necessary. The application program passes the data via a function module interface to the Smart Form. When activating the Smart Form, the system automatically generates a function module. At runtime, the system processes this function module.
    You can insert static and dynamic tables. This includes line feeds in individual table cells, triggering events for table headings and subtotals, and sorting data before output.
    You can check individual nodes as well as the entire form and find any existing errors in the tree structure. The data flow analysis checks whether all fields (variables) have a defined value at the moment they are displayed.
    SAP Smart Forms allow you to include graphics, which you can display either as part of the form or as background graphics. You use background graphics to copy the layout of an existing (scanned) form or to lend forms a company-specific look. During printout, you can suppress the background graphic, if desired.
    SAP Smart Forms also support postage optimizing.
    Also read SAP Note No. 168368 - Smart Forms: New form tool in Release 4.6C
    What Transaction to start SAP Smart Forms?
    Execute transaction SMARTFORMS to start SAP Smart Forms.
    Key Benefits of SAP Smart Forms:
    SAP Smart Forms allows you to reduce considerably the implementation costs of mySAP.com solutions since forms can be adjusted in minimum time.
    You design a form using the graphical Form Painter and the graphical Table Painter. The form logic is represented by a hierarchy structure (tree structure) that consists of individual nodes, such as nodes for global settings, nodes for texts, nodes for output tables, or nodes for graphics.
    To make changes, use Drag & Drop, Copy & Paste, and select different attributes.
    These actions do not include writing of coding lines or using a Script language.
    Using your form description maintained in the Form Builder, Smart Forms generates a function module that encapsulates layout, content and form logic. So you do not need a group of function modules to print a form, but only one.
    For Web publishing, the system provides a generated XML output of the processed form.
    Smart Forms provides a data stream called XML for Smart Forms (XSF) to allow the use of 3rd party printing tools. XSF passes form content from R/3 to an external product without passing any layout information about the Smart Form.
    Reward if useful
    Anji

  • How can i print data in smartforms from ABAP program.

    Dear gurus:
    in my abap program i process require data, and saved in a internal table.
    how can l print the data in smartforms.?
    who can give me a code sample is better:)
    reward all helpful advise.

    Try this....
    1) Tcode --> SmartForms
    2) Form name --> Z_SF_TEST Create
    3) Under Global settings
    a) Form Interface  
        Table Tab
       ITAB LIKE EKPO
    b) GLOBAL Definitions
    WA_NETPR LIKE EKPO-NETPR
    In smart forms if we want to display quantity and currency fields. We can't directly display currency field and quantity fields
    For that we have to create an extra variable in global definitions
    Ex: netpr FIELD of EKPO
    CREATE program lines and specify WA_NETWR = itab-netpr.
    4) RT CLick on main Window
       CREATE --> TABLE
      Click Table painter
    DEFAULT %LTYPE will be Created
    a) If you want more like Header footer etc add by rt click on %LTYPE1
    Table (Tab)
    %LTYPE  Radio(SELECT) 5 CM 5 CM 6 CM
    CLICK on DATA (Tab)
    INTERNAL TABLE ITAB LIKE ITAB
    5)RT click on table control and create --> program lines
    General attribute (Tab)
    INPUT PARAMETER               OUTPUT PARAMETER
    itab                               WA_NETPR
    Code Area
    WA_NETWR = ITAB-NETPR.
    6) RT CLcick on table ctl and create 3 text to display the fields
    a) % text1 +button(insert field)
       FIELD name &itab-ebeln&
    Output options (tab)
    Check New line   LINETYPE   %Ltype1
    check new cell
    b) % text2
       & itab-ebelp&
    output options
    check new cell
    c) % text2
       & wa_netpr&
    output options
    check new cell
    <b>Report ac
    Tables ekpo.
    Data: itab1 like ekpo occurs 0 with header line.
    select * into table itab1 from ekpo.
    Call function module --> smart form function module and pass your internal table</b>
    Regards,
    SaiRam

  • Please help! Looking for script to insert current date on page.

    I currently use a Dreamweaver Extension that lets you insert
    current date and time on your web page.
    The problem is, I don't know Javascript and cannot edit the
    Javascript codes to "remove the time"
    I only need the current date that will change every day.
    Do you know where I can get this script, I goggled and got
    several but I'm looking for something authentic.
    Also is it possible to have your page validate when you use
    Javascript embedded in your HTML?
    Thanks everyone,
    Patrick

    quote:
    Originally posted by:
    Newsgroup User
    Webethics wrote:
    > The problem is, I don't know Javascript and cannot edit
    the Javascript codes
    > to "remove the time"
    > I only need the current date that will change every day.
    JavaScript generates the date by using the clock on the
    computer of each
    visitor to your site. If a visitor's clock has the wrong
    date, your site
    will also display the wrong date.
    > Do you know where I can get this script, I goggled and
    got several but I'm
    > looking for something authentic.
    I don't know what you mean by "authentic". Date generation in
    JavaScript
    is one of the most basic features of the language, so if it
    works, it's
    "authentic".
    > Also is it possible to have your page validate when you
    use Javascript
    > embedded in your HTML?
    Yes, but you shouldn't embed JavaScript in XHTML.
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/
    So mr. Powers are there people that use Javascript Date in
    their page?
    Would you recommend it?
    I could use PHP but I don't know PHP,
    How do I come up with the string in this format, say,
    Wednesday, October 29th, 2008 that will change to a new day
    according to the server time and date.
    Thanks so much for your help and I have two of your books! I
    will be taking PHP classes in December.
    Patrick

  • Insert the data automatically in a table

    Hi,
    i want to insert the data in a table automatically if the time is 12:00AM
    Is it possible?

    hi,
    i have the table "tab_eg" like
    id name code
    1 Rai 1
    2 Hewlett 3
    id is primary key.
    code is auto generated.
    (ie) if anybody is getting the code from tab_eg table,
    the code is automatically incremented by 1 using update query.
    It is working fine.
    Then
    i am creating the DBMS_SCHEDULER like this:
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'UPDATE_TAB_CODE',
    job_type => 'PLSQL_BLOCK',
    job_action => 'begin execute '' update scott.tab_eg SET code = 1 '' ; commit; end;',
    start_date=> '01/APR/2007 12:00:00 AM',
    repeat_interval => 'FREQ=YEARLY',
    enabled => TRUE);
    END ;
    it is also created successfully in SYS.
    My doubt is
    when i have changed the server time as '01/APR/2008 12:00:00 AM',
    the code is not reset to 1.
    i want to reset the code as 1.
    what do i have to change in this DBMS_SCHEDULER.
    Thanx in Advance

  • Converting Smartforms to PDF and displaying Smartforms on print preview

    Hi,
    How to convert smartforms to pdf?
    How to attach this pdf to email?
    How to attach this pdf to the email and at the same time can print preview the smartforms?
    Thanks.

    Hi Navi,
    Code Snippet for Simple Mail
    *& Report  ZZ_TEST                                                     *
    REPORT  zz_test                                 .
    INCLUDE zz_test_top.
    INCLUDE zz_test01.
          FORM entry                                                    *
    -->  RETURN_CODE                                                   *
    -->  US_SCREEN                                                     *
    FORM entry USING return_code us_screen.
      CLEAR retcode.
      xscreen = us_screen.
      PERFORM processing USING us_screen.
      CASE retcode.
        WHEN 0.
          return_code = 0.
        WHEN 3.
          return_code = 3.
        WHEN OTHERS.
          return_code = 1.
      ENDCASE.
    ENDFORM.                    "entry
    *&  Include           ZZ_TEST_TOP                                      *
      TABLES : nast,
               tnapr.
    TYPES : BEGIN OF t_SOUDNAMEI1.
            INCLUDE STRUCTURE SOUDNAMEI1.
    TYPES : END OF t_SOUDNAMEI1.
    Internal Table declarations
      DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
      i_tline TYPE TABLE OF tline WITH HEADER LINE,
      i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
      i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    *Objects to send mail.
      i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
      i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
      i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
      i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
      i_lips LIKE lips OCCURS 0 WITH HEADER LINE,
      i_SOUDNAMEI1 TYPE STANDARD TABLE OF t_SOUDNAMEI1.
    Work Area declarations
      DATA:w_objhead TYPE soli_tab,
      wa_control_parameters TYPE ssfctrlop,
      wa_output_options TYPE ssfcompop,
      w_return TYPE ssfcrescl,
      w_doc_chng TYPE sodocchgi1,
      w_data TYPE sodocchgi1,
      w_buffer TYPE string,"To convert from 132 to 255
      wa_SOUDNAMEI1 TYPE t_SOUDNAMEI1,
    Variables declarations
      w_form_name TYPE rs38l_fnam,
      w_len_in LIKE sood-objlen,
      w_len_out LIKE sood-objlen,
      w_len_outn TYPE i,
      w_lines_txt TYPE i,
      w_lines_bin TYPE i,
      retcode      TYPE sy-subrc,
      xscreen      TYPE c,
      w_spld TYPE usr01-spld,
      w_receiver TYPE SOXNA-FULLNAME,
      w_OBJ_RECORD TYPE OBJ_RECORD,
      w_user type sy-uname,
      w_email TYPE ad_smtpadr.
    Constants Declaration
      CONSTANTS : c_x TYPE c VALUE 'X',
                  c_atrate(1) TYPE c VALUE '@'.
    *&  Include           ZZ_TEST01                                        *
          FORM PROCESSING                                               *
    FORM processing USING proc_screen.
      SELECT * FROM lips
        INTO TABLE i_lips
        WHERE vbeln = nast-objky.
    Call Function module to Getfunction Module name Generated by Smartform
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = tnapr-sform
        IMPORTING
          fm_name            = w_form_name
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      IF sy-subrc <> 0.
        retcode = sy-subrc.
      ENDIF.
      CLEAR : wa_control_parameters,
              wa_output_options.
      CASE nast-nacha.
        WHEN '1'.
          wa_control_parameters-device    = 'PRINTER'.
        WHEN '7'.
          DATA: l_email TYPE ad_smtpadr.
          wa_output_options-tdnoprev = c_x.
          wa_control_parameters-getotf  = c_x.
    To get the default output device maintained in the
    User profile
         SELECT SINGLE spld FROM usr01
          INTO w_spld
          WHERE bname EQ nast-usnam.
          IF sy-subrc EQ 0.
            MOVE w_spld TO  wa_output_options-tddest   .
          ENDIF.
          wa_output_options-tdnoprev = c_x.
          wa_control_parameters-getotf  = c_x.
    To get the email address maintained for the particular output
          CALL FUNCTION 'NAST_GET_MESSAGE_OBJECT_RECV'
            EXPORTING
              pi_objkey             = nast-tdname
            IMPORTING
              pe_addr               = w_receiver
            CHANGING
              pc_objhandle          = w_obj_record
            EXCEPTIONS
              maildata_not_readable = 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.
          IF w_receiver NA c_atrate.
    To retrieve the E-Mail Id in case we get the User name from NAST
            CLEAR wa_soudnamei1.
            REFRESH i_soudnamei1.
            MOVE w_receiver TO wa_soudnamei1-fullname.
    To get the user name
            CALL FUNCTION 'SO_NAME_CONVERT_API1'
              EXPORTING
                name            = wa_soudnamei1
              TABLES
                names           = i_soudnamei1
              EXCEPTIONS
                user_not_exist  = 1
                parameter_error = 2
                x_error         = 3
                OTHERS          = 4.
            IF sy-subrc <> 0.
              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            ENDIF.
            CLEAR wa_soudnamei1.
            READ TABLE i_soudnamei1 INTO wa_soudnamei1 INDEX 1.
            MOVE wa_soudnamei1-sapname TO w_user.
    To get the e-mail Id maintained in the user profile
            CALL FUNCTION 'FTR_CORR_CHECK_EMAIL_SAP_USER'
              EXPORTING
                i_user              = w_user
              IMPORTING
                e_email_address     = l_email
              EXCEPTIONS
                mail_address        = 1
                determination_error = 2
                OTHERS              = 3.
            IF sy-subrc <> 0.
              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            ENDIF.
            MOVE l_email TO w_receiver.
          ENDIF.
          MOVE  w_receiver TO w_email.
      ENDCASE.
      wa_control_parameters-no_dialog = c_x.
      wa_control_parameters-langu     = nast-spras .
      wa_output_options-tdteleland    = nast-tland.
      wa_output_options-tdtelenum     = nast-telfx .
      wa_output_options-tdsenddate    = nast-erdat .
      wa_output_options-tdsendtime    = nast-eruhr .
      wa_output_options-tddataset     = nast-dsnam .
      wa_output_options-tdsuffix1     = nast-dsuf1 .
      wa_output_options-tdsuffix2     = nast-dsuf2 .
      wa_output_options-tdimmed       = nast-dimme .
      wa_output_options-tddelete      = nast-delet .
      wa_output_options-tdautority    = nast-tdautority.
      wa_output_options-tdcovtitle    = nast-tdcovtitle .
      wa_output_options-tdcover       = nast-tdocover .
      wa_output_options-tdreceiver    = nast-tdreceiver.
      wa_output_options-tddivision    = nast-tddivision.
      wa_output_options-tdcopies      = nast-anzal .
      wa_output_options-tdnewid       = c_x.
      wa_output_options-tdarmod       = nast-tdarmod.
      wa_output_options-tdnoarmch     = c_x.
      CALL FUNCTION w_form_name
        EXPORTING
         archive_index      = toa_dara
         archive_parameters = arc_params
          control_parameters = wa_control_parameters
          output_options     = wa_output_options
          user_settings      = ' '
        IMPORTING
          job_output_info    = w_return
        TABLES
          it_lips            = i_lips
        EXCEPTIONS
          formatting_error   = 1
          internal_error     = 2
          send_error         = 3
          user_canceled      = 4
          OTHERS             = 5.
      IF nast-nacha EQ 7 AND sy-subrc EQ 0.
        i_otf[] = w_return-otfdata[].
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format                = 'PDF'
            max_linewidth         = 132
          IMPORTING
            bin_filesize          = w_len_in
          TABLES
            otf                   = i_otf
            lines                 = i_tline
          EXCEPTIONS
            err_max_linewidth     = 1
            err_format            = 2
            err_conv_not_possible = 3
            OTHERS                = 4.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Convert PDF from 132 to 255.
        LOOP AT i_tline.
    Replacing space by ~
          TRANSLATE i_tline USING ' ~'.
          CONCATENATE w_buffer i_tline INTO w_buffer.
        ENDLOOP.
    Replacing ~ by space
        TRANSLATE w_buffer USING '~ '.
        DO.
          i_record = w_buffer.
    Appending 255 characters as a record
          APPEND i_record.
          SHIFT w_buffer LEFT BY 255 PLACES.
          IF w_buffer IS INITIAL.
            EXIT.
          ENDIF.
        ENDDO.
        REFRESH: i_reclist,
        i_objtxt,
        i_objbin,
        i_objpack.
        CLEAR w_objhead.
    Object with PDF.
        i_objbin[] = i_record[].
        DESCRIBE TABLE i_objbin LINES w_lines_bin.
    Document information.
        w_doc_chng-obj_name = 'Smartform'.
        w_doc_chng-expiry_dat = sy-datum + 10.
        CONCATENATE 'Delivery' 'Note'
        INTO w_doc_chng-obj_descr.
    *w_doc_chng-obj_descr = 'Smart form output'.
        w_doc_chng-sensitivty = 'F'. "Functional object
        w_doc_chng-doc_size = w_lines_txt * 255.
    Pack to main body as RAW.
    Obj. to be transported not in binary form
        CLEAR i_objpack-transf_bin.
    Start line of object header in transport packet
        i_objpack-head_start = 1.
    Number of lines of an object header in object packet
        i_objpack-head_num = 0.
    Start line of object contents in an object packet
        i_objpack-body_start = 1.
    Number of lines of the object contents in an object packet
        i_objpack-body_num = w_lines_txt.
    Code for document class
        i_objpack-doc_type = 'RAW'.
        APPEND i_objpack.
    Packing as PDF.
        i_objpack-transf_bin = 'X'.
        i_objpack-head_start = 1.
        i_objpack-head_num = 1.
        i_objpack-body_start = 1.
        i_objpack-body_num = w_lines_bin.
        i_objpack-doc_type = 'PDF'.
        i_objpack-obj_name = 'Smartform'.
        CONCATENATE 'Delivery' 'Note' '.pdf'
        INTO i_objpack-obj_descr.
        i_objpack-doc_size = w_lines_bin * 255.
        APPEND i_objpack.
    Document information.
        CLEAR i_reclist.
    e-mail receivers.
        i_reclist-receiver = w_email.
        i_reclist-express = 'X'.
        i_reclist-rec_type = 'U'. "Internet address
        APPEND i_reclist.
    sending mail.
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data              = w_doc_chng
            put_in_outbox              = 'X'
          TABLES
            packing_list               = i_objpack
            object_header              = w_objhead
            contents_bin               = i_objbin
       contents_txt               = i_objtxt
            receivers                  = i_reclist
          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.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.
    ENDFORM.                    "processing
    OTF to PDF
    ========================================================================
    Program1
    *& REPORT  zpmm_print1
    REPORT  zpmm_print1.
    DATA : gw_ssfcrescl TYPE ssfcrescl.
    DATA: gt_otf TYPE STANDARD TABLE OF itcoo ,
          gt_tline TYPE STANDARD TABLE OF tline,
          gv_len LIKE sood-objlen,
          gw_ssfctrlop TYPE ssfctrlop, "for CONTROL_PARAMETERS
          gw_ssfcompop TYPE ssfcompop. "for OUTPUT_OPTIONS
    DATA  fm_name TYPE rs38l_fnam.
    gw_ssfctrlop-getotf = 'X'.
    gw_ssfctrlop-no_dialog = 'X'.
    gw_ssfcompop-tdnoprev = 'X'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        formname           = 'ZPMM_1'
      IMPORTING
        fm_name            = fm_name
      EXCEPTIONS
        no_form            = 1
        no_function_module = 2
        OTHERS             = 3.
    IF sy-subrc <> 0.
    <error handling>
    ENDIF.
    CALL FUNCTION fm_name
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       control_parameters         = gw_ssfctrlop
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       output_options             = gw_ssfcompop
       user_settings              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       job_output_info            = gw_ssfcrescl
      JOB_OUTPUT_OPTIONS         =
    EXCEPTIONS
      FORMATTING_ERROR           = 1
      INTERNAL_ERROR             = 2
      SEND_ERROR                 = 3
      USER_CANCELED              = 4
      OTHERS                     = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    gt_otf[] = gw_ssfcrescl-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
        format                = 'PDF'
        max_linewidth         = 132
      IMPORTING
        bin_filesize          = gv_len
      TABLES
        otf                   = gt_otf
        lines                 = gt_tline
      EXCEPTIONS
        err_max_linewidth     = 1
        err_format            = 2
        err_conv_not_possible = 3
        OTHERS                = 4.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    DATA : gv_filename LIKE rlgrap-filename VALUE 'C:\swet.pdf'.
    CALL FUNCTION 'DOWNLOAD'
      EXPORTING
        bin_filesize     = gv_len
        filename         = gv_filename
        filetype         = 'BIN'
        filetype_no_show = 'X'
      IMPORTING
        act_filename     = gv_filename
        filesize         = gv_len
       cancel           = ''
      TABLES
        data_tab         = gt_tline.
    Program 2
    *& REPORT  zpmm_print2
    REPORT  zpmm_print2.
    DATA : gw_ssfcrescl TYPE ssfcrescl.
    DATA: gt_otf TYPE STANDARD TABLE OF itcoo ,
          gt_tline TYPE STANDARD TABLE OF tline,
          gv_len LIKE sood-objlen,
          gw_ssfctrlop TYPE ssfctrlop, "for CONTROL_PARAMETERS
          gw_ssfcompop TYPE ssfcompop. "for OUTPUT_OPTIONS
    DATA  fm_name TYPE rs38l_fnam.
    gw_ssfctrlop-getotf = 'X'.
    gw_ssfctrlop-no_dialog = 'X'.
    gw_ssfcompop-tdnoprev = 'X'.
    CALL FUNCTION '/1BCDWB/SF00000041'
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       control_parameters         = gw_ssfctrlop
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       output_options             = gw_ssfcompop
       user_settings              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       job_output_info            = gw_ssfcrescl
      JOB_OUTPUT_OPTIONS         =
    EXCEPTIONS
      FORMATTING_ERROR           = 1
      INTERNAL_ERROR             = 2
      SEND_ERROR                 = 3
      USER_CANCELED              = 4
      OTHERS                     = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    gt_otf[] = gw_ssfcrescl-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
        format                = 'PDF'
        max_linewidth         = 132
      IMPORTING
        bin_filesize          = gv_len
      TABLES
        otf                   = gt_otf
        lines                 = gt_tline
      EXCEPTIONS
        err_max_linewidth     = 1
        err_format            = 2
        err_conv_not_possible = 3
        OTHERS                = 4.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    DATA : gv_filename LIKE rlgrap-filename VALUE 'C:\swet.pdf'.
    CALL FUNCTION 'DOWNLOAD'
      EXPORTING
        bin_filesize     = gv_len
        filename         = gv_filename
        filetype         = 'BIN'
        filetype_no_show = 'X'
      IMPORTING
        act_filename     = gv_filename
        filesize         = gv_len
       cancel           = ''
      TABLES
        data_tab         = gt_tline.
    =========================================================================
    Cheers
    Mohinder Singh Chauhan

  • Submit PDF data to servlet

    Hiii
    I am new to LiveCycle Desiger suite. I have created a form using live cycle .When user fill the form , i want this info to pass servlet
    End users are using Adobe reader 8 and above. Can it possible??
    How to submit this pdf data to servlet??
    Plz guide
    Thanks

    hiii
    Bamboomania and paul
    Thanks friends,
    I have also added some javascript in PDF.
    I pass some parameters throgh url to PDF and then display this parameters in PDF fields .
    Javascript is as follows :
    var
    sURL = event.target.URL;
    var
    nRequestStart = sURL.indexOf("?");
    if
    (nRequestStart > 0) {
    var sRequest = sURL.substr(nRequestStart + 1);this.rawValue
    = sRequest; 
    var aRequests = new Array();aRequests
    = sRequest.split("?"); this.rawValue
    =decodeURI(decodeURIComponent(aRequests[0].substr(7)));}
    This code work well in adobe reader and acrobat also (some user use acobat).
    but now when I user this  HTTP button , form works well in abode reader
    but show soem alert message in acrobat 7.0 pro such as
    Invalide enumerated value:urlencoded
    The fault occurred on line 626
    After this message pdf get open , but submit only null values to servlet.
    Is that required any onther settings on abode acrobat ??
    Thanks

  • To display execise number and date in smartform

    Hi Abappers,
    i want to display execise number and date in smartform and by using driver program also.
    i have taken fields from vbrk,vbrp and send to final internal table,but now i want to display execise number in my Smartform also.
    Thanking u,
    sri.

    Create a window inside window create text element inside that insert field your excise number and date field names.
    Go to form interface -> import parameters declare your internal table name type vbrp/vbrk.
    In your print program smart form function module pass this table.

  • Using DECODE() to insert to DATE field

    I'm trying to use the DECODE function to test for NULL before inserting to a DATE field. However, it seems to only insert the DATE, with a "default" time of 12:00 - it isn't properly inserting the time.
    Basically I need to test if Date1 is NULL. If it isn't I need to concatenate the DATE from Date1 with the TIME from Date2 to get a full date/time... then insert this new value.
    Generic Example:
    CREATE TABLE DATETEST (TestID NUMBER(1), TestDate DATE);
    DECLARE
    v_Date1 DATE;
    v_Date2 DATE;
    BEGIN
    v_Date1 := TO_DATE('01-JAN-11 05:53:12', 'DD-MON-YY HH:MI:SS');
    v_Date2 := TO_DATE('08-FEB-11 02:18:31', 'DD-MON-YY HH:MI:SS');
    INSERT INTO DATETEST (TestID, TestDate) VALUES ('1', DECODE(v_Date1, NULL, NULL, TO_DATE(To_Char(v_Date1, 'DD-MON-YY') || ' ' || TO_CHAR(v_Date2, 'HH:MI:SS'),'DD-MON-YY HH:MI:SS')));
    INSERT INTO DATETEST (TestID, TestDate) VALUES ('2', TO_DATE(To_Char(v_Date1, 'DD-MON-YY') || ' ' || TO_CHAR(v_Date2, 'HH:MI:SS'),'DD-MON-YY HH:MI:SS'));
    END;
    SELECT TestID, TO_CHAR(TestDate, 'DD-MON-YY HH:MI:SS') from DATETEST;
    This example performs two inserts. One with the DECODE function, and one without. The one without inserts the time properly. Can anyone tell me why the one with the DECODE function doesn't? I realize I can use a simple if/then to check if the date is null above and put the date/time in a variable, but since my real scenario is in a large chunk of other stuff, I'm trying to keep it as streamlined as possible.
    Edited by: BoredBillJ on Jul 14, 2011 6:39 AM

    The problem you are having is due to the nature of how DECODE and CASE determine what datatype to return, and you nls_date_format settings. Both use the data type of the first returnable argument to determine all of them. So, in your decode statement, the first returnable value is NULL which, in the absence of a cast (either implicit or explicit), is a varchar2 column. So, if the date is not null, the implicit conversion to a varchar to match the retunr type, then back to date to insert into the table is losing the time. you need something more like:
       INSERT INTO test_date (Test_ID, TestDate)
       VALUES ('1', DECODE(v_Date1, NULL, TO_DATE(NULL),
                                          TO_DATE(To_Char(v_Date1, 'DD-MON-YY') || ' ' ||
                                          TO_CHAR(v_Date2, 'HH:MI:SS'),'DD-MON-YY HH:MI:SS')));Even if you use Solomon's method of generating the date, if you need the decode/case, then you will have to either use the TO_DATE(NULL) or use case instead of decode and reverse the test so the first returnable is a date like:
    SQL> DECLARE
      2     v_Date1 DATE;
      3     v_Date2 DATE;
      4  BEGIN
      5     v_Date1 := TO_DATE('01-JAN-11 05:53:12', 'DD-MON-YY HH:MI:SS');
      6     v_Date2 := TO_DATE('08-FEB-11 02:18:31', 'DD-MON-YY HH:MI:SS');
      7     INSERT INTO test_date (Test_ID, TestDate)
      8     VALUES ('1', CASE WHEN v_date1 IS NOT NULL
      9                       THEN TO_DATE(To_Char(v_Date1, 'DD-MON-YY') || ' ' ||
    10                                    TO_CHAR(v_Date2, 'HH:MI:SS'),'DD-MON-YY HH:MI:SS')
    11                       ELSE NULL END);
    12     INSERT INTO test_date (Test_ID, TestDate)
    13     VALUES ('2', TO_DATE(To_Char(v_Date1, 'DD-MON-YY') || ' ' ||
    14                  TO_CHAR(v_Date2, 'HH:MI:SS'),'DD-MON-YY HH:MI:SS'));
    15  END;
    16  /
    PL/SQL procedure successfully completed.
    SQL> select test_id, to_char(testdate, 'dd-mon-yyyy hh24:mi:ss')
      2  from test_date;
       TEST_ID TO_CHAR(TESTDATE,'DD
             1 01-jan-2011 02:18:31
             2 01-jan-2011 02:18:31John

Maybe you are looking for

  • Downloading Fixed length File,  Delimited with '|'

    Hi, I have a requirement to download data from SAP into local PC and the file needs to be Fixed Length, delimited with separator '|'. My data in the output file should look like ==> P317|122887************|ARP1|0000000004.000|EA |. But i am getting t

  • Settlement job is held up on JEST table

    Hi , A settlement job is held up in JEST table and is shown in SM66.There are many hits of this JEST table which is in sequential read status .The job which is related to this table is running inconsistently since 3 days ie the duration for completio

  • BAPI or FM to create OrgUnits and positions in Organizational Management

    Hi all, is there a way to create a OrgUnit or a Position in the Organizational Management  without using the user interface (ppome)? Does an BAPI or function module exists to create a position or OrgUnit in the background? Or how can I realize this?

  • Error message when setting up POP3 email account

    I have my phone setup with my Gmail account and my work accout. Both were working fine, but after a few weeks I could no longer send email from my work account. I would get the "Connection to the outgoing SMTP server failed" error message. I tried to

  • QuickTime Player won't launch

    I can't get QuickTime to work whatsoever. Nothing happens when I click on it. What am I doing wrong?