Inbound IDoc Processing
Partner profile, process code and function module.
Explanation
An inbound IDoc reaches SAP via ALE/EDI, is matched to a partner profile (WE20) which points to a process code (WE42). The process code triggers a function module (or workflow) that reads the IDoc segments, calls a BAPI/logic and writes a status record. Errors go to status 51; success to 53.
Code example
" Standard skeleton for an inbound FMFUNCTION zidoc_process_orders. LOOP AT idoc_contrl INTO DATA(ls_ctrl). " parse segments, call BAPI, set status ENDLOOP.ENDFUNCTION.Real project scenario
An IDoc-driven order intake supported 30 partners. Adding a custom function module for a new EDI variant took 2 days without touching existing flows.
Common mistakes
Not setting status per IDoc; committing inside the loop and orphaning failed IDocs; ignoring workflow for error alerts.
Best practices
Keep the FM thin, delegate to a class; always populate return status; alert via workflow on repeated failures.
Interview angle
How does IDoc processing recover from BAPI errors?