Why need message type when u create data type...

why need message type when u create data type...

Hi,
A message type comprises a data type that describes the structure of a message. At the following points in SAP Exchange Infrastructure you can refer to the message to be exchanged at runtime by using the message type:
·        More than one message interface can use the same message type. For example, an asynchronous outbound message interface and an asynchronous inbound message interface can reference the same message type because the request message does not need to be mapped.
·        When defining a message mapping you can directly reference message types to map messages from an outbound interface to messages from a receiver interface.
For technical reasons, a data type is not sufficient to describe the instance of a message. In XML schema, data types are defined as abstract types that are not yet fixed to an element. You can only describe an instance of a message when you have specified a data type as an element type. Therefore, a message type defines the root element of a message.
A message type does not define the direction of the message exchange, in other words, whether it is a request or a response. In exceptional cases you can use the same message type for both the request and the response message.
A message type has the following characteristics:
·        It comprises exactly one data type, which determines the content of the message to be transferred.
·        It is identified by a name and an XML namespace. The name (together with the namespace) of a message type is located in the uppermost tag of the message to be exchanged. This is an element tag.
You have defined a message type GreetingRes that references a simple data type of type xsd:string. The XML namespace of the message type is http://sap.com/xi/myExample. The corresponding payload might look like this:
<?xml version="1.0" encoding="utf-8" ?>
<ns1:GreetingRes xmlns:ns1="http://sap.com/xi/myExample"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   Hello Mrs. Miller
</ns1:GreetingRes>
You can specify how a message type is used in more detail in the description
hope this will help you.
regards
Aashish Sinha
PS : reward points if helpful

Similar Messages

  • Element VS attribute in IR when we create data type.

    hi guruz,
    when we make data type in  IR ,and while creating node ,according node we give type(Element ,attribue etc).
    what is diff between element and attribute.
    please help me
    warm regards.

    Hi,
    You create complex data types using elements and attributes in the XSD editor
    Element
    Create structured data types. Elements that have a type cannot contain subelements.
    Example Instance
    <myElem>
      <f1> Value of f1 </f1>
      <f2> Value of f2 </f2>
    </myElem>
    Attribute
    Add attributes to elements. Attributes cannot usually have subnodes.
    Example Instance
    <myElem myAttr="AttributeValue">
      Element Value
    </myElem>
    You can flag an attribute as optional or required in the Occurrence column. These values mean the same for elements with an occurrence of 0..1 or 1. The only difference between elements and attributes is that attributes cannot have subnodes and that the same attribute cannot be used more than once in an element.
    Hope this will clarify you.
    Regards
    Aashish Sinha
    PS : reward points if helpful

  • Why should we create data type

    Hi all,
    I have a basic question!
    why do we create data type and then wrap it as message type?
    why dont we directly create a message type and use that ?
    please give the answers. Thanks in Advance.

    Hi Seshu,
    Please go through below links, you get answer
    message type and datatype
    Difference between Data type and Message type - Process Integration - SCN Wiki
    Regards,
    Krupa

  • Problem in creating data type

    hi..
    i've problem in creating data type in xi after importing idoc from the R/3 sender
    plz tell me the basic steps for creating data type in the receiver i.e xi.....
    thanks in advance

    Hi,
    You don't need to create a data type after importing the IDOC.
    Idoc itself acts as message type and message interface.
    check this for creating a data type..
    http://help.sap.com/saphelp_nw70/helpdata/en/2d/c0633c3a892251e10000000a114084/frameset.htm
    Thanks,
    Vijaya.

  • Validation while create data type

    HI All ,
    I have a pop-up in my report that user can create data type in  didc,
    There is a simple way to support validation for data types ,
    I have pop-up where the user need  to provide name of attribute
    he need to create and the data type for it (char ,string ,int etc )
    and he also need to provide the leng of the attribute he want to create
    (e.g. char10 ) and also decimal places .
    the issue here that i need to do some validation in the pop-up
    for e.g. if user choose
    case 1
    name     - attribute1
    datatype  - string
    leng   - in this case he dont need to provide leng (string )
    dec - dont need to provide (string )
    case 2
    name     - attribute1
    datatype  - char 
    leng   - 10
    dec - dont need to provide (char )
    Any idea how to do this validation in a simple way  (maybe to use standard functionlity)
    Regards
    Alex

    HI Keshav.
    What i did is created a popup with FM in the popup i have 4 field
    the field with the data type which i want to trigger event to it is domain and not ref to FM
    The ppoup have 4 field
    attr name
    datatype
    length
    decimal
    so from what you are say there is not option to trigger event when the user press F4
    and choose a entry from it ,
    since what i want to do is that if user for instance chose string i want that the next to fields (length and dec ) will be
    remove from the popup since he dont need them .
    and for he choose char the the decimal field will remove from the popup
    Any idea how to solve this issue ?
    Regards
    Alex
    Edited by: Alex Dean on Oct 12, 2010 3:02 PM

  • CREATE DATA TYPE TABLE

    Hi Colleagues,
    regarding my IDOC viewer project I'm facing a question regarding the SAP release. I started with some success on Release 471, now I tried to continue on 46C.
    CREATE DATA gr_ref
      TYPE lvc_t_fcat."STANDARD TABLE OF LVC_S_FCAT.
    works in both releases, while
    CREATE DATA ls_seg_dat-ref
      TYPE STANDARD TABLE OF (<edid4>-segnam).
    compiles on 471, but generates syntax error in 46C.
    The error message "Unable to interpret "TABLE". Possible causes of error: Incorrect spelling or comma error."
    does not help too much.
    Does this mean that there is no way to create tables dynamically on release 46C?
    Hope for a solution!
    regards,
    C.

    Hello,
    the only possibility I found was to use available table types in the dictionary. This works on a 4.6C system:
      DATA: lf_type(20)          TYPE c VALUE 'MARA',
            lf_table_type(20)    TYPE c VALUE 'MARA_TAB'.
      DATA: wa_data              TYPE REF TO data,
            lt_data              TYPE REF TO data.
      FIELD-SYMBOLS: <structure> TYPE ANY,
                     <field>     TYPE ANY,
                     <table>     TYPE TABLE.
      CREATE DATA wa_data TYPE (lf_type).
      ASSIGN wa_data->* TO <structure>.
      ASSIGN COMPONENT 'MATNR' OF STRUCTURE <structure> TO <field>.
      <field> = 'My Material'.
      CREATE DATA lt_data TYPE (lf_table_type).
      ASSIGN lt_data->* TO <table>.
      APPEND <structure> TO <table>.
    Little curious: An internal table type defined with "TYPES ty_mara_tab TYPE TABLE OF mara" is not accepted by CREATE DATA, but the dictionary type is. So even generating a little top include dynamically with the needed type as a table type will not work on 4.6C
    Best regards,
    Stefan Kozlowski

  • Creating data types

    Hi
    How do u create a data type when u get an input file.
    How do u know when to create header , footer n all?
    Can some one tell me or send a url on how to create data types. would be of great help!
    Thanks!

    HI,
    Generally identifying the structure from the input file need  some analysis work.
    You may refer some of the below tips while creating the data types
    1. List down the input structure of data fields  from input file.
    2. Decide the Header and detail information based on the data and go for sub-structure.
    3. With File adapter try to maintain the structure level max. upto 2.
      i.e. Root>Header>Fields etc.
    4. Try to avoid the substructure for the internal fields.
    5. Decide the Occurances fo every root and sub structures and fields.
    6. Identify if there any relations within Header and detail fields.etc.
    Check with SAP Help for various activities
    http://help.sap.com/saphelp_nw04/helpdata/en/a5/04623c4f69b712e10000000a114084/content.htm
    Thanks
    Swarup

  • Error while creating data type

    Hi
    I am creating data type for the scenario from File to IDOC
    Namespace urn:xiworkshop:groupxx:legacy is not defined in the software component version NEWPRODUCT , 100 of sap Object Message Type Vendor | urn:xiworkshop:groupxx:legacy references the inactive object Data Type Vendor | urn:xiworkshop:groupxx:legacy
    Please help me

    Hi;
    First activate your namespace and then create the data type.
    Namespace + default datatypes should be activated together.
    Then your data type
    Mudit

  • Import  XSD to create Data type in Design

    hi,
      I know that we can import XSD in Design and create data type,my question is:
    1.  Can i import an XSD thats been created in message mapping and use that to create my data type in design.
    (or)
    2.Should i have to write an XSD on my own and then import it to create my data type, and is there any standard format to write it.

    Hello Prashanth,
    For your first question: i don't know exactly what you mean that the the xsd you create in the data mapping steps. So can you explain it in details?
    For your 2nd question:  Sure you can write your own XSD to create a data type. And i will give you an example xsd file format. Then you can import it in the XSD tab view.
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://sap.com/xi/XI/hansteel" targetNamespace="http://sap.com/xi/XI/hansteel">
         <xsd:complexType name="CustomerInfo">
              <xsd:annotation>
                   <xsd:appinfo source="http://sap.com/xi/TextID">
                   a6c26c80000f11dac45e00096b1669b3
                   </xsd:appinfo>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="ID">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             dfe699c0e7bc11d9c736d51c0a0013e1
                             </xsd:appinfo>
                        </xsd:annotation>
                        <xsd:simpleType>
                             <xsd:restriction base="xsd:string">
                                  <xsd:length value="10" />
                             </xsd:restriction>
                        </xsd:simpleType>
                   </xsd:element>
                   <xsd:element name="NAME">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             dfe82060e7bc11d9b2efd51c0a0013e1
                             </xsd:appinfo>
                        </xsd:annotation>
                        <xsd:simpleType>
                             <xsd:restriction base="xsd:string">
                                  <xsd:length value="35" />
                             </xsd:restriction>
                        </xsd:simpleType>
                   </xsd:element>
                   <xsd:element name="CUSTTYPE">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             dfe82061e7bc11d9c193d51c0a0013e1
                             </xsd:appinfo>
                        </xsd:annotation>
                        <xsd:simpleType>
                             <xsd:restriction base="xsd:string">
                                  <xsd:length value="4" />
                             </xsd:restriction>
                        </xsd:simpleType>
                   </xsd:element>
                   <xsd:element name="POSTCODE">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             e93039a0e7bc11d9c7c6d51c0a0013e1
                             </xsd:appinfo>
                        </xsd:annotation>
                        <xsd:simpleType>
                             <xsd:restriction base="xsd:string">
                                  <xsd:length value="10" />
                             </xsd:restriction>
                        </xsd:simpleType>
                   </xsd:element>
                   <xsd:element name="CITY">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             f0122850e7bc11d99189d51c0a0013e1
                             </xsd:appinfo>
                        </xsd:annotation>
                        <xsd:simpleType>
                             <xsd:restriction base="xsd:string">
                                  <xsd:length value="35" />
                             </xsd:restriction>
                        </xsd:simpleType>
                   </xsd:element>
              </xsd:sequence>
         </xsd:complexType>
    </xsd:schema>
    Hope this will be helpful.
    Eric Ma

  • Create Data Type from XSD

    Hey guys
    i need to create Data Type from and XSD,in the beginning i had an XML document which i converted to XSD using Altova ,then i imported this XSD in IR under External definition,now how should i go ahead with creating Data Type?
    my sample XSD is something like this
    <?xml version="1.0" encoding="UTF-8"?>
    <!W3C Schema generated by XMLSpy v2007 sp2 (http://www.altova.com)>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
         <xs:element name="WorkOrderNumber">
              <xs:simpleType>
                   <xs:restriction base="xs:short">
                        <xs:enumeration value="10942"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="VendorNumber">
              <xs:simpleType>
                   <xs:restriction base="xs:int">
                        <xs:enumeration value="109845"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
    Its not the complete XSD,just the first few lines.
    thanx
    Ahmad

    Hey Prabhu
    my XSD looks like this
    <?xml version="1.0" encoding="UTF-8"?>
    <!W3C Schema generated by XMLSpy v2007 sp2 (http://www.altova.com)>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
         <xs:element name="WorkOrderNumber">
              <xs:simpleType>
                   <xs:restriction base="xs:short">
                        <xs:enumeration value="10942"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="VendorNumber">
              <xs:simpleType>
                   <xs:restriction base="xs:int">
                        <xs:enumeration value="109845"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="UnitPrice">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="MonetaryAmount"/>
                        <xs:element ref="UnitOfMeasureCode"/>
                        <xs:element ref="CurrencyCode"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="UnitOfMeasureCode">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:enumeration value="EA"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="TotalLineItems">
              <xs:simpleType>
                   <xs:restriction base="xs:byte">
                        <xs:enumeration value="6"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="TaxTypeCode">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:enumeration value="GoodsAndServicesTax"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="TaxReference">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:enumeration value="GST"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="TaxAmount">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="MonetaryAmount"/>
                        <xs:element ref="CurrencyCode"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="Tax">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="TaxTypeCode"/>
                        <xs:element ref="TaxAmount"/>
                        <xs:element ref="TaxReference"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="Requisition">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="Number"/>
                        <xs:element ref="LineItemNumber"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="Quantity">
              <xs:simpleType>
                   <xs:restriction base="xs:decimal">
                        <xs:enumeration value="1.0"/>
                        <xs:enumeration value="2.0"/>
                        <xs:enumeration value="6.0"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="PrimaryCurrency">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="CurrencyCode"/>
                        <xs:element ref="ExchangeRate"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="Pricing">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="UnitPrice"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="PaymentTerms">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:enumeration value="NT30"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="Number">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:enumeration value="Q173849"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="MonetaryAmount">
              <xs:simpleType>
                   <xs:restriction base="xs:decimal">
                        <xs:enumeration value="1.98"/>
                        <xs:enumeration value="12.48"/>
                        <xs:enumeration value="12.63"/>
                        <xs:enumeration value="16.75"/>
                        <xs:enumeration value="24.96"/>
                        <xs:enumeration value="240.0"/>
                        <xs:enumeration value="33.84"/>
                        <xs:enumeration value="43.83"/>
                        <xs:enumeration value="5.64"/>
                        <xs:enumeration value="74.81"/>
                        <xs:enumeration value="87.66"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="LineItemTotal">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="MonetaryAmount"/>
                        <xs:element ref="CurrencyCode"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="LineItemNumber">
              <xs:simpleType>
                   <xs:restriction base="xs:byte">
                        <xs:enumeration value="10"/>
                        <xs:enumeration value="20"/>
                        <xs:enumeration value="30"/>
                        <xs:enumeration value="40"/>
                        <xs:enumeration value="50"/>
                        <xs:enumeration value="60"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="LineItemMaterialNumber">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:enumeration value="108739"/>
                        <xs:enumeration value="192740-A"/>
                        <xs:enumeration value="380495"/>
                        <xs:enumeration value="43998"/>
                        <xs:enumeration value="54727S"/>
                        <xs:enumeration value="5746"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="LineItemInformation">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="LineItemMaterialNumber"/>
                        <xs:element ref="LineItemDescription"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="LineItemDescription">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:enumeration value="ABSRBT PAD 17 IN X 19 IN X 3/8 IN UNIV P"/>
                        <xs:enumeration value="BSHG HEX 1 IN X 1/2 IN THD FS A105N"/>
                        <xs:enumeration value="GGE 4 IN 1M / 7000 DL SCALE 1/2 IN LM WI"/>
                        <xs:enumeration value="PEN REC RD MED GRAPHIC 39-202"/>
                        <xs:enumeration value="PL ORF 3 IN .5 IN ORF SER 500 316 SS"/>
                        <xs:enumeration value="WPR F-200 FLC NOV LABEL 20"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="Invoices">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="Invoice"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="InvoiceTypeCode">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:enumeration value="ProductOrService"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="InvoiceTotal">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="MonetaryAmount"/>
                        <xs:element ref="CurrencyCode"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="InvoiceSummary">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="TotalLineItems"/>
                        <xs:element ref="InvoiceTotal"/>
                        <xs:element ref="Tax"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="InvoiceQuantity">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="Quantity"/>
                        <xs:element ref="UnitOfMeasureCode"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="InvoiceProperties">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="InvoiceNumber"/>
                        <xs:element ref="InvoiceDate"/>
                        <xs:element ref="VendorNumber"/>
                        <xs:element ref="InvoiceTypeCode"/>
                        <xs:element ref="PrimaryCurrency"/>
                        <xs:element ref="PaymentTerms"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="InvoiceNumber">
              <xs:simpleType>
                   <xs:restriction base="xs:int">
                        <xs:enumeration value="98815236"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="InvoiceLineItem">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="WorkOrderNumber"/>
                        <xs:element ref="LineItemNumber"/>
                        <xs:element ref="InvoiceQuantity"/>
                        <xs:element ref="LineItemInformation"/>
                        <xs:element ref="Pricing"/>
                        <xs:element ref="LineItemTotal"/>
                        <xs:element ref="Requisition"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="InvoiceDetails">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="InvoiceLineItem" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="InvoiceDate">
              <xs:simpleType>
                   <xs:restriction base="xs:date">
                        <xs:enumeration value="2007-01-25"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="Invoice">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="InvoiceProperties"/>
                        <xs:element ref="InvoiceDetails"/>
                        <xs:element ref="InvoiceSummary"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="ExchangeRate">
              <xs:complexType/>
         </xs:element>
         <xs:element name="CurrencyCode">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:enumeration value="CAD"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
    </xs:schema>
    can you please tell me how to nest the structures,i m fairly new to XSD and stuffs
    thanx
    ahmad

  • Idoc message type which contains all  data types

    Hi,
    I need idoc type or name which consist of all data type sap has defined. There are nearly 24 data types.
    Pls help..
    Regards,
    Taj

    hi,
    you will not have any message types which contain all data types.
    message types will be defined based on specific data.
    for example :
    MATMAS - Material master
    DEBMAS - Customer master data distribution

  • How  create data type for coulmn name having special characters in IR

    hi ,
    any idea how to create how to do create data type for coulmn name having special characters

    Hi Amit,
    Can you ellaborate ?
    Actually if you are reading a file(or anything else) which contains special characters, the data type can be created as done for other interfaces. But it is in the adapters that we actually take care of handling these special characters.
    ShabZ

  • Adobe Forms Error Message 'Error when transforming object data'

    Hi,
      When i tried to save(Adobe Forms) after making changes in Layout its giving an error message 'Error when transforming object data' and takes me out of the transaction. How do i solve this ? Can anyone help me out.
    Thanks and Regards,
    Franklin.

    hi
      I have the same problem , plz help me out
    thanks

  • Create data type string

    HI
    There is a way to create date type string using the command
    Create data type "string"...
    I know that I can create data type C but string dont have any restrication so how I can hanlde it ?
    Regards
    Joy

    Hi,
    You can use the create data statement:
    DATA: lo_data TYPE REF TO data.
    FIELD-SYMBOLS: <str> TYPE ANY.
    CREATE DATA lo_data TYPE string.
    ASSIGN lo_data->* TO <str>.
    Here <str> will be of type string.
    Kr,
    m.

  • The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

    I am trying to insert records into a temporary table with date values concatenated with other string values  into one large string value.I am getting the following error:
    Msg 242, Level 16, State 3, Line 12
    The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
    Msg 241, Level 16, State 1, Line 28
    Conversion failed when converting date and/or time from character string.
    -My code below
    Declare
           @hdrLOCAL char(255),                                                       
        @CR char(255),                                                             
        @BLDCHKDT DATETIME,                                                         
        @BLDCHTIME DATETIME,                                                         
        @hdrline int
        SELECT @hdrLOCAL = DDLINE FROM DD40400 WHERE INDXLONG =1
        SELECT @CR = DDLINE FROM DD40400 WHERE INDXLONG =2
        SELECT @hdrline =1
        SELECT
                @BLDCHKDT = CONVERT(varchar(20),T756.PAYDATE,105) ,
                -- convert(varchar,getdate(),15)
                @BLDCHTIME= CONVERT(varchar(20),T756.PAYDATE,105)
                FROM STATS.dbo.DD10500 T762
                LEFT OUTER JOIN STATS.dbo.DD10400 T756 ON (
                        T762.INDXLONG = T756.INDXLONG
                        AND T756.INCLPYMT = 1
                WHERE (T756.INCLPYMT = 1)
                    AND (T762.DDAMTDLR <> 0)
      Create TABLE [dbo].[##DD10200B](
        [INDXLONG] [int] NOT NULL,
        [DDLINE] [varchar](8000) NOT NULL,
        [DEX_ROW_ID] [int] IDENTITY(1,1) NOT NULL,
    BEGIN
    INSERT INTO ##DD10200B (INDXLONG,DDLINE)
            VALUES (1,@hdrLOCAL +',' + @CR +','+ @BLDCHKDT +',' + @BLDCHTIME )
    END
    Msg 242, Level 16, State 3, Line 12
    The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
    Msg 241, Level 16, State 1, Line 28
    Conversion failed when converting date and/or time from character string.
    The Best thing in Life is Life

    Since the Variable
    BLDCHKDT and BLDCHTIME are of type date time why are you trying to assign it a value
    of type varchar
    and the format 105 gives you dd-mm-yyyy but SQL server takes the default format as mm-dd-yyyy so the error occurs for all dates that
    are greater than 12
    try the below code
    Declare
    @hdrLOCAL char(255),
    @CR char(255),
    @BLDCHKDT Varchar(50),
    @BLDCHTIME Varchar(50),
    @hdrline int
    SELECT @hdrLOCAL = DDLINE FROM DD40400 WHERE INDXLONG =1
    SELECT @CR = DDLINE FROM DD40400 WHERE INDXLONG =2
    SELECT @hdrline =1
    SELECT
    @BLDCHKDT = CONVERT(varchar(20),T756.PAYDATE,105) ,
    -- convert(varchar,getdate(),15)
    @BLDCHTIME= CONVERT(varchar(20),T756.PAYDATE,105)
    FROM STATS.dbo.DD10500 T762
    LEFT OUTER JOIN STATS.dbo.DD10400 T756 ON (
    T762.INDXLONG = T756.INDXLONG
    AND T756.INCLPYMT = 1
    WHERE (T756.INCLPYMT = 1)
    AND (T762.DDAMTDLR <> 0)
    Create TABLE [dbo].[##DD10200B](
    [INDXLONG] [int] NOT NULL,
    [DDLINE] [varchar](8000) NOT NULL,
    [DEX_ROW_ID] [int] IDENTITY(1,1) NOT NULL,
    BEGIN
    INSERT INTO ##DD10200B (INDXLONG,DDLINE)
    VALUES (1,@hdrLOCAL +',' + @CR +','+ @BLDCHKDT +',' + @BLDCHTIME )
    END
    the only change done is 
    @BLDCHKDT Varchar(50),
    @BLDCHTIME Varchar(50),
    Surender Singh Bhadauria
    My Blog

Maybe you are looking for

  • Don't see email accounts to change notifications and no notifications for TEXTS.

    I have had carrier issued software release 10.2.1.2977 for awhile. I noticed now that under Notifications --> Core Applications there is no mention of any of my email accounts. (But I have no issue receiving or sending email via this Q10). And althou

  • Capturing dvcpro 50 - help!

    Hi - I'm trying to capture dvcpro 50 tapes into FCP 6. It recognizes the deck and I have control, but the preview is all pixellated. The deck keeps giving me the E-00 error (servo not locked). Does this sound like a deck issue or a settings issue? I'

  • Installation Issues - Solaris 10

    Here's the situation. I've got a sparc machine that I'm trying to install Solaris 10 on. I've verified the equipment in the approved hardware guide, so I'm not worried about that. I get through the installation process and am asked to reboot without

  • Doubt on Dates

    Hi exports, I want to create executable program which is having date field in selection screen. date is select-options field. now my problem is i want to select the data from ztable. the table contains many filed in that one field is from_date and an

  • Java SE 6 required to run Flash CS6

    But I have version 8, update 25 on my Mac running OS X Yosemite. If I install V6, will it overwrite my current version of Java? I'm not sure if this is a good idea. What about Flash CC 2014, what version of Java does it require? ~paul