Hello,

Sign up to join our community!

Welcome Back,

Please sign in to your account!

Forgot Password,

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask a question.

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

SAP EWM Help Latest Questions

  • 0
  • 0
DPM125
Beginner

SAP SCRIPT : Sales Order Confirmation

A company wants to generate a Sales Order Confirmation that prints both header data (from VBAK: Sales Order Number, Customer, Date) and item details (from VBAP: Material, Description, Quantity).
The business expects a simple printable document that can be given to customers.

Since this is a text-heavy output with minimal graphics, the customer chooses SAPscript as the form technology.

ABAP Driver Program → Fetch data (VBAK/VBAP)

SAPscript Layout Set (SE71) → Windows + Paragraph Formats

Functions: OPEN_FORM → WRITE_FORM → CLOSE_FORM

Final Output → Printed / Spool / PDF

REPORT zsd_sapscript_driver.

TABLES: vbak, vbap.

DATA: it_vbak TYPE vbak,
it_vbap TYPE TABLE OF vbap,
wa_vbap TYPE vbap.

PARAMETERS: p_vbeln TYPE vbak-vbeln OBLIGATORY.

START-OF-SELECTION.

“Fetch Sales Order Header
SELECT SINGLE * INTO it_vbak
FROM vbak
WHERE vbeln = p_vbeln.

IF sy-subrc <> 0.
MESSAGE ‘Sales Order not found’ TYPE ‘E’.
ENDIF.

“Fetch Sales Order Items
SELECT * INTO TABLE it_vbap
FROM vbap
WHERE vbeln = p_vbeln.

“Open Form
CALL FUNCTION ‘OPEN_FORM’
EXPORTING
form = ‘ZSALES_ORDER’ ” SAPscript layout set
language = sy-langu.

“Print Header Window
CALL FUNCTION ‘WRITE_FORM’
EXPORTING
element = ‘HEADER’ ” SAPscript text element
TABLES
lines = it_vbak.

“Print Items
LOOP AT it_vbap INTO wa_vbap.
CALL FUNCTION ‘WRITE_FORM’
EXPORTING
element = ‘ITEMS’
TABLES
lines = wa_vbap.
ENDLOOP.

“Close Form
CALL FUNCTION ‘CLOSE_FORM’.

 

Key Notes

  • Layout set is created in SE71 (e.g., ZSALES_ORDER).

  • Text elements HEADER and ITEMS must be defined inside the layout set.

  • Data (from VBAK/VBAP) flows from ABAP → WRITE_FORM → Windows in layout.

Related Questions

Leave an answer

Leave an answer