Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Inbound IDOC Posting

$
0
0

I am developing a function module in ECC that will be used to post inbound IDOC for customer creation DEBMAS07

 

The logic is as follows -

 

The function receives an IDOC structure

It then invokes function module 'IDOC_INPUT_DEBITOR'

 

IDOC_INPUT_DEBITOR takes care of creating a new customer in table KNA1. But I was expecting IDOC_INPUT_DEBITOR to also handle the IDOC posting. This way I can go to WE02 and see a new IDOC record. What am I missing? Is there some more code I need to write after the function module call?

 

Thank you.

 

 

* IDOC structures for using ALE

     data       lc_no_display         type bdwfap_par-inputmethd value ' '.

 

     data       lt_idoc_control       type standard table of edidc.

     data       ls_idoc_control       type edidc.

     data       lt_idoc_data          type standard table of edidd.

     data       lt_idoc_data_knvi     type standard table of edidd.

     data       lt_idoc_status        type standard table of bdidocstat.

     data       ls_idoc_status        type bdidocstat.

     data       lt_return_variables   type standard table of bdwfretvar.

     data       lt_serialization_info type standard table of bdi_ser.

     data       lv_workflow_result    type bdwf_param-result.

 

     data       pi_idoctyp            type edi_iapi00-idoctyp.

     data       pt_segments           type standard table of edi_iapi11.

     data       lw_segments           type edi_iapi11.

 

     data       ls_idoc_data          type edidd.

     data       ls_e1kna1m            type  zdebmas07_e1kna1m.

     data       e1kna1m               type e1kna1m.

 

 

 

**********************************************************************

*** CONTROL DATA

**********************************************************************

     ls_idoc_control-mandt  = input-idoc-edi_dc40-mandt.

     ls_idoc_control-status = input-idoc-edi_dc40-status.

     ls_idoc_control-doctyp = input-idoc-edi_dc40-idoctyp.

     ls_idoc_control-direct = input-idoc-edi_dc40-outmod.

     ls_idoc_control-rcvprt = input-idoc-edi_dc40-rcvprt.

     ls_idoc_control-rcvprn = input-idoc-edi_dc40-rcvprn.

     ls_idoc_control-stdmes = input-idoc-edi_dc40-stdmes.

     ls_idoc_control-outmod = input-idoc-edi_dc40-outmod.

     ls_idoc_control-sndpor = input-idoc-edi_dc40-sndpor.

     ls_idoc_control-sndprt = input-idoc-edi_dc40-sndprt.

     ls_idoc_control-sndprn = input-idoc-edi_dc40-sndprn.

     ls_idoc_control-mestyp = input-idoc-edi_dc40-mestyp.

     ls_idoc_control-idoctp = input-idoc-edi_dc40-idoctyp.

     append ls_idoc_control to lt_idoc_control.

 

 

**********************************************************************

*** READ SEGMENTS

**********************************************************************

     pi_idoctyp = ls_idoc_control-idoctp.

     call function 'IDOCTYPE_READ_COMPLETE'

       exporting

         pi_idoctyp         = pi_idoctyp

       tables

         pt_segments        = pt_segments

       exceptions

         object_unknown     = 1

         segment_unknown    = 2

         relation_not_found = 3

         others             = 4.

 

     loop at pt_segments into lw_segments.

       case lw_segments-segmenttyp.

         when 'E1KNA1M'.

           ls_idoc_data-segnam = 'E1KNA1M'.

           ls_idoc_data-mandt  = sy-mandt.

           ls_idoc_data-segnum = lw_segments-nr.

           ls_idoc_data-psgnum = lw_segments-parpno.

           ls_e1kna1m          = input-idoc-e1kna1m.

           move-corresponding ls_e1kna1m to e1kna1m.

           move e1kna1m to ls_idoc_data-sdata.

           append ls_idoc_data to lt_idoc_data.

           exit.

       endcase.

     endloop.

 

 

**********************************************************************

*** IDOC INPUT CALL FUNCTION

**********************************************************************

     data: response type zsi_create_customer_is_res_tab.

     data: response_lwa type zsi_create_customer_is_respons.

     data: lwa_error_message type string.

 

 

     call function 'IDOC_INPUT_DEBITOR'

       exporting

         input_method          = lc_no_display

         mass_processing       = space

       importing

         workflow_result       = lv_workflow_result

       tables

         idoc_contrl           = lt_idoc_control

         idoc_data             = lt_idoc_data

         idoc_status           = lt_idoc_status

         return_variables      = lt_return_variables

         serialization_info    = lt_serialization_info

       exceptions

         wrong_function_called = 1

others                = 2.


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>