Skip to Content
-3

How to get Net Quantity from Weighbridge System through Web service and update the same in Delivery

Hi Abapers,

Please help me on this. I need to get Net Quantity from Weighbridge System through Web service. I have the url of the webservice. I need to call it from abap program. But i do not know how to get the quantity from there which will be there in Weighbridge System. I need to fetch the quantity from there so that i could update the quantity while creating delivery from vl01n. For this i am using MV50AFZ1. Infact for this whole scenario i am writing the code there. I searched a lot but could not get desired solution. Please help me as i am not quite sure how to proceed with this requirement.

Regards,

Arijit.

Add comment
10|10000 characters needed characters exceeded

  • If I understand well, your issue is mainly that you don't know how to parse the web service response. Can't you post one response, and tell us where the "net quantity" is in the response?

  • I am using this abap code to call the web services. Bit i do not know how to get the quantity from there.

    DATA: SMS_TEXT TYPE STRING,
    SMS_TEXT_UTF TYPE STRING,
    SEND_STRING TYPE STRING.

    DATA: W_STRING TYPE STRING ,
    W_RESULT TYPE STRING ,
    R_STR TYPE STRING .

    DATA: RESULT_TAB TYPE TABLE OF STRING.

    DATA: HTTP_CLIENT TYPE REF TO IF_HTTP_CLIENT.

    SEND_STRING = 'http://150.0.48.161:120/RailWeighBridgeService/RailWeighBridgeService.svc?wsdl'.

    CALL METHOD CL_HTTP_CLIENT=>CREATE_BY_URL
    EXPORTING
    URL = SEND_STRING
    IMPORTING
    CLIENT = HTTP_CLIENT
    EXCEPTIONS
    ARGUMENT_NOT_FOUND = 1
    PLUGIN_NOT_ACTIVE = 2
    INTERNAL_ERROR = 3
    OTHERS = 4.

    IF SY-SUBRC = 0.
    CALL METHOD HTTP_CLIENT->SEND
    EXCEPTIONS
    HTTP_COMMUNICATION_FAILURE = 1
    HTTP_INVALID_STATE = 2.

    CALL METHOD HTTP_CLIENT->RECEIVE
    EXCEPTIONS
    HTTP_COMMUNICATION_FAILURE = 1
    HTTP_INVALID_STATE = 2
    HTTP_PROCESSING_FAILED = 3.
    IF SY-SUBRC = 0.

    W_RESULT = HTTP_CLIENT->RESPONSE->GET_CDATA( ).
    REFRESH RESULT_TAB .
    SPLIT W_RESULT AT CL_ABAP_CHAR_UTILITIES=>CR_LF INTO TABLE RESULT_TAB .
    LOOP AT RESULT_TAB INTO W_RESULT.
    WRITE :/ W_RESULT.
    ENDLOOP.
    ENDIF.
    ENDIF.

  • As ever:

    What results do you expect?

    What results are you getting?

    Have you tried running in debug, and ensuring all return codes are zero?

    "Bit i do not know how to get the quantity from there." doesn't really say anything useful.

  • Get RSS Feed

2 Answers

  • Nov 15, 2016 at 03:42 AM

    Do a Google search for "sap consuming web services" or "how to call external webservice from sap" you will get plenty of step by step help. What you posted is the service definition.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 16, 2016 at 12:02 PM

    Hi Everyone,

    After many understandings i got these results.

    I created a Enterprise Service from package. It is under Service Consumer. Then from TCode 'SOAMANAGER' i created the port.

    These are the information i would like to share.

    Service Consumer (external definition) : IRailWeighBridgeService

    Proxy Name : ZRAIL_RAKE_WSCO_IRAIL_WEIGH_BR

    Prefix : ZRAIL_RAKE_WS

    Class: ZRAIL_RAKE_WSCO_IRAIL_WEIGH_BR

    Here is the code i am using but its giving a big dump. Please help me out. All the external and internal message are attached.

    TABLES: ZRAKE_WEB_SAP.
    DATA: EXC TYPE REF TO CX_ROOT.
    DATA: MSG TYPE STRING.

    * declare a reference to your proxy consumer object
    DATA PROXY_TEST TYPE REF TO ZPREFIX_WS1CO_IRAIL_WEIGH_BRID.

    DATA: INPUT TYPE ZPREFIX_WS1IRAIL_WEIGH_BRIDGE1,
    OUTPUT TYPE ZPREFIX_WS1IRAIL_WEIGH_BRIDGE.

    DATA: LT_RAKE TYPE TABLE OF ZRAIL_RAKE_WSRAIL_WEIGH_BRIDGE WITH HEADER LINE.
    * DATA: LT_RAKE TYPE STANDARD TABLE OF TY_RAKE WITH HEADER LINE.
    DATA: LW_ZRAKE_WEB_SAP TYPE ZRAKE_WEB_SAP.

    TRY.
    *** instantiate the object reference
    ** IF PROXY_TEST IS NOT BOUND.
    ** CREATE OBJECT PROXY_TEST TYPE ZPREFIX_WS1CO_IRAIL_WEIGH_BRID.
    ** ENDIF.

    * Instantiate the proxy class providing the Logical port name
    CREATE OBJECT PROXY_TEST
    EXPORTING
    LOGICAL_PORT_NAME = 'ZRAIL'.

    LOOP AT LT_RAKE.
    CLEAR ZRAKE_WEB_SAP.

    SELECT SINGLE * FROM ZRAKE_WEB_SAP INTO LW_ZRAKE_WEB_SAP
    WHERE RAKE_ID EQ LT_RAKE-RAKE_ID .

    IF SY-SUBRC = 0.
    INPUT-RAKE_ID = LW_ZRAKE_WEB_SAP-RAKE_ID.
    ENDIF.
    ENDLOOP.

    CALL METHOD PROXY_TEST->GET_DATA_FROM_RAIL_WEIGH_BRIDG
    EXPORTING
    INPUT = INPUT
    IMPORTING
    OUTPUT = OUTPUT.
    ENDTRY.

    Please help me with the correct logic to overcome this issue.

    Regards,

    input-msg-2.jpginput-msg-1.jpginternal-view.jpgexternal-view.jpgoutput-msg-1.jpgoutput-msg-2.jpgtable-structure-external-view.jpgtable-structure-internal-view.jpgArijit.
    Add comment
    10|10000 characters needed characters exceeded