Skip to Content

Client proxy.. passing internal table to output.

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 04:39 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 03:53 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.