$120 tested Claude codes · real before/after data · Full tier $15 one-timebuy --sheet=15 →
$Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. download --free →
clskills.sh — terminal v2.4 — 2,347 skills indexed● online
[CL]Skills_
SAPintermediateNew

SAP SD Sales Order

Share

Create and process sales orders with BAPI_SALESORDER_CREATEFROMDAT2

Works with OpenClaude

You are an SAP SD consultant. The user wants to create and process sales orders in SAP using the BAPI_SALESORDER_CREATEFROMDAT2 function module.

What to check first

  • Verify your user has the required ABAP/4 transaction authorization (especially for BAPI execution via RFC)
  • Check that the material master and customer master records exist in the system
  • Run transaction SE37 to locate and examine BAPI_SALESORDER_CREATEFROMDAT2 function signature directly

Steps

  1. Establish an RFC connection to the SAP system using SAP GUI or programmatic RFC library (e.g., pyarfc, node-gyp + nwrfc)
  2. Populate the ORDER_HEADER_IN structure with mandatory fields: doc_type (e.g., 'TA'), sales_org, distr_channel, division, soldto_party, purch_no, purch_date
  3. Build the ORDER_ITEMS_IN table with each line item including material, quantity, net_price, plant, req_date
  4. Optionally fill ORDER_PARTNERS_IN table if billing or shipping partners differ from sold-to party
  5. Call BAPI_SALESORDER_CREATEFROMDAT2 with all populated structures
  6. Parse the return tables: SALESDOCUMENT (order number), RETURN (status/error messages), ORDER_ITEMS_OUT (line item details)
  7. If status is successful (type 'S' or 'W'), commit the transaction with BAPI_TRANSACTION_COMMIT to persist the order
  8. Log the returned sales order number for reference and integrate with downstream processes (delivery, billing)

Code

REPORT ZTEST_SD_ORDER.

DATA: ls_order_header_in TYPE bapisdhd1,
      lt_order_items_in  TYPE TABLE OF bapisdit1,
      ls_order_item      TYPE bapisdit1,
      lt_order_partners  TYPE TABLE OF bapisdpm1,
      ls_partner         TYPE bapisdpm1,
      lt_return          TYPE TABLE OF bapiret2,
      ls_return          TYPE bapiret2,
      lv_salesdoc        TYPE bapisdh1-doc_number,
      lv_error_flag      TYPE flag.

* Fill Order Header
ls_order_header_in-doc_type = 'TA'.           "Standard Order
ls_order_header_in-sales_org = '1000'.
ls_order_header_in-distr_channel = '10'.
ls_order_header_in-division = '00'.
ls_order_header_in-soldto_party = '0000000001'.  "Customer number
ls_order_header_in-purch_no = 'PO123456'.
ls_

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

CategorySAP
Difficultyintermediate
Version1.0.0
AuthorClaude Skills Hub
sapsdsales-order

Install command:

curl -o ~/.claude/skills/sap-sd-sales-order.md https://clskills.in/skills/sap/sap-sd-sales-order.md

Related SAP Skills

Other Claude Code skills in the same category — free to download.

Want a SAP skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.