cancel
Showing results for 
Search instead for 
Did you mean: 

need ABAP coding in Proxy TO File scenario

Former Member
0 Kudos

Hi friends,

i need to do the Proxy to file scenario.. for this.. i want to retrive the data from R/3 system and load the data into the class which we defined in SPROXY (Outbound class) ..

so, can any one give me the exact coding... for this.. how can we move the data from our executable program to Outbound Class structure....

helpful answers will be appriciated..

Thanks

Babu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

<i>i want to retrive the data from R/3 system and load the data into the class which we defined in SPROXY (Outbound class) ..</i>

-->

data: cproxy type ref to ZCO_MI_MKPROXY2RFC_OUT,

itab_out type ZMT_MKPROXY2RFC_OUT,

itab_in type ZMT_MKPROXY2RFC_RES.

TYPES: BEGIN OF values,

carrid TYPE spfli-carrid,

connid TYPE spfli-connid,

END OF values.

DATA: progname like sy-repid,

dynnum like sy-dynnr,

dynpro_values TYPE TABLE OF dynpread,

field_value LIKE LINE OF dynpro_values,

values_tab type table of values.

progname = sy-repid.

dynnum = sy-dynnr.

CLEAR: field_value, dynpro_values.

start-of-selection.

parameter: p_carrid like sflight-carrid obligatory value check,

p_connid like sflight-connid.

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

EXPORTING

tabname = 'DEMOF4HELP'

fieldname = 'carrid'

dynpprog = progname

dynpnr = dynnum

dynprofield = 'p_carrid'.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = progname

DYNUMB = dynnum

TABLES

DYNPFIELDS = dynpro_values

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

read table dynpro_values index 1 into field_value.

SELECT carrid connid

FROM spfli

INTO CORRESPONDING FIELDS OF TABLE values_tab

WHERE carrid = field_value-fieldvalue.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'connid'

DYNPPROG = progname

DYNPNR = dynnum

DYNPROFIELD = 'CONNECTION'

TABLES

VALUE_TAB = values_tab

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

TRY.

CREATE OBJECT cproxy.

itab_out-MT_MKPROXY2RFC_OUT-CARRID = p_carrid.

itab_out-MT_MKPROXY2RFC_OUT-CONNID = p_connid.

progname = sy-repid.

dynnum = sy-dynnr.

CALL METHOD cproxy->EXECUTE_SYNCHRONOUS

EXPORTING

OUTPUT = itab_out

IMPORTING

INPUT = itab_in

CATCH CX_AI_SYSTEM_FAULT .

write: itab_in-MT_MKPROXY2RFC_RES-CURRENCY,itab_in-MT_MKPROXY2RFC_RES-FLDATE,

itab_in-MT_MKPROXY2RFC_RES-PLANETTYPE,itab_in-MT_MKPROXY2RFC_RES-PRICE,

above code reads carrid and connid from screen and the same are passed to proxy..

hope you can relate it to your requirement....

itab_in-MT_MKPROXY2RFC_RES-SFATSMAX,itab_in-MT_MKPROXY2RFC_RES-SEATSOCC,

itab_in-MT_MKPROXY2RFC_RES-STATUS.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Babu,

For Outbound Proxy, what you can do is:

<b>Insinde your class</b>

1. Declare all Data types and internal tables.

2. Select all your desired data into your internal table.

2. Now pass this data (internal table data) to <b>OUTBOUND PROXY</b>.

<b>Example:</b>

<b>DATA:</b> outb_prxy <b>TYPE REF TO</b> <Class Name>.

<b>CREATE OBJECT</b> outb_prxy.

<b>DATA:</b> it_customer TYPE <Output Structure Name>.

<b>TRY.</b>

<<b>Note:--</b> Select all your data here and pass it your internal table <b>it_customer</b>>

<b>CALL METHOD</b> outb_prxy->execute_asynchronous

<b>EXPORTING</b>

output = <b>it_customer</b>.

<b>COMMIT WORK.</b>

<b>CATCH</b> cx_ai_system_fault .

<b>DATA:</b> faultmsg TYPE REF TO cx_ai_system_fault .

<b>CREATE OBJECT</b> faultmsg.

<b>WRITE :</b> faultmsg->errormessage.

<b>ENDTRY.</b>

I hope this will help you.

Regards,

Sarvesh

santhosh_kumarv
Active Contributor
0 Kudos

Hi BABU,

This Blog has the code that u are lookin for..

<a href="/people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy Proxies in XI - Client Proxy</a> By Ravikumar Allampalam

Also have a look at this blogs

<a href="/people/sravya.talanki2/blog/2006/07/28/smarter-approach-for-coding-abap-proxies Approach for coading ABAP Proxies</a> By Sravya Talanki

<a href="/people/vijaya.kumari2/blog/2006/01/26/how-do-you-activate-abap-proxies do you activate ABAP Proxies?</a> By Vijayakumari

Regards

San

<a href=" to set the thread to solved when you have received a solution</a>

Where There is a <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/weblogs?blog=/weblogs/topic/16">blog</a> there is a Way.