cancel
Showing results for 
Search instead for 
Did you mean: 

Proxy to File

Former Member
0 Kudos

Hi eXperts,

I am developing an ABAP Proxy scenario where I have to get data from the Internal table and then send to a Legasy system as a FLAT FILE.

I have developed a sample code and providing in SDN to get me corrected if any errors.

Proxy to File Data Structure.

DT_S

ROOT 1-un

SI 1-1

S2 1-1

S3 1-1

MT_S

MI_S

Client Proxy Structure

^Class ZXX_CO_MI_S

^METHOD EXECUTE_ASYNCHRONOUS

^IMPORTING OUTPUT ZXX_MT_S

^MT_S ZXX_DT_S

^ROOT

S1 STRING

S2 STRING

S3 STRING

ZProgram.

Tables : lfa1.

Parameters : P_Date type lfa1-aedat.

  • Types for export parameters.

DATA : Pur_order type Zxx_mt_s.

*For calling class and exceptions.

Data : client_proxy type ref to ZXX_CO_MI_S,

Sys_exception type ref to CX_AI_SYSTEM_FAULT,

APPL_Exception type ref to AI_APPLICATION_FAULT.

Data : Begin of it_out occurs 0,

Lifnr like lfa1-lifnr,

Name1 like lfa1-name1,

Land1 like lfa1-land1,

End of it_itab.

Select lifnr, name1, land1 from lfa1 into table it_itab where aedat = p_date.

Loop at it_itab.

Pur_order-mt_s-root-s1 = it_itab-lifnr.

Pur_order-mt_s-root-s2 = it_itab-name.1

Pur_order-mt_s-root-s3 = it_itab-land1.

Clear it_itab.

Endloop.

*Create Proxy object and call method.

CREATE OBJECT CLIENT_PROXY().

TRY

CALL METHOD CLIENT_PROXY -> EXECUTE_ASYCHRONOUS

EXPORTING

OUTPUT = PUR_ORDER.

If sy-subrc = 0.

Write: / ‘Method called successfully.’

Else.

Write: / ‘Method called failed.’

Endif.

*exception handling.

CATCH CX_AI_SYSTEM_FAULT INTO SYS_EXCEPTION.

Write : / ‘System fault encountered.’

Write : / SYS_EXCEPTION -> ERROR TEXT.

RETURN.

CATCH CX_AI_APPLICATION_FAULT INTO APPL_EXCEPTION.

Write : / ‘Application fault encountered.’

RETURN.

ENDTRY.

COMMIT WORK.

Please Very Urgent.

thanks in advance...

Accepted Solutions (1)

Accepted Solutions (1)

moorthy
Active Contributor
0 Kudos

Hope you have gone thru this blog-

/people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy

code looks ok..but need to check during runtime,

Rgds Moorthy

Former Member
0 Kudos

Hi Moorthy,

Thanks for your reply.

As per the given blog it will work perfectly if we are having only one record.

But in case of Internal table we have to handle multiple records at a time.

I think you have understood my priblem.

Former Member
0 Kudos

HI Swapna,

Thats what I suggested to u...U can try to check ur code by running the report and if it is giving u the proper result than ur code is perfectly OK.

Just let me know the result of ur code.

I also feel ur code looks fine to me.

Thnaks and regards,

Chirag

Former Member
0 Kudos

u r not passing the itab data to proxy.

pass the data to proxy before calling method..

client_proxy-MT_S ZXX_DT_S-ROOT[] = it_tab[].

*Create Proxy object and call method.

CREATE OBJECT CLIENT_PROXY().

TRY

CALL METHOD CLIENT_PROXY -> EXECUTE_ASYCHRONOUS

EXPORTING

OUTPUT = PUR_ORDER.

If sy-subrc = 0.

Write: / ‘Method called successfully.’

Else.

Write: / ‘Method called failed.’

Endif.

*exception handling.

CATCH CX_AI_SYSTEM_FAULT INTO SYS_EXCEPTION.

Write : / ‘System fault encountered.’

Write : / SYS_EXCEPTION -> ERROR TEXT.

RETURN.

CATCH CX_AI_APPLICATION_FAULT INTO APPL_EXCEPTION.

Write : / ‘Application fault encountered.’

RETURN.

ENDTRY.

COMMIT WORK.

Please Very Urgent.

thanks in advance...

Former Member
0 Kudos

Hi Chirag Gohil,

Thak you for your suggestion.

But my problem is the scenario is in developing stage and I got a duobt that's why I posted early.

Defenitely I will send you a message after testing . It might be by today evening.

Thanks and regards,

Swapna

Answers (1)

Answers (1)

Former Member
0 Kudos

HI,

1) First check the syntax.

2) run ur proxy report and check whether the strutucre got field in or not in SXMB_MONI

U will come to know about ur required output.

Thnx

Chirag