Skip to Content
0
Former Member
Mar 12, 2009 at 08:04 PM

BAPI Called via webservice doesn't get all the data sent from outside world

93 Views

Hello SAP Gurus,

I need a big help regarding calling a BAPI from an outside world using webservice.

I have created wsdl file for "BAPI_QUOTATION_CREATEFROMDATA2".

I tried calling this from SE38 Program, which I have attached at the bottom. It works perfectly fine and creates the QUOTE succesffully.

However, when we call the same BAPI from outside world via webservice, it sends back a message that Quotation was created successfully and also sends the number. However when I go to transaction VA23 and look for this quote, it is not there. We have made sure to use COMMIT_TRANSACTION. We are sending the same parameters.

Also, when I put an external break point and debug I can see the variables under QUOTATION_HEADER_IN parameter. However, none of the parameters defined as TABLES is being seen. Either they are Zeros or blank.

Any help will be highly appreciated.

========PROGRAM IN SE38 CALLING THIS BAPI===============

&----


*& Report ZQUOTECREATE_TEST1

*&

&----


*&

*&

&----


report zquotecreate_temp line-size 265.

data: ls_quotation_header_in type bapisdhd1,

ls_quotation_header_inx type bapisdhd1x,

ls_salesdocument type bapivbeln-vbeln,

ls_behave_when_error type bapiflag-bapiflag,

ls_quotation_schedules_in like bapischdl occurs 1 with header line,

ls_quotation_partners like bapiparnr occurs 1 with header line,

ls_return like bapiret2 occurs 1 with header line,

ls_quotation_cfgs_inst like bapicuins occurs 1 with header line,

ls_quotation_cfgs_ref like bapicucfg occurs 1 with header line,

ls_quotation_cfgs_value like bapicuval occurs 1 with header line,

ls_quotation_items_in like bapisditm occurs 1 with header line.

ls_quotation_header_in-distr_chan = '12'.

ls_quotation_header_in-division = '00'.

ls_quotation_header_in-sales_org = '1000'.

ls_quotation_header_in-doc_type = 'QT'.

ls_quotation_header_in-req_date_h = '20090319'. "changed your dates for clarity

ls_quotation_header_in-qt_valid_t = '20191230'. "changed your dates for clarity

ls_quotation_header_in-purch_no_c = 'SA200812150959'.

ls_quotation_header_in-incoterms1 = 'CIP'.

ls_quotation_header_in-incoterms2 = 'JUST TESTING'.

ls_quotation_header_in-pmnttrms = 'ZB01'.

ls_quotation_header_in-dlv_block = '01'.

ls_quotation_header_in-qt_valid_f = '20081219'.

ls_quotation_header_in-qt_valid_f = '20191230'.

ls_quotation_header_in-purch_date = '20081219'.

ls_quotation_header_in-sd_doc_cat = 'B'.

ls_quotation_header_in-dun_count = '0'.

ls_behave_when_error = 'P'.

ls_quotation_partners-partn_role = 'SP'.

ls_quotation_partners-partn_numb = '0000001012'. "must have leading zeros

*ls_quotation_partners-itm_number = '000000'.

*ls_QUOTATION_PARTNERS-NAME = 'Autohaus Franzl GmbH'.

*ls_QUOTATION_PARTNERS-STREET = '51 Schwarzhauptstrasse'.

*ls_QUOTATION_PARTNERS-COUNTRY = 'DE'.

*ls_QUOTATION_PARTNERS-POSTL_CODE = '80939'.

*ls_QUOTATION_PARTNERS-CITY = 'Muenchen'.

*ls_QUOTATION_PARTNERS-REGION = '09'.

append ls_quotation_partners. "added append statement

ls_quotation_schedules_in-itm_number = '000010'.

ls_quotation_schedules_in-sched_line = '0010'.

ls_quotation_schedules_in-req_date = '20190318'. "Changed dates for clarity

ls_quotation_schedules_in-req_qty = '1'.

append ls_quotation_schedules_in. "added append statement

ls_quotation_header_inx-updateflag = 'I'.

ls_quotation_header_inx-doc_type = 'X'.

ls_quotation_header_inx-sales_org = 'X'.

ls_quotation_header_inx-distr_chan = 'X'.

ls_quotation_header_inx-division = 'X'.

ls_quotation_header_inx-req_date_h = 'X'.

ls_quotation_header_inx-qt_valid_t = 'X'.

ls_quotation_header_inx-purch_no_c = 'X'.

ls_quotation_cfgs_inst-config_id = '000001'.

ls_quotation_cfgs_inst-inst_id = '00000001'. "changed to 00000001

ls_quotation_cfgs_inst-obj_type = 'MARA'.

ls_quotation_cfgs_inst-class_type = '001'.

ls_quotation_cfgs_inst-obj_key = 'C-1100'.

append ls_quotation_cfgs_inst. "added append statement

*

ls_quotation_cfgs_ref-posex = '000010'.

ls_quotation_cfgs_ref-config_id = '000001'. "changed to 00000001

ls_quotation_cfgs_ref-root_id = '00000001'.

append ls_quotation_cfgs_ref. "added append statement

ls_quotation_cfgs_value-config_id = '000001'.

ls_quotation_cfgs_value-inst_id = '00000001'. "changed to 00000001

ls_quotation_cfgs_value-charc = 'LENGTH'.

ls_quotation_cfgs_value-value = '11'.

append ls_quotation_cfgs_value. "added append statement

ls_quotation_cfgs_value-charc = 'TESTCHAR'. "added statement

ls_quotation_cfgs_value-value = 'ABC'. "added statement

append ls_quotation_cfgs_value. "added statement

*

ls_quotation_items_in-itm_number = '000010'.

ls_quotation_items_in-po_itm_no = '000010'. "added leading zeros

ls_quotation_items_in-material = 'C-1100'.

ls_quotation_items_in-PLANT = '1000'. "added to get rid of incomplete doc error

ls_quotation_items_in-SHIP_POINT = '1000'. "added to get rid of incomplete doc error

append ls_quotation_items_in. "added append statement

call function 'BAPI_QUOTATION_CREATEFROMDATA2'

exporting

  • SALESDOCUMENTIN =

quotation_header_in = ls_quotation_header_in

  • QUOTATION_HEADER_INX =

  • SENDER =

  • BINARY_RELATIONSHIPTYPE = ' '

  • INT_NUMBER_ASSIGNMENT = ' '

behave_when_error = ls_behave_when_error "you want this on

  • LOGIC_SWITCH =

  • TESTRUN =

convert = 'X' "you need this on

importing

salesdocument = ls_salesdocument

tables

return = ls_return

quotation_items_in = ls_quotation_items_in "uncommented

  • QUOTATION_ITEMS_INX =

quotation_partners = ls_quotation_partners

quotation_schedules_in = ls_quotation_schedules_in "uncommented

  • QUOTATION_SCHEDULES_INX =

  • QUOTATION_CONDITIONS_IN =

  • QUOTATION_CONDITIONS_INX =

quotation_cfgs_ref = ls_quotation_cfgs_ref

quotation_cfgs_inst = ls_quotation_cfgs_inst

  • QUOTATION_CFGS_PART_OF =

quotation_cfgs_value = ls_quotation_cfgs_value "uncommented

  • QUOTATION_CFGS_BLOB =

  • QUOTATION_CFGS_VK =

  • QUOTATION_CFGS_REFINST =

  • QUOTATION_KEYS =

  • QUOTATION_TEXT =

  • EXTENSIONIN =

  • PARTNERADDRESSES =

  • NFMETALLITMS =

.

call function 'BAPI_TRANSACTION_COMMIT'.

write :/ ' sales document created : ',ls_salesdocument.

loop at ls_return.

write: / ls_return(264).

endloop.

========================

Thanks

Ram