Home > Ask the SAP software/management Experts > SAP NetWeaver, ESA and EAI Questions & Answers > How to send an inbound IDoc from SAP for tracking
Ask The SAP Expert: Questions & Answers
EMAIL THIS

How to send an inbound IDoc from SAP for tracking

Axel Angeli EXPERT RESPONSE FROM: Axel Angeli

Pose a Question
Other SAP Categories
Meet all SAP Experts
Become an Expert for this site


SAP news, tips and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 15 November 2005
For the purpose of tracking, I would like to send myself an inbound IDoc from SAP. Maybe this sounds weird, but is an idea that sounds workable. Is there any way to do this?


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
SAP NetWeaver, ESA and EAI
In an upgrade to SAP ECC 6.0, when do integrated apps get upgraded?
Configuring SAP EDI for sales orders
Installing SAP NetWeaver PI 7.1 on servers running ECC 6.0
Resolving app server connectivity problems for remote users
Should a manufacturing expert pursue SAP PP or SAP SCM (APO)?
How to start an SAP NetWeaver career
How to pursue an SAP developer job even if you hate Java
How to choose between SAP Basis and SAP security courses
Which SAP IDoc type can solve the EDI X12 211 error message?
How to fix two common SAP ABAP problems

SAP interface technologies
SAP CTO expects today's SAP applications to be running in 2020
SAP TechEd 09 keynoters: Managing change today like trying to board a speeding train
SAP's Web 2.0 strategy makes way for social networking in business apps
Error when clicking the SAP GUI logon button
SAP applications demo: BP's key mapping
Viewing a list of SAP interfaces
Interface a locally developed application with SAP
Will there always be an implicit commit in an RFC?
Is there a way to search within IDocs using a purchase order number?
Configuring the JDBC Connector Service to perform database lookups

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Application Link Enabling  (SearchSAP.com)
IDoc  (SearchSAP.com)
Remote Function Call  (SearchSAP.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


That's not weird at all, but a common method to achieve a lot of goals. You can create an inbound IDoc with transaction WE19 for test purposes. And you can send an IDoc to a system by calling the RFC function IDOC_INBOUND_ASYNCHRONOUS. Here is some example code:



report  zaxx_idoc_picking_create.
*
tables: likp.
*
parameters: vbeln_va type vbeln_va .
parameters: vbeln_vl type vbeln_vl .
parameters: vbelp    type vbelp    .
*
data: object like nast.
data: control_record like edidc.
data: int_edidd type table of edidd with header line.
data: own_logical_system type tbdls-logsys.
*
data: int_edi_dc type edi_dc.
data: int_edi_dd type table of edi_dd with header line.
*
perform init_control.
perform build_idoc using vbeln_vl vbelp.
*
perform idoc_send_async tables int_edidd using control_record.
*
write: / sy-subrc color col_normal,
         control_record-docnum color col_normal hotspot.
hide: control_record.
*
form idoc_send_async
  tables int_edidd structure edidd
   using x_edidc structure edidc.      .
  data: tedi_dc40 type table of edi_dc40 with header line.
  data: tedi_dd40 type table of edi_dd40 with header line.
*
  refresh tedi_dd40 .
  loop at int_edidd.
    move-corresponding int_edidd to tedi_dd40.
    append tedi_dd40 .
  endloop.
*
  call function 'IDOC_CONTROL_OUTBOUND_CONVERT'
    exporting
      control_record         = x_edidc
      port_version           = '3'
    importing
*   CONTROL_30             =
      control_40             = tedi_dc40
   exceptions
     conversion_error       = 1
     others                 = 2            .
  append tedi_dc40.

  call function 'IDOC_INBOUND_ASYNCHRONOUS'
    destination 'NONE'
    tables
      idoc_control_rec_40 = tedi_dc40[]
      idoc_data_rec_40    = tedi_dd40[].

  call function 'BAPI_TRANSACTION_COMMIT'
   destination 'NONE'
   exporting
     wait          = 'X'            .
*
  select max( docnum ) into x_edidc-docnum
    from edidc
   where idoctp eq x_edidc-idoctp
     and sndpor eq x_edidc-sndpor
     and mestyp eq x_edidc-mestyp.
*
endform.                    "idoc_send
*
form build_idoc using vbeln posnr.
  data: header type e1vpdlh.
  data: item   type e1vpdli.
*
  unpack vbeln to header-vbeln_vl.
  header-vbeln = header-vbeln_vl.
  unpack '1' to header-tanum.
  header-komue = 'X'.
  perform add_segment
    tables int_edidd
     using control_record-docnum 'E1VPDLH' header.

  item-vbeln_vl = header-vbeln_vl.
  item-posnr_vl = posnr.
  item-vbeln    = header-vbeln.
  item-posnn = '900101'.
  item-pikmg    = '222'.
  item-meins    = 'KG'.
  item-brgew    = '333'.
  item-ntgew    = '222'.
  item-gewei    = 'KG'.
  item-charg    = 'CHARGE'.
  item-matnr    = 'MAT01'.

  perform add_segment
    tables int_edidd
     using control_record-docnum 'E1VPDLI' item.

endform.                    "build_idoc
*
form add_segment
  tables int_edidd structure edidd
  using docnum segnam like edidd-segnam
        sdata.
  unpack docnum to int_edidd-docnum.
  int_edidd-segnam = segnam.
  int_edidd-sdata = sdata.
  append int_edidd.
endform.                    "add_segment
*
form init_control.
  control_record-mestyp = 'SDPICK'.
  control_record-idoctp = 'SDPIID01'.
  unpack '1' to control_record-docnum.
*
  call function 'OWN_LOGICAL_SYSTEM_GET'
    importing
      own_logical_system             = own_logical_system
    exceptions
      own_logical_system_not_defined = 1
      others                         = 0.
*
  control_record-sndprt = 'LS'.
  control_record-sndprn = own_logical_system.
  control_record-sndpor = own_logical_system.
*
  control_record-rcvprt = 'LS'.
  control_record-rcvprn = own_logical_system.
  control_record-rcvpor = space.
*
endform.                    "init_control
*
at line-selection.
  data: fdnam type string.
  get cursor field fdnam.
  case fdnam.
    when 'CONTROL_RECORD-DOCNUM'.
      if not control_record-docnum is initial.
        call function 'EDI_DOCUMENT_TREE_DISPLAY'
          exporting
            docnum              = control_record-docnum
*     OPEN                =
         exceptions
           no_idoc_found       = 1
           others              = 2
                  .
        if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.

      endif.
    when 'LIKP-VBELN'.
      set parameter id 'VL' field likp-vbeln.
      call transaction 'VL02'.
  endcase.
*




Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



SAP White Paper Topics
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
SearchSAP.com is a search service provided by TechTarget and is completely
independent of and not affiliated with SAP AG.
  TechTarget - The IT Media ROI Experts