Paste the prompt in any leading LLM Agent - Claude, Adri etc.
← Back to gists
ABAP Vibe Coders
AI configures SAP GUI mock
AI configures HTML mock of a SAP GUI screen (SE11)
Published Oct 14, 2025View on LinkedIn
Shared by
Shyam Swaroop - Adri AI | LinkedIn
Shyam Swaroop is a passionate and driven entrepreneur who co-founded Adri AI, a startup… · Experience: Adri AI · Education: Y Combinator · Location: San Francisco · 500+ connections on LinkedIn. View Shyam Swaroop’s profile on LinkedIn, a professional community of 1 billion members.
How-to guide
Files
prompt.md
markdownYour primary responsibility is to fill in the configuration details in SAP GUI screens with data required to implement the <change-request>. You don't have access to manipulating the SAP GUI screens directly, hence, you will modify the HTML representation of the GUI screens. It's responsibility of a downstream tool to actually map your output data from HTML into the SAP GUI. Your workflow:1. Identify the tasks that are possible with the screens from <screen-repo>. These are the only jobs that are under your job description.1. Deduce your job description from different types of screens from <screen-repo> i.e. your job description only includes filling in configuration for screens provided in <screen-repo>.2. Identify all the tasks that the <change-request> entails and fits your job description.3. Finally, produce HTML outputs for all the tasks you have identified Clarification for potential conflicting information between <screen-repo> and <change-request>:The HTML screen in <screen-repo> might show some data already filled in. This existing data is just for presentation purpose and should only be treated as such. Treat the information in <change-request> as the only source for the requirements. You are provided with two inputs: <screen-repo> and <change-request>. Structure of <screen-repo>:1. Direct child is <screen> with name attribute2. Structure of <screen>2.1. <screen-html> - contains the HTML representation of SAP GUI2.2. <user-guide> - contains the user guide for usage of the screen. you must follow the user guide. <screen-repo><screen name="new-table-fields-tab"><screen-html><!DOCTYPE html><html lang='en'><head><meta charset='UTF-8'><meta name='viewport' content='width=device-width, initial-scale=1.0'><title>SAP GUI - NSP</title><style> * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-size: 11px; background-color: #f0f0f0; overflow: hidden; } .sap-window { position: absolute; background-color: #f0f0f0; border: 1px solid #808080; box-shadow: 2px 2px 4px rgba(0,0,0,0.3); } .sap-window-title { background: linear-gradient(to bottom, #4a90e2, #357abd); color: white; padding: 4px 8px; font-weight: bold; border-bottom: 1px solid #2e5a87; height: 22px; box-sizing: border-box; display: flex; align-items: center; } .sap-window.iconic { opacity: 0.7; transform: scale(0.9); } .sap-window-content { position: relative; height: calc(100% - 22px); overflow: hidden; background-color: #f0f0f0; } .sap-element { position: absolute; font-family: inherit; font-size: 11px; } .sap-textfield { border: 1px inset #c0c0c0; padding: 2px 4px; background-color: white; font-size: 11px; } .sap-textfield:focus { outline: 1px solid #4a90e2; } .sap-textfield.required { background-color: #ffffcc; } .sap-button { border: 1px outset #c0c0c0; background: linear-gradient(to bottom, #f8f8f8, #e8e8e8); padding: 2px 8px; cursor: pointer; font-size: 11px; text-align: center; } .sap-button:hover { background: linear-gradient(to bottom, #f0f0f0, #e0e0e0); } .sap-button:active { border: 1px inset #c0c0c0; background: linear-gradient(to bottom, #e0e0e0, #f0f0f0); } .sap-button.emphasized { background: linear-gradient(to bottom, #4a90e2, #357abd); color: white; border: 1px outset #357abd; } .sap-label { color: #000; background-color: transparent; white-space: nowrap; font-size: 11px; } .sap-label.hotspot { color: #0000ff; text-decoration: underline; cursor: pointer; } .sap-label.highlighted { background-color: #ffffcc; } .sap-checkbox { width: 13px; height: 13px; border: 1px inset #c0c0c0; background-color: white; display: inline-block; position: relative; } .sap-checkbox.checked::after { content: '✓'; position: absolute; left: 1px; top: -2px; font-size: 10px; color: #000; } .sap-radiobutton { width: 12px; height: 12px; border: 1px inset #c0c0c0; border-radius: 50%; background-color: white; display: inline-block; position: relative; } .sap-radiobutton.selected::after { content: ''; position: absolute; left: 3px; top: 3px; width: 4px; height: 4px; border-radius: 50%; background-color: #000; } .sap-combobox { border: 1px inset #c0c0c0; background-color: white; position: relative; display: inline-block; } .sap-combobox-text { padding: 2px 20px 2px 4px; border: none; background: transparent; font-size: 11px; width: 100%; } .sap-combobox-dropdown { position: absolute; right: 0; top: 0; width: 18px; height: 100%; border-left: 1px solid #c0c0c0; background: linear-gradient(to bottom, #f8f8f8, #e8e8e8); cursor: pointer; } .sap-combobox-dropdown::after { content: '▼'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 8px; } .sap-combobox-entry { padding: 2px 4px; cursor: pointer; border-bottom: 1px solid #e0e0e0; } .sap-combobox-entry:hover { background-color: #e8f4fd; } .sap-combobox-entry.selected { background-color: #4a90e2; color: white; } .sap-table { border: 1px solid #808080; background-color: white; overflow: hidden; } .sap-table-header { background: linear-gradient(to bottom, #f0f0f0, #d8d8d8); border-bottom: 1px solid #808080; font-weight: bold; display: flex; } .sap-table-header-cell { border-right: 1px solid #808080; padding: 2px 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; position: relative; } .sap-table-header-cell.selected { background: linear-gradient(to bottom, #4a90e2, #357abd); color: white; } .sap-table-header-cell:last-child { border-right: none; } .sap-table-body { overflow: auto; } .sap-table-row { display: flex; border-bottom: 1px solid #e0e0e0; } .sap-table-row.selected { background-color: #4a90e2; color: white; } .sap-table-cell { border-right: 1px solid #e0e0e0; padding: 1px 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } .sap-tree { border: 1px solid #808080; background-color: white; overflow: auto; } .sap-tree-node { padding: 1px; cursor: pointer; white-space: nowrap; display: flex; align-items: center; } .sap-tree-node:hover { background-color: #e8f4fd; } .sap-tree-node.selected { background-color: #4a90e2; color: white; } .sap-tree-indent { display: inline-block; } .sap-tree-icon { margin-right: 2px; width: 16px; text-align: center; } .sap-tabstrip { border: 1px solid #808080; background-color: #f0f0f0; } .sap-tabstrip-tabs { display: flex; border-bottom: 1px solid #808080; background: linear-gradient(to bottom, #f8f8f8, #e8e8e8); } .sap-tab { padding: 4px 12px; border-right: 1px solid #808080; border-top: 1px solid #c0c0c0; border-left: 1px solid #c0c0c0; background: linear-gradient(to bottom, #e8e8e8, #d0d0d0); cursor: pointer; margin-top: 2px; } .sap-tab.selected { background: linear-gradient(to bottom, #f8f8f8, #f0f0f0); border-bottom: 1px solid #f0f0f0; margin-top: 0; padding-top: 6px; } .sap-tabstrip-content { padding: 8px; background-color: #f0f0f0; overflow: auto; } .sap-shell { border: 1px inset #c0c0c0; background-color: #f8f8f8; } .sap-grid { border: 1px solid #808080; background-color: white; overflow: auto; } .sap-scrollbar { background-color: #f0f0f0; border: 1px inset #c0c0c0; } .sap-scrollbar-thumb { background: linear-gradient(to bottom, #d0d0d0, #b0b0b0); border: 1px outset #c0c0c0; } .sap-textfield[readonly] { background-color: #f0f0f0; color: #666; } .sap-combobox.disabled .sap-combobox-text { background-color: #f0f0f0; color: #666; } .sap-checkbox.disabled, .sap-radiobutton.disabled { opacity: 0.6; cursor: not-allowed; }</style></head><body><div class='sap-window' style='z-index: 1001; left: -8px; top: -8px; width: 1456px; height: 868px' data-window-id='/app/con[0]/ses[0]/wnd[0]'><div class='sap-window-title'>Dictionary: Change Table</div><div class='sap-window-content' style='position: relative; height: calc(100% - 22px); overflow: hidden;'><div class="sap-element" style="left: 38px; top: 18px; width: 1142px; height: 18px" data-element-id="/app/con[0]/ses[0]/wnd[0]/mbar" data-element-type="GuiMenubar" title=""></div><div class="sap-element" style="left: 22px; top: 46px; width: 1412px; height: 31px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]" data-element-type="GuiToolbar" title=""><button class="sap-element sap-button" style="left: 8px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[0]" title="Enter"></button><button class="sap-element sap-button" style="left: 186px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[423]" title="Close Command Field"></button><button class="sap-element sap-button" style="left: 208px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[11]" title="Save (Ctrl+S)"></button><button class="sap-element sap-button" style="left: 242px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[3]" title="Back (F3)"></button><button class="sap-element sap-button" style="left: 264px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[15]" title="Exit (Shift+F3)"></button><button class="sap-element sap-button" style="left: 286px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[12]" title="Cancel (F12)"></button><button class="sap-element sap-button" style="left: 320px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[86]" title="Print... (Ctrl+P)"></button><button class="sap-element sap-button" style="left: 342px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[71]" title="Find (Ctrl+F)"></button><button class="sap-element sap-button" style="left: 364px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[84]" title="Find Next (Ctrl+G)"></button><button class="sap-element sap-button" style="left: 398px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[80]" title="First Page (Ctrl+Page up)"></button><button class="sap-element sap-button" style="left: 420px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[81]" title="Previous Page (Page up)"></button><button class="sap-element sap-button" style="left: 442px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[82]" title="Next Page (Page down)"></button><button class="sap-element sap-button" style="left: 464px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[83]" title="Last Page (Ctrl+Page down)"></button><button class="sap-element sap-button" style="left: 498px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[419]" title="Creates New Session"></button><button class="sap-element sap-button" style="left: 520px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[418]" title="Generates a Shortcut"></button><button class="sap-element sap-button" style="left: 554px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[1]" title="Help (F1)"></button><button class="sap-element sap-button" style="left: 576px; top: 4px; width: 22px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[446]" title="Customize Local Layout (Alt+F12)"></button><div class="sap-element" style="left: 40px; top: 5px; width: 142px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[0]/okcd" data-element-type="GuiOkCodeField" title=""></div></div><div class="sap-element" style="left: 22px; top: 86px; width: 1412px; height: 31px" data-element-id="/app/con[0]/ses[0]/wnd[0]/titl" data-element-type="GuiTitlebar" title=""><span>Dictionary: Change Table</span></div><div class="sap-element" style="left: 22px; top: 117px; width: 1412px; height: 34px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]" data-element-type="GuiToolbar" title=""><button class="sap-element sap-button" style="left: 10px; top: 6px; width: 20px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[18]" title="Previous Object (Shift+F6)"></button><button class="sap-element sap-button" style="left: 34px; top: 6px; width: 20px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[19]" title="Next Object (Shift+F7)"></button><button class="sap-element sap-button" style="left: 68px; top: 6px; width: 20px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[25]" title="Display <-> Change (Ctrl+F1)"></button><button class="sap-element sap-button" style="left: 92px; top: 6px; width: 20px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[20]" title="Active <-> Inactive (Shift+F8)"></button><button class="sap-element sap-button" style="left: 116px; top: 6px; width: 20px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[17]" title="Other Object... (Shift+F5)"></button><button class="sap-element sap-button" style="left: 150px; top: 6px; width: 20px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[26]" title="Check (Ctrl+F2)"></button><button class="sap-element sap-button" style="left: 174px; top: 6px; width: 20px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[27]" title="Activate (Ctrl+F3)"></button><button class="sap-element sap-button" style="left: 198px; top: 6px; width: 20px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[39]" title="Where-Used List (Ctrl+Shift+F3)"></button><button class="sap-element sap-button" style="left: 232px; top: 6px; width: 20px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[41]" title="Display Object List (Ctrl+Shift+F5)"></button><button class="sap-element sap-button" style="left: 256px; top: 6px; width: 20px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[40]" title="Display Navigation Window (Ctrl+Shift+F4)"></button><button class="sap-element sap-button" style="left: 280px; top: 6px; width: 20px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[24]" title="Full Screen On/Off (Shift+F12)"></button><button class="sap-element sap-button" style="left: 304px; top: 6px; width: 20px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[32]" title="Application Help (Ctrl+F8)"></button><button class="sap-element sap-button" style="left: 338px; top: 6px; width: 20px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[47]" title="Graphic (Ctrl+Shift+F11)"></button><button class="sap-element sap-button" style="left: 362px; top: 6px; width: 20px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[46]" title="Contents (Ctrl+Shift+F10)"></button><button class="sap-element sap-button" style="left: 386px; top: 6px; width: 114px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[45]" title="Technical Settings (Ctrl+Shift+F9)">Technical Settings</button><button class="sap-element sap-button" style="left: 504px; top: 6px; width: 69px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[29]" title="Indexes... (Ctrl+F5)">Indexes...</button><button class="sap-element sap-button" style="left: 577px; top: 6px; width: 125px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/tbar[1]/btn[5]" title="Append Structure... (F5)">Append Structure...</button></div><div class="sap-element" style="left: 22px; top: 151px; width: 1412px; height: 680px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr" data-element-type="GuiUserArea" title=""><input type="text" class="sap-element sap-textfield" style="left: 3px; top: 8px; width: 132px; height: 20px" value="Transparent Table " data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/txtDD02D-TABCLTEXT" title="" readonly><div class="sap-element" style="left: 136px; top: 8px; width: 118px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/ctxtDD02D-DBTABNAME" data-element-type="GuiCTextField" title=""><span>ZDEMO_TO_DC</span></div><input type="text" class="sap-element sap-textfield" style="left: 276px; top: 8px; width: 314px; height: 20px" value="New " data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/txtRSDXX-TXTSAVSTAT" title="" readonly><div class="sap-element sap-label" style="left: 3px; top: 30px; width: 132px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/lblDD02D-DDTEXT" title="">Short Description</div><input type="text" class="sap-element sap-textfield required" style="left: 136px; top: 30px; width: 426px; height: 20px" value="short description " data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/txtDD02D-DDTEXT" title=""><div class="sap-element sap-tabstrip" style="left: 3px; top: 52px; width: 1406px; height: 609px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP" title=""><div class="sap-tabstrip-tabs"><div class="sap-tab" data-tab-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpHEAD">Attributes</div><div class="sap-tab" data-tab-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpMAIN">Delivery and Maintenance</div><div class="sap-tab selected" data-tab-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF">Fields</div><div class="sap-tab" data-tab-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpF4V">Entry help/check</div><div class="sap-tab" data-tab-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpREFF">Currency/Quantity Fields</div></div><div class="sap-tabstrip-content"><div class="sap-element" style="left: 7px; top: 44px; width: 1392px; height: 549px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201" data-element-type="GuiScrollContainer" title=""><button class="sap-element sap-button" style="left: 287px; top: -1px; width: 20px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/btnI_FRKE" title="Foreign Keys"></button><button class="sap-element sap-button" style="left: 308px; top: -1px; width: 76px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/btnI_IFSH" title="">Srch Help</button><button class="sap-element sap-button" style="left: 392px; top: -1px; width: 111px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/btnCUA_DYNTEXT" title="">Predefined Type</button><div class="sap-element" style="left: 0px; top: 0px; width: 125px; height: 21px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/subSUB_EDIT_BUTTONS:SAPLSED5:0200" title=""><button class="sap-element sap-button" style="left: 0px; top: -1px; width: 20px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/subSUB_EDIT_BUTTONS:SAPLSED5:0200/btnCUT" title="Cut"></button><button class="sap-element sap-button" style="left: 21px; top: -1px; width: 20px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/subSUB_EDIT_BUTTONS:SAPLSED5:0200/btnCOPY" title="Copy"></button><button class="sap-element sap-button" style="left: 42px; top: -1px; width: 20px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/subSUB_EDIT_BUTTONS:SAPLSED5:0200/btnPASTE" title="Paste"></button><button class="sap-element sap-button" style="left: 63px; top: -1px; width: 20px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/subSUB_EDIT_BUTTONS:SAPLSED5:0200/btnINSERT" title="Insert Row"></button><button class="sap-element sap-button" style="left: 84px; top: -1px; width: 20px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/subSUB_EDIT_BUTTONS:SAPLSED5:0200/btnDELETE" title="Delete Row"></button></div><div class="sap-element" style="left: 161px; top: 0px; width: 97px; height: 21px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/subSUB_EXPAND_BUTTONS:SAPLSED5:0300" title=""><button class="sap-element sap-button" style="left: 0px; top: -1px; width: 20px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/subSUB_EXPAND_BUTTONS:SAPLSED5:0300/btnI_EXPA" title="Expand All"></button><button class="sap-element sap-button" style="left: 21px; top: -1px; width: 20px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/subSUB_EXPAND_BUTTONS:SAPLSED5:0300/btnI_EXPL" title="Expand include"></button><button class="sap-element sap-button" style="left: 42px; top: -1px; width: 20px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/subSUB_EXPAND_BUTTONS:SAPLSED5:0300/btnI_CPRL" title="Compress include"></button><button class="sap-element sap-button" style="left: 63px; top: -1px; width: 20px; height: 22px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/subSUB_EXPAND_BUTTONS:SAPLSED5:0300/btnI_CPRA" title="Collapse All"></button></div><input type="text" class="sap-element sap-textfield" style="left: 700px; top: 0px; width: 69px; height: 20px" value=" 1" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/txtTC0-TOP_LINE" title="" readonly><div class="sap-element sap-label" style="left: 770px; top: 0px; width: 13px; height: 20px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/lblTXT1" title="">/</div><input type="text" class="sap-element sap-textfield" style="left: 784px; top: 0px; width: 69px; height: 20px" value="1 " data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/txtTC0_SEC-COUNT" title="" readonly><div class="sap-element sap-table" style="left: -2px; top: 20px; width: 1368px; height: 505px" data-element-id="/app/con[0]/ses[0]/wnd[0]/usr/tabsTAB_STRIP/tabpDEF/ssubTS_SCREEN:SAPLSD41:2201/tblSAPLSD41TC0" title=""><div class="sap-table-header"><div class="sap-table-header-cell" style="width: 116px">Field</div><div class="sap-table-header-cell" style="width: 25px">Key</div><div class="sap-table-header-cell" style="width: 32px">Initial Values</div><div class="sap-table-header-cell" style="width: 116px">Data element</div><div class="sap-table-header-cell" style="width: 74px">Data Type</div><div class="sap-table-header-cell" style="width: 46px">Length</div><div class="sap-table-header-cell" style="width: 46px">Decimal Places</div><div class="sap-table-header-cell" style="width: 424px">Short Description</div><div class="sap-table-header-cell" style="width: 214px">Group</div></div><div class="sap-table-body"><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value="CLIENT " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;" checked></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px">MANDT</div><div class="sap-table-cell" style="width: 74px; height: 20px">CLNT </div><div class="sap-table-cell" style="width: 46px; height: 20px"> 3</div><div class="sap-table-cell" style="width: 46px; height: 20px"> 0</div><div class="sap-table-cell" style="width: 424px; height: 20px">Client </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 20px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 20px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 20px"></div><div class="sap-table-cell" style="width: 74px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 46px; height: 20px"> </div><div class="sap-table-cell" style="width: 424px; height: 20px"> </div><div class="sap-table-cell" style="width: 214px; height: 20px"> </div></div><div class="sap-table-row"><div class="sap-table-cell" style="width: 116px; height: 18px"><input type="text" value=" " style="border: none; background: transparent; width: 100%; font-size: inherit;"></div><div class="sap-table-cell" style="width: 25px; height: 18px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 32px; height: 18px"><input type="checkbox" style="margin: 0;"></div><div class="sap-table-cell" style="width: 116px; height: 18px"></div><div class="sap-table-cell" style="width: 74px; height: 18px"> </div><div class="sap-table-cell" style="width: 46px; height: 18px"> </div><div class="sap-table-cell" style="width: 46px; height: 18px"> </div><div class="sap-table-cell" style="width: 424px; height: 18px"> </div><div class="sap-table-cell" style="width: 214px; height: 18px"> </div></div></div></div></div></div></div></div><div class="sap-element" style="left: 22px; top: 831px; width: 1412px; height: 29px" data-element-id="/app/con[0]/ses[0]/wnd[0]/sbar" data-element-type="GuiStatusbar" title=""><div class="sap-element" style="left: 4px; top: 2px; width: 1408px; height: 27px" data-element-id="/app/con[0]/ses[0]/wnd[0]/sbar/pane[0]" data-element-type="GuiStatusPane" title=""></div></div></div></div></body></html></screen-html></screen><user-guide>A field can either have "Data element" or "Data Type" but it cannot have both. Also, the "Decimal" column is used for certain "Data Type"s only.</user-guide></screen-repo><change-request>Change Request 11724# Change Request (CR)## TitleCredit Memo Pricing/Refund Reconstruction from Original Sale## ObjectiveCreate/adjust a customer **credit memo** for a return by **reconstructing prices, taxes, surcharges, FX, and discounts exactly as invoiced** on the original sale, with governed exceptions (e.g., restocking fees, freight exclusion, depreciation).## In Scope* SD documents: Return **Sales Order** (RE/REN), **Credit Memo Request** (CR/CRN), **Credit Memo** (G2).* Pricing rebuild based on original **Invoice** (VBRK/VBRP, KONV/PRCD\_ELEMENTS).* Partial/quantity-based refunds, item-level eligibility, tax adjustments, rounding parity with FI.* Optional policies: restocking fee %, freight exclusion, depreciation by usage period.* Multi-currency: original currency vs. company code currency, FX from original invoice date.* Serial/batch tracing to find the correct invoice.## Out of Scope* Return logistics/eWM/QM processing (only signals/blocks consumed).* Vendor returns to supplier (separate CR).* Retail returns without original reference.- - -## Business Rules1. **Invoice Sourcing Hierarchy** * If RE item references an invoice item → use it. * Else, match by serial (EQUI/SER\* → LIPS/VBRP), then by customer+material+date proximity; if multiple, prefer last fully billed invoice.2. **Refund Basis** * Default: **Net Value as invoiced** (all pricing conditions with same signs), quantity aligned to accepted return qty. **\*Exclusions** (configurable): freight (e.g., F\*), COD/surcharges (e.g., ZCOD), promotional rebates (e.g., ZREB) if policy says "non-refundable".3. **Restocking/Handling** * Apply as negative condition **ZRST** percentage or absolute per item; tier rules by reason code.4. **Tax Handling** * Rebuild tax as invoiced; if jurisdiction requires current-date tax, compute both, post the compliant one; capture delta in a dedicated condition **ZTXA**.5. **FX** * Refund in original document currency by default. If paying in local currency, convert with **invoice posting date rate** (TCURR, KURSF); post FX diff to gain/loss.6. **Rounding Parity** * Item and header rounding to match SD→FI integration; no penny deltas vs BKPF/BSEG totals.7. **Blocks** * Hard block if warranty invalid, outside policy, or QM usage decision ≠ "Accepted" and policy requires it.8. **Auditability** * Store original invoice keys and extracted condition snapshot in Z-tables; display on credit memo header.- - -## Data Model & Tables Touched* **Sales/Billing**: VBAK, VBAP, VBRK, VBRP, VBFA, LIKP, LIPS* **Pricing**: KONV (ECC) / PRCD\_ELEMENTS (S/4), KONH, KONP, T683\*, T685\** **Serial/Batch (optional)**: EQUI, SER05/SER03, OBJK; MCHA/MCHB* **FX/Tax**: TCURR/TCURF, BSET (FI tax), T007\** **Material/Customer**: MARA, MVKE, KNA1* **Custom**: **\*ZRET\_CFG** – policy toggles (exclude freight, tiers, min/max refunds) **\*ZRET\_PRCOND** – condition include/exclude matrix **\*ZRET\_MATCH\_LOG** – how invoice was matched **\*ZRET\_KONV\_SNAP** – immutable snapshot of pricing elements used **\*ZRET\_AUDIT** – header/item audit trail- - -## Process Flow (Happy Path)1. User creates Return SO (RE) referencing invoice or with serial → **Save**.2. On **Save** or via Fiori action "Create Credit Memo Request": * Find original invoice(s). * Extract pricing stack. * Filter/transform per policy (fees/exclusions). * Build **Credit Memo Request** (CR) with copied prices.3. Billing creates **Credit Memo** (G2) from CR; totals equal reconstructed amounts.4. Post to FI/CO; store snapshot & linkages.- - -## Technical Design### Key Enhancement Points* **Invoice match**: Implement in **BAdI BADI\_SD\_SALES** (S/4) or `MV45AFZZ` user exits during RE save to populate original refs if missing.* **Copy control**: VOFM **Requirement/Formulas** * Copy `VBRP → CR item` & `KONV → CR pricing` * Custom requirement routine e.g., **Req 988** "Copy only refundable conditions" * Custom formula e.g., **AltCBA 988** for base, **AltCV 988** for value calcs (restocking/FX delta)* **Pricing exits**: **\*USEREXIT\_PRICING\_PREPARE\_TKOMK/TKOMP** (RV60AFZZ) to set switches & reference keys. * BAdI **SD\_BIL\_HEAD/ITEM** for header/item tweaks at billing.* **Derive tax**: BAdI **BADI\_SD\_TAX** (or country-specific) to select "as-invoiced vs current".* **FX**: Exit in pricing to fix exchange rate field **KOMK-KURSK** to invoice date's rate when refunding in local currency.### Algorithm (Invoice Sourcing)1. If `VBAP-VGBEL/VGPOS` → find `VBRP` through `VBFA`.2. Else, by **serial**: * From return item serials (SER05) → deliveries (OBJK→LIPS) → invoices (VBFA/VBRP).3. Else, **best fit**: * Query `VBRP` where `KUNRG/KUNAG = RE-KUNNR`, `MATNR = RE-MATNR`, date within configurable window; pick last with full price.### Pricing Reconstruction Logic* Pull conditions from **KONV** rows for the selected `VBRK/VBRP`.* Include/exclude using **ZRET\_PRCOND**: * Columns: `KSCHL`, `REFUNDABLE(Y/N)`, `MODE(copy/percent/fixed)`, `CAP/ FLOOR`, `TAXABLE(Y/N)`.* Recalculate with returned quantity: * Scales: if original had scale, recompute step with **original base** or **pro-rata** (config).* Add **ZRST** from policy table (tier by reason, customer group, material group).* Taxes: apply as invoiced unless override.### Error Handling & Edge Cases* Multiple invoices match → present list; default to most recent full invoice.* Mixed-currency invoices → split by currency; create separate CRs.* Condition records missing today → still use **snapshot** (do not re-find).* Inverted signs (returns) → ensure condition sign mirrors invoiced sign logic.- - -## UI/UX* Fiori button on RE/CR: **"Rebuild Refund from Original Sale"*** Popup shows: * Matched invoice, delta rules applied, preview of item conditions & totals. * Policy switches: "Exclude freight", "Apply restocking", "Refund in original currency".* Error messages friendly, with match log.- - -## Security & Auth* Auth objects: `V_VBAK_AAT`, `V_VBAK_VKO`, `V_TVAK_VKO`, `F_BKPF_BUK`* Only roles **SD Refund Analyst** and **Billing** can override policy switches.- - -## Performance* Index reads: * `VBFA` (BELV1) by VBELV, `VBRP` by `VBELN/MATNR`, `SER05` by SERNR* Buffer KONV/PRCD read by primary keys; avoid generic pricing re-determination when snapshotting.* Commit once per CR; enqueue by customer.- - -## Test Scenarios (Must Pass)1. **Direct reference**: RE references invoice → CR equals original prices less ZRST.2. **Serial match**: No reference; serial finds invoice → same total as #1.3. **Exclude freight**: F\* conditions excluded, tax adjusts accordingly.4. **Partial qty**: Return 2/5; scales recomputed per policy; totals proportional.5. **Multi-currency**: Original USD, company SGD; refund in SGD with invoice-date rate; FX diff posted.6. **Tax regime change**: Today's tax differs; system selects compliant route and logs delta.7. **No match**: No invoice; CR blocked with reason, log written.8. **Rounding**: Header/Item totals match FI to the cent; no residuals.9. **High-value approval**: Restocking waived → workflow triggers; only approver may release.10. **Mixed items**: Some refundable, some not; item-wise outcomes correct.- - -## Objects & Transports* **Custom tables**: ZRET\_CFG, ZRET\_PRCOND, ZRET\_MATCH\_LOG, ZRET\_KONV\_SNAP, ZRET\_AUDIT* **VOFM routines**: Requirement 988, Formula AltCBA 988, AltCV 988* **Enhancements**: BAdIs (SD\_SALES, SD\_BILLING, SD\_TAX), exits in RV60AFZZ/MV45AFZZ* **Fiori/UI5**: App extension for action + preview* **Auth roles**: Z\_SD\_REFUND\_ANALYST, Z\_SD\_REFUND\_APPROVER- - -## Pseudocode (ABAP-ish, condensed)```abap* Input: RE-VBELNDATA: lt_items TYPE TABLE OF vbap, lt_ser TYPE TABLE OF ser05, lt_vbfa TYPE TABLE OF vbfa, ls_match TYPE zret_match, lt_konv TYPE TABLE OF konv, lt_pr TYPE TABLE OF zret_prcond, lt_snap TYPE TABLE OF zret_konv_snap, ls_cfg TYPE zret_cfg.PERFORM get_re_items USING re-vbeln CHANGING lt_items.READ TABLE lt_items TRANSPORTING NO FIELDS WITH KEY vgbel IS NOT INITIAL.IF sy-subrc = 0. PERFORM find_invoice_via_vbfa USING re-vbeln CHANGING ls_match.ELSE. PERFORM find_invoice_via_serial USING re-vbeln CHANGING ls_match.ENDIF.IF ls_match-is_found IS INITIAL. MESSAGE e398(zret) WITH 'No original invoice found'; EXIT.ENDIF.SELECT * FROM konv INTO TABLE lt_konv WHERE knumv = ls_match-knumv.SELECT * FROM zret_prcond INTO TABLE lt_pr.LOOP AT lt_items ASSIGNING FIELD-SYMBOL(<i>). DATA(lt_konv_item) = FILTER #( lt_konv WHERE kposn = <i>-posnr ). PERFORM apply_policy USING lt_konv_item lt_pr ls_cfg <i>-req_qty CHANGING <i>-cond_out. PERFORM snapshot_cond USING lt_konv_item CHANGING lt_snap.ENDLOOP.PERFORM build_cr_document USING re-header lt_items.PERFORM set_fx_rate USING ls_match-bldat.PERFORM recalc_taxes USING ls_cfg.PERFORM save_and_log USING re-vbeln ls_match lt_snap.```- - -## Migration & Cutover* Populate **ZRET\_PRCOND** from current pricing schema (initial extract).* Backfill **ZRET\_CFG** defaults per country/company code.* No historical re-pricing; applies only to new RE/CR.- - -## Acceptance Criteria* For a controlled sample of 50 returns, **credit memo totals = original invoice totals** minus policy adjustments, with rounding parity and auditable snapshots.* Processing time ≤ 2s per item (95th percentile) for pricing rebuild.- - -## Risks & Mitigations* **Mis-match to wrong invoice** → show selection UI + write ZRET\_MATCH\_LOG.* **Tax law variances** → country exit layer & config flag.* **Performance on KONV** → use key read via `KNUMV` and avoid generic re-pricing.- - -System: S/4 HANA 2023Instructions: Give me detailed code structure and complete code</change-request>