Skip to Content
author's profile photo Former Member
Former Member

Can we make a BDC program as a webservice

Hi All,

Can we write a BDC program in RFC Function Module and access it through web service.

We have a requirement to create a Return Order, for that we have recorded the Va01 transaction for return order and included the same recorded code in RFC Function module and also created web service for it. But when we tried to access through webservice, it is showing the following error

"Call to returned http code 500 (Internal Server Error) with unacceptable content type (text/html; charset=utf-8).

><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode> soap:Server </faultcode><faultstring xml:lang="en"> RABAX occurred on server side </faultstring><detail><sap:Rabax xmlns:sap="http://www.sap.com/webas/710/soap/runtime/abap/fault/generic"><MESSAGE>Access via 'NULL' object reference not possible.</MESSAGE><SYMSGID>VX</SYMSGID><SYMSGTY>S</SYMSGTY><SYMSGNO>206</SYMSGNO><SYMSGV1>TextEditControl</SYMSGV1><SYMSGV2></SYMSGV2><SYMSGV3></SYMSGV3><SYMSGV4></SYMSGV4><SYREPID>SAPLV70T</SYREPID><SYTCODE>VA01</SYTCODE><SYDYNNR>2000</SYDYNNR><SYUNAME>DIK</SYUNAME><SYMANDT>100</SYMANDT><SYLANGU>E</SYLANGU><SYECODE>558</SYECODE><SYHOST>sapdvp</SYHOST><SYSYSID>SD1</SYSYSID><SYOPSYS>Windows NT</SYOPSYS><SYDBSYS>MSSQL</SYDBSYS><SYSAPRL>700</SYSAPRL><SYXPROG>SAPCNVE</SYXPROG><SYXFORM>CONVERSION_EXIT</SYXFORM><SYDATUM>20111104</SYDATUM><SYUZEIT>153001</SYUZEIT><SYETEXT>RABAX_STATE</SYETEXT><ERRORCODE>OBJECTS_OBJREF_NOT_ASSIGNED</ERRORCODE><PATHTRANS>/sap/bc/srt/rfc/sap/zcom_create_return_bdc/100/zcom_create_return_bdc/zcom_create_return_bdc</PATHTRANS><MESSAGE>Access via 'NULL' object reference not possible.</MESSAGE><ERRORCODE>OBJECTS_OBJREF_NOT_ASSIGNED</ERRORCODE></sap:Rabax></detail></soap:Fault></soap:Body></soap:Envelope>"

When we execute the same RFC from SAP SE37 T-Code , it is working fine but same not working from web service .

One more thing If anybody knows the standard BAPI or Function Module to create the Sales Return Order please do post .

Thanks in advance ,

Chaitanya

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Nov 07, 2011 at 04:49 PM

    Hi Chaitanya,

    For the first problem - objects not assigned, refer the following link:

    Link: [ST22: OBJECTS_OBJREF_NOT_ASSIGNED;

    I feel you are missing some parameter in your connection string. Your BASIS Team should help you to resolve this issue.

    For the second problem - BAPI for Sales Order Return, even I would recommend you to use a BAPI instead of a BDC. Since, you are using T. Code VA01, I believe 'BAPI_SALESORDER_CREATE' should be the right one. I'm not sure about the BAPI as I have never worked on that scenario.

    Regards,

    Pranav.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 09, 2011 at 12:11 PM

    Hi Pranav,

    created rfc function module in sap using se37 t-code for sales return order and i am using bdc performs in it to create return order with reference order and it is working fine when we testing in sap, but when we run the same rfc function module

    through webservices it giving the below error

    (Call to returned http code 500 (Internal Server Error) with unacceptable content type (text/html; charset=utf-8).

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode> soap:Server </faultcode><faultstring xml:lang="en"> RABAX occurred on server side </faultstring><detail><sap:Rabax xmlns:sap="http://www.sap.com/webas/710/soap/runtime/abap/fault/generic"><MESSAGE>Access via 'NULL' object reference not possible.</MESSAGE><SYMSGID>VX</SYMSGID><SYMSGTY>S</SYMSGTY><SYMSGNO>206</SYMSGNO><SYMSGV1>TextEditControl</SYMSGV1><SYMSGV2></SYMSGV2><SYMSGV3></SYMSGV3><SYMSGV4></SYMSGV4><SYREPID>SAPLV70T</SYREPID><SYTCODE>VA01</SYTCODE><SYDYNNR>2000</SYDYNNR><SYUNAME>DIK</SYUNAME><SYMANDT>100</SYMANDT><SYLANGU>E</SYLANGU><SYECODE>558</SYECODE><SYHOST>sapdvp</SYHOST><SYSYSID>SD1</SYSYSID><SYOPSYS>Windows NT</SYOPSYS><SYDBSYS>MSSQL</SYDBSYS><SYSAPRL>700</SYSAPRL><SYXPROG>SAPCNVE</SYXPROG><SYXFORM>CONVERSION_EXIT</SYXFORM><SYDATUM>20111109</SYDATUM><SYUZEIT>105717</SYUZEIT><SYETEXT>RABAX_STATE</SYETEXT><ERRORCODE>OBJECTS_OBJREF_NOT_ASSIGNED</ERRORCODE><PATHTRANS>/sap/bc/srt/rfc/sap/zrfc/100/zrfc/zrfc</PATHTRANS><MESSAGE>Access via 'NULL' object reference not possible.</MESSAGE><ERRORCODE>OBJECTS_OBJREF_NOT_ASSIGNED</ERRORCODE></sap:Rabax></detail></soap:Fault></soap:Body></soap:Envelope>).

    i am dubuged that function module , it is giving error in call transaction perform in bdccode. remaining performs are working fine so just give help me how to solve that type of errors in webservice.

    what does meaning of " Access via 'NULL' object reference not possible.</MESSAGE><ERRORCODE>OBJECTS_OBJREF_NOT_ASSIGNED</ERRORCODE></sap:Rabax></detail></soap:Fault></soap:Body></soap:Envelope>)".

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Pranav Mandelia

      Hi Pranav,

      Okay. Kindly let me know how to run rfc function module in background because we have call transaction perform in RFC function module and I am posting BDC code that is using inside RFC function module.

      TYPES:BEGIN OF t_bdcdata,

      program TYPE bdc_prog,

      dynpro TYPE bdc_dynr,

      dynbegin TYPE bdc_start,

      fnam TYPE fnam_____4,

      fval TYPE bdc_fval,

      END OF t_bdcdata.

      DATA:wa_bdcdata TYPE t_bdcdata,

      it_bdcdata TYPE TABLE OF t_bdcdata.

      DATA:auart_001 TYPE bdc_fval,

      vkorg_002 TYPE bdc_fval,

      vtweg_003 TYPE bdc_fval,

      spart_004 TYPE bdc_fval,

      vbeln_005 TYPE bdc_fval,

      kunwe_006 TYPE bdc_fval,

      bstkd_007 TYPE bdc_fval,

      augru_010 TYPE bdc_fval,

      bsark_011 TYPE bdc_fval,

      augru_019 TYPE bdc_fval,

      bsark_020 TYPE bdc_fval.

      DATA:v_subrc TYPE sy-subrc.

      MOVE auart TO auart_001.

      MOVE vkorg TO vkorg_002.

      MOVE vtweg TO vtweg_003.

      MOVE spart TO spart_004.

      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

      EXPORTING

      input = vbeln

      IMPORTING

      output = vbeln.

      MOVE vbeln TO vbeln_005.

      MOVE kunwe TO kunwe_006.

      MOVE bstkd TO bstkd_007.

      MOVE augru TO augru_010.

      MOVE bsark TO bsark_011.

      MOVE augru TO augru_019.

      MOVE bsark TO bsark_020.

      wa_bdcdata-program = 'SAPMV45A'.

      wa_bdcdata-dynpro = '0101'.

      wa_bdcdata-dynbegin = 'X'.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'BDC_CURSOR'.

      wa_bdcdata-fval = 'VBAK-AUART'.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'BDC_OKCODE'.

      wa_bdcdata-fval = '=COPY'.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'VBAK-AUART'.

      wa_bdcdata-fval = auart_001.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'VBAK-VKORG'.

      wa_bdcdata-fval = vkorg_002.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'VBAK-VTWEG'.

      wa_bdcdata-fval = vtweg_003.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'VBAK-SPART'.

      wa_bdcdata-fval = spart_004.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-program = 'SAPLV45C'.

      wa_bdcdata-dynpro = '0100'.

      wa_bdcdata-dynbegin = 'X'.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'BDC_OKCODE'.

      wa_bdcdata-fval = '=UEBR'.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'BDC_CURSOR'.

      wa_bdcdata-fval = 'LV45C-VBELN'.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'LV45C-VBELN'.

      wa_bdcdata-fval = vbeln_005.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-program = 'SAPLJ3AD'.

      wa_bdcdata-dynpro = '2010'.

      wa_bdcdata-dynbegin = 'X'.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'BDC_OKCODE'.

      wa_bdcdata-fval = '=ENT1'.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'BDC_CURSOR'.

      wa_bdcdata-fval = 'J_3ASZFH-BSTKD'.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'J_3ASZFH-KUNWE'.

      wa_bdcdata-fval = kunwe_006.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'J_3ASZFH-BSTKD'.

      wa_bdcdata-fval = bstkd_007.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'J_3ASZFH-AUGRU'.

      wa_bdcdata-fval = augru_010.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'J_3ASZFH-BSARK'.

      wa_bdcdata-fval = bsark_011.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-program = 'SAPLJ3AD'.

      wa_bdcdata-dynpro = '2010'.

      wa_bdcdata-dynbegin = 'X'.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'BDC_OKCODE'.

      wa_bdcdata-fval = '=SICH'.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'BDC_CURSOR'.

      wa_bdcdata-fval = 'J_3ASZFH-BSTKD'.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'J_3ASZFH-AUGRU'.

      wa_bdcdata-fval = augru_019.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      wa_bdcdata-fnam = 'J_3ASZFH-BSARK'.

      wa_bdcdata-fval = bsark_020.

      APPEND wa_bdcdata TO it_bdcdata.

      CLEAR wa_bdcdata.

      CALL FUNCTION 'ABAP4_CALL_TRANSACTION'

      EXPORTING

      tcode = 'VA01'

      skip_screen = ''

      mode_val = 'N'

      update_val = 'A'

      IMPORTING

      subrc = subrc

      TABLES

      using_tab = it_bdcdata

      • SPAGPA_TAB =

      mess_tab = messtab

      EXCEPTIONS

      call_transaction_denied = 1

      tcode_invalid = 2

      OTHERS = 3

      .

      IF sy-subrc <> 0.

      subrc = sy-subrc.

      EXIT.

      ENDIF.

      so i am using BDC code to create order instead of function module and converted bdccode into rfc function module,

      just help how to do with above code.

      With Regards,

      Krishna Chaitanya

  • Posted on Nov 09, 2011 at 12:51 PM

    Hi Chaitanya,

    I think you kept the code directly in fm.Instead of that keep your code in a report and use memory concept and collect the return messages.This will work.Did you tries with standard bapi for va01.

    Regards,

    Madhu.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 09, 2011 at 02:54 PM

    Hi Madhu,

    I tried with standard BAPI and able to create return order. But the problem is coming with one of the pricing conditions. We have scale based pricing ie., if customer bought 1 piece he will be given 30% discount, for >100 pieces 47%, >200 pieces 53% and so on.

    When customer purchased 100 pieces of same material, he will be given 47%. When there is a defect in any one of the piece, he will place a return order. When we create return order using the standard va01 bapi, the discount % it is taking is 30% instead of 47%. Since he is returning one piece it is taking pricing condition for one piece. I am passing order number as reference while creating the return order. But this BAPI is not copying all the pricing conditions available in Sale order to return order.

    BAPIs I used are given below

    /AFS/VBAK_SALESDOCUMENT_CREATE

    BAPI_CUSTOMERRETURN_CREATE

    BAPI_CUSTOMERRETURN_CREATEDAT1

    BAPI_CUSTOMERRETURN_CREATEDAT2

    With Regards,

    Krishna Chaitanya

    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.