Skip to Content
0
Former Member
Dec 31, 2007 at 06:12 AM

Proxy to File

25 Views

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...