cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Programm for calling Proxies

Former Member
0 Kudos

Hi Experts,

I was writing a ABAP programm für starting a ABAP proxy.

*&----


*

*& Report Z_XI_MAPPING

*&

*&----


*

*&

*&

*&----


*

REPORT Z_XI_MAPPING.

parameters: PA_WAIT type decimals default 0,

PA_LOOP type decimals default 1,

PA_EOIO type char1 default 'X',

PA_QUEUE type PRX_SCNT default 'Regression01'.

DATA: myProxy TYPE REF TO ZCO_MI_MAPPING_OUT ,

l_start type tims value is initial,

l_start_time type i value 0,

l_end_time type i value 0,

l_max_time type i value 0,

l_min_time type i value 999999999,

l_delta_time type i value 999999999,

l_avr_time type i value 0,

l_ctr type i value 0,

l_ctr_item type i value 0,

lt_pers_id type char10,

it_pers_id type char10,

lo_async_messaging TYPE REF TO if_wsprotocol_async_messaging.

get time.

WRITE: / 'System: ' , sy-sysid,

'Start Time: ', sy-datum, sy-uzeit,

'Wait Time: ' , pa_wait,

'Loops: ' , pa_loop.

WRITE: / 'start-time execution-time'.

TRY.

CREATE OBJECT myProxy

  • EXPORTING

  • LOGICAL_PORT_NAME = 'LP_XI_REGRESSION'.

.

CATCH CX_AI_SYSTEM_FAULT .

ENDTRY.

  • specify queue id

if pa_EOIO = 'X'.

lo_async_messaging ?= myProxy->get_protocol( if_wsprotocol=>async_messaging ).

lo_async_messaging->set_serialization_context( pa_QUEUE ).

endif.

data: OUTPUT type ZMT_MAPPING_OUT .

move 'Element01' to OUTPUT-MT_MAPPING_OUT-set-set_ELEMENT_01.

move 'Element02' to OUTPUT-MT_MAPPING_OUT-set-set_ELEMENT_02.

move 'Element03' to OUTPUT-MT_MAPPING_OUT-set-set_ELEMENT_03.

move 'Element04' to OUTPUT-MT_MAPPING_OUT-set-set_ELEMENT_04.

move 'Element05' to OUTPUT-MT_MAPPING_OUT-set-set_ELEMENT_05.

move 'Element06' to OUTPUT-MT_MAPPING_OUT-set-set_ELEMENT_06.

move 'Element07' to OUTPUT-MT_MAPPING_OUT-set-set_ELEMENT_07.

move 'Element08' to OUTPUT-MT_MAPPING_OUT-set-set_ELEMENT_08.

move 'Element09' to OUTPUT-MT_MAPPING_OUT-set-set_ELEMENT_09.

move 'Element10' to OUTPUT-MT_MAPPING_OUT-set-set_ELEMENT_10.

do pa_loop TIMES.

l_ctr = l_ctr + 1 .

get time.

move sy-uzeit to l_start.

get run time field l_start_time.

TRY.

CALL METHOD myProxy->EXECUTE_ASYNCHRONOUS

EXPORTING

OUTPUT = OUTPUT.

.

CATCH CX_AI_SYSTEM_FAULT .

ENDTRY.

get run time field l_end_time.

l_delta_time = l_end_time - l_start_time.

l_avr_time = l_avr_time + l_delta_time.

if l_delta_time < l_min_time.

move l_delta_time to l_min_time.

endif.

if l_delta_time > l_max_time.

move l_delta_time to l_max_time.

endif.

WRITE: / l_start,

11 l_delta_time.

wait up to pa_wait seconds .

enddo.

COMMIT WORK.

l_avr_time = l_avr_time / l_ctr .

WRITE: / 'fastest call: ', l_min_time,

'slowest call: ', l_max_time,

'average time: ', l_avr_time,

'Count IDs: ' , l_ctr.

When activating this program I get the error: "The data object OUTPUT-MT_MAPPING_OUT does not have a component SET-SET_ELEMENT_01

But the structure of the Proxy looks like this:

ZCO_MI_MAPPING_OUT

Method Execute Asynchronous

Importing OUTPUT

MT_MAPPING_OUT

SET

SET_ELEMENT_01

SET_ELEMENT_02

I gernereated and activated the proxies several times, which did not solve the problem. I switched also in the ABAP Coding between capital an dsmall letters...

I have no idea where the problem is, it looks all fine for me.

Hope you can help me there.

Thanks,

Sebastian

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sebastian,

It's because you reference the wrong structure. It's a bit tricky to get the right one, but look into generation tab in SPROXY. Here you can see, which data elements has been created, and using the right one of these is the key. Notice you can foreward navigate into the different structures, which can help you.

Kind regards

Mikkel

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

the problem was that SET was of complex type....

cheers,

Sebastian

former_member181962
Active Contributor
0 Kudos

Hi Sebastian.

Double Click on the ZCO_MI_MAPPING_OUT structure(Or open the structure in SE11 transaction) and navigate to the element in question.

keep duble clicking on MT_MAPPING_OUT and then on then on SET to see if your element is there or not.

Regards,

Ravi

Former Member
0 Kudos

Hi,

Did you activated all the objects[Message Type,Data Type,Interfac...] in XI before creating this proxy.

Thanks

Sudharshan