cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Mapping - BPM

Former Member
0 Kudos

Hello Experts,

I am developing a BPM scenario for material records flowing from MDM -> PI-> ECC.

I need acknowledgements from ECC for which I am implementing the scenario as mentioned in tis blog https://weblogs.sdn.sap.com/pub/wlg/12249. [original link is broken] [original link is broken] [original link is broken]

My BPM process looks like:

Receive -


> Send to ECC-------> ABAP mapping -


> SEnd RFC call to ECC

(MATMAS from MDM) (to retrieve IDoc number from PI based on

message id generated from previous step)

I am stuck at triggering ABAp mapping in BPM and this is my first try with BPM too.

Will the transformation step (ABAp mapping) read the message id on its own or do I have to handle it manually?? How can i debug and see if this ABAP mapping works correctly?

ABAp mapping program::

method IF_MAPPING~EXECUTE.

  • initialize iXML

type-pools: ixml.

class cl_ixml definition load.

data irc type i.

  • create main factory

data: ixmlfactory type ref to if_ixml.

ixmlfactory = cl_ixml=>create( ).

  • create stream factory

data: streamfactory type ref to

if_ixml_stream_factory.

streamfactory = ixmlfactory->create_stream_factory(

).

  • create input stream

data: istream type ref to if_ixml_istream.

istream = streamfactory->create_istream_xstring(

source ).

  • initialize input document

data: idocument type ref to if_ixml_document.

idocument = ixmlfactory->create_document( ).

data: ele type ref to if_ixml_element.

data: iparser type ref to if_ixml_parser.

iparser = ixmlfactory->create_parser( stream_factory

=

streamfactory

istream = istream

document = idocument ).

iparser->parse( ).

*----


---

*----Data declaration

data : oref TYPE REF TO cx_root,

l_msgid_ref TYPE string,

wa_SWFRXIHDR type SWFRXIHDR,

l_msgid type string,

l_v_idocnumber type string,

l_v_sendersys type string,

l_v_msgtyp type string,

l_v_createdate type string,

wa_IDXRCVPOR type IDXRCVPOR.

*---Getting the messageID

TRY.

l_msgid_ref = param->get(

IF_MAPPING_PARAM=>MESSAGE_ID ).

catch CX_SY_REF_IS_INITIAL into oref.

endtry.

*---Get the Guid for SEND step

select single guid

from SWFRXIHDR

into l_msgid

where

REFGUID = l_msgid_ref and

CREA_POINT = 'SEND'.

*---Wait so that all the commits are done

wait up to 30 seconds.

*---Get IdocNumber from this table based on GUID

SELECT single *

from IDXRCVPOR

into wa_IDXRCVPOR

where GUID = l_msgid.

l_v_idocnumber = wa_IDXRCVPOR-IDOCNUMBER.

l_v_msgtyp = wa_IDXRCVPOR-IDOCTYP.

l_v_sendersys = wa_IDXRCVPOR-SNDPRN.

l_v_createdate = wa_IDXRCVPOR-CREDATE.

*----


---

  • build up output document

=============================================

  • create output document

data: odocument type ref to if_ixml_document.

odocument = ixmlfactory->create_document( ).

data: msgtype type ref to if_ixml_element.

msgtype = odocument->create_simple_element(

name = 'ns0:ZALEAUDIT4XI'

parent = odocument ).

irc = msgtype->set_attribute( name = 'xmlns:ns0'

value = 'urn:sap-com:document:sap:rfc:functions' ).

data: l_idocnumber type ref to if_ixml_element.

l_idocnumber = odocument->create_simple_element(

name = 'S_DOCNUM'

value = l_V_idocnumber

parent = msgtype ).

data: l_msgtyp type ref to if_ixml_element.

l_msgtyp = odocument->create_simple_element(

name = 'S_MESTYP'

value = l_v_msgtyp

parent = msgtype ).

data: l_sndsys type ref to if_ixml_element.

l_sndsys = odocument->create_simple_element(

name = 'S_SNDSYS'

value = l_v_sendersys

parent = msgtype ).

data: l_credate type ref to if_ixml_element.

l_credate = odocument->create_simple_element(

name = 'S_UPDDAT'

value = l_v_createdate

parent = msgtype ).

  • render document

====================================================

==

  • create output stream

data: ostream type ref to if_ixml_ostream.

ostream = streamfactory->create_ostream_xstring(

result ).

  • create renderer

data: renderer type ref to if_ixml_renderer.

renderer = ixmlfactory->create_renderer( ostream =

ostream

document = odocument ).

irc = renderer->render( ).

endmethod.

PLEASE advice.

Thanks in advance,

Elizabeth.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

REsolved it...