/sc4sap:smartform-previewfrom sc4sap
Generates a JPG and HTML print preview of an SAP SmartForm, showing windows at real mm positions, SmartStyle fonts, table grids, SE78 graphics, and loops with sample data. Reports cut-off cells and windows.
Ships in sc4sap. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Offline profile (
common/offline-mode.md): blocked — reply with the stop line there and stop.
Reads one SmartForm from the connected system and draws what a printed page will look like, without running the print program: one JPG and one HTML page (A4 in mm). Field symbols (&HEADER-NAME1&) are filled with invented sample values that fit the field types read from the DDIC, so the picture shows realistic widths — and the places where the form cuts text off.
<Response_Prefix>Every response triggered by this skill MUST begin with [Model: <main-model> · Dispatched: <sub-summary>] per ../../common/model-routing-rule.md § Response Prefix Convention. This skill dispatches no agents (Dispatched: none).</Response_Prefix>
<Target_Object>The target object is looked up on the active profile's system only. Not found → stop and ask per ../../common/multi-profile-artifact-resolution.md § Target object not on the active system — never substitute a similar name, never switch profiles on your own.</Target_Object>
<Team_Mode>No teamMode integration. Reading and drawing are scripted; the main thread writes the sample values.</Team_Mode>
<Use_When>
<Do_Not_Use_When>
<Decisions_Fixed>
| Topic | Decision |
|---|---|
| Source | MCP GetSmartFormContent (active version, logon language) → <form>.content.json in the MCP output directory |
| Values | Invented by the main thread from the field types (GetStructure / GetDataElement / GetTable), never read from documents |
| Loops / tables | 3 sample rows unless the user asks for more; a row count that overflows MAIN shows where the page would break |
| Pages | First page; firstPage / lastPage windows all shown (one-page document) |
| Cut-off text | Drawn cut off, as SAP prints it (cell clips, no wrap); listed in the report |
| Borders / shading | As stored in the form — gaps in borders are real |
| Output | <artifact-base>/smartforms/<FORM>/<FORM>-preview.{jpg,html} + values.json (artifact base per ../../common/multi-profile-artifact-resolution.md) |
| </Decisions_Fixed> |
Step 1 — Target. Form name from ARGUMENTS; if missing ask once. Uppercase it.
Step 2 — Read the form. GetSmartFormContent(form_name, summary: true) — the summary lists windows, data declarations, symbols, graphics, styles and files.content (the full result on disk). Read only the summary; never load the content file into the conversation.
graphics[].error or dynamicReferences (keys set at print time) → the drawing shows a box there; say so in the result.<out>/values.json exists from an earlier run, offer to reuse it (Recommended) or write new values.Step 3 — Where each symbol prints.
node scripts/smartform/build-preview.mjs symbols "<content>"
→ per symbol: its declaration (HEADER → type ZXX_S_HEAD), every place it prints (window, paragraph, font pt, cell width mm, in a loop or not).
Step 4 — Field types. For every declaration type behind a symbol: GetStructure (structures, table lines), GetDataElement (single fields such as CHAR100, STCEG); GetTable when the type is a table. Parallel calls. Keep per field: data type, length, decimals, description.
Write the answers to <out>/ddic.json (per type name: { "fields": { "NAME1": { "type": "CHAR", "length": 35, "decimals": 0, "desc": "…" } } } for a structure, { "type", "length", "decimals", "desc" } for a data element, { "lineType": "…" } for a table type), then save fields.json for the next runs and the preview workbench:
node scripts/smartform/build-preview.mjs fields "<content>" --ddic "<out>/ddic.json" --out "<out>/fields.json"
unknownType lists symbols whose type was not read — say so; never guess a type.
Step 5 — Sample values → write <out>/values.json with the Write tool:
{ "form": "ZXX_FORM", "defaultParagraph": "AA", "rows": 3,
"values": { "HEADER-NAME1": "Northwind Trading Co., Ltd.",
"GS_ITEM-MATNR": ["100234", "100235", "100512"] } }
config.json → country; KR / US style 1,250.000, DE style 1.250,000), currency amounts with their decimals, units as their external code." 12.500") unless the symbol has a length or (C) option. Signed fields (CURR, signed DEC) end with the sign position: a blank when positive (" 1,234.56 "), - when negative. In a narrow cell the blanks wrap the number onto a second line that a fixed-height row cuts off — SAP prints the cell empty, and so must the preview."L_WRBTR@%TEXT59": "99,999.96" wins over "L_WRBTR": [...].REF_NAME &GV_TEXT&) prints a text table: give its lines, "GV_TEXT": ["First line", {"TDFORMAT": "", "TDLINE": "continued"}] (a string = a * line; a blank TDFORMAT continues the paragraph). One text per loop row = an array of such arrays.4500001234, 0010004567). A symbol inside a loop or table gets an array, one value per row; totals add up.defaultParagraph: the paragraph for lines formatted * (the style's standard paragraph is not in the content). Take the paragraph of the neighbouring label of the same kind (e.g. the title cell next to it); say which one in the result. Keep the choice in values.json for later runs.SFSY-PAGE, SFSY-FORMPAGES) default to 1 on a one-page print; on several pages they are the page numbers.Step 6 — Build.
node scripts/smartform/build-preview.mjs build "<content>" --values "<out>/values.json" --out-dir "<out>" --fields "<out>/fields.json" [--rows N] [--mark] [--layout-json]
--fields gives the DDIC types SAPscript needs for &'pre'F'post'& (a zero of a numeric / date / time field is initial: no pre / post text). --layout-json also writes <FORM>-preview.layout.json: the printed texts and lines in mm. With SAP's PDF of the same values, node scripts/forms-common/score-fidelity.mjs "<sap.pdf>" "<out>/<FORM>-preview.layout.json" gives the fidelity score (target ≥ 98 %) with its missing / moved / extra list. --mark tints the sample values yellow (for review); unfilled symbols always show as blue &NAME& placeholders. The JSON report lists filled, unfilled, overflow (cells / windows whose content does not fit), approximations and the defaultParagraph used.
Step 7 — Check and show. Read the JPG and look at it before answering: overlapping windows, empty windows, missing graphics, symbols left blue. Fix values.json and rebuild for value problems; report layout findings — never "fix" the form's layout in the drawing.
<Data_Rules>
Only the form definition, styles, graphics and DDIC metadata are read. Sample values are invented — never business data, never real customer, vendor or company names, never real tax numbers or addresses of real parties. Do not call GetTableContents / GetSqlQuery to fill the form; a request for "the real output of document X" is refused: say the preview uses invented values and the real output comes from the print program (e.g. the output type's processing program or SMARTFORMS test).
</Data_Rules>
<Output_Format>
SmartForm preview: ZXX_FORM (page %PAGE1, A4 portrait)
Windows: 7 · Graphics: 2 (logo, signature) · Symbols: 30 filled, 0 left blank · Sample rows: 3
Cut off as printed (4): "Purchase Order No." (%TEXT24), "(Unit)" (%TEXT45, %TEXT50), …
Window overflow: %WINDOW4 — graphic 27.2 mm in a 25 mm window
Standard paragraph: AA assumed for '*' lines
JPG: .sc4sap/work/DEV/smartforms/ZXX_FORM/ZXX_FORM-preview.jpg
HTML: .sc4sap/work/DEV/smartforms/ZXX_FORM/ZXX_FORM-preview.html
Values: .sc4sap/work/DEV/smartforms/ZXX_FORM/values.json
Next: "10 rows", "other values", "mark the sample values", "show the second page"
Reply in the user's language; show the JPG to the user when the client can display images. </Output_Format>
- When MAIN continues (or the first page has no MAIN window: a cover page), every page is drawn: MAIN is cut before the first row / paragraph that does not fit, the next pages follow the next-page order, and page conditions apply per page. The JPG shows page 1; the HTML and layout.json have all pages (report `pages`). A table that goes on to the next page repeats its header rows there; a NEWPAGE command goes to the page it names (MCP 4.13.1+ exports the name; without it the next page), and a page without MAIN that a command sends the print to ends it. - Field conditions (`condition` other than first / last page) and alternatives: the node is shown / the first branch is drawn; listed under `approximations`. - Text commands: `/*` comment lines are not printed; `/: IF … ELSE … ENDIF` is decided from the sample values (`&X& = 'v'`, `<>`), otherwise the first branch is drawn; other `/:` commands are skipped (listed). A SmartStyle a node names but the system lacks is replaced by the style its parents pass down (listed). - Address nodes and include texts with a key set at print time are drawn as labelled boxes. - Text in a template / table cell is clipped on one line; SAP's own wrapping inside a cell is not imitated. Window text wraps at the window width. - Page formats other than A4 are drawn as A4 (listed).<MCP_Tools_Used>
GetSmartFormContent (summary: true)GetStructure, GetDataElement, GetTable, GetDomain (field types only)
</MCP_Tools_Used><Related_Skills>
/sc4sap:program-to-spec — the print program's specification (attach the preview as expected output)/sc4sap:program-to-manual — user manual of the print program
</Related_Skills>Task: $ARGUMENTS
What SKILL.md sets; muted values are Claude Code's defaults
inheritThree short reads, in order
npx claudepluginhub babamba2/superclaude-for-sap --plugin sc4sap31 skills in this plugin
/adobe-from-pdfBuild an Adobe form (SFP — interface, context and XDP layout) from a PDF of the printed form, the way smartform-from-pdf builds a SmartForm, upload it to the DEV system, print it there and score the print against the source page. Awaiting approval — not runnable yet./adobe-previewDraw the expected print of an Adobe form (SFP, S/4HANA) as HTML pages in mm (plus JPG / PDF with a local browser) — the XFA layout with its master pages, flowed tables with repeated headers, page breaks, captions, pictures (dates, numbers, currency shifts), rich text with embedded fields, rounded boxes and images — filled with invented sample values sized to the interface's DDIC types. On a development system it can print SAP's example forms through ADS and score the preview against SAP's own PDF./analyze-codeABAP code analysis — size-gated review (one Opus sap-code-reviewer, or Haiku sap-checker detectors + Opus judge for large objects), Haiku evidence check on every finding, then a canned report or a richer briefing on the main thread/analyze-symptomRead-only, step-by-step root cause analysis for SAP operational errors. Reads the dump summary and failing source via MCP (known-issue web lookup only when the failure is in standard SAP code), widens to transports and where-used only when the clues call for it, narrows hypotheses with minimal user questions, and provides SAP Note search keywords. Never changes code or data./ask-consultantDirect operational Q&A with a SAP module consultant agent. Auto-routes the question to the matching sap-{module}-consultant and answers against the configured SAP environment (version, industry, country, active modules)./assistBusiness assistant for the connected SAP system — looks up and changes specific documents through the installed business actions (query → preview → user confirm → execute), one confirmed step at a time. Use for requests about concrete SAP data such as open purchase orders, goods receipt, delivery complete, PO release, production order release / confirmation / TECO, sales order create or change, delivery / billing block, post goods issue, billing, FI document display or reversal, payment block, G/L posting, internal order status, cost center actuals, cost repost or activity allocation, document output status or reprint, shipments, picking, packing / handling units, shipment costs, warehouse transfer orders and requirements, bin and warehouse stock (ECC LE / WM), maintenance notifications and orders, equipment, functional locations and maintenance plans (ECC PM), EWM warehouse tasks, warehouse orders, bins, stock locations, handling units and delivery warehouse progress (S/4 EWM, lookups only). Korean requests too — 미결 PO, 입고, 완결, 납기 변경, 승인, 생산오더, 실적 등록, 기술적 완료, 판매오더, 출하 보류, 청구 보류, 출고 전기, 청구 생성, 전표 조회, 역분개, 지급보류, 분개 전기, 내부오더, 코스트센터 실적, 비용 재전기, 활동 배부, 출력 상태, 재출력, 운송/선적 생성, 피킹, 포장, HU, 운송비, 이전오더(TO) 생성/확정/취소, 이전요청(TR), 저장빈, 창고 재고, 재고실사, 보전오더, 보전통지, 고장 통지, 설비, 기능위치, 보전계획, 보전오더 기술적 완료, 미결 창고작업, 창고작업 조회, 창고오더, 빈 저장빈, 재고 위치, 납품 창고 진행, 검사로트, 사용결정, 검사결과 입력, 품질통지. Not for how / why / configuration questions (ask-consultant).Other plugins' skills for the same job