on 06-17-2008 12:00 PM
Hi friends,
I have created a proxy-JDBC scnario..
For this i created a datatype with 2 fields..
DT_Proxy_Outbound as complex type and 2 elements..and after that i have created a proxy class
ZCO_MI_PROXY_OUTBOUND (Proxy class)
ZMT_PROXY_OUTBOUND(structure)
and i have writen a code in abap report to pass data to output parameter..
but output parameter is of line type not a table type...
so it is taking onley one value but not entire internal table to output parameter.
i am including mycode here.
REPORT ZTEST_ABAP_PROXY.
DATA PRXY TYPE REF TO ZCO_MI_PROXY_OUTBOUND.
DATA: BEGIN OF I_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
ERNAM LIKE MARA-ERNAM,
END OF I_MARA.
CREATE OBJECT PRXY.
DATA IT TYPE ZMT_PROXY_OUTBOUND OCCURS 0 WITH HEADER LINE.
TRY.
SELECT MATNR ERNAM INTO TABLE I_MARA FROM MARA UP TO 10 ROWS.
LOOP AT I_MARA.
IT-MT_PROXY_OUTBOUND-MATNR = I_MARA-MATNR.
IT-MT_PROXY_OUTBOUND-ERNAM = I_MARA-ERNAM.
APPEND IT.
ENDLOOP.
CALL METHOD PRXY->EXECUTE_ASYNCHRONOUS
EXPORTING
OUTPUT = IT.
COMMIT WORK.
CATCH CX_AI_SYSTEM_FAULT .
DATA FAULT TYPE REF TO CX_AI_SYSTEM_FAULT .
CREATE OBJECT FAULT.
WRITE 😕 FAULT->ERRORTEXT.
ENDTRY.
where should i change structure so that output can accept total internal table rather than line item.
Thnaks and Regards
Vijay
Hi Vijay,
Try using the following code. I have used the variable ZDT_PROXY_OUTBOUND_TAB , which should appear in the zproxy transaction. The name may not be exactly correct, so please check and change accordingly. Check parameters of execute- asynchronous method. double click on associated type of output (ZMT..). You will get controller and Message type MT...Click on component type - ZDT.., you will get controller and a recordset( the name you have mentioned in your data type sender side). The corresponding component type would be the table ZDT_PROXY_OUTBOUND_TAB. Hope you understand and change accordingly.
REPORT ZTEST_ABAP_PROXY.
TABLES : MARA.
DATA PRXY TYPE REF TO ZCO_MI_PROXY_OUTBOUND.
DATA: BEGIN OF I_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
ERNAM LIKE MARA-ERNAM,
END OF I_MARA.
DATA : REC_OUTPUT TYPE ZDT_PROXY_OUTBOUND_TAB,
WA_REC_OUTPUT LIKE LINE OF REC_OUTPUT,
MARA_OUTPUT TYPE ZMT_PROXY_OUTBOUND.
CREATE OBJECT PRXY.
TRY.
SELECT MATNR ERNAM INTO TABLE I_MARA FROM MARA UP TO 10 ROWS.
LOOP AT I_MARA.
WA_REC_OUTPUT-MATNR = I_MARA-MATNR.
WA_REC_OUTPUT-ERNAM = I_MARA-ERNAM.
INSERT WA_REC_OUTPUT INTO TABLE REC_OUTPUT.
CLEAR : WA_REC_OUTPUT, I_MARA.
ENDLOOP.
MARA_OUTPUT-MT_PROXY_OUTBOUND-RECORDSET = REC_OUTPUT.
CALL METHOD PRXY->EXECUTE_ASYNCHRONOUS
EXPORTING
OUTPUT = MARA_OUTPUT.
COMMIT WORK.
CATCH CX_AI_SYSTEM_FAULT .
DATA FAULT TYPE REF TO CX_AI_SYSTEM_FAULT .
CREATE OBJECT FAULT.
WRITE 😕 FAULT->ERRORTEXT.
ENDTRY.
-
-Regards,
Shamly
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vijay,
You need to change the occurance of data type in XI to 0....to Outbound,
so that when you generate Proxy class in R/3 a table type structure will be generated as
ZMT_PROXY_OUTBOUND_DO_TAB (Proxy Table Type) which can hold 'N' number of records as
Internal table.
Change the Data Type occurance and regenarate the Proxy class in R/3 and check.
You will find:
ZCO_MI_PROXY_OUTBOUND (Proxy class)
ZMT_PROXY_OUTBOUND(structure)
ZMT_PROXY_OUTBOUND_DO_TAB (Proxy Table Type) -- This one extra
Thanks,
Kishore.
Hi Vijay,
I think you need to do changes in Message Interface.
Number of occurrence should be 0..Unbounded for the root element. Then in mapping need to map the root elements.
Somewhere I read about this..not sure.. let me know if it works fine..
Regards,
Vivek LR
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.