Tuesday, November 24, 2015

ALE Configuration

ALE Configuration:
•     WE30 - IDOC type creation
•     WE31 - Create segment
•     WE81 - Message type creation
•     WE82 - Link IDOC type to Message type
•     SE37   - Create Inbound Function Module
•     BD51  - Maintain entry for Function Module
•     WE57 - Maintain
•     BD57  - Link Function Module, IDOC type and Message type
•     WE42 – Create Inbound Process Code
•     BD67  - Link Process code to Function Module
•     WE20 - Create Partner Profile
•     BD64  -  Display Distribution Model
•     WE02 -  IDoc List, Display all Inbound/Outbound IDocs
•     WE14 -  Outbound Processing of IDoc’s
•     BD20 -  Inbound Processing of IDoc’s

1st Step:   Create  a Segment  ( WE31)
         Segment is a structure for passing data in IDoc. It actually contains the IDoc data, just like the DDIC table/structure. Segment is created with all the required fields. Then Save it.  But, to actually use this Segment, you have to Release the Segment, otherwise u can’t use the Segment, by menu, EDIT--> Set Release.
         Now, if you want to do some change to this Segment, u cant, unless & until u Cancel the Release, by Edit--> Cancel Release.

2nd Step:   Create IDOC Type  ( WE30 )
        After creating the Segment, now we have to create the IDoc Type. IDOC Type is like an envelop of a letter, which contains the data inside it, & also some more information like address. IDoc type can be Basic Or Extended.

       Basic IDoc Type:  Using some SAP existing IDOC type (ex. MATMAS) or Custom IDOC type.
       Extension IDOC Type:  When we need some fields extra to an existing IDOC type, then we can extend that Basic Idoc Type by another Segment. This is called Extended idoc type

3rd Step:   Create Message Type (WE81)
     Message Type is like the Postman for sending the Letter.

4th Step:   Attach Message Type to the IDOC Type (WE82)
 
5th Step:   Create a Function Module (SE37)
       Write the Processing logic in a Function Module.

6th Step:   Mention the IDOC Type, i.e, 0/1/2 (BD51)
       
7th Step:   Assign the Message Type, IDOC Type & Function Module (WE57)

8th Step:   Create a Custom Process Code (WE42)

9th Step:   Attach the Function Module to the Process Code (BD67)

10th Step: Execute Inbound IDOC’ s (WE19)

Example Function Module: IDOC_INPUT_ORDERS (Standard FM to create Sales Order).

Monday, June 29, 2015

SAP ABAP Custom program to release request including tasks


REPORT ZZLOCAL_RELEASE_TR.


DATA: gt_e070 TYPE TABLE OF e070,
      return TYPE bapiret2.
FIELD-SYMBOLS: <e070> TYPE e070.

SELECT-OPTIONS: so_num FOR <e070>-trkorr  NO INTERVALS OBLIGATORY.


START-OF-SELECTION.
  DATA lv_answer(01).

  CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
    EXPORTING
      DEFAULTOPTION  = 'N'
      TEXTLINE1      = text-001
*     TEXTLINE2      = ' '
      TITEL          = text-002
*     START_COLUMN   = 25
*     START_ROW      = 6
*     CANCEL_DISPLAY = 'X'
    IMPORTING
      ANSWER         = lv_answer.

  IF lv_answer EQ 'J'.
    SORT so_num by low.
    delete ADJACENT DUPLICATES FROM so_num.
    CHECK so_num is NOT INITIAL.

    SELECT * INTO TABLE gt_e070
      FROM e070
      WHERE trkorr IN so_num
        AND trstatus EQ 'D' " not yet released
        AND strkorr EQ space. " only request not task

    CHECK sy-subrc EQ 0.

    LOOP AT gt_e070 ASSIGNING <e070>.
      CALL FUNCTION 'BAPI_CTREQUEST_RELEASE'
        EXPORTING
          requestid = <e070>-trkorr
          complete  = 'X' " Release request including tasks
        IMPORTING
          return    = return.
      IF NOT return-type IS INITIAL.
        Write:/      'Error',
                     return-message_v1,
                     return-message_v2,
                     return-message_v3,
                     return-message_v4.

      ELSE.
        CONDENSE <e070>-trkorr.
        WRITE : / 'TR released ', <e070>-trkorr, ',', <e070>-AS4USER.
      ENDIF.
    ENDLOOP.
  ENDIF.