cancel
Showing results for 
Search instead for 
Did you mean: 

Using IFS_XML_CONTAINER parameter of SAP_WAPI_CREATE_EVENT

sanjay_deshpande4
Participant
0 Kudos

Dear All,

I need to pass internal table from my user exit to workflow template using SAP_WAPI_CREATE_EVENT function module.

This function module has INPUT_CONTAINER which can be used to pass the structure ONLY.However my requirement is to pass internal table which can be achieved using  IFS_XML_CONTAINER of this function module.

How ever how to use this parameter is not clear for passing internal table.

Can anybody kindly guide how this can be achieved.

A sample code will be great help.

 


Regards,

SD

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi SD,

Table parameter INPUT_CONTAINER can be used to pass internal table, declare an internal table of type SWRTCONT which is table type for structure SWR_CONT and add entries into this table. refer below logic:

lt_container type SWRTCONT.

ls_container type  SWR_CONT.

loop at lt_mara into ls_mara.

ls_container-element = 'CONTAINER_NAME'

ls_container-value     = ls_mara.

append ls_container to lt_container.

endloop.

CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'

    EXPORTING

      object_type     = 'BO_Name'

      object_key      = l_objkey

      event              = l_event

    TABLES

      input_container = lt_container.

Hope this will help your query.

Regards,

Deb

Former Member
0 Kudos

Hi,

please read the answers to your previous post

https://scn.sap.com/message/16661983#16661983

first, before opening a new thread with the same remaining question.

Florin

sanjay_deshpande4
Participant
0 Kudos

Dear Floriin ,

Thnaks for response.

Actually last time i was stuck at following and i was waiting for your resposnse to query.I will eb really thankful for kindly answering following queries.

1)lo_event_container is not defined in include <swfcntn01>.

I got error : FIeld lo_event_container is  unknown in my code.

I also went through the macros/declarations available in the include.

2)Also kindly let me know if container declaration needed or lv_xml_container is to be replaced with wa_mara and how to declare this container.

Former Member
0 Kudos

Hello SD,

I gave some example coding with having omitted some parts.

lo_event_container is the data field with the type declared in the include. As per a common naming convention, LO_... is a local variable holding an object instance.

... with my statement .... like the one defined in <swfcntn01> I was adressing line #12, where the type is defined:  swf_container

So the example(!) coding goes like this. Please adapt yourself accordingly.

swf_container  lo_event_container.

DATA: v_xml_container       TYPE STRING.

swf_create_container lo_event_container.

"... Now add the elements as you need and continue with the ...to_xml() call later on.

There you are.

   Florin

sanjay_deshpande4
Participant
0 Kudos

Dear Florin,

Thanks for replying.

My earlier problem solved now.

Can you kindly explain now how to code for filling up the data in v_xml_container  from internal table?

Shall i concatenate individual rows of table?I am trying to pass few fields of mara table.

Kindly guide.   

Former Member
0 Kudos

the lv_xml_container variable, declared as a String, is created by the returning value of the call ->to_xml( ) on the container object. Take a look at the debugger after the statement.

sanjay_deshpande4
Participant
0 Kudos

I agree. In that case can you please guide how to fill up lo_event_container of

  lo_event_container

->to_XML( IMPORTING xml_stream = v_xml_container ).


so that V_XML_CONTAINER will hold data in XML string format.

Kindly help me as i am having very limited exposure to OO programming.

Former Member
0 Kudos

Hi,

well, you should be somewhat experiences with ABAP-OO when working on newer Workflow-Scenarios. However, most - or nearly all, including the to_xml() call - is part of this post, or the previously referenced post, too.

I'm not gonna write the complete code for you; but maybe someone else is showing up here. ... or ask a colluege with some OO know-how.

Florin

Sandra_Rossi
Active Contributor
0 Kudos

Are you sure you can't pass several lines of a table element by adding the lines to INPUT_CONTAINER with the same table element name?