# BAPI_INQUIRY_CREATEFROMDATA2 — Create Customer Inquiry

> Creates a customer inquiry from header, item, partner and schedule line data, like VA11. It is used when requests from portals or e-mail tools are recorded in SD before a quotation is made. Fill the X structures, check RETURN and call BAPI_TRANSACTION_COMMIT afterwards only when RETURN contains no message of type E or A.

- Modules: SD
- Type: BAPI
- Function group: 2030
- Remote-enabled (RFC): Yes
- S/4HANA status: Used the same way in S/4HANA
- URL: https://nekuhub.com/en/functions/bapi-inquiry-createfromdata2/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| SALESDOCUMENTIN | BAPIVBELN-VBELN | External sales document number | - |
| INQUIRY_HEADER_IN | BAPISDHD1 | Inquiry header data | Yes |
| INQUIRY_HEADER_INX | BAPISDHD1X | Inquiry header change flags (X structure) | - |
| SENDER | BAPI_SENDER | Logical sender system (ALE) | - |
| BEHAVE_WHEN_ERROR | BAPIFLAG-BAPIFLAG | Error handling behavior | - |
| TESTRUN | BAPIFLAG-BAPIFLAG | Test run (no update) | - |
| CONVERT | BAPIFLAG-BAPIFLAG | Convert partner roles and document types to internal format | - |
| LOGIC_SWITCH | BAPISDLS | SD logic switch (pricing, ATP control) | - |

## Exporting parameters

| Parameter | Type | Description |
|---|---|---|
| SALESDOCUMENT | BAPIVBELN-VBELN | Inquiry number created |

## Tables parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| RETURN | BAPIRET2 | Return messages | - |
| INQUIRY_ITEMS_IN | BAPISDITM | Inquiry item data | - |
| INQUIRY_ITEMS_INX | BAPISDITMX | Inquiry item change flags (X structure) | - |
| INQUIRY_PARTNERS | BAPIPARNR | Inquiry partners | Yes |
| INQUIRY_SCHEDULES_IN | BAPISCHDL | Schedule lines | - |
| INQUIRY_SCHEDULES_INX | BAPISCHDLX | Schedule line change flags (X structure) | - |
| INQUIRY_CONDITIONS_IN | BAPICOND | Pricing conditions | - |
| INQUIRY_CONDITIONS_INX | BAPICONDX | Condition change flags (X structure) | - |
| INQUIRY_TEXT | BAPISDTEXT | Texts | - |
| INQUIRY_KEYS | BAPISDKEY | Reference keys of created objects | - |
| PARTNERADDRESSES | BAPIADDR1 | Partner addresses | - |
| EXTENSIONIN | BAPIPAREX | Customer enhancement fields (EXTENSIONIN) | - |

## Call template (ABAP)

```abap
CALL FUNCTION 'BAPI_INQUIRY_CREATEFROMDATA2'
  EXPORTING
    inquiry_header_in = lv_inquiry_header_in
  IMPORTING
    salesdocument = lv_salesdocument
  TABLES
    return = lt_return
    inquiry_items_in = lt_inquiry_items_in
    inquiry_items_inx = lt_inquiry_items_inx
    inquiry_partners = lt_inquiry_partners
    inquiry_schedules_in = lt_inquiry_schedules_in
    inquiry_schedules_inx = lt_inquiry_schedules_inx
    inquiry_conditions_in = lt_inquiry_conditions_in
    inquiry_conditions_inx = lt_inquiry_conditions_inx
    inquiry_text = lt_inquiry_text
    inquiry_keys = lt_inquiry_keys.
```

## Related tables

VBAK, VBAP, VBEP, VBPA

