Application Development and Automation 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: 
Read only

BAPI to create an RFQ

Former Member
0 Likes
873

Hi everyone,

Could anyone tell me if there is a BAPI for creating a Request For Quotation, please?

I found several BAPIs that create a Quotation, such as BAPI_QUOTATION_CREATEFROMDATA, or BAPI_QUOTATION_CREATEFROMDATA2.

If there are no BAPIs for RFQ, would it be possibile to use one of these 2, and modify the document in some way to get an RFQ? Has anyone tried something like this before?

Thanks, and best regards

Srdj

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
698

Hi,

You can use two BAPIs:

BAPI_QUOTATION_CREATEFROMDATA

BAPI_QUOTATION_CREATEFROMDATA2

(1) BAPI_QUOTATION_CREATEFROMDATA ,this BAPI is released in 4.0A version .

(2) BAPI_QUOTATION_CREATEFROMDATA2 this BAPI is released in latest version ,the kernal level patches provides more security when this BAPI is called from an external application across variuos networks.

If ever using the BAPI internally with in sap or calling it from the application within the same network the only diff using the old BAPI wud be in the next future upgrades SAP wud not support the BAPI_QUOTATION_CREATEFROMDATA but the usage wise and functionality wise there is no diff.

CODE

Data: loc_bp type BAPIBUS1006_HEAD-BPARTNER.

data: re_return like BAPIRET2 occurs 0.

data: wa_return type BAPIRET2.

data: re_order_header_in like BAPISDHD1.

data: wa_BAPISDH1X type BAPISDH1X.

data: order_partners like BAPIPARNR occurs 0 with header line.

data: order_items_in like BAPISDITM occurs 0 with header line.

data: order_items_sched LIKE bapischdl OCCURS 0 WITH HEADER LINE.

data: g_vbeln like smovbak-vbeln,

l_vbeln like smovbak-vbeln.

move BUSINESSPARTNER to loc_bp.

*delete line if middleware active.

*loc_bp = '0030000309'.

re_order_header_in-DOC_TYPE = 'TA'.

re_order_header_in-SALES_ORG = 'NL01'.

re_order_header_in-DISTR_CHAN = '02'.

re_order_header_in-DIVISION = '01'.

order_partners-partn_role = 'AG'.

order_partners-partn_numb = loc_bp.

append order_partners.

order_partners-partn_role = 'WE'.

order_partners-partn_numb = loc_bp.

append order_partners.

order_items_in-itm_number = '000010'.

order_items_in-MATERIAL = MATERIAL.

order_items_sched-itm_number = '00010'.

order_items_sched-req_qty = '1'.

append order_items_sched.

append order_items_in.

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

DESTINATION 'zorder'

EXPORTING

ORDER_HEADER_IN = re_order_header_in

TESTRUN = ' '

importing

salesdocument = g_vbeln

TABLES

RETURN = re_return

ORDER_ITEMS_IN = order_items_in

ORDER_PARTNERS = order_partners

order_schedules_in = order_items_sched.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

DESTINATION 'zorder'

EXPORTING

WAIT = 'X'

IMPORTING

RETURN = wa_return.

Regards,

Shiva Kumar

Hi everyone,

Could anyone tell me if there is a BAPI for creating a Request For Quotation, please?

I found several BAPIs that create a Quotation, such as BAPI_QUOTATION_CREATEFROMDATA, or BAPI_QUOTATION_CREATEFROMDATA2.

If there are no BAPIs for RFQ, would it be possibile to use one of these 2, and modify the document in some way to get an RFQ? Has anyone tried something like this before?

Thanks, and best regards

Srdj

2 REPLIES 2
Read only

Former Member
0 Likes
699

Hi,

You can use two BAPIs:

BAPI_QUOTATION_CREATEFROMDATA

BAPI_QUOTATION_CREATEFROMDATA2

(1) BAPI_QUOTATION_CREATEFROMDATA ,this BAPI is released in 4.0A version .

(2) BAPI_QUOTATION_CREATEFROMDATA2 this BAPI is released in latest version ,the kernal level patches provides more security when this BAPI is called from an external application across variuos networks.

If ever using the BAPI internally with in sap or calling it from the application within the same network the only diff using the old BAPI wud be in the next future upgrades SAP wud not support the BAPI_QUOTATION_CREATEFROMDATA but the usage wise and functionality wise there is no diff.

CODE

Data: loc_bp type BAPIBUS1006_HEAD-BPARTNER.

data: re_return like BAPIRET2 occurs 0.

data: wa_return type BAPIRET2.

data: re_order_header_in like BAPISDHD1.

data: wa_BAPISDH1X type BAPISDH1X.

data: order_partners like BAPIPARNR occurs 0 with header line.

data: order_items_in like BAPISDITM occurs 0 with header line.

data: order_items_sched LIKE bapischdl OCCURS 0 WITH HEADER LINE.

data: g_vbeln like smovbak-vbeln,

l_vbeln like smovbak-vbeln.

move BUSINESSPARTNER to loc_bp.

*delete line if middleware active.

*loc_bp = '0030000309'.

re_order_header_in-DOC_TYPE = 'TA'.

re_order_header_in-SALES_ORG = 'NL01'.

re_order_header_in-DISTR_CHAN = '02'.

re_order_header_in-DIVISION = '01'.

order_partners-partn_role = 'AG'.

order_partners-partn_numb = loc_bp.

append order_partners.

order_partners-partn_role = 'WE'.

order_partners-partn_numb = loc_bp.

append order_partners.

order_items_in-itm_number = '000010'.

order_items_in-MATERIAL = MATERIAL.

order_items_sched-itm_number = '00010'.

order_items_sched-req_qty = '1'.

append order_items_sched.

append order_items_in.

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

DESTINATION 'zorder'

EXPORTING

ORDER_HEADER_IN = re_order_header_in

TESTRUN = ' '

importing

salesdocument = g_vbeln

TABLES

RETURN = re_return

ORDER_ITEMS_IN = order_items_in

ORDER_PARTNERS = order_partners

order_schedules_in = order_items_sched.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

DESTINATION 'zorder'

EXPORTING

WAIT = 'X'

IMPORTING

RETURN = wa_return.

Regards,

Shiva Kumar

Read only

0 Likes
698

Thanks Shiva, that was helpful. I figured out that the BAPI..CREATEFROMDATA2 is the newer one, so I was planning to use that one in any case, but I still don't know whether it is capable of creating an RFQ, and not the Quotiation. I will try it, and then possibly get back to this thread with the results.

Thanks again!