Skip to Content
avatar image
Former Member

Offline Interactive forms

Hi Gurus,

My scenario is when the customer send mail attachment with Sales order PDF document. The vendor should download that pdf forms. In that pdf forms we have an submit and cancel button. Once i submit that button that data should store in the database table. Here i am not using webdynpro. So,please give me idea how can we do this and how can i hardcode this.

Thanks

Kevin mike

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jul 02, 2008 at 11:58 AM

    on send button define a event which submits the form to a predefined email address, using transaction 'scot' configure the inbound processing.

    create a class and implement the interface 'IF_INBOUND_EXIT_BCS'

    now under the method tab of your class you will find the following two methods.

    IF_INBOUND_EXIT_BCS~CREATE_INSTANCE

    IF_INBOUND_EXIT_BCS~PROCESS_INBOUND

    create a attribute named 'instance' make it as static and private and should be of the type same as your class name.

    in 'create instance' method write the following code:

    IF instance IS INITIAL.

    CREATE OBJECT instance.

    ENDIF.

    • Return the instance.

    ro_ref = instance.

    in 'PROCESS_INBOUND' method write the following code:

    • Get the email document that was sent.

    DATA: document TYPE REF TO if_document_bcs.

    document = io_sreq->get_document( ).

    • Get the interactive form attachment.

    DATA: pdf_table TYPE bcss_dbpc.

    pdf_table = document->get_body_part_content( 2 ).

    • Convert the pdf table into an xstring.

    DATA: pdf_xstring TYPE xstring,

    pdf_line TYPE solix.

    CLEAR pdf_xstring.

    LOOP AT pdf_table-cont_hex INTO pdf_line.

    CONCATENATE pdf_xstring pdf_line-line INTO pdf_xstring

    IN BYTE MODE.

    ENDLOOP.

    • Get a reference to the form processing class.

    DATA: l_fp TYPE REF TO if_fp.

    l_fp = cl_fp=>get_reference( ).

    • Get a reference to the PDF Object class.

    DATA: l_pdfobj TYPE REF TO if_fp_pdf_object.

    l_pdfobj = l_fp->create_pdf_object( ).

    • Set the pdf in the PDF Object.

    l_pdfobj->set_document( pdfdata = pdf_xstring ).

    • Set the PDF Object to extract data the Form data.

    l_pdfobj->set_extractdata( ).

    • Execute call to ADS

    l_pdfobj->execute( ).

    • Get the PDF Form data.

    DATA: pdf_form_data TYPE xstring.

    l_pdfobj->get_data( IMPORTING formdata = pdf_form_data ).

    • Convert the xstring form data to string so it can be

    • processed using the iXML classes.

    • DATA: converter TYPE REF TO cl_abap_conv_in_ce.

    • converter = cl_abap_conv_in_ce=>create( input = pdf_form_data ).

    DATA: formxml TYPE string.

    • converter->read( IMPORTING data = formxml ).

    CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'

    EXPORTING

    im_xstring = pdf_form_data

    IMPORTING

    ex_string = formxml.

    TYPE-POOLS: ixml.

    • Get a reference to iXML object.

    DATA: l_ixml TYPE REF TO if_ixml.

    l_ixml = cl_ixml=>create( ).

    • Get iStream object from StreamFactory

    DATA: streamfactory TYPE REF TO if_ixml_stream_factory.

    DATA: istream TYPE REF TO if_ixml_istream.

    streamfactory = l_ixml->create_stream_factory( ).

    istream = streamfactory->create_istream_string( formxml ).

    • Create an XML Document class that will be used to process the XML

    DATA: document TYPE REF TO if_ixml_document.

    document1 = l_ixml->create_document( ).

    • Create the Parser class

    DATA: parser TYPE REF TO if_ixml_parser.

    parser = l_ixml->create_parser( stream_factory = streamfactory

    istream = istream

    document = document ).

    parser->parse( ).

    data: node type ref to if_ixml_node.

    data: strChecked type string.

    *getting form values

    node = document->find_from_name( name = 'RESERVED'

    ).

    strChecked = node->get_value( ).

    this is how you can get the data into internal table

    and eventually save it into you system.

    configuring 'SCOT'

    configure the inbound processing

    put the name of your class and the default email address, this will do you job.

    regards,

    Suhail Khan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Suhail

      Your posting was really useful and it works very well.

      Actually I am working on Offline IF for Purchase Requisition.

      In Purchase Requisition I can have more than one line items, so in this case your code is retriving only the first line item.

      Can you provide me the code to process xml with multiple lines.

      thanks

      Vijai