20170401 ABAP calls CIS WebService

Source: Internet
Author: User

Problem:

SAP ABAP

SRM Java tuning WebService not pass,

CIS Java side of the WebService can pass,

Why?

Key
Request Header,
Problems with the system framework,

LF: Because of the problem with the request head.
CX: What is the difference between a request header?

Lf:r3 sent out the request, the header is very complex, probably not meet the requirements of SRM,
This is the beginning of the Pogo would a system, I do not know why it will appear, and other SAP developers do interface does not have this problem, have always wanted to find the reason, but because of lack of attachment, and the ability to lack of success find reason, may be some system framework problems,

ABAP "-" Java or listening convenience, from a technical point of view, a lot of feasible,

 

FUNCTION zmlscp1_fr0008.*"----------------------------------------------------------------------*"*"Local Interface:*"Importing*"VALUE (I_ebeln) TYPE Ebeln OPTIONAL*"VALUE (I_MATNR) TYPE Matnr OPTIONAL*"Exporting*"VALUE (O_statu) TYPE CHAR1*"VALUE (o_msg) TYPE CHAR255*"TABLES*"Ot_resource STRUCTURE Zsrm_resource*"----------------------------------------------------------------------*&flag0Manually1-automatic Data:l_tabix TYPE SY-Tabix.  Data:lv_flag TYPE C.  Data:lv_con TYPE STRING.  Data:error TYPE REF to Cx_ai_system_fault. Data:prxy TYPE REF to Zco_request_imatnr_resource_se."Proxy NameData:z_in TYPE ZREQUEST8."Request inData:z_out TYPE ZRESPONSE8."Request outdata:o_cx TYPE REF to Cx_root.  Data:o_error TYPE REF to Cx_st_error. Types:begin of Ty_re, BACKUP1 TYPE STRING,"Alternate Field 1BACKUP2 TYPE STRING,"Alternate Field 2BACKUP3 TYPE STRING,"Alternate Field 3BACKUP4 TYPE STRING,"Alternate Field 4BACKUP5 TYPE STRING,"Alternate Field 5Ebeln TYPE STRING,"Purchase order numberEbelp TYPE STRING,"Purchase order line item numberLifnramount TYPE STRING,"Vendor Inventory QuantityMAKTX TYPE STRING,"Item DescriptionMatnr TYPE STRING,"Item CodeProamount TYPE STRING,"Production QuantityStoreamount TYPE STRING,"stock quantity of line side warehouse* Prodate TYPE DATUM,"Production DateEND of Ty_re. Data:gt_re TYPE Standard TABLE of ty_re, wa_re like Line of Gt_re.*&Job user IF SY-uname EQ"'. Lv_flag='1'.    ELSE. Lv_flag='0'.  ENDIF. Concatenate'<in0>'Lv_flag'</in0>' '<in1>'I_ebeln'</in1>' '<in2>'I_matnr'</in2>'Into Lv_con.*&s1.call ProxyGetData via CIS* Z_in-request_data ='<?xml version= "1.0" encoding= "UTF-8"?>'&& Lv_flag &&'</in0>'. Concatenate'<?xml version= "1.0" encoding= "UTF-8"?>'Lv_con''Into z_in-Request_data.  CLEAR ERROR.      TRY. CREATE OBJECT prxy Exporting Logical_port_name='Zmlscp_get_resource'. Call METHOD prxy-REQUEST Exporting INPUT=z_in Importing OUTPUT=Z_out.      CATCH Cx_ai_system_fault into ERROR. O_statu='E'. O_msg= error->ERRORTEXT.  RETURN. Endtry.*&1.1  isIt OK?IF z_out-return_code ='E'. O_statu='E'. O_msg= z_out-Return_desc.*RETURN. ENDIF.* fortest:if z_out-Return_data is INITIAL. Concatenate'<?xml version= "1.0" encoding= "UTF-8"?>'    ''    '<MLMatnrResource><backup1/><backup2/><backup3/><backup4/><backup5/> <ebeln>4800064316</ebeln><ebelp>00010</ebelp><lifnramount/><maktx>a-Class refrigerator type sticker _c0414.6-1 (a</maktx>'    '<matnr>000000000800013563</matnr><proAmount/><storeAmount>12.0</storeAmount> </MLMatnrResource>'    '<MLMatnrResource><backup1/><backup2/><backup3/><backup4/><backup5/> <ebeln>4800064316</ebeln><ebelp>00020</ebelp><lifnramount/><maktx>a-Class refrigerator type sticker _c0414.6-1 (a</maktx>'    '<matnr>000000000800013563</matnr><proAmount/><storeAmount>12.0</storeAmount> </MLMatnrResource>'    '<MLMatnrResource><backup1/><backup2/><backup3/><backup4/><backup5/> <ebeln>4800064317</ebeln><ebelp>00010</ebelp><lifnramount/><maktx>a-Class refrigerator type sticker _c0414.6-1 (a</maktx>'    '<matnr>000000000800013563</matnr><proAmount/><storeAmount>12.0</storeAmount> </MLMatnrResource>'    '</out>'Into z_out-Return_data. ENDIF.*&s2.transfer XML IF z_out-return_data is not INITIAL."Business System return message is not emptyTRY.        Clear:gt_re,wa_re. Call Transformation Zml_xml_trans02"Zml_xml_resourceSOURCE XML z_out-return_data RESULT Mlmatnrresource= Gt_re."ot_resource[]IF SY-SUBRC NE0. O_statu='E'. O_msg='XML parsing failed! '.        RETURN.      ENDIF.        CATCH Cx_st_error into O_error. O_statu='E'. O_msg= o_error->Get_text ().  Endtry.    ELSE. O_statu='E'. O_msg='The returned result is empty! '. ENDIF.*&S3.data Save to Zsrm_resource LOOP at Gt_re into Wa_re. MOVE-corresponding wa_re to Ot_resource. Ot_resource-zdatum = sy-DATUM. Ot_resource-ZCPUTM = sy-Uzeit. Ot_resource-usnam = sy-UNAME. Ot_resource-zflag =Lv_flag. APPEND Ot_resource.*MODIFY gt_re from Wa_re.*CLEAR wa_re. Endloop.*TRY CHECK ot_resource[] is not INITIAL.    MODIFY Zsrm_resource from TABLE Ot_resource. IF SY-SUBRC EQ0.      COMMIT work and WAIT.      DESCRIBE TABLE ot_resource LINES L_tabix. O_statu='S'. O_msg='successfully deposited Zsrm_resource'&& L_tabix &&'record! '.      ELSE.      ROLLBACK work. O_statu='E'. O_msg='data saved to Zsrm_resource table failed! '. ENDIF. Endfunction.

20170401 ABAP calls CIS WebService

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.