Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Parameters to be passed to BAPI_SALESORDER_SIMULATE

Former Member
0 Kudos
1,983

Hi Experts,

I need your help to identify the parameters that need to be passed to the bapi: BAPI_SALESORDER_SIMULATE.

I am using this BAPI to perform ATP Check, Payment Authorization (Credit Cards), Conditions and Credit Check.

I am not sure about which fields need to be filled in the structures ORDER_ITEMS_IN, ORDER_PARTNERS, ORDER_SCHEDULE_IN, ORDER_CCARD.

If any other structures need to be filled, kindly let me know of the same.

Thanks in advance.

Regards,

Keerthi

5 REPLIES 5

former_member585865
Contributor
0 Kudos
148

Hi Keerthi,

t_orderitem_in-req_date = <date>.

t_orderitem_in-itm_number = <line item no>.

PERFORM convert_salesunit_input CHANGING it_mat-vrkme.

t_orderitem_in-material = <Material>

APPEND t_orderitem_in.

CLEAR t_orderitem_in.

t_orderschedulein-itm_number = <line item no>

  • T_ORDERSCHEDULEIN-REQ_DATE = SY-DATUM. "T_SOHDR-VDATU.

  • T_ORDERSCHEDULEIN-SCHED_LINE = 1.

t_orderschedulein-req_qty = <req quantity>

APPEND t_orderschedulein.

CLEAR t_orderschedulein.

MODIFY it_mat TRANSPORTING itmno.

ENDLOOP.

  • Sold to Party

IF t_sohdr-kunnr CO '0123456789 '.

p_kunnr = t_sohdr-kunnr.

t_sohdr-kunnr = p_kunnr.

ENDIF.

MOVE: 'AG' TO t_orderpart-partn_role,

t_sohdr-kunnr TO t_orderpart-partn_numb.

APPEND t_orderpart.

  • Ship to Party

IF t_sohdr-shknr CO '0123456789 '.

p_kunnr = t_sohdr-shknr.

t_sohdr-shknr = p_kunnr.

ENDIF.

MOVE: 'WE' TO t_orderpart-partn_role,

t_sohdr-shknr TO t_orderpart-partn_numb.

APPEND t_orderpart.

CALL FUNCTION 'BAPI_SALESORDER_SIMULATE'

EXPORTING

order_header_in = orderhead

IMPORTING

return = return

TABLES

order_items_in = t_orderitem_in

order_partners = t_orderpart

order_schedule_in = t_orderschedulein

order_items_out = t_orderitem_out

order_schedule_ex = t_orderitem_sch

order_condition_ex = t_orderitem_cond

messagetable = t_bapi_return2

EXCEPTIONS

OTHERS = 1.

Former Member
0 Kudos
148

Hi,

You need to pass ORDER_HEADER_IN, ORDER_ITEMS_IN, ORDER_PARTNERS, ORDER_CCARD and ORDER_CCARD_EX.

-


DATA: st_BAPISDHEAD like BAPISDHEAD, " Sales Order Header Data

ta_BAPIITEMIN like BAPIITEMIN occurs 0 with header line, " Ln item

ta_BAPIPARTNR like BAPIPARTNR occurs 0 with header line, " Partner

int_BAPIITEMEX like BAPIITEMEX occurs 0 with header line,

int_BAPISDHEDU like BAPISDHEDU occurs 0 with header line,

int_BAPICOND like BAPICOND occurs 0 with header line,

int_BAPIINCOMP like BAPIINCOMP occurs 0 with header line,

d_BAPIRETURN1 like BAPIRETURN. " Bapi return msg

  • Move the data to create sales order in the repective parameters------*

move: 'TA' to st_BAPISDHEAD-DOC_TYPE, " Sales document type

'15493' to st_BAPISDHEAD-PURCH_NO_C,

'00010' to ta_BAPIITEMIN-ITM_NUMBER,

'Y-351' to ta_BAPIITEMIN-MATERIAL,

'1100' to ta_BAPIITEMIN-PLANT,

'1' to ta_BAPIITEMIN-REQ_QTY,

'AG' to ta_BAPIPARTNR-PARTN_ROLE, " Sold to Party

'0000007777' to ta_BAPIPARTNR-PARTN_NUMB.

  • Append the internal tables-------------------------------------------*

append ta_BAPIPARTNR.

clear ta_BAPIPARTNR.

append ta_BAPIITEMIN.

clear ta_BAPIITEMIN.

  • Move ship to party---------------------------------------------------*

move: 'RG' to ta_BAPIPARTNR-PARTN_ROLE, " Ship to party

'0000007777' to ta_BAPIPARTNR-PARTN_NUMB.

  • Append the internal tables-------------------------------------------*

append ta_BAPIPARTNR.

clear ta_BAPIPARTNR.

  • Call BAPI to SIMULATE the Order

CALL FUNCTION 'BAPI_SALESORDER_SIMULATE'

EXPORTING

ORDER_HEADER_IN = st_BAPISDHEAD

  • CONVERT_PARVW_AUART = ' '

IMPORTING

  • SALESDOCUMENT =

  • SOLD_TO_PARTY =

  • SHIP_TO_PARTY =

  • BILLING_PARTY =

RETURN = d_BAPIRETURN1

TABLES

ORDER_ITEMS_IN = ta_BAPIITEMIN

ORDER_PARTNERS = ta_BAPIPARTNR

  • ORDER_SCHEDULE_IN =

ORDER_ITEMS_OUT = int_BAPIITEMEX

  • ORDER_CFGS_REF =

  • ORDER_CFGS_INST =

  • ORDER_CFGS_PART_OF =

  • ORDER_CFGS_VALUE =

  • ORDER_CFGS_BLOB =

  • ORDER_CCARD =

  • ORDER_CCARD_EX =

ORDER_SCHEDULE_EX = int_BAPISDHEDU

ORDER_CONDITION_EX = int_BAPICOND

ORDER_INCOMPLETE = int_BAPIINCOMP

  • MESSAGETABLE =

  • EXTENSIONIN =

  • PARTNERADDRESSES =

.

IF SY-SUBRC = 0.

ENDIF

Former Member
0 Kudos
148

hi Keerthi,

first u have to create the following internal table.

DATA: IT_ORDER_HEADER_IN TYPE STANDARD TABLE OF BAPISDHEAD WITH HEADER LINE,

IT_RETURN TYPE STANDARD TABLE OF BAPIRETURN WITH HEADER LINE,

IT_ORDER_ITEMS_IN TYPE STANDARD TABLE OF BAPIITEMIN WITH HEADER LINE,

IT_ORDER_PARTNERS TYPE STANDARD TABLE OF BAPIPARTNR WITH HEADER LINE,

IT_ORDER_SCHEDULE_IN TYPE STANDARD TABLE OFBAPISCHDL WITH HEADER LINE,

IT_ORDER_ITEMS_OUT TYPE STANDARD TABLE OF BAPIITEMEX WITH HEADER LINE,

IT_ORDER_CFGS_REF TYPE STANDARD TABLE OFBAPICUCFGWITH HEADER LINE,

IT_ORDER_CFGS_INST TYPE STANDARD TABLE OFBAPICUINSWITH HEADER LINE,

IT_ORDER_CFGS_PART_OF TYPE STANDARD TABLE OF BAPICUPRT WITH HEADER LINE,

IT_ORDER_CFGS_VALUE TYPE STANDARD TABLE OF BAPICUVAL WITH HEADER LINE,

IT_ORDER_CFGS_BLOB TYPE STANDARD TABLE OF BAPICUBLB WITH HEADER LINE,

IT_ORDER_CCARD TYPE STANDARD TABLE OFBAPICCARD WITH HEADER LINE,

IT_ORDER_CCARD_EX TYPE STANDARD TABLE OFBAPICCARD_EX WITH HEADER LINE,

IT_ORDER_SCHEDULE_EX TYPE STANDARD TABLE OF BAPISDHEDUWITH HEADER LINE,

IT_ORDER_CONDITION_EX TYPE STANDARD TABLE OF BAPICOND WITH HEADER LINE,

IT_ORDER_INCOMPLETE TYPE STANDARD TABLE OF BAPIINCOMP WITH HEADER LINE,

IT_MESSAGETABLE TYPE STANDARD TABLE OFBAPIRET2 WITH HEADER LINE,

IT_EXTENSIONIN TYPE STANDARD TABLE OF BAPIPAREX WITH HEADER LINE,

IT_PARTNERADDRESSES TYPE STANDARD TABLE OF BAPIADDR1 WITH HEADER LINE,

CONVERT_PARVW_AUART type BAPIFLAG-BAPIFLAG,

then pass it where required.

Hope this helps

Regards

Ritesh J

Former Member
0 Kudos
148

Hi,

See the mandatory field's of all structure of bapi and fill them with require data and also update updation flag if any.

Thanks

Mohit

Former Member
0 Kudos
148

see the following example


*&---------------------------------------------------------------------*
*& Report  ZSALESORDER_SIMULATE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZSALESORDER_SIMULATE.


*REPORT  z_salesorder_simulate.

DATA: order_header_in LIKE bapisdhead,
      order_items_in LIKE TABLE OF bapiitemin,
      return LIKE bapireturn,
      wa_order_items_in LIKE LINE OF order_items_in,
      order_partners LIKE TABLE OF bapipartnr,
      wa_order_partners LIKE LINE OF order_partners,
      order_items_out LIKE TABLE OF bapiitemex,
      wa_order_items_out LIKE LINE OF order_items_out.

* Fill order_header_in
order_header_in-doc_type = 'TA'.

* Fill order_items_in
wa_order_items_in-material = '000000000000020927'.
wa_order_items_in-req_qty = '1000'.

APPEND wa_order_items_in TO order_items_in.

* Fill order_items_in
wa_order_partners-partn_role = 'AG'.
wa_order_partners-partn_numb = '0000000001'.

APPEND wa_order_partners TO order_partners.

* Execute Function Module BAPI_SALESORDER_SIMULATE
CALL FUNCTION 'BAPI_SALESORDER_SIMULATE'
  EXPORTING
    order_header_in           = order_header_in
  IMPORTING
    return                    = return
  TABLES
    order_items_in            = order_items_in
    order_partners            = order_partners
    order_items_out           = order_items_out.

* The return structure gives any error messages
WRITE: return-message.

* Print out the order items
LOOP AT order_items_out INTO wa_order_items_out.
  WRITE: wa_order_items_out-material,
         wa_order_items_out-short_text,
         wa_order_items_out-subtotal_2.
ENDLOOP.




*