How to create 'service confirm order' through bapi?
I want to create service confirm order,
pls help me some bapi
Yudomg
Try this BAPI: <b>BAPI_BUSPROCESSND_CREATEMULTI</b>
Thanks
Jack
<b>Allot points if mys post helps !!!!!</b>
Similar Messages
-
How to create the sales order using BAPI's ....?
Hi Guru's,
could you please provide how to create the sales order using BAPI's .....i need step by step process and please provide the details from scratch....basically i don't have basic knowledge on this....please provide required inputs ....:)
thanks in advance
Srinivas......Hi Guru's thanks for your inouts and your valuble time...
please find the program logic below...
*& Report ZAREPAS30
REPORT zarepas30.
DATA : gs_vbeln TYPE vbak-vbeln,
gs_order_header_in TYPE bapisdhd1,
gs_order_header_inx TYPE bapisdhd1x,
gt_order_items_in TYPE STANDARD TABLE OF bapisditm,
gwa_itab1 TYPE bapisditm,
gt_order_items_inx TYPE STANDARD TABLE OF bapisditmx,
gwa_itab2 TYPE bapisditmx,
gt_order_partners TYPE STANDARD TABLE OF bapiparnr,
gwa_itab3 TYPE bapiparnr,
gt_return TYPE STANDARD TABLE OF bapiret2,
gwa_itab4 TYPE bapiret2.
Sales document type
PARAMETERS: p_auart TYPE auart OBLIGATORY.
Sales organization
PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
Distribution channel
PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
Division.
PARAMETERS: p_spart TYPE spart OBLIGATORY.
Requested Delivery Date
PARAMETERS: p_edatu TYPE edatu OBLIGATORY.
Sold-to
PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
Ship-to
PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
Material
PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
Quantity.
PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
Plant
PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
Start-of-selection.
START-OF-SELECTION.
Header data
Sales document type
gs_order_header_in-doc_type = p_auart.
gs_order_header_inx-doc_type = 'X'.
Sales organization
gs_order_header_in-sales_org = p_vkorg.
gs_order_header_inx-sales_org = 'X'.
Distribution channel
gs_order_header_in-distr_chan = p_vtweg.
gs_order_header_inx-distr_chan = 'X'.
Division
gs_order_header_in-division = p_spart.
gs_order_header_inx-division = 'X'.
Reguested Delivery Date
gs_order_header_in-req_date_h = p_edatu.
gs_order_header_inx-req_date_h = 'X'.
gs_order_header_inx-updateflag = 'I'.
Partner data
Sold to
gwa_itab3-partn_role = 'AG'.
gwa_itab3-partn_numb = p_sold.
APPEND gwa_itab3 TO gt_order_partners .
ship to
gwa_itab3-partn_role = 'WE'.
gwa_itab3-partn_numb = p_ship.
APPEND gwa_itab3 TO gt_order_partners .
ITEM DATA
gwa_itab2-updateflag = 'I'.
Line item number.
gwa_itab1-itm_number = '000010'.
gwa_itab2-itm_number = 'X'.
Material
gwa_itab1-material = p_matnr.
gwa_itab2-material = 'X'.
Plant
gwa_itab1-plant = p_plant.
gwa_itab2-plant = 'X'.
Quantity
gwa_itab1-target_qty = p_menge.
gwa_itab2-target_qty = 'X'.
APPEND gwa_itab1 TO gt_order_items_in.
APPEND gwa_itab2 TO gt_order_items_inx.
Line item number.
gwa_itab1-itm_number = '000020'.
gwa_itab2-itm_number = 'X'.
Material
gwa_itab1-material = p_matnr.
gwa_itab2-material = 'X'.
Plant
gwa_itab1-plant = p_plant.
gwa_itab2-plant = 'X'.
Quantity
gwa_itab1-target_qty = p_menge.
gwa_itab2-target_qty = 'X'.
APPEND gwa_itab1 TO gt_order_items_in.
APPEND gwa_itab2 TO gt_order_items_inx.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = gs_order_header_in
ORDER_HEADER_INX = gs_order_header_inx
IMPORTING
SALESDOCUMENT = gs_vbeln
tables
RETURN = gt_return
ORDER_ITEMS_IN = gt_order_items_in
ORDER_ITEMS_INX = gt_order_items_inx
order_partners = gt_order_partners.
Check the return table.
LOOP AT gt_return into gwa_itab4 WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE: / 'Error occured while creating sales order '.
ELSE.
Commit the work.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
WRITE: / 'Document ', gs_vbeln, ' created'.
ENDIF. -
How to create a Sales Order through an EDI configuration.
Hi
How to create a Sales Order through an EDI configuration.
Tell me the step-by-step procedure for this.
Any power point presentation would be fine.
Cheers
MaruthiHi,
You can go to these links to know little bit about sales order creation through EDI/ALE by means of IDOCS.
http://www.riyaz.net/blog/index.php/2008/01/19/beginners-guide-to-ale-and-idocs-a-step-by-step-approach/
Sales Order Idoc Extension.
http://www.*******************/2007/11/abap-idocs-basic-tools.html
For any specific information, just do a google search(information like message t ype, IDOC type, Functoin module, etc. You will definitely get the information you are looking for
Please reward if this helps you -
How to create open sales order using BAPI....?
Hi Guru's,
please help me how to create open sales order and which BAPI i have to use for open sales order.
please provide any program logic related to this or step by step process.....
that would be helpful to me.
thanks in advance...
Srinivas....Hi sreenu,
Open PO or Open sales order means that the complete cycle is not complete. That means the Sales order is not completely delievered or is not billed or is not paid for. Only once the cycle is completed the order status shows as complete untill then its Open.
You can use VA05 to find open sales orders.
Similarlry open PO's are those PO's whos inbound delivery is not complete or whos goods receipt is not complete and whos payment is not done to the vendor
U cannot directly find the open PO and open SO from any table.
That u have to calculate from the status of the PO and SO and then check wheteher that is complete or not.
U have table VBUP for SO status.Check out the fields in that table
pls see the below link.
http://abaplovers.blogspot.com/2008/02/bapi-sales-order-create-code.html
http://msdn.microsoft.com/en-us/library/cc185190.aspx
thjanks
karthik -
How to create a sales order using bapi
hi
i need to create a sales order using bapi.
can any one help meDo NOT USE BAPI_SALESORDER_CREATEFROMDATA, that FM is obsolete!
Use BAPI_SALESORDER_CREATEFROMDAT1 .
To build a reference to your contract you have to supply ORDER_HEADER_IN.
Here´s a sample:
MOVE:
gs_vbak-vbeln TO ls_bapisdhd1-refobjkey,
gs_vbak-vbeln TO ls_bapisdhd1-ref_doc,
gs_vbak-vbtyp TO ls_bapisdhd1-refdoc_cat,
gs_vbak-auart TO ls_bapisdhd1-refdoctype.
also gothrouh the links
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap%2b-%2bsimple%2bprogram%2bto%2bcreate%2bsales%2border%2busing%2bbapi -
How to create shipment cost document through BAPI?
Hi SAP Guru,
My requirement is to create shipment cost document through BAPI.
Is there any standard BAPI to create Shipment cost documents? If any buddy no please help me out.I am in client place i have find out the solution..
Thanks & Regards,
Pankaj SinhaHi Pankaj,
See the following link for more help.
IDOC/BAPI for changing Shipment cost number/document
Regards -
How to create service PO while using BAPI
Dear Experts
I am getting error while creating Service PO using BAPI
E 518
No account assignment exists for service line 0000000010
E 518
No account assignment exists for service line 0000000010
TYPES : BEGIN OF ty_header,
po_no(10) TYPE n,
purch_org TYPE bapimepoheader-purch_org,
pur_group TYPE bapimepoheader-pur_group,
doc_type TYPE bapimepoheader-doc_type,
vendor TYPE bapimepoheader-vendor,
doc_date TYPE bapimepoheader-doc_date,
currency TYPE bapimepoheader-currency,
comp_code TYPE bapimepoheader-comp_code,
END OF ty_header,
BEGIN OF ty_item,
po_no(10) TYPE n, " Internal Use
po_item TYPE bapimepoitem-po_item,
acctasscat TYPE bapimepoitem-acctasscat,
short_text TYPE bapimepoitem-short_text,
plant TYPE bapimepoitem-plant,
pckg_no TYPE bapimepoitem-pckg_no,
stge_loc TYPE bapimepoitem-stge_loc,
quantity TYPE bapimepoitem-quantity,
po_unit TYPE bapimepoitem-po_unit,
po_price TYPE bapimepoitem-po_price,
net_price TYPE bapimepoitem-net_price,
price_unit TYPE bapimepoitem-price_unit,
orderpr_un TYPE bapimepoitem-orderpr_un,
delivery_date TYPE bapimeposchedule-delivery_date, " bapimeposchedule
matl_group TYPE bapimepoitem-matl_group,
tax_code TYPE bapimepoitem-tax_code,
END OF ty_item,
BEGIN OF ty_service,
po_no(10) TYPE n, " Internal Use
po_item TYPE bapimepoitem-po_item, " Internal Use
pckg_no TYPE bapiesllc-pckg_no,
line_no TYPE bapiesllc-line_no,
ext_line TYPE bapiesllc-ext_line,
outl_ind TYPE bapiesllc-outl_ind,
subpckg_no TYPE bapiesllc-subpckg_no,
serial_no TYPE bapiesklc-serial_no, " bapiesklc
short_text TYPE bapiesllc-short_text,
quantity TYPE bapiesllc-quantity,
base_uom TYPE bapiesllc-base_uom,
gr_price TYPE bapiesllc-gr_price,
matl_group TYPE bapiesllc-matl_group,
END OF ty_service,
BEGIN OF ty_poaccount,
po_no(10) TYPE n, " Internal Use
po_item TYPE bapimepoaccount-po_item,
serial_no TYPE bapimepoaccount-serial_no,
gl_account TYPE bapimepoaccount-gl_account,
costcenter TYPE bapimepoaccount-costcenter,
asset_no TYPE bapimepoaccount-asset_no,
orderid TYPE bapimepoaccount-orderid,
END OF ty_poaccount.
DATA : it_header TYPE TABLE OF ty_header,
wa_header TYPE ty_header,
it_item TYPE TABLE OF ty_item,
wa_item TYPE ty_item,
it_service TYPE TABLE OF ty_service,
wa_service TYPE ty_service,
it_account TYPE TABLE OF ty_poaccount,
wa_account TYPE ty_poaccount.
DATA : it_excel1 TYPE TABLE OF alsmex_tabline,
wa_excel1 TYPE alsmex_tabline,
it_excel2 TYPE TABLE OF alsmex_tabline,
wa_excel2 TYPE alsmex_tabline,
it_excel3 TYPE TABLE OF alsmex_tabline,
wa_excel3 TYPE alsmex_tabline,
it_excel4 TYPE TABLE OF alsmex_tabline,
wa_excel4 TYPE alsmex_tabline.
DATA : number TYPE string,
number1 TYPE string.
********** BAPI**************
CONSTANTS : c_x VALUE 'X'.
*Structures to hold PO header data
DATA : header LIKE bapimepoheader ,
headerx LIKE bapimepoheaderx .
*Internal Tables to hold PO ITEM DATA
DATA : item LIKE bapimepoitem OCCURS 0 WITH HEADER LINE,
itemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
*Structures to hold PO schedule data
DATA : itemschedule LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE ,
itemschedulex LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE .
*Structures to hold PO services data
DATA : services LIKE bapiesllc OCCURS 0 WITH HEADER LINE .
*Structures to hold PO (distrib.imputac.lín.servicios) data
DATA : posrvaccessvalues LIKE bapiesklc OCCURS 0 WITH HEADER LINE .
*Structures to hold PO account data
DATA : account LIKE bapimepoaccount OCCURS 0 WITH HEADER LINE ,
accountx LIKE bapimepoaccountx OCCURS 0 WITH HEADER LINE .
*Internal table to hold messages from BAPI call
DATA : return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
purchaseorder LIKE bapimepoheader-po_number.
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_file1 TYPE rlgrap-filename OBLIGATORY,
p_brow1 TYPE i,
p_erow1 TYPE i.
SELECTION-SCREEN : END OF BLOCK b1.
SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS : p_file2 TYPE rlgrap-filename OBLIGATORY,
p_brow2 TYPE i,
p_erow2 TYPE i.
SELECTION-SCREEN : END OF BLOCK b2.
SELECTION-SCREEN : BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETERS : p_file3 TYPE rlgrap-filename OBLIGATORY,
p_brow3 TYPE i,
p_erow3 TYPE i.
SELECTION-SCREEN : END OF BLOCK b3.
SELECTION-SCREEN : BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.
PARAMETERS : p_file4 TYPE rlgrap-filename OBLIGATORY,
p_brow4 TYPE i,
p_erow4 TYPE i.
SELECTION-SCREEN : END OF BLOCK b4.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = p_file1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file2.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = p_file2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file3.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = p_file3.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file4.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = p_file4.
START-OF-SELECTION.
PERFORM excel_to_itab.
PERFORM get_final.
*& Form excel_to_itab
* text
* --> p1 text
* <-- p2 text
FORM excel_to_itab .
************** Excel 1
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file1
i_begin_col = '1'
i_begin_row = p_brow1
i_end_col = '08'
i_end_row = p_erow1
TABLES
intern = it_excel1
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_excel1 INTO wa_excel1.
CASE wa_excel1-col.
WHEN '0001'.
wa_header-po_no = wa_excel1-value.
WHEN '0002'.
wa_header-purch_org = wa_excel1-value.
WHEN '0003'.
wa_header-pur_group = wa_excel1-value.
WHEN '0004'.
wa_header-doc_type = wa_excel1-value.
WHEN '0005'.
wa_header-vendor = wa_excel1-value.
WHEN '0006'.
wa_header-doc_date = wa_excel1-value.
WHEN '0007'.
wa_header-currency = wa_excel1-value.
WHEN '0008'.
wa_header-comp_code = wa_excel1-value.
ENDCASE.
AT END OF row.
APPEND wa_header TO it_header.
CLEAR wa_header.
ENDAT.
ENDLOOP.
************** Excel 2
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file2
i_begin_col = '1'
i_begin_row = p_brow2
i_end_col = '16'
i_end_row = p_erow2
TABLES
intern = it_excel2
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_excel2 INTO wa_excel2.
CASE wa_excel2-col.
WHEN '0001'.
wa_item-po_no = wa_excel2-value.
WHEN '0002'.
wa_item-po_item = wa_excel2-value.
WHEN '0003'.
wa_item-acctasscat = wa_excel2-value.
WHEN '0004'.
wa_item-short_text = wa_excel2-value.
WHEN '0005'.
wa_item-plant = wa_excel2-value.
WHEN '0006'.
wa_item-pckg_no = wa_excel2-value.
WHEN '0007'.
wa_item-stge_loc = wa_excel2-value.
WHEN '0008'.
wa_item-quantity = wa_excel2-value.
WHEN '0009'.
wa_item-po_unit = wa_excel2-value.
WHEN '0010'.
wa_item-po_price = wa_excel2-value.
WHEN '0011'.
wa_item-net_price = wa_excel2-value.
WHEN '0012'.
wa_item-price_unit = wa_excel2-value.
WHEN '0013'.
wa_item-orderpr_un = wa_excel2-value.
WHEN '0014'.
wa_item-delivery_date = wa_excel2-value.
WHEN '0015'.
wa_item-matl_group = wa_excel2-value.
WHEN '0016'.
wa_item-tax_code = wa_excel2-value.
ENDCASE.
AT END OF row.
APPEND wa_item TO it_item.
CLEAR wa_item.
ENDAT.
ENDLOOP.
************** Excel 3
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file3
i_begin_col = '1'
i_begin_row = p_brow3
i_end_col = '13'
i_end_row = p_erow3
TABLES
intern = it_excel3
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_excel3 INTO wa_excel3.
CASE wa_excel3-col.
WHEN '0001'.
wa_service-po_no = wa_excel3-value.
WHEN '0002'.
wa_service-po_item = wa_excel3-value.
WHEN '0003'.
wa_service-pckg_no = wa_excel3-value.
WHEN '0004'.
wa_service-line_no = wa_excel3-value.
WHEN '0005'.
wa_service-ext_line = wa_excel3-value.
WHEN '0006'.
wa_service-outl_ind = wa_excel3-value.
WHEN '0007'.
wa_service-subpckg_no = wa_excel3-value.
WHEN '0008'.
wa_service-serial_no = wa_excel3-value.
WHEN '0009'.
wa_service-short_text = wa_excel3-value.
WHEN '0010'.
wa_service-quantity = wa_excel3-value.
WHEN '0011'.
wa_service-base_uom = wa_excel3-value.
WHEN '0012'.
wa_service-gr_price = wa_excel3-value.
WHEN '0013'.
wa_service-matl_group = wa_excel3-value.
ENDCASE.
AT END OF row.
APPEND wa_service TO it_service.
CLEAR wa_service.
ENDAT.
ENDLOOP.
************** Excel 3
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file4
i_begin_col = '1'
i_begin_row = p_brow4
i_end_col = '07'
i_end_row = p_erow4
TABLES
intern = it_excel4
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT it_excel4 INTO wa_excel4.
CASE wa_excel4-col.
WHEN '0001'.
wa_account-po_no = wa_excel4-value.
WHEN '0002'.
wa_account-po_item = wa_excel4-value.
WHEN '0003'.
wa_account-serial_no = wa_excel4-value.
WHEN '0004'.
wa_account-gl_account = wa_excel4-value.
WHEN '0005'.
wa_account-costcenter = wa_excel4-value.
WHEN '0006'.
wa_account-asset_no = wa_excel4-value.
WHEN '0007'.
wa_account-orderid = wa_excel4-value.
ENDCASE.
AT END OF row.
APPEND wa_account TO it_account.
CLEAR wa_account.
ENDAT.
ENDLOOP.
ENDFORM. " excel_to_itab
*& Form GET_FINAL
* text
* --> p1 text
* <-- p2 text
FORM get_final .
LOOP AT it_header INTO wa_header.
* BAPI HEADER
header-purch_org = wa_header-purch_org.
header-pur_group = wa_header-pur_group.
header-doc_type = wa_header-doc_type.
header-vendor = wa_header-vendor.
header-doc_date = wa_header-doc_date.
header-currency = wa_header-currency.
header-comp_code = wa_header-comp_code.
* BAPI HEADERX
headerx-comp_code = c_x.
headerx-doc_type = c_x.
headerx-vendor = c_x.
headerx-creat_date = c_x.
headerx-created_by = c_x.
headerx-purch_org = c_x.
headerx-pur_group = c_x.
headerx-langu = c_x.
headerx-sales_pers = c_x.
headerx-currency = c_x.
headerx-doc_date = c_x. " Added
LOOP AT it_item INTO wa_item WHERE po_no = wa_header-po_no.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'SERVICE'
* quantity = '1'
* SUBOBJECT = ' '
* TOYEAR = '0000'
* IGNORE_BUFFER = ' '
IMPORTING
number = number
* QUANTITY =
* RETURNCODE =
* EXCEPTIONS
* INTERVAL_NOT_FOUND = 1
* NUMBER_RANGE_NOT_INTERN = 2
* OBJECT_NOT_FOUND = 3
* QUANTITY_IS_0 = 4
* QUANTITY_IS_NOT_1 = 5
* INTERVAL_OVERFLOW = 6
* BUFFER_OVERFLOW = 7
* OTHERS = 8
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
item-po_item = wa_item-po_item.
item-acctasscat = wa_item-acctasscat.
item-item_cat = '9'.
item-short_text = wa_item-short_text.
item-plant = wa_item-plant.
item-pckg_no = number.
item-stge_loc = wa_item-stge_loc.
item-quantity = wa_item-quantity.
item-po_unit = wa_item-po_unit.
item-po_price = wa_item-po_price.
item-net_price = wa_item-net_price.
item-price_unit = wa_item-price_unit.
item-orderpr_un = wa_item-orderpr_un.
item-matl_group = wa_item-matl_group.
item-tax_code = wa_item-tax_code.
APPEND item.
CLEAR item.
itemx-po_item = wa_item-po_item.
itemx-item_cat = c_x.
itemx-po_itemx = c_x.
itemx-short_text = c_x.
itemx-quantity = c_x.
itemx-tax_code = c_x.
itemx-acctasscat = c_x.
itemx-item_cat = c_x.
itemx-matl_group = c_x.
itemx-plant = c_x.
itemx-trackingno = c_x.
itemx-agreement = c_x.
itemx-agmt_item = c_x.
itemx-stge_loc = c_x.
itemx-quantity = c_x.
itemx-po_unit = c_x.
itemx-conv_num1 = c_x.
itemx-conv_den1 = c_x.
itemx-net_price = c_x.
itemx-price_unit = c_x.
itemx-gr_pr_time = c_x.
itemx-prnt_price = c_x.
itemx-unlimited_dlv = c_x.
itemx-gr_ind = c_x .
itemx-ir_ind = c_x .
itemx-gr_basediv = c_x .
itemx-pckg_no = c_x.
itemx-po_price = c_x. " Added
itemx-orderpr_un = c_x. " Added
APPEND itemx.
CLEAR itemx.
itemschedule-po_item = wa_item-po_item.
itemschedule-del_datcat_ext = 'D'.
itemschedule-delivery_date = wa_item-delivery_date.
APPEND itemschedule.
CLEAR itemschedule.
itemschedulex-po_item = wa_item-po_item.
itemschedulex-po_itemx = c_x .
itemschedulex-del_datcat_ext = c_x.
itemschedulex-delivery_date = c_x .
APPEND itemschedulex.
CLEAR itemschedulex.
LOOP AT it_service INTO wa_service WHERE po_no = wa_item-po_no AND po_item = wa_item-po_item.
IF wa_service-outl_ind IS INITIAL.
IF number1 IS INITIAL.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'SERVICE'
* quantity = '1'
* SUBOBJECT = ' '
* TOYEAR = '0000'
* IGNORE_BUFFER = ' '
IMPORTING
number = number1
* QUANTITY =
* RETURNCODE =
* EXCEPTIONS
* INTERVAL_NOT_FOUND = 1
* NUMBER_RANGE_NOT_INTERN = 2
* OBJECT_NOT_FOUND = 3
* QUANTITY_IS_0 = 4
* QUANTITY_IS_NOT_1 = 5
* INTERVAL_OVERFLOW = 6
* BUFFER_OVERFLOW = 7
* OTHERS = 8
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
services-pckg_no = number.
services-line_no = '1'.
services-ext_line = '0'.
services-outl_ind = 'X'.
services-subpckg_no = number1.
* services-short_text = wa_service-short_text.
* services-quantity = wa_service-quantity.
* services-base_uom = wa_service-base_uom.
* services-gr_price = wa_service-gr_price.
* services-matl_group = wa_service-matl_group.
APPEND services.
CLEAR services.
ENDIF.
* ELSE.
services-pckg_no = number1.
services-line_no = wa_service-line_no.
services-ext_line = wa_service-ext_line.
* services-outl_ind = wa_service-outl_ind.
services-subpckg_no = '0'.
services-short_text = wa_service-short_text.
services-quantity = wa_service-quantity.
services-base_uom = wa_service-base_uom.
services-gr_price = wa_service-gr_price.
services-matl_group = wa_service-matl_group.
APPEND services.
CLEAR services.
ENDIF.
IF wa_service-outl_ind IS INITIAL.
posrvaccessvalues-pckg_no = number1.
posrvaccessvalues-line_no = wa_service-line_no.
posrvaccessvalues-serno_line = '01'.
posrvaccessvalues-serial_no = wa_service-serial_no.
* posrvaccessvalues-percentage = '100'.
APPEND posrvaccessvalues . CLEAR posrvaccessvalues.
ENDIF.
ENDLOOP.
LOOP AT it_account INTO wa_account WHERE po_no = wa_item-po_no AND po_item = wa_item-po_item.
account-po_item = wa_account-po_item.
account-serial_no = wa_account-serial_no.
account-gl_account = wa_account-gl_account.
account-costcenter = wa_account-costcenter.
account-asset_no = wa_account-asset_no.
account-orderid = wa_account-orderid.
APPEND account.
CLEAR account.
accountx-po_item = wa_account-po_item.
accountx-po_itemx = c_x .
accountx-serial_no = wa_account-serial_no.
accountx-serial_nox = c_x .
* accountx-creat_date = c_x .
accountx-costcenter = c_x .
accountx-gl_account = c_x .
* accountx-co_area = c_x .
* accountx-tax_code = c_x .
* accountx-asset_no = c_x . " Added
* accountx-orderid = c_x . " Added
APPEND accountx. CLEAR accountx.
ENDLOOP.
ENDLOOP.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = header
poheaderx = headerx
* POADDRVENDOR =
* TESTRUN =
IMPORTING
exppurchaseorder = purchaseorder
* EXPHEADER =
* EXPPOEXPIMPHEADER =
TABLES
return = return
poitem = item
poitemx = itemx
poschedule = itemschedule
poschedulex = itemschedulex
poaccount = account
poaccountx = accountx
poservices = services.
posrvaccessvalues = posrvaccessvalues.
IF purchaseorder IS NOT INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
LOOP AT return.
WRITE : / return-type, return-number, return-message.
ENDLOOP.
ENDLOOP.
ENDFORM. " GET_FINALHi ganesh,
Please look at the SAP note 376424 - BAPI_PO_CREATE1: Error messages for parked POs.
Sap recommends to install the support service pack. Take a look at the note for detailed understanding.
Also take a look at SAP NOte
767284 - SE518 occurs although account assignment is supplied to BAPI (this requires Note 552114 must be applied as a prerequisite)
Consider contacting basis team after your analysis about the issue.
Regards,
Sivaganesh -
After creating new sales order through BAPI, it is not showing in VA03
Hi Experts
I am developing one program to create sales order using FM BAPI_SALESORDER_CREATEFROMDAT2. In output screen it is showing that the new sales order number created with new sales order number. But whenever I want to display the newly created sales order via VA03 it shows an error message SD document 10007547 is not in the database or has been archived but in program output it shows that 10007547 is created. This is in DEV server. Document numbers are generated by the system sequencially, but it is not reflected in database.
I am also attaching my code below.
REPORT z_bapi_salesorder.
DATA : gt_header LIKE bapisdhd1,
gt_item TYPE TABLE OF bapisditm,
gt_itemx TYPE TABLE OF bapisditmx,
gt_partner TYPE TABLE OF bapiparnr,
gt_return TYPE TABLE OF bapiret2.
DATA : gs_item LIKE LINE OF gt_item,
gs_itemx LIKE LINE OF gt_itemx,
gs_partner LIKE LINE OF gt_partner,
gs_return LIKE LINE OF gt_return.
DATA : v_vbeln TYPE vbeln_va.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(30) ord_type FOR FIELD p_auart.
PARAMETERS : p_auart TYPE auart OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_vkorg TYPE vkorg OBLIGATORY,
p_vtweg TYPE vtweg OBLIGATORY,
p_spart TYPE vbak-spart OBLIGATORY,
p_sold TYPE kunnr OBLIGATORY,
p_ship TYPE kunnr OBLIGATORY,
p_matnr TYPE matnr OBLIGATORY,
p_menge TYPE kwmeng OBLIGATORY,
p_plant TYPE werks_d OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK b1.
INITIALIZATION.
ord_type = 'Order Type'.
START-OF-SELECTION.
*Header information data.
gt_header-doc_type = p_auart.
gt_header-sales_org = p_vkorg.
gt_header-distr_chan = p_vtweg.
gt_header-division = p_spart.
*Partner information data.
gs_partner-partn_role = 'AG'.
gs_partner-partn_numb = p_sold.
APPEND gs_partner TO gt_partner.
CLEAR gs_partner.
gs_partner-partn_role = 'WE'.
gs_partner-partn_numb = p_ship.
APPEND gs_partner TO gt_partner.
CLEAR gs_partner.
*Item data
gs_item-itm_number = '000010'.
gs_itemx-itm_number = 'X'.
gs_item-material = p_matnr.
gs_itemx-material = 'X'.
gs_item-plant = p_plant.
gs_itemx-plant = 'X'.
gs_item-target_qty = p_menge.
gs_itemx-target_qty = 0.
APPEND gs_item TO gt_item.
APPEND gs_itemx TO gt_itemx.
CLEAR : gs_item, gs_itemx.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN =
order_header_in = gt_header
ORDER_HEADER_INX =
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
salesdocument = v_vbeln
TABLES
return = gt_return
order_items_in = gt_item
order_items_inx = gt_itemx
order_partners = gt_partner
ORDER_SCHEDULES_IN =
ORDER_SCHEDULES_INX =
ORDER_CONDITIONS_IN =
ORDER_CONDITIONS_INX =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
ORDER_CCARD =
ORDER_TEXT =
ORDER_KEYS =
EXTENSIONIN =
PARTNERADDRESSES =
IF v_vbeln <> space.
COMMIT WORK.
WRITE :/ 'Document', v_vbeln ,'created'.
CLEAR : v_vbeln, gt_header.
REFRESH : gt_partner, gt_item, gt_itemx.
ELSE.
WRITE :/ 'Error in creating document'.
ENDIF.
Please give the possible solutions for this. What is reason for that update termination.CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
EXPORTING
ORDER_HEADER_IN = ORDER_HEADER_IN
WITHOUT_COMMIT = ' '
CONVERT_PARVW_AUART = ' '
IMPORTING
SALESDOCUMENT = SALESDOCUMENT
SOLD_TO_PARTY =
SHIP_TO_PARTY =
BILLING_PARTY =
RETURN = RETURN
TABLES
ORDER_ITEMS_IN = ORDER_ITEMS_IN
ORDER_PARTNERS = ORDER_PARTNERS
ORDER_ITEMS_OUT =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CCARD =
ORDER_CFGS_BLOB =
ORDER_SCHEDULE_EX = ORDER_SCHEDULE_EX
use bapi_transaction_commit.
Regards,
Venkat -
Creating sales order through Bapi
Hi all,
I am trying to create sales order through bapi.
Now my problem is mapping sales order fields with bapi structure fields.
1.'Overall Order status' field in the 'Status' tab of the header in VA02.
2.'Tax'feild in the 'conditions' tab of the header in VA02.
Please help me to map these fields into Bapi structure.
Thanks in advance.
Regards,
Shalem.HI
GOOD
GO THROUGH THIS LINK,I HOPE THIS WILL GIVE YOU THE COMPLETE IDETA OF CREATING A SALES ORDER THROUGH BAPI,
http://help.sap.com/saphelp_nw04/helpdata/en/4c/fd7ebb515911d395f900a0c94260a5/content.htm
http://www.sappoint.com/abap/bapiintro.pdf
THANKS
MRUTYUN -
Creating sales order through BAPI - do not want to send idoc confirmation
Hi guys!
I'm creating a sales order using BAPI BAPI_SALESORDER_CREATEFROMDAT1. The system was cuztomized to send an idoc through an output type, so whenever this BAPI is executed an idoc is sent.
My problem is that I do not want the Idoc to be created when using this BAPI.
Is there a way not to use an output type when using the BAPI?
Thanks in advance for your help!Use an output requirement that stops the proposal of the output. You'll want to make sure that it works in both immediate and delayed modes, e.g., you can't use a field-symbol (or the KOMKBV1 user exit) for access to T180-TCODE or to the CALL_BAPI value in memory. You might want to try the VBAK-ERNAM value, since you probably use a specific (non-dialog) user for the call. Otherwise, use another field to identify a BAPI call and check that field in the requirement.
-
FM/Class for creating service confirmation from service order
Hello Gurus,
Does anyone know a FM/BAPI/Class to create service confirmation from service order ?
With warm regards,
Kallol BhowmickHello Kallol
You can trigger a confirmation from service order using action profile.
Here is how to define action profile:
IMG > CRM > Basic Functions > Actions > Actions in Transaction
Dialog Stucture> Action profile:
Object type = BUS2000116
Context class = CL_DOC_CONTEXT_CRM_ORDER
Dialog Stucture> Action Definition:
Processing time: Processing using selection report
Check box schedule automatically, Changeable in dialog and executable in dialog.
Dialog Stucture> Processing types
Permitted processing types of actions: Select - Method Call
Settings method call: Method - COPY_DOCUMENT (you can also try COPY_DEF_ITEMS)
Processing Parameter:
-Select change icon a new window opens - container editor
-select create icon another window opens - display container editor
Here enter following:
Element = PROCESS_TYPE
Name = PROCESS_TYPE
short desp = PROCESS_TYPE
Tab > Dtype:
Structure = CRMC_PROC_TYPE
Field = PROCESS_TYPE
Tab> initial value
Here maintain the transaction type of your confirmation.
save your action profile. Now assign action profile to Service oder transaction type.
I hope this info helps.
Regards
Rupesh Patil -
FM BAPI To Create Service Confirmation
Hi Friends,
Kindly suggest me FM \ BAPI to create Service Confirmation.
Regards,
Narendra GoyalHi,
Find the code below:
creation of header guid for service confirmation
CLEAR v_head_ref_guid.
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_16 = v_head_ref_guid.
CREATION OF THE ITEM GUID
CLEAR v_item_ref_guid.
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_16 = v_item_ref_guid.
CREATION OF SCHEDULING LOGICAL GUID.
CLEAR v_sched_logical.
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_16 = v_sched_logical.
values for it_pricing
CLEAR wa_pricing.
CLEAR it_pricing.
wa_pricing-ref_handle = c_ref_handle2.
wa_pricing-ref_guid = v_item_ref_guid.
wa_pricing-ref_kind = c_b_kind.
INSERT wa_pricing INTO TABLE it_pricing.
values for product_i-UOM
CLEAR wa_product.
READ TABLE it_product INTO wa_product INDEX 1.
IF sy-subrc = 0.
CLEAR wa_fieldname.
CLEAR it_fields.
wa_fieldname-fieldname = c_process_qty_unit_field.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_input_field.
wa_input_field-ref_handle = c_ref_handle2.
wa_input_field-ref_guid = v_item_ref_guid.
wa_input_field-ref_kind = c_b_kind.
wa_input_field-objectname = c_product_i_input.
wa_input_field-field_names = it_fields.
INSERT wa_input_field INTO TABLE it_input_field.
CLEAR wa_product_i.
wa_product_i-ref_guid = v_item_ref_guid.
wa_product_i-ref_handle = c_ref_handle2.
wa_product_i-process_qty_unit = wa_product-process_qty_unit.
INSERT wa_product_i INTO TABLE it_product_i.
ENDIF.
values for service_i
CLEAR wa_input_field.
wa_input_field-ref_handle = c_ref_handle2.
wa_input_field-ref_guid = v_item_ref_guid.
wa_input_field-ref_kind = c_b_kind.
wa_input_field-objectname = c_service_i.
wa_input_field-field_names = it_fields.
INSERT wa_input_field INTO TABLE it_input_field.
CLEAR wa_service_i.
wa_service_i-ref_guid = v_item_ref_guid.
wa_service_i-ref_handle = c_ref_handle2.
INSERT wa_service_i INTO TABLE it_service_i.
fieldnames for quantity
CLEAR wa_schedul.
READ TABLE it_schedul INTO wa_schedul INDEX 1.
IF sy-subrc = 0.
CLEAR wa_fieldname.
CLEAR it_fields.
wa_fieldname-fieldname = c_logical_key.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_fieldname.
wa_fieldname-fieldname = c_quantity.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_input_field.
wa_input_field-ref_handle = c_ref_handle2.
wa_input_field-ref_guid = v_item_ref_guid.
wa_input_field-ref_kind = c_b_kind.
wa_input_field-objectname = c_schedlin_input.
wa_input_field-logical_key = c_log_key_item.
wa_input_field-field_names = it_fields.
INSERT wa_input_field INTO TABLE it_input_field.
CLEAR wa_quantity.
CLEAR it_quantity.
wa_quantity-guid = v_sched_logical.
wa_quantity-item_guid = v_item_ref_guid.
wa_quantity-quantity = wa_schedul-quantity.
wa_quantity-logical_key = c_log_key_item.
wa_quantity-handle = c_ref_handle0.
INSERT wa_quantity INTO TABLE it_quantity.
valus for quantity
CLEAR wa_schedulin.
wa_schedulin-ref_guid = v_item_ref_guid.
wa_schedulin-ref_handle = c_ref_handle2.
wa_schedulin-schedlines = it_quantity.
INSERT wa_schedulin INTO TABLE it_schedulin.
ENDIF.
fieldnames for product
CLEAR wa_orderadm.
READ TABLE it_orderadm INTO wa_orderadm INDEX 1.
IF sy-subrc = 0.
CLEAR wa_fieldname.
CLEAR it_fields.
wa_fieldname-fieldname = c_itm_proc_ident.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_fieldname.
wa_fieldname-fieldname = c_mode_input.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_fieldname.
wa_fieldname-fieldname = c_ordered_prod.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_fieldname.
wa_fieldname-fieldname = c_number_int.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_fieldname.
wa_fieldname-fieldname = c_prog_id.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_input_field.
wa_input_field-ref_handle = c_ref_handle2.
wa_input_field-ref_guid = v_item_ref_guid.
wa_input_field-objectname = c_orderadm_i_input.
wa_input_field-field_names = it_fields.
INSERT wa_input_field INTO TABLE it_input_field.
values for product
CLEAR wa_orderprp_i.
CLEAR v_itemno.
v_itemno = v_itemno + v_line_incr.
wa_orderprp_i-guid = v_item_ref_guid.
wa_orderprp_i-header = v_head_ref_guid.
wa_orderprp_i-number_int = v_itemno.
wa_orderprp_i-ordered_prod = wa_orderadm-ordered_prod.
wa_orderprp_i-description = wa_orderadm-description.
wa_orderprp_i-handle = c_ref_handle2.
wa_orderprp_i-number_int = wa_orderadm-number_int .
wa_orderprp_i-zzprogram_id = wa_orderadm-zzprogram_id.
INSERT wa_orderprp_i INTO TABLE it_orderprp_i.
ENDIF.
ENDIF.
field names for header
CLEAR wa_fieldname.
CLEAR it_fields.
wa_fieldname-fieldname = c_mode.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_fieldname.
wa_fieldname-fieldname = c_process_type_field.
INSERT wa_fieldname INTO TABLE it_fields.
input field values for header
CLEAR wa_input_field.
wa_input_field-ref_guid = v_head_ref_guid.
wa_input_field-ref_kind = c_a_input.
wa_input_field-objectname = c_orderadmh_input.
wa_input_field-field_names = it_fields.
INSERT wa_input_field INTO TABLE it_input_field.
Clearing buffer
CALL FUNCTION 'CRM_ORDER_INITIALIZE'
EXPORTING
iv_initialize_whole_buffer = c_x
EXCEPTIONS
error_occurred = 1
OTHERS = 2.
CHECK sy-subrc = 0.
values for header
CLEAR wa_orderadm_h.
wa_orderadm_h-guid = v_head_ref_guid.
wa_orderadm_h-mode = c_a_mode.
wa_orderadm_h-process_type = c_process_type.
INSERT wa_orderadm_h INTO TABLE it_orderadm_h.
values for comp _date
CLEAR it_fields.
CLEAR wa_fieldname.
wa_fieldname-fieldname = c_dominant_field.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_fieldname.
wa_fieldname-fieldname = c_duration_field.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_fieldname.
wa_fieldname-fieldname = c_rule_name_field.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_fieldname.
wa_fieldname-fieldname = c_show_local_field.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_fieldname.
wa_fieldname-fieldname = c_timestamp_from_field.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_fieldname.
wa_fieldname-fieldname = c_timestamp_to_fiel.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_fieldname.
wa_fieldname-fieldname = c_timezone_from_field.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_fieldname.
wa_fieldname-fieldname = c_timezone_to_field.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_fieldname.
wa_fieldname-fieldname = c_time_unit_field.
INSERT wa_fieldname INTO TABLE it_fields.
CLEAR wa_input_field.
wa_input_field-ref_handle = c_ref_handle0.
wa_input_field-ref_guid = v_head_ref_guid.
wa_input_field-field_names = it_fields.
wa_input_field-ref_kind = c_a_input.
wa_input_field-objectname = c_appointment.
wa_input_field-logical_key = c_log_key_appointment.
INSERT wa_input_field INTO TABLE it_input_field.
CLEAR v_time.
v_time = sy-uzeit.
CLEAR v_timestamp.
CLEAR wa_appointment.
CONCATENATE wa_record-comp_date v_time INTO v_timestamp.
wa_appointment-ref_guid = v_head_ref_guid.
wa_appointment-ref_kind = c_a_input.
wa_appointment-appt_type = c_appt_type.
wa_appointment-timestamp_from = v_timestamp.
wa_appointment-timezone_from = c_timezone.
wa_appointment-timezone_to = c_timezone.
wa_appointment-ref_handle = c_ref_handle0.
INSERT wa_appointment INTO TABLE it_appointment.
to create a service confirmation as a follow up document
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_product_i = it_product_i
it_service_i = it_service_i
it_pricing = it_pricing
it_schedlin_i = it_schedulin
it_appointment = it_appointment
CHANGING
ct_orderadm_h = it_orderadm_h
ct_orderadm_i = it_orderprp_i
ct_input_fields = it_input_field
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 5.
IF sy-subrc = 0.
CLEAR it_objects_to_save.
CLEAR it_saved_objects.
INSERT v_head_ref_guid INTO TABLE it_objects_to_save.
fm to save the service confirmation
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = it_objects_to_save
iv_no_bdoc_send = c_x
IMPORTING
et_saved_objects = it_saved_objects
EXCEPTIONS
document_not_saved = 1
OTHERS = 2.
CHECK sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = c_x. -
How to creating Service Contract using BAPI_SLSTRANSACT_CREATEMULTI
Hi,
In my requirement, I have to create a Service Contract from flat file by using BAPI - BAPI_SLSTRANSACT_CREATEMULTI and data which are comming from flat files are, Serial number, Sold-to party, Ship-to party, Installation date, Contract start date, Contract end date, Service profile, Response profile.
Please suggest me what are the Import parameters should I pass in this BAPI to create Service Contract?
Thanks in Advance,
DeepeshHi All,
for everybody's benefit (and to avoid you the time I've spent to work this out...), here is a working example on how to create an sales order (TA) via the BAPI_SLSTRANSACT_CREATEMULTI.
Not really a Service Contract, but it tells you how to call the BAPI.
Points appreciated, if you find this helpful...
I use the convention entryField for the values that should be set based on your system.
Cheers
G
*& Report ZZGVBAPISALESORDER
REPORT ZZGVBAPISALESORDER.
include constants
include crm_direct.
// GUIDs
data: lv_guid_h type GUID_32,
lv_guid_i type GUID_32,
lv_guid_sl type GUID_32,
lv_guid_p type GUID_32.
// Handles
data: lv_current_handle type crmt_handle,
lv_handle_h type crmt_handle,
lv_handle_i type crmt_handle,
lv_handle_sl type crmt_handle,
lv_handle_p type crmt_handle.
// Administration header + item + etc
data: lt_salesorder_header type table of bapibus20001_header_ins,
ls_salesorder_header type bapibus20001_header_ins,
lt_salesorder_item type table of bapibus20001_item,
ls_salesorder_item type bapibus20001_item,
lt_scheduleline type table of BAPIBUS20001_SCHEDLIN,
ls_scheduleline type BAPIBUS20001_SCHEDLIN,
lt_partner type table of BAPIBUS20001_PARTNER_INS,
ls_partner type BAPIBUS20001_PARTNER_INS,
ls_logical_key TYPE crmt_partner_logic_partner_key,
lt_organisation type table of BAPIBUS20001_ORGMAN_INS,
ls_organisation type BAPIBUS20001_ORGMAN_INS.
// Saved sales orders
data: lt_saved_process type table of bapibus20001_object_id,
ls_saved_process type bapibus20001_object_id,
ls_salesorder type CRMT_RETURN_OBJECTS_STRUC.
data: lt_input_fields type table of bapibus20001_input_fields,
ls_input_fields type bapibus20001_input_fields,
lt_return type table of bapiret2,
ls_return type bapiret2.
// Macro definition to populate structure and input field
This, called as
setfield ls_salesorder_header GUID lv_guid_h
is exploded as
ls_salesorder_header-GUID = lv_guid_h.
ls_input_fields-fieldname = 'GUID'.
append ls_input_fields to lt_input_fields.
Note 1: &2 (field name) MUST be uppercase
Note 2: for the salesorder header, I haven't used the macro,
to show how the code should look.
I've used the macro everywhere else.
define setfield.
&1-&2 = &3.
ls_input_fields-fieldname = '&2'.
append ls_input_fields to lt_input_fields.
end-of-definition.
// end of macro definition
// fill order administration header
perform get_guid changing lv_guid_h.
add 1 to lv_handle_h.
ls_salesorder_header-guid = lv_guid_h.
ls_salesorder_header-handle = lv_handle_h.
ls_salesorder_header-process_type = 'TA'.
clear ls_input_fields.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_guid = lv_guid_h.
*ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-orderadm_h.
ls_input_fields-fieldname = 'GUID'.
append ls_input_fields to lt_input_fields.
ls_input_fields-fieldname = 'HANDLE'.
append ls_input_fields to lt_input_fields.
ls_input_fields-fieldname = 'PROCESS_TYPE'.
append ls_input_fields to lt_input_fields.
append ls_salesorder_header to lt_salesorder_header.
// fill organisation data (I needed this, you may rely on
sales org determination instead...)
clear ls_input_fields.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_guid = lv_guid_h.
ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-orgman.
setfield ls_organisation REF_GUID lv_guid_h.
setfield ls_organisation REF_HANDLE lv_handle_h.
setfield ls_organisation REF_KIND gc_object_ref_kind-orderadm_h.
setfield ls_organisation SALES_ORG_RESP salesOrgResp(input).
setfield ls_organisation SALES_ORG salesOrg(input).
setfield ls_organisation DIS_CHANNEL disChannel(input).
append ls_organisation to lt_organisation.
// fill order administration item
perform get_guid changing lv_guid_i.
lv_handle_i = lv_handle_h.
add 1 to lv_handle_i.
clear ls_input_fields.
ls_input_fields-ref_guid = lv_guid_i.
ls_input_fields-ref_handle = lv_handle_i.
*ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_i.
ls_input_fields-objectname = gc_object_name-orderadm_i.
setfield ls_salesorder_item GUID lv_guid_i.
setfield ls_salesorder_item HEADER lv_guid_h.
setfield ls_salesorder_item HANDLE lv_handle_i.
setfield ls_salesorder_item HEADER_HANDLE lv_handle_h.
setfield ls_salesorder_item ORDERED_PROD product(input).
*_set_field ls_salesorder_item ITM_TYPE 'TAN'.
setfield ls_salesorder_item MODE 'A'.
*adjustment taken from standard include LCMS_MAPPERF04
*(see where-used-list for BAPI_SLSTRANSACT_CREATEMULTI, program LCMS_MAPPERU11)
delete lt_input_fields where fieldname = 'HANDLE'
OR
fieldname = 'HEADER_HANDLE'.
append ls_salesorder_item to lt_salesorder_item.
// fill schedule line for item
perform get_guid changing lv_guid_sl.
add 1 to lv_handle_sl.
clear ls_input_fields.
ls_input_fields-ref_guid = lv_guid_i.
ls_input_fields-ref_handle = lv_handle_i.
ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_i.
ls_input_fields-objectname = gc_object_name-schedlin.
setfield ls_scheduleline ITEM_GUID lv_guid_i.
setfield ls_scheduleline GUID lv_guid_sl.
setfield ls_scheduleline HANDLE lv_handle_sl.
setfield ls_scheduleline ITEM_HANDLE lv_handle_i.
setfield ls_scheduleline QUANTITY '1.000'.
append ls_scheduleline to lt_scheduleline.
// fill partner line
*perform get_guid changing lv_guid_p.
*the partner use the logical key as well
ls_logical_key-ref_partner_handle = '0001'.
clear ls_input_fields.
ls_input_fields-ref_guid = lv_guid_h.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-partner.
ls_input_fields-logical_key = ls_logical_key.
setfield ls_partner REF_GUID lv_guid_h.
setfield ls_partner REF_HANDLE lv_handle_h.
setfield ls_partner REF_KIND gc_object_ref_kind-orderadm_h.
setfield ls_partner REF_PARTNER_HANDLE '0001'.
setfield ls_partner KIND_OF_ENTRY 'C'.
setfield ls_partner PARTNER_FCT '00000001'.
setfield ls_partner PARTNER_NO bpNumber(input).
setfield ls_partner NO_TYPE 'BP'.
setfield ls_partner DISPLAY_TYPE 'BP'.
move-corresponding ls_partner to ls_logical_key.
append ls_partner to lt_partner.
// example of a second partner function (custom) with data
override
ls_logical_key-ref_partner_handle = '0002'.
clear ls_input_fields.
ls_input_fields-ref_guid = lv_guid_h.
ls_input_fields-ref_handle = lv_handle_h.
ls_input_fields-ref_kind = gc_object_ref_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-partner.
ls_input_fields-logical_key = ls_logical_key.
setfield ls_partner REF_GUID lv_guid_h.
setfield ls_partner REF_HANDLE lv_handle_h.
setfield ls_partner REF_KIND gc_object_ref_kind-orderadm_h.
setfield ls_partner REF_PARTNER_HANDLE '0002'.
setfield ls_partner KIND_OF_ENTRY 'B'. "manual entry...
setfield ls_partner PARTNER_FCT customFct(input).
setfield ls_partner PARTNER_NO bpNumber(input).
setfield ls_partner NO_TYPE 'BP'.
setfield ls_partner DISPLAY_TYPE 'BP'.
setfield ls_partner TITLE 'Mr.'.
setfield ls_partner FIRSTNAME 'John'.
setfield ls_partner LASTNAME 'Smith'.
setfield ls_partner STR_SUPPL1 'John Smith and Co'.
setfield ls_partner STREET 'Street1'.
setfield ls_partner STR_SUPPL3 'Street4'.
setfield ls_partner HOUSE_NO '42'.
setfield ls_partner CITY 'Townville'.
setfield ls_partner DISTRICT 'Districtshire'.
setfield ls_partner POSTL_COD1 'AA1 2BB'.
note now ...
*adjustment taken from standard include LCMS_MAPPERF04
*(see where-used-list for BAPI_SLSTRANSACT_CREATEMULTI, program LCMS_MAPPERU11)
I don't use macro because name of the field in input_table is different
*_set_field ls_partner COUNTRYISO 'GB'.
*instead
ls_partner-COUNTRYISO = 'GB'.
ls_input_fields-fieldname = 'COUNTRY'.
append ls_input_fields to lt_input_fields.
*_set_field ls_partner LANGU_ISO 'EN'.
ls_partner-LANGU_ISO = 'EN'.
ls_input_fields-fieldname = 'LANGU'.
append ls_input_fields to lt_input_fields.
move-corresponding ls_partner to ls_logical_key.
append ls_partner to lt_partner.
Create sales orders *
call function 'BAPI_SLSTRANSACT_CREATEMULTI'
EXPORTING
testrun = false
TABLES
header = lt_salesorder_header[]
item = lt_salesorder_item[]
partner = lt_partner[]
organisation = lt_organisation[]
input_fields = lt_input_fields[]
scheduleline = lt_scheduleline[]
saved_process = lt_saved_process[]
return = lt_return[].
// get the GUID of the created object
call function 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
INCLUDE ZZGVBAPISALESORDER_GET_GUIDF01.
The include contains only this:
***INCLUDE ZZGVBAPISALESORDER_GET_GUIDF01 .
*& Form get_guid
text
<--guid text
FORM get_guid CHANGING GUID.
CALL FUNCTION 'SYSTEM_UUID_C_CREATE'
IMPORTING
UUID = GUID.
ENDFORM. " get_guid -
Unable to Change Withholding Tax Base Amount while creating Service AP Invoice through DI API?
Dear All,
I am trying to create Service AP Invoice through DI API.
If I post the document without changing SAPPurchaseInvoice.WithholdingTaxData.TaxableAmount the dount ocument is created in SAP without any problem.
But if I change amount in above field then DI API throws error Unbalanced Transaction.
If I post same document in SAP with changed base amount it got posted in SAP without any Issue.
Where I am doing wrong?
please guide.
Using:
SAP B1 version 9 Patch Level 11
Location : India.
Thanks.Hi ,
maybe you can find solution to these note 1812344
1846344 - Overview Note for SAP Business One 8.82 PL12
Symptom
This SAP Note contains collective information related to upgrades to SAP Business One 8.82 Patch Level 12 (B1 8.82 PL12) from previous SAP Business One releases.
In order to receive information about delivered patches via email or RSS, please use the upper right subscription options on http://service.sap.com/~sapidp/011000358700001458732008E
Solution
Patch installation options:
SAP Business One 8.82 PL12 can be installed directly on previous patches of SAP Business One 8.82
You can upgrade your SAP Business One to 8.82PL12 from all patches of the following versions:8.81; 8.8; 2007 A SP01; 2007 A SP00; 2007 B SP00; 2005 A SP01; 2005 B
Patch content:
SAP Business One 8.82 PL12 includes all corrections from previous patches for releases 8.82, 8.81, 8.8, 2007, and 2005.
For details about the contained corrections, please see the SAP Notes listed in the References section.
Notes: SAP Business One 8.82 PL12 contains B1if version 1.17.5
Patch download:
Open http://service.sap.com/sbo-swcenter -> SAP Business One Products -> Updates -> SAP Business One 8.8 -> SAP BUSINESS ONE 8.82 -> Comprised Software Component Versions -> SAP BUSINESS ONE 8.82 -> Win32 -> Downloads tab
Header Data
Released On
02.05.2013 02:34:18
Release Status
Released for Customer
Component
SBO-BC-UPG Upgrade
Priority
Recommendations/additional info
Category
Upgrade information
References
This document refers to:
SAP Business One Notes
1482452
IN_Wrong tax amount was created for some items in the invoice with Excisable BOM item involves
1650289
Printing Inventory Posting List for huge amount of data
1678528
Withholding amount in the first row is zeroed.
1754529
Error Message When Running Pick and Pack Manager
1756263
Open Items List shuts down on out of memory
1757641
Year-end closing
1757690
SEPA File Formats - New Pain Versions
1757898
Incoming Bank File Format
1757904
Outgoing Bank File Format
1762860
Incorrect weight calculation when Automatic Availability Check is on
1770690
Pro Forma Invoice
1776948
Calendar columns are wrong when working with Group View
1780460
OINM column description is not translated
1780486
UI_System crash when you set extreme value of double type to DataTable column
1788256
Incorrect User-Defined Field displayed in a Stock Transfer Request
1788372
ZH: 'Unacceptable Field' when export document to word
1788818
RU loc: No freight in the Tax Invoice layout
1790404
Cash Flow Inconsistency when Canceling Payment
1791295
B1info property of UI API AddonsInstaller object returns NULL value
1791416
Adding a new item to BoM is slow
1794111
Text is overlapping in specific localization
1795595
Change log for item group shows current system date in all the "Created" fields
1797292
Queries in alerts should support more query results
1800055
B1if_ Line break issue in inbound retrieval using JDBC
1802580
Add Journal Voucher to General Ledger report
1803586
Not realized payment is exported via Payment Engine using 'SAPBPDEOPBT_DTAUS' file format
1803751
Period indicator of document series can be changed although it has been used
1804340
LOC_BR_Cannot update Nota Fiscal Model
1805554
G/L Account displayed in a wrong position when unticking the checkbox "Account with Balance of Zero"
1806576
Payment Cannot Be Reconciled Internally
1807611
Cannot update UDF in Distribution Rule used in transactions
1807654
Serial No./Batch inconsistency by canceled Inventory Transfer
1808694
BR: Business Partner Code cannot be updated with CNPJ CPF error
1809398
CR_Cannot Display Related Multi-Value Parameters
1809758
Arrow key not work for Batch/Serial Number Transactions Report
1810099
Tax Amount is Recalculated Even if Tax Code Is Not Changed
1811270
Upgrade fails on Serial And Batches object with error code -10
1811846
Cannot run Exchange Rate Differences when multi branch is activated
1812344
Withholding Tax Amount Is Not Updated in Payment Once Witholding Tax Code Is Changed in Document through DI API
1812740
DI:"Operation Code" show wrong value when add "A/P Tax Invoice" based on "A/P Invoice"
1813029
US_Vendor address on 1099 Summary by Form/Box Report is not updated according to the latest Invoice
1813835
Wrong amounts of Goods Return in Open Item List
1814207
Preliminary page prints setting does not keep after upgrade
1814860
Value "Zero" cannot be imported to "Minimum Inventory Level" field via Excel file
1815535
RFQ: Web front end not displayed in supplier language
1815810
GT: Adding Incoming Payment for Some Cash Flow Relevant Accounts Fails
1816191
BR:System Crashes While Working with Tax Code Determination Window
1816611
CR_Crystal Report Displayed Incorrectly Afte -
Hi Guys,
Any one tell me how to create a Sales Order. What are the Mandatory parameters we need to pass while creating. Thanks in advance.
Thanks
Kiran.BHello kiran,
<b>**REMEMBER: please do reward points for good answers**</b>
1. Create sales order
This process step can be triggered as follows:
The customer accepts the quotation and places an order.
You create a sales order with reference to a quotation. For more information, see Structure link processing Quotations. The system copies the items from the quotation.
You create a sales order. This is also possible without performing the previous steps.
2. Enter products
You enter products requested by customers.
Note
If necessary, you can configure products again for every item of the sales order. You can find more information in the business scenario variant Structure linkQuotation and Order Management (Configure-to-Order) and under Structure linkProduct Configuration in the Sales Transaction.
3. Check availability, schedule order and create requirements
The system triggers an availability check and scheduling in SAP APO for every order item in SAP CRM. The confirmed quantities and dates are confirmed by SAP APO to SAP CRM, and saved in the sales order (see Structure linkAvailability Check in the Sales Order). At the same time, a customer requirement is created in SAP APO.
Note
You can also execute the availability check in SAP R/3. You can find more information under Structure linkAvailability Check with SAP R/3.
4. Maintain and determine conditions
The system determines the prices and the value of individual items. If necessary, you can process these. For more information, see Structure linkPricing.
5. Perform credit check
SAP R/3 executes a credit check based on the results of pricing in SAP CRM. The result of the credit check is confirmed in SAP CRM, and saved as the credit status at item level. For more information, see Structure linkAutomatic Credit Check.
6. System replicates sales order
After the sales order has been saved in SAP CRM, complete and without errors, it is replicated for logistics processing in SAP R/3. Order data is transferred together with confirmed scheduling lines to SAP R/3.
7. System receives sales order
After replication to SAP R/3, you can change the sales order in SAP CRM and SAP R/3. You can find more information on this under Structure linkData Exchange for Sales Transactions: CRM Enterprise - SAP R/3
8. Send order confirmation to customer
You can send the order confirmation either electronically, or in print to the customer. You can find more information under Structure linkSales Order Confirmation by E-Mail.
9. Monitor status of order
Regards
Ak
Maybe you are looking for
-
How do I unlock my phone if i dont remember the code?
I am going back to an old phone and it is locked. I cant remember the code what do I do?
-
Has anyone found any solution for the noise problem for an iMac 21.5"?
I have recently bought a new iMac 21.5" 1TB. There is constant noise which sounds like it comes from the disk drive. It is very loud and annoying and you can hear it 10 ft away even. I took it to the Apple store and of course it is too noisy in t
-
First_nonlogged_scn and Dataguard
How do you do! Can I ask for help please? In my DB that created from hot backup I see nonlogged activity - query from view V$DATAFILE returns one row with not empty column first_nonlogged_scn. After validation of data file in view v$database_block_co
-
Create Now - Web | Create Now | Adobe TV
In this episode we deep dive into all things web, with Paul Burnett guiding us through the powerful new features in Photoshop CC, Edge Code and Dreamweaver CC. Michael Stoddart chats with web agency Pretty to discuss how they built their business aro
-
Need help in converting authorware files to HTML5
Hi, I am using Windows7 64 bit OS, I have games written in Authorware and I want to convert this into HTML5. Can anybody help me in achieving this. I went through some forums which says there is no direct conversion possible. But I want to know what