You are on page 1of 4

Search

Hom e Tra i ni ngs Qui z Ti ps Tutori a l s Functi ona l Ce rt Q's I nte rvi e w Q's Jobs Te sti m oni a l s Adve rti se Conta ct Us

SAP Virtual/Onsite
Trainings
Document Categories:

Step-by-step guide to ALE and IDOCs


...Previous

In Client 800 Steps:


Function Module Creation:

ABAPTM
Adobe Forms
ABAP-HR
ALE & IDocs
ALV
BAPI
BASIS
BSP
Business Objects
Business Workflow
CRM NEW
LSMW
SAP Script/Smart Forms
BI/BW
eXchange Infrastructure (XI)
Enterprise Portals (EP)
eCATT
Object Oriented Programming
SAP Query
Userexits/BADIs
WebDynpro for Java/ABAPTM
Others

Create a Function Module to update the table from the IDOC segments
Go to SE37
Specify a name and click on create.

In dialog box specify function group and description, and click on save.

What's New?
ABAP Test Cockpit HOT
SAP ABAP Pragmas
Understanding SE32 (ABAP Text
Element Maintenance)
Creating an IDoc File on SAP
Application Server
Understanding Advance with
dialog option of SAP Workflow
SAP Workflow Scenario:
Maintenance Notification
Approval
Enhancements to a standard
class
Working with Floating Field in
Adobe Forms
Inserting data from Internal Table
into the step Send Mail
Display GL Account long text
using enhancement framework
Differences between
polymorphism in JAVA and ABAP
Passing multiline parameters
from an ABAP Class event to a
Workflow container
Concept of Re-evaluate agents
for active work items in SAP
Workflow
Dynamic creation of component
usage in ABAP WebDynpro
Adobe Forms: Display symbols
like copyright and others
Deactivate Hold functionality in
Purchase order (ME21N)
Quiz on OOABAP
Add fields in FBL5N using BADIs
Tutorial on Wide casting
Defining a Range in Module Pool
Program
Copy fields from one
structure/table into another
structure/table
Side Panel Usage in NWBC

Specify the Import parameters in Import tab

Specify the Export parameters in Export tab

Specify the Table parameters in Tables tab

Contribute?
Sample Specs
What's Hot?
Web Dynpro for ABAP Tutorials

Join the Mailing List


Enter name and email address below :

Specify the Exceptions in Exception tab

Name:
Email:

Subscribe

Unsubscribe

GO

Click on Source code Tab.

Write the following code in Source code tab.


FUNCTION ZSHAN_IDOC_ZSHSTUDMT.
*"-------------------------------------------------------------------*"*"Local Interface:
*" IMPORTING
*"
REFERENCE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*"
REFERENCE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
*" EXPORTING
*"
REFERENCE(WORKFLOW_RESULT) LIKE BDWF_PARAM-RESULT
*"
REFERENCE(APPLICATION_VARIABLE) LIKE BDWF_PARAM-APPL_VAR
*"
REFERENCE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK
*"
REFERENCE(CALL_TRANSACTION_DONE) LIKE BDWFAP_PAR-CALLTRANS
*" TABLES
*"
IDOC_CONTRL STRUCTURE EDIDC
*"
IDOC_DATA STRUCTURE EDIDD
*"
IDOC_STATUS STRUCTURE BDIDOCSTAT
*"
RETURN_VARIABLES STRUCTURE BDWFRETVAR
*"
SERIALIZATION_INFO STRUCTURE BDI_SER
*" EXCEPTIONS
*"
WRONG_FUNCTION_CALLED
*"-------------------------------------------------------------------* Include File containing ALE constants
INCLUDE MBDCONWF.
TABLES : ZSTUDENTS.
DATA : W_ZSHSTUSEG LIKE ZSHSTUSEG.
DATA : T_ZSTUDENTS LIKE ZSTUDENTS OCCURS 0 WITH HEADER LINE.
WORKFLOW_RESULT = C_WF_RESULT_OK.
LOOP AT IDOC_CONTRL.
IF IDOC_CONTRL-MESTYP NE 'ZSHSTUDMT'.
RAISE WRONG_FUNCTION_CALLED.
ENDIF.
* Before reading a new entry, clear application buffer
LOOP AT IDOC_DATA WHERE DOCNUM EQ IDOC_CONTRL-DOCNUM.

W_ZSHSTUSEG = IDOC_DATA-SDATA.
MOVE-CORRESPONDING W_ZSHSTUSEG TO T_ZSTUDENTS.
INSERT INTO ZSTUDENTS VALUES T_ZSTUDENTS.
ENDLOOP.
UPDATE ZSTUDENTS FROM T_ZSTUDENTS.
IF SY-SUBRC EQ 0.
IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
IDOC_STATUS-STATUS = '53'.
IDOC_STATUS-MSGTY = 'I'.
IDOC_STATUS-MSGID = 'YM'.
IDOC_STATUS-MSGNO = '004'.
IDOC_STATUS-MSGV1 = T_ZSTUDENTS-ZSTUID.
APPEND IDOC_STATUS.
CLEAR IDOC_STATUS.
ELSE.
IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
IDOC_STATUS-STATUS = '51'.
IDOC_STATUS-MSGTY = 'E'.
IDOC_STATUS-MSGID = 'YM'.
IDOC_STATUS-MSGNO = '005'.
IDOC_STATUS-MSGV1 = T_ZSTUDENTS-ZSTUID.
APPEND IDOC_STATUS.
CLEAR IDOC_STATUS.
WORKFLOW_RESULT = C_WF_RESULT_ERROR.
RETURN_VARIABLES-WF_PARAM = 'Error_Idocs'.
RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
APPEND RETURN_VARIABLES.
CLEAR RETURN_VARIABLES.
ENDIF.
ENDLOOP.
ENDFUNCTION.

Click on Save and Activate.


Assign FM to Logical Message:
Go to TCODE WE57
Click on Display / Change button.

Click on New Entries Button

Specify created FM name, Function Type, Basic Type (IDOC), Message Type, and
Direction and click on SAVE button.

Click on Back button.


Click here to continue...

Pleas e s end us your feedback/s ugges tions at webm as ter@SAPTechnical.COM


Hom e Contribute About Us Privacy Term s Of Us e Dis claim er Safe Com panies : Advertis e on SAPTechnical.COM | Pos t Job Contact Us
2006-2007 SAPTechnical.COM. All rights reserved.
All product names are trademarks of their respective companies. SAPTechnical.COM is in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver, and and any other SAP trademarks are registered trademarks of SAP AG in Germany and in several other countries.
Every effort is made to ensure content integrity. Use information on this site at your own risk.

Graphic Des ign by Round the Bend Wizards

You might also like