RH 10 Snippets Report innacurate

I am using RoboHelp 10 on Windows XP and found that the Snippet report is inaccurate. It often reports that a snippet is used in a topic when it is not. The same inaccuracy applies when you look at the properties of a snippet and look at "The Used in" tab.
Is this a known bug or have my snippets, or the topics they are located in, become corrupt?
This thread http://forums.adobe.com/thread/514229 says snippets are located in the registry for RH7, but I could not find any snippets defined in the registry for RH10. Has this changed?
I know that the rhsnippet.apj file defines the snippets and the relevant .hts file defines the content of the snippet, but is the location of snippets in a project defined anywhere in a file that is editable?
Any help appreciated.
Mark

Snippets are in the root of your project.
I have not had any issues like this and cannot recall seeing any other posts. Maybe the CPD needs a kick or maybe it's a source control issue?
See www.grainge.org for RoboHelp and Authoring tips
@petergrainge

Similar Messages

  • HR-ABAP Payroll-reports-interfaces-forms

    Hi everybody,
                     Please can any body send me the code for HR-ABAP  Payroll, time management  in case of REPORTS, Interfaces.
    I mean  to  get  coding fof retrievel of data from Payroll and Time Management modules.
    Waiting for reply.

    Hi,
    please go thorugh following links
    HR deals with the INFOTYPES which are similar to Tables in General ABAP.
    There are different ways of fetching data from these infotypes.
    There are different areas in HR LIKE Personal Admn, Orgn Management, Benefits, Time amangement, Event Management, Payroll etc
    Infotypes for these areas are different from one another area.
    storing of records data in each type of area is different
    LDBS like PNP are used in HR programing.
    Instead of Select.. we use some ROUTINES and PROVIDE..ENDPROVIDE.. etc
    and in the case of Pay roll we use Clusters and we Import and Export them for data fetching.
    On the whole Normal ABAP is different from HR abap.
    For Personal Admn the Infotypes start with PA0000 to PA1999
    Time Related Infotypes start with PA2000 to PA2999.
    Orgn related Infotypes start with HRP1000 to HRP1999.
    All custom developed infotypes stsrat with PA9000 onwards.
    In payroll processing we use Clusters like PCL1,2,3 and 4.
    Instead of Select query we use PROVIDE and ENDPROVIDE..
    You have to assign a Logical Database in the attributes PNP.
    Go through the SAp doc for HR programming and start doing.
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/report%2bin%2bhr%2babap%2b(without%2bLDB)
    http://www.sapdevelopment.co.uk/hr/hrhome.htm
    See:
    http://help.sap.com/saphelp_46c/helpdata/en/4f/d5268a575e11d189270000e8322f96/content.htm
    Please check this link for HR sample programs.
    http://www.sapdevelopment.co.uk/hr/hrhome.htm
    http://www.sapfans.com/forums/viewtopic.php?p=498530&sid=d7ec5866e3fb26880da129de45ce79de
    http://www.sapcookbook.com/preview_hr_questions.htm
    http://www.atomhr.com/library_full.htm
    http://www.sapdevelopment.co.uk/hr/hrhome.htm
    http://www.planetsap.com/hr_abap_main_page.htm
    http://expertanswercenter.techtarget.com/eac/knowledgebaseAnswer/0,295199,sid63_gci983590,00.html
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b74ce990-0201-0010-a595-8c1203c93e56
    http://www.planetsap.com/hr_abap_main_page.htm
    http://www.sap-img.com/abap/sample-hr-reports-allocate-petrol-allowance.htm
    http://www.planetsap.com/HR_ABAP_LDB.htm
    http://help.sap.com/erp2005_ehp_02/helpdata/en/16/b8b83b5b831f3be10000000a114084/content.htm
    http://help.sap.com/saphelp_45b/helpdata/en/1e/728d281d5e11d289d30000e82158f1/content.htm
    http://diocio.wordpress.com/2007/04/27/sap-abap-insert-infotype-data-with-maintain-text/
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • How to create reports in HR ABAP?

    hi,
    can anyone tell me how to write reports in HR ABAP?
    as i m new to HR ABAP.
    wat r the points to be remembered?

    u can check the following link,
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/report%2bin%2bhr%2babap%2b(LDB)
    and check TRMAC table for Macro's.
    best reguards,
    raj.

  • Please help me with this error in this code snippet!

    Code Snippet:
    REPORT  ZMKTEST6.
    data : f1(2) type c,
           f2(2) type c,
           f3(10) type n value '12345'.
      clear: f1 with 'X',
             f2 with f1,
             f3 with '3'.
    write :/ f1 ,f2, f3.
    Process Error:
    The field "F1" must have the length 1.

    hi ,
    ther is not syntax with clear with 'X".
    but you can do one thing to get the one character.
    REPORT ZMKTEST6.
    data : f1(2) type c,
    f2(2) type c,
    f3(10) type n value '12345'.
    clear: f1 with 'X',  "Comment this
    f1 = f1+0(1).        "write this
    f2 with f1,
    f3 with '3'.
    write :/ f1 ,f2, f3.
    now f1 containd one charater instead of 2.
    now you can display as usuall

  • Embedding LR4 Gallery Into iWeb

    Hello,
    After looking at many options, I had decided to use Airtight SimpleViewer in Lightroom 4 to create photo galleries with the intention of embedding these galleries into my website created with iWeb (3.0.4).
    However, I am stumbling at the html snippet stage.
    I have tried both uploading the gallery to my FTP site as well as exporting the gallery and then using Fetch to upload the gallery.
    I tried using the html snippets reported in www.iwebfaq.org:
    <iframe src=
    "http://web.me.com/username/Slideshow/index.html"
    style="width:615px; height:500px;
    border-color:#990033;
    border-style:solid;
    border-width:0px"
    scrolling="yes" >
    </iframe>
    Can anyone tell me what I am doing wrong?
    Thanks

    I put the slideshow folders into my public folder in my Dropbox:
    When I insert the following into the HTML snippets, I don't get the Simple Viewer Gallery either in iWeb or on my blog after putting it with Fetch:
    When I click on the index.html file within the Public Dropx folder for the Ice Fishing slideshow, this is the link I get: https://dl-web.dropbox.com/get/Public/Slideshows/Ice_Fishing/index.html?w=AABKs1 m6rARJTOqw4plIXFTCkvdEqU3X-D1J9yWfiSObZQ; and this is the result in both iWeb and my blog:
    I have Adobe Flash installed so that is not the issue. When I hit the Gallery link, I get this error message:
    Thanks for your help thus far. I think I am much closer, but still obviously doing something wrong.

  • Table to find out the function modules used in a particular program

    Hi,
    Is there any standard table to find out the function modules used in a particular program?
    Such as there is a table D010TAB to find out the tables used in a program .

    Hello
    There is no exist such table.
    But try this snippet:
    REPORT ZSEARCH.
    PARAMETERS: P_NAME LIKE D010SINF-PROG.
    DATA: PROGTXT(72) TYPE C OCCURS 0 WITH HEADER LINE.
    DATA: TMP(72) TYPE C OCCURS 0 WITH HEADER LINE.
    DATA: FUNCT TYPE RS38L_FNAM OCCURS 0 WITH HEADER LINE.
    DATA: INCL TYPE RSEUINC OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'RS_GET_ALL_INCLUDES'
         EXPORTING PROGRAM    = P_NAME
         TABLES    INCLUDETAB = INCL.
    LOOP AT INCL.
      READ REPORT INCL-MASTER INTO TMP.
      APPEND LINES OF TMP TO PROGTXT.
      REFRESH TMP.
    ENDLOOP.
    READ REPORT P_NAME INTO TMP.
    APPEND LINES OF TMP TO PROGTXT.
    LOOP AT PROGTXT.
      IF PROGTXT CS 'CALL FUNCTION'.
        SEARCH PROGTXT FOR ''''.
        IF SY-SUBRC = 0.
          DO.
            SHIFT PROGTXT LEFT BY 1 PLACES.
            IF PROGTXT(1) = ''''.
              SHIFT PROGTXT LEFT BY 1 PLACES.
              DO.
                SHIFT PROGTXT RIGHT BY 1 PLACES.
                IF PROGTXT+71(1) = ''''.
                  SHIFT PROGTXT RIGHT BY 1 PLACES.
                  CONDENSE PROGTXT.
                  FUNCT = PROGTXT. COLLECT FUNCT. EXIT.
                ENDIF.
              ENDDO.
              EXIT.
            ENDIF.
          ENDDO.
        ENDIF.
      ENDIF.
    ENDLOOP.
    SORT FUNCT.
    LOOP AT FUNCT.
      WRITE: FUNCT. NEW-LINE.
    ENDLOOP.

  • Ale-idoc  steps

    Hi All,
    Can any one please give me the step by step ale-idoc toturial.about the steps to send data from one client to other.
    Regards,
    bunty

    Hi,
    <b>
      It gives, entire idoc documentation.
    http://help.sap.com/saphelp_nw04/helpdata/en/3b/beb13b00ae793be10000000a11402f/frameset.htm
    To develop a new custom ALE scenario, comprises 5 steps:
    1. Design and develop the custom IDoc with it’s segments and a new message type
    2. Configure the ALE environment with the new IDoc and message type (customer model, partner profiles and linking IDoc to message type)
    3. Develop the outbound process which does the following:
    • Populates the custom IDoc with control info and functional data
    • Sends the IDoc to the ALE layer for distribution
    • Updates status and handles errors
    4. Configure the ALE inbound side (partner profiles with inbound process code)
    5. Develop the inbound process which does the following:
    • Reads the IDoc into a BDC table; selects other data that is required
    • Runs transaction using call transaction or BDC session
    • Updates status and handles errors
    Below is a pictorial representation of the flow of a complete ALE scenario from the sending system to the receiving system.
    Figure 1: ALE Scenario model
    1.1. ALE Example
    For the purposes of this example we will develop a small ALE scenario. This scenario is described below.
    “The receiver of an internal service must be able to reverse (cancel) the invoice receipt which will then cancel the applicable billing document automatically on the service provider’s system.”
    Figure 2: Example Purchasing & Selling scenario
    We will develop a custom IDoc to carry the billing number from the Service Receiver’s system to the Service Provider’s system. We will populate the IDoc in a user exit on the sending side and we will process the transaction on the receiving side using a custom function module and a BDC transaction call.
    No rule conversion, segment filtering or version conversion will be implemented in the model as described in Figure 1.
    Requirements
    • Working ALE environment - See ALE Basis Configuration Guide;
    • ALE scenario design together with the business requirement;
    • Development access; and
    • ALE configuration access.
    NOTES:
    1. All IMG references to transactions are located in the transaction SALE which is the ALE portion of the IMG
    2. This is one way of developing a scenario where no message control exists. If message control exist (EG. On purchase orders) then NAST can be used to call an outbound function module that would create the required IDocs.
    3. Extensive knowledge of IDocs and ALE basis configuration is required in order to understand this guide.
    2. OUTBOUND PROCESSING
    2.1. Create IDoc type (WE30) Client independent
    The IDoc type refers to the IDoc structure that you will require for your development. In our case the IDoc type is called ZINVRV01. This IDoc type will have 1 segment called Z1INVRV with 2 fields, LIFNR & XBLNR, in this segment. If you require many segments or nested segments then they are also created using the same procedure.
    We will create the IDoc of the following structure:
    ZINVRV01
    Purchasing and Selling - Invoice receipt reversal
    Z1INVRV P&S - Segment 1
    Segment fields
    LIFNR Vendor account number
    XBLNR Reference document number
    Figure 3: IDoc type ZINVRV01
    To create the IDoc type, follow these next few steps:
    • Enter transaction WE30 (ALE -> Extensions -> IDoc types -> Maintain IDoc type)
    • Type in ZINVRV01 and click on Basic IDoc type, click the Create icon
    • Click on Create new (we are creating an IDoc from scratch but you may want to copy another IDoc if it is similar to your requirements) and enter a description, and press enter
    • Click on ZINVRV01 and then on the Create icon
    • Enter Z1INVRV as the segment type (must start with Z1), check mandatory if the segment must exist (in this case check it), enter 1 in minimum number and 1 as maximum number. (Make the maximum number 9999999999 if there are going to be many of these segments in each IDoc. IE. When line items are passed via IDocs), click on Segment editor
    • Enter a description for your segment type and create
    • Enter a description for your segment, enter each field required in your IDoc, in our case type LIFNR across for Field name, DE structure and DE documentation, repeat for XBLNR and press enter to validate.
    • Save and generate, press back
    • To release the segment choose Goto, Release from the menu
    • Check the box on the line of your new segment
    • Save, back and enter
    • Your IDoc type structure should be displayed with your new segment
    • Save and back
    • To release the IDoc type choose Extras, Release type from the menu and Yes
    Your IDoc is now ready for use. If you need to add fields or segments to your IDoc type, you will need to cancel the release of the IDoc type as well as the segment release using a similar procedure followed above (except now you uncheck the release box for the segment and you choose cancel release for the IDoc type).
    2.2. Create message type (WE81) Client independent
    To create a new message type, follow these next few steps:
    • Enter transaction WE81 (ALE -> Extensions -> IDoc types -> Maintain message type for intermed. Structure -> Create logical message type)
    • Choose Create logical message type by double clicking on it
    • Click on change icon to enter change mode
    • Click on New entries to add a new type
    • Enter the required message type, in our case it is ZINVRV and an appropriate description
    • Save and exit.
    Your message type has now been created. The next step will be to link it to the IDoc.
    2.2.1. Link message to IDoc type (WE82 & BD69) Client independent
    To link the message type to the IDoc type follow these next few steps:
    • Enter transaction WE82 (ALE -> Extensions -> IDoc types -> Maintain message type for intermed. Structure -> EDI: Message Types and Assignment to IDoc Types)
    • Click on change icon to enter change mode
    • Click on New entries to create the link
    • Enter the message type ZINVRV and the BasicIDoc type as ZINVRV01
    • Save and exit
    • Enter transaction BD69 (ALE -> Extensions -> IDoc types -> Maintain message type for intermed. Structure -> Assign message type to IDoc for ALE)
    • Click on change icon to enter change mode
    • Click on New entries to create the link
    • Enter the message type ZINVRV and the BasicIDoc type as ZINVRV01
    • Save and exit
    Your IDoc is now linked to your message type. We still need to link object types and add the message to the model before we can use the message.
    2.2.2. Maintain object type for message type (BD59) Client independent
    The ALE objects are used to create links between IDocs and applications objects, to control the serialisation, to filter messages in the customer model and to use listings.
    For our own message type and IDoc you must maintain object types for the links.
    If you want to check the serialisation for the message type, then you must maintain object types for the serialisation. If no serialisation object has been maintained for a given message type, then the serialisation will not be checked for this message type.
    To add an object type to our message type, follow these next few steps:
    • Enter transaction BD59 (ALE -> Extensions -> ALE object maintenance -> Maintain object types)
    • Type in your message type ZINVRV and press enter
    • Click on New entries
    • Enter your object type, LIFNR (We need to use the vendor as a filter object), the segment name where LIFNR resides, Z1INVRV, a number 1 for the sequence followed by the actual field name LIFNR
    • Save and exit.
    You have now created an object that we’ll use as a filter object in the customer model to direct the flow of messages to the various logical systems based on the vendors in the filter of the message type ZINVRV.
    We now need to add our new message type to the distribution model.
    2.3. Configuring the Distribution Model
    This task is performed on your ALE reference client.
    2.3.1. Manual Configuration (BD64) Client dependent
    To manually configure the customer distribution model, read the ALE configuration procedure, and follow these steps:
    • Perform the Maintain customer distribution model directly function. (ALE -> Distribution customer model -> Maintain customer distribution model directly)
    • Specify the customer model you want to maintain and the logical system that is to be the sender of the messages OR create a new model. (Create model ALE with logical system ALELS1C400)
    • Choose the receiving systems to which the sending system must forward message type ZINVRV to.
    • For each receiving logical system allocate the message type necessary for communication to the receiving systems as per ALE configuration procedure.
    • Create filter objects (in our case LIFNR as the object type with the associated vendor number, 0000018001 with leading zeros, in the object area) for the message types.
    • Save the entries.
    NOTES:
    You cannot maintain a message type between the same sender and receiver in more than one customer distribution model.
    Only the owner is authorised to modify the model.
    To change the owner of a model, choose the 'Maintain ownership of customer distribution model' function. Make sure that all changes will be distributed to all systems that know the corresponding model. To do so, you can use the correction and transport system.
    To transport the customer distribution model you should use the Distribute customer model function of the IMG as described below.
    2.3.2. Distribute customer model (BD71) Client dependent
    After the customer model has been created centrally, it must be distributed to the other remote systems. This entails first of all setting up the communication for the distributed systems and then sending the model.
    2.3.2.1. Distribute Model (BD71) Client dependent
    This task is performed on your ALE reference client. To distribute the customer distribution model, read the ALE configuration procedure and follow these steps:
    • Make the settings for the communication with the other decentral systems, you have not set them yet.
    • Define the RFC destination for R/3 connections whose names correspond to the name of the corresponding logical system.
    • Create the output partner profile.
    • Distribute the customer model
    • Specify the name of the customer model.
    • You must specify the target system to which you want to distribute the customer model.
    • You must repeat this function for every distributed logical system.
    2.3.2.2. Maintain sending system partner profile (WE20) Client dependent
    With this function, you define the partner profiles for all outbound and inbound messages on the basis of the customer distribution model.
    After you have defined and distributed the customer model, you will have to maintain the partner profiles locally. To do this read the ALE configuration procedure.
    • Enter the output mode (background, immediately) and the package size for outbound processing.
    Requirements
    • The customer model must be maintained.
    • RFC destinations must be maintained.
    • The customer model must be distributed.
    • To ensure that the appropriate persons in charge are informed if a processing error occurs, you must make settings in: Error processing Maintain organisational units.
    2.4. Populate & distribute IDoc using ABAP
    An IDoc consists of a control record with structure edidc and one or more data records with structure edidd. The control record contains the sender and recipient of the IDoc, as well as information on the type of message.
    To be able to pass an IDoc to the ALE layer, you must set up a field string with structure edidc and an internal table with structure edidd. They are used to call function module master_idoc_distribute, which performs the save to the database and triggers the dispatch if necessary.
    2.4.1. Example code
    The code displayed below does the following:
    • populates our IDoc segment Z1INVR with the 2 fields XBLNR and LIFNR, populates the segment name and appends this to an internal table used to store the IDoc data;
    • populates the control record info with the message type and IDoc type; and
    • calls the MASTER_IDOC_DISTRIBUTE function module which distributes the IDoc as configured in the customer distribution model.
    *--- Data declaration statements
    DATA: C_INVREV_SEGNAME(7) TYPE C VALUE 'Z1INVRV',
    C_INVREV_MESTYPE(6) TYPE C VALUE 'ZINVRV',
    C_INVREV_IDOC_TYPE(8) TYPE C VALUE 'ZINVRV01',
    Z1INVRV LIKE Z1INVRV,
    C_INVREV_DOCTYPE LIKE BKPF-BLART VALUE 'YY',
    IDOC_CONTROL LIKE EDIDC,
    T_COMM_CONTROL LIKE EDIDC OCCURS 0 WITH HEADER LINE,
    IDOC_DATA LIKE EDIDD OCCURS 0 WITH HEADER LINE.
    *--- Move the document header into a structure
    LOOP AT DOC_HEAD_TAB INTO DOC_HEAD.
    ENDLOOP.
    *--- Move the document item data into a structure
    LOOP AT DOC_ITEM_TAB INTO DOC_ITEM WHERE NOT ( LIFNR IS INITIAL ).
    ENDLOOP.
    *--- Populate the IDoc segment’s field with the required data
    CLEAR Z1INVRV.
    Z1INVRV-LIFNR = DOC_ITEM-LIFNR. “Store vendor number for filter
    Z1INVRV-XBLNR = DOC_HEAD-XBLNR. “Billing number
    IDOC_DATA-SEGNAM = C_INVREV_SEGNAME. “Segment name
    IDOC_DATA-SDATA = Z1INVRV. “Segment data
    APPEND IDOC_DATA. “Populate IDoc internal table
    *--- Move the control data info required for the distribution
    IDOC_CONTROL-MESTYP = C_INVREV_MESTYPE.
    IDOC_CONTROL-DOCTYP = C_INVREV_IDOC_TYPE.
    *--- Call the distribute function with the required parameters
    CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE' IN UPDATE TASK
    EXPORTING
    MASTER_IDOC_CONTROL = IDOC_CONTROL
    TABLES
    COMMUNICATION_IDOC_CONTROL = T_COMM_CONTROL
    MASTER_IDOC_DATA = IDOC_DATA
    EXCEPTIONS
    ERROR_IN_IDOC_CONTROL = 1
    ERROR_WRITING_IDOC_STATUS = 2
    ERROR_IN_IDOC_DATA = 3
    SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
    OTHERS = 5.
    Figure 4: Outbound processing example code
    NOTE:
    For debugging purposes, use transaction WE05 (IDoc overview) to see check your IDoc status, or to see whether an IDoc was created/
    3. INBOUND PROCESSING
    3.1. Create Function Module
    This function module is called when a message type, of type ZINVRV, comes into the receiving system. This needs to be configured and is dealt with later in this section. The function module is passed the IDoc as a parameter.
    Example parameters
    Import parameters Reference field Opt Y/N
    INPUT_METHOD BDWFAP_PAR-INPUTMETHD N
    MASS_PROCESSING BDWFAP_PAR-MASS_PROC N
    Export Parameters Reference field Opt Y/N
    WORKFLOW_RESULT BDWFAP_PAR-RESULT N
    APPLICATION_VARIABLE BDWFAP_PAR-APPL_VAR N
    IN_UPDATE_TASK BDWFAP_PAR-UPDATETASK N
    CALL_TRANSACTION_DONE BDWFAP_PAR-CALLTRANS N
    Table Parameters Reference field Optional Y/N
    IDOC_CONTRL EDIDC
    IDOC_DATA EDIDD
    IDOC_STATUS BDIDOCSTAT
    RETURN_VARIABLES BDWFRETVAR
    SERIALIZATION_INFO BDI_SER
    Exceptions
    WRONG_FUNCTION_CALLED
    Example code
    The code displayed below does the following:
    • populates a BDC table with the IDoc info;
    • calls the transaction via a BDC call; and
    • updates the IDoc status according to the BDC error status.
    EXTRACT FROM: Z_IDOC_INPUT_ZINVRV
    *--- Declaration of local variables
    DATA: C_SEGNAM(10) TYPE C VALUE 'Z1INVRV'.
    *-Loop through the IDOCs
    LOOP AT IDOC_CONTRL.
    *---Loop through the data for the IDOC
    LOOP AT IDOC_DATA WHERE DOCNUM = IDOC_CONTRL-DOCNUM.
    CASE IDOC_DATA-SEGNAM.
    WHEN C_SEGNAM.
    Here we get the info from the idoc table
    IT_Z1INVRV = IDOC_DATA-SDATA.
    ENDCASE.
    PERFORM REV_INV.
    ENDLOOP.
    PERFORM UPDATE_IDOC_STATUS.
    ENDLOOP.
    FORM REV_INV "Reverse invoice form
    *--- Local variables & constants
    DATA: C_TCODE LIKE BKPF-TCODE VALUE 'VF11'. "BDC transaction code
    *--- Now we can build the bdc table to call the reversal transaction start of screen 109
    CLEAR BDC_TAB.
    BDC_TAB-PROGRAM = 'SAPMV60A'.
    BDC_TAB-DYNPRO = '109'.
    BDC_TAB-DYNBEGIN = 'X'.
    APPEND BDC_TAB.
    *--- Document number
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = 'KOMFK-VBELN(01)'.
    BDC_TAB-FVAL = IT_Z1INVRV-XBLNR. "Billing document number
    APPEND BDC_TAB.
    *--- OK Code for screen 109
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = 'BDC_OKCODE'.
    BDC_TAB-FVAL = 'SICH'.
    APPEND BDC_TAB.
    *--- Now we can call transaction 'VF11' with the populated bdc table. The transaction is called inside the idoc-contrl loop, so a transaction will be called for every idoc (journal). the transaction is called in no-display mode ('N') because this code runs in background as it is called by ale. The update is specified to be synchronous ('S') because we have to wait for the result to update the idoc status correctly.
    CALL TRANSACTION C_TCODE USING BDC_TAB MODE 'N' UPDATE 'S'.
    *--- Store the return code for use in another form (status update)
    RETURN_CODE = SY-SUBRC.
    *--- Here we check the return code, if there was an error, we put the transaction in a bdc session for the user to review and correct.
    IF SY-SUBRC NE 0.
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
    CLIENT = SY-MANDT
    GROUP = 'ZINVRV'
    USER = C_ALE_USER
    KEEP = 'X'.
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
    TCODE = C_TCODE
    TABLES
    DYNPROTAB = BDC_TAB.
    CALL FUNCTION 'BDC_CLOSE_GROUP'
    EXCEPTIONS
    NOT_OPEN = 1
    QUEUE_ERROR = 2
    OTHERS = 3.
    ELSE. "No problems
    C_EXISTS = 'N'.
    Select from the billing document table to get sales doc number
    SELECT * FROM VBRP WHERE VBELN = IT_Z1INVRV-XBLNR.
    Select from the sales document table to get user status number
    SELECT SINGLE * FROM VBAP WHERE VBELN = VBRP-AUBEL AND
    POSNR = VBRP-AUPOS.
    Select from the status table to change the user status to pending
    SELECT * FROM JEST WHERE OBJNR = VBAP-OBJNR AND
    STAT LIKE C_USER_STATUS.
    IF JEST-STAT = C_US_PENDING. "User status is pending
    JEST-INACT = C_UNCHECKED. "Make pending the active status
    UPDATE JEST.
    C_EXISTS = 'Y'. "I.E. An entry is already in table
    ELSEIF JEST-INACT = C_UNCHECKED AND JEST-STAT NE C_US_PENDING.
    JEST-INACT = C_CHECKED. "Make everything else inactive
    UPDATE JEST.
    ENDIF.
    ENDSELECT.
    IF C_EXISTS = 'N'. "I.E. Pending has never been a status before
    JEST-OBJNR = VBAP-OBJNR.
    JEST-STAT = C_US_PENDING.
    JEST-INACT = C_UNCHECKED. "Make pending the active status
    INSERT JEST.
    ENDIF.
    ENDSELECT. "Select from VBRP (Billing document table)
    ENDIF.
    ENDFORM. " REV_INV
    FORM UPDATE_IDOC_STATUS.
    *--- Now we check the CALL TRANSACTION return code and set IDOC status
    CLEAR IDOC_STATUS.
    IF RETURN_CODE = 0.
    WORKFLOW_RESULT = '0'.
    IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
    IDOC_STATUS-STATUS = '53'.
    IDOC_STATUS-UNAME = SY-UNAME.
    IDOC_STATUS-REPID = SY-REPID.
    IDOC_STATUS-MSGTY = SY-MSGTY.
    IDOC_STATUS-MSGID = SY-MSGID.
    IDOC_STATUS-MSGNO = SY-MSGNO.
    IDOC_STATUS-MSGV1 = SY-MSGV1.
    IDOC_STATUS-MSGV2 = SY-MSGV2.
    IDOC_STATUS-MSGV3 = SY-MSGV3.
    IDOC_STATUS-MSGV4 = SY-MSGV4.
    RETURN_VARIABLES-WF_PARAM = 'Processed_IDOCs'.
    RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
    APPEND RETURN_VARIABLES.
    ELSE.
    WORKFLOW_RESULT = '99999'.
    IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
    IDOC_STATUS-STATUS = '51'.
    IDOC_STATUS-UNAME = SY-UNAME.
    IDOC_STATUS-REPID = SY-REPID.
    IDOC_STATUS-MSGTY = SY-MSGTY.
    IDOC_STATUS-MSGID = SY-MSGID.
    IDOC_STATUS-MSGNO = SY-MSGNO.
    IDOC_STATUS-MSGV1 = SY-MSGV1.
    IDOC_STATUS-MSGV2 = SY-MSGV2.
    IDOC_STATUS-MSGV3 = SY-MSGV3.
    IDOC_STATUS-MSGV4 = SY-MSGV4.
    RETURN_VARIABLES-WF_PARAM = 'ERROR_IDOCS'.
    RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
    APPEND RETURN_VARIABLES.
    ENDIF.
    APPEND IDOC_STATUS.
    ENDFORM. " UPDATE_IDOC_STATUS
    Figure 5: Inbound processing example code
    3.1.1. Debugging inbound FM
    Use transaction WE19 to test inbound function module in debugging mode. Also use WE05 to view the IDocs and their statuses.
    3.2. Maintain ALE attributes
    The inbound function module needs to be linked to the message type and the message type needs to be linked to the appropriate inbound process code at the partner profile level before the scenario is enabled. These steps are described below in detail.
    3.2.1. Link Message Type to Function Module (WE57) Client independent
    To link a message (ZINVRV) type to a function module (Z_IDOC_INPUT_ZINVRV) follow these steps:
    • Enter transaction WE57 (ALE -> Extensions -> Inbound -> Allocate function module to logical message)
    • Select an entry (EG. IDOC_INPUT_ORDERS) and copy
    • Type in module name Z_IDOC_INPUT_ZINVRV
    • Type in basic IDoc type as ZINVRV01
    • Type in message type as ZINVRV
    • Type object type as IDOCINVOIC (Invoice document) - Used for workflow
    • Direction should be set to 2 for inbound
    • Enter and save
    3.2.2. Define FM settings (BD51) Client independent
    • Enter transaction BD51 (ALE -> Extensions -> Inbound -> Define settings for input modules)
    • Click on New entries
    • Type in the name of the new function module Z_IDOC_INPUT_ZINVRV
    • Enter 0 for mass processing in the output column
    • Save and Exit
    3.2.3. Maintain process codes (WE42) Client dependent
    A process code needs to be maintained on each client. It then needs to be linked to the message via the partner profiles on each client. This allows the various clients to use a unique function module for the same message type.
    To maintain the process code follow these steps:
    • Log on to the appropriate receiving system client
    • Execute WE42 (ALE -> Extensions -> Inbound -> Maintaining process codes inbound)
    • Choose Inbound with ALE service
    • Choose Processing with function module
    • Click on Processing with function module and choose create icon
    • Click on New Entries
    • Type in process code ZINR and give it a description and save
    • Now you are asked to Please maintain codes added in ALE entry methods, enter and choose Z_IDOC_INPUT_FIRVSL and copy it. You should choose a FM similar to your one.
    • Enter your process code ZINR
    • Enter your function module Z_IDOC_INPUT_ZINVRV
    NOTE: The next 6 steps are used in workflow error handling.
    • Enter IDPKFIDCMT in object type
    • Enter MASSINPUTFINISHED in End event
    • Enter IDOCINVOIC in IDoc object type
    • Enter INPUTERROROCCURREDFI in IDoc start event
    • Enter INPUTFINISHEDFI in IDoc End event
    • Enter IDOCINVOIC in Application object type
    You will need to determine the task associated with object IDOCINVOIC, and then assign the appropriate position to it. This position will then receive the application error messages via workflow.
    To set up the workflow area please consult the Workflow config guide.
    3.3. Create inbound partner profile
    For each message type you need to maintain the inbound partner profiles.
    3.3.1. Maintain receiving system partner profile (WE20) Client dependent
    To maintain inbound partner profiles read the document ALE configuration procedure:
    • Add the message type ZINVRV with process code ZINR.
    • Enter the output mode (background, immediately) for inbound processing and NO message code.
    • Enter the position S and choose the ALE administrator 50000085. This position will then receive all the technical ALE errors via workflow.
    3.4. Test
    Once the inbound function module has been debugged the scenario should be ready to test in its entirety. If problems occur, read through the relevant areas of this document to check your configuration or code.
    IDOC Programming
    Index
    Process Steps for IDOC Programming 3
    Interpreting An IDoc Segment Info 3
    IDoc Type – The Structure of The IDoc File 5
    Defining The Message Type 6
    Define Valid Combination Of Message and IDoc Types 6
    Process Steps for Inbound IDOC Programming 7
    Characteristics of Inbound function module 7
    Assigning a processing function 8
    Processing Codes 9
    Workflow Handling 12
    Create Inbound Partner Profile 12
    Sample Code Snippet 14
    Execution Steps for inbound Idoc: 17
    Testing of Inbound Idoc: 19
    Process Steps for Outbound IDOC Programming 21
    Common Steps 21
    Create Outbound Partner Profile 21
    Sample Code Snippet 23
    Execution Steps: 26
    Testing of Outbound Idoc: 26
    Change Pointers & Reduction of IDOCs. 26
                                                                                    What is IDOC
    IDocs are SAP’s file format to exchange data with a foreign system. IDocs is the acronym for Intermediate Document. This indicates a set of (electronic) information, which builds a logical entity. An IDoc is e.g. all the data of a single customer in your customer master data file. Or the Idoc is all the data of a single invoice.
    • IDocs are an ASCII file format to exchange data between computers; the format is chosen arbitrarily
    • IDocs are similar to segmented files; they are not a description language like ANSI X.12, EDIFACT or XML
    • The IDoc contents are processed by function modules, which can be assigned in customizing
    Process Steps for IDOC Programming
    The following steps are required for inbound and outbound IDOC Programming.
    Interpreting An IDoc Segment Info
    All IDoc data records are exchanged in a fixed format, regardless of the segment type. The segment’s true structure is stored in R/3’s repository as a DDIC structure of the same name.
    Go to transaction code WE31. Enter the name of the Segment, which is to be created (fig 2.1).
    E.g. Create the segment ZEMPMASTSEG
    Fig 2.1 WE31- IDOC Segment main screen.
    Fig 2.2 WE31 IDOC Segment definition screen.
    In the above screen user can enter the fields, which are necessary for the segment. Once all the necessary fields will be populated then Save the transaction. After Saving release the version of the Segment by selecting the version and through menu Edit -> Set release.
    Same way create one or more segment.
    Fig 2.3 WE31 – IDOC Segment definition screen for another segment (ZEMPMASTHEADERSEG).
    IDoc Type – The Structure of the IDoc File
    The IDoc type is the name of the data structure used to describe the file format of a specific IDoc.
    An IDoc is a segmented data file. It has typically several segments. The segments are usually structured into fields, however different segments use different fields.
    The IDoc type is defined with transaction WE30, the respective segments are defined with transaction WE31 as per the point 2
    Go to transaction code WE30. Enter the IDOC Type name.
    Fig 3.1 WE30 – IDOC Type main screen.
    Add the segments to the IDOC Type as per the requirement.
    For e.g. in the fig 3.2 it shown that IDOC Type is having only one segment ZEMPMASTHEADERSEG, which is having one child segment ZEMPMASTSEG
    Fig 3.2 WE30 – IDOC Type segment screen
    For each segment developer (double click on the segment) can set the minimum, maximum number of segment in a sequence.
    Fig 3.3 fig 3.4
    Defining the Message Type
    The message type defines the context under which an IDoc is transferred to its destination. It allows using the same IDoc file format to use for several different applications.
    The message type together with the IDoc type determines the processing function.
    The message type defined using transaction code WE81.
    fig 4.1 WE81 – Message Types
    Define Valid Combination Of Message and IDoc Types
    The valid combinations of message type and IDoc type are stored in table EDIMSG, using transaction WE82.
    The declaration of valid combinations is done to allow validation, if the system can handle a certain combination.
    Fig 5.1 WE82 – Message Type Assignment
    Process Step for Inbound IDOC Programming
    Characteristics of Inbound function module
    Before assigning the function module to Inbound process code, its characteristics must be set with the transaction BD51. This step is mandatory before assigning the function module to Inbound process code.
    For inbound processing you need to tell, whether the function will be capable of dialog processing. This is meant for those functions, which process the inbound data via call transaction. Those functions can be replayed in visible batch input mode to check why the processing might have failed.
    Fig 6.1
    Here the main characteristic is Input Type. It means “How are IDoc packages processed?” and having values like
    Input Type Short Text
    0 Mass Processing
    1 Individual input
    2 Individual input with IDOC locked in CALL TRANSACTION
    Also another property Dialog Allowed can be set here. With “Dialog allowed” IDocs can be processed in dialog mode.
    Fig 6.2 – BD51 Characteristics of Inbound Function Module
    Assigning a processing function
    The combination of message type and IDoc type determine the processing algorithm. This is usually a function module with a well-defined interface or a SAP business object and is set up in table EDIFCT.
    The entry made the points to a function module, which will be called when the IDoc is to be processed. The entries for message code and message function are usually left blank. They can be used to derive sub types of messages together with the partner profile used.
    Used transaction code WE57 for assigning function module to IDOC Type.
    Fig 7.1 WE57 – Assign Function Module to Message and IDOC Type
    Fig 7.2 Assign a handler function to a message/message type
    Process Codes
    R/3 uses the method of logical process codes to detach the Idoc processing and the processing function module. They assign a logical name to function instead of specifying the physical function name.
    The combination message type/IDoc will determine the logical processing code, which itself points to a function. If the function changes, only the definition of the processing codes will be changed and the new function will be immediately effective for all IDocs associated with the process code.
    For inbound processing codes you have to specify the method to use for the determination of the inbound function.
    The Inbound processing code can be attach to the function module using transaction code WE42
    Fig 8.1 WE42 – Define Inbound Process Code
    You need to tick, if your function can be used via the ALE engine. This is the option you would usually choose. It allows processing via the ALE scenarios. See fig below
    Fig 8.2 WE42 – Set properties of Inbound Process Code
    See fig 8.4
    Fig 8.3 WE42 – Set the Message type for the Inbound Process Code
    Fig 8.4 WE42 – Fill the details of the Inbound Process Code.
    The properties set in the above fig 8.4 are used for the workflow handling when the IDOC is having any error.
    Properties, which are useful in the workflow processing, are as follows.
    • Object Type – It is a business object created using transaction code SWO1 and used as a handler
    • Starting Event - Will triggered the workflow on occur of Error.
    • Ending Event - Will terminate the workflow after processing the
    Workflow Handling
    Refer: - Workflow Guide
    Create Inbound Partner Profile
    For each message type you need to maintain the inbound partner profiles. Maintain receiving system partner profile using WE20 (See fig. 10.3). Add the message type in the Senders inbound parameter.
    Following steps will be followed for creation of partner profile (Inbound).
    • Add the message type (e.g. ZEMPMSG) into the inbound parameter by clicking .
    Fig. 10.1 WE20 – Addition of message type in Inbound Partner Profile
    • On the next screen enter the message type , process code. In the Processing by function module block select the radio button based on the need. If you clicked on Triggered by background program then the IDOC will be collected and will triggered by another program which will run in background and if the second option Triggered immediately is clicked then the IDOC will be processed by the function module as soon as it is triggered.
    Fig. 10.2 WE20 – Inbound Parameters.
    Fig 10.3 WE20 – Create Partner profile
    Sample Code Snippet
    Important Steps are as follows.
    1) Unpacking of IDOC: - Unpack the IDOC into the respective segments.
    2) Process Data: - Process the unpacked data.
    3) Error Handling.
    4) Workflow triggering.
    FUNCTION Z_IDOC_INPUT_EMPMAST.
    ""Local interface:
    *” IMPORTING
    *" REFERENCE (INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
    *" REFERENCE (MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
    *” EXPORTING
    *" REFERENCE (WORKFLOW_RESULT) LIKE BDWFAP_PAR-RESULT
    *" REFERENCE (APPLICATION_VARIABLE) LIKE BDWFAP_PAR-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
    DATA: S_EMPMAST LIKE ZEMPMASTHEADERSEG.
    DATA: T_EMPMAST LIKE ZEMPMASTSEG OCCURS 0 WITH HEADER LINE.
    DATA: WA_EMPMAST LIKE ZEMPMAST.
    DATA: L_FLAG VALUE 'Y'.
    CLEAR S_EMPMAST.
    REFRESH T_EMPMAST.
    check if the function is called correctly *
    IF IDOC_CONTRL-MESTYP <> 'ZEMPMSG'.
    RAISE WRONG_FUNCTION_CALLED.
    ENDIF.
    WORKFLOW_RESULT = 0.
    Unpacking the IDoc
    LOOP AT IDOC_DATA.
    CASE IDOC_DATA-SEGNAM.
    WHEN 'ZEMPMASTHEADERSEG'.
    MOVE IDOC_DATA-SDATA TO S_EMPMAST.
    WHEN 'ZEMPMASTSEG'.
    MOVE IDOC_DATA-SDATA TO T_EMPMAST.
    APPEND T_EMPMAST.
    ENDCASE.
    ENDLOOP.
    IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
    IDOC_STATUS-MSGV1 = IDOC_CONTRL-IDOCTP.
    IDOC_STATUS-MSGID = '00'.
    IDOC_STATUS-MSGNO = '398'.
    Processing Data
    LOOP AT T_EMPMAST.
    MOVE-CORRESPONDING T_EMPMAST TO WA_EMPMAST.
    INSERT INTO ZEMPMAST VALUES WA_EMPMAST.
    G_OKCODE = SY-SUBRC.
    IF G_OKCODE <> 0.
    L_FLAG = 'N'.
    Error Handling
    IDOC_STATUS-STATUS = '51'.
    IDOC_STATUS-MSGTY = 'E'.
    IDOC_STATUS-MSGV2 = 'Employee & already exists'.
    REPLACE '&' WITH WA_EMPMAST-EMPNO INTO IDOC_STATUS-MSGV2.
    IDOC_STATUS-SEGNUM = SY-TABIX + 1.
    APPEND IDOC_STATUS.
    ENDIF.
    AT LAST.
    ENDAT.
    ENDLOOP.
    IF L_FLAG <> 'Y'.
    Workflow Triggering
    CLEAR RETURN_VARIABLES.
    RETURN_VARIABLES-WF_PARAM = 'Error_IDOCs'.
    RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
    APPEND RETURN_VARIABLES.
    WORKFLOW_RESULT = '99999'.
    ROLLBACK WORK.
    ELSE.
    IDOC_STATUS-STATUS = '53'.
    IDOC_STATUS-MSGTY = 'S'.
    IDOC_STATUS-MSGV2 = 'Employee Info inserted'.
    APPEND IDOC_STATUS.
    ENDIF.
    ENDFUNCTION.
    Execution Steps for inbound Idoc:
    To execute inbound idoc go to Transaction we19 give the Idoc number execute the transaction
    It displays a screen with control, data, and status records. Click Standard inbound OR inbound function module buttons and process the idoc.
    i) Standard inbound:
    If you have selected the standard inbound button it displays a screen with the standard setup:
    II) Inbound function module:
    If you select the in bound function module button displays the below screen you can enter the function module name which you want to execute
    If you select Check box Call in debug mode you can execute the function module in debug mode.
    Call transaction Processing:
    In Background:
    The function module is called in the background
    This setting is only important if the function module to be called reacts accordingly to the importing parameter 'INPUT_METHOD'. This is therefore only valid for function modules which implement the application functionality using the command 'CALL TRANSACTION'.
    In foreground :
    The function module is called in the foreground.
    This setting is only important if the function module to be called reacts accordingly to the importing parameter 'INPUT_METHOD'. This is therefore only true for function modules which implement application functionality using the command 'CALL TRANSACTION'.
    In foreground After error:
    The function module is called in a background session. This becomes a session in the foreground after the first error has occurred.
    This setting is only important if the function module to be called reacts accordingly to the importing parameter 'INPUT_METHOD'. This is therefore only true for function modules which implement application functionality using the command 'CALL TRANSACTION'.
    Now it will post the idoc.
    Testing of Inbound Idoc:
    If you need to check the status of idoc Go to Transaction ZE05 give the idoc number in the idoc number select option execute the transaction.
    Then displays a screen with Out box and Inbox . select the idoc number in the Inbox Shows the control record , data record ,status record .select the status record and check for the idoc status Then you will be known the idoc is successful posted or not.
    The idoc which has been posted into SAP successfully will have the status 53.
    The list of the other valid status for Inbound Idoc are as follows:
    Status Message Description
    50 IDoc added
    51 Error: Application document not posted
    52 Application document posted
    62 IDoc passed to application
    64 IDoc ready to be transferred to application
    74 IDoc was created by test transaction
                                                                                    Process Steps for Outbound IDOC Programming
    The following steps are required for Outbound IDOC Programming.
    Common Steps
    The steps for new segment creation, new Idoc Type, new Message Type and linking between message type and Idoc Type are same as Inbound Idoc Programming. The detail Steps for such activities are mentioned in the Page 2 to Page 5.
    Create Outbound Partner Profile
    Use Transaction WE20 and select the Receiver Partner. Then add message type ZEMPMSG in the outbound parameters. The partner profile needs to be created at the ReceiverLogical System(LS)/Customer(KU)/Vendor(LI)/Bank(B)/Benefits provider(BP)/ User(US) only.
    Then double click on the Message type ZEMPMSG and it navigates to the following screen where user has to set the following attributes:
    • Receiver port as A000000001 for RFC
    • Packet Size field as 1
    • Idoc type Z_EMPMAT_IN in basic type field
    • Set the Syntax check box
    • Set the output mode as Transfer Idoc immediately
    • Save the changes.
    Coding Steps:
    1) Create an Executable Program Based on specification.
    2) All the Important Data should be displayed as Parameters with mandatory.
    i) Message type
    ii) Sender port
    iii) Sender partner
    iv) Sender partner function
    v) Receiver port
    vi) Receiver partner
    vii) Receiver partner function
    3) Select the data based on selection screen into an internal table.
    4) Read the selected internal table and fill the Header segment.
    5) Now Loop the internal table to fill other Segments.
    6) Fill the Control segment data.
    7) Call the proper Function module and pass the data to the function module
    To create the idoc.
    8) Change the status of idoc based on the function module return code.
    9) If FM return code is 0 set status to 03.
    10) See the demo program Z_IDOC_OUTBOUND_EMP for more Clarification.
    Sample Code Snippet
    REPORT Z_IDOC_OUTBOUND_EMP .
    TABLES: ZEMPMAST.
    DATA: F_IDOC_CONTRL LIKE EDIDC,
    T_COMM_CONTROL LIKE EDIDC OCCURS 0 WITH HEADER LINE,
    T_IDOC_DATA LIKE EDIDD OCCURS 0 WITH HEADER LINE.
    Data: Begin of t_zempmast occurs 0.
    include structure zempmast.
    Data: end of t_zempmast.
    data:wa_ZEMPMAST like ZEMPMAST.
    data:wa_ZEMPMASTSEG like ZEMPMASTSEG.
    Data: wa_ZEMPMASTHEADERSEG like ZEMPMASTHEADERSEG.
    CONSTANTS: C_BASIC_IDOC_TYPE LIKE EDIDC-IDOCTP VALUE 'Z_EMPMAT_IN',
    C_Z1CLIPS_SEG_NAME LIKE EDIDD-SEGNAM VALUE 'Z1CLIPS',
    TRUE VALUE 'X',
    FALSE VALUE SPACE.
    “Selection Screen----
    SELECTION-SCREEN BEGIN OF BLOCK EMP WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_EMPNO FOR ZEMPMAST-EMPNO.
    SELECTION-SCREEN END OF BLOCK EMP.
    PARAMETERS: P_MESTYP LIKE EDIDC-MESTYP
    DEFAULT 'ZEMPMSG'
    OBLIGATORY.
    PARAMETERS: P_SNDPRT LIKE EDIDC-SNDPRT,
    P_SNDPRN LIKE EDIDC-SNDPRN,
    P_SNDPFC LIKE EDIDC-SNDPFC.
    PARAMETERS: P_RCVPRT LIKE EDIDC-RCVPRT,
    P_RCVPRN LIKE EDIDC-RCVPRN,
    P_RCVPFC LIKE EDIDC-RCVPFC.
    “Selection of data
    Perform select_data.
    “Create Idoc
    perform creat_idoc.
    CLEAR F_IDOC_CONTRL.
    *& Form select_data
    text
    --> p1 text
    <-- p2 text
    FORM select_data.
    “Selecting the required data based on Selection Screen
    select * into corresponding fields of table t_ZEMPMAST from ZEMPMAST
    where EMPNO in s_EMPNO.
    ENDFORM. " select_data
    *& Form creat_idoc
    text
    --> p1 text
    <-- p2 text
    FORM creat_idoc.
    “Creating Header Segment
    if not t_zempmast[] is initial.
    T_IDOC_DATA-SEGNAM = 'ZEMPMASTHEADERSEG'.
    “Populating Idoc data table with header Segment
    perform prepare_segment using wa_zempmast.
    T_IDOC_DATA-SDATA = wa_ZEMPMASTHEADERSEG.
    APPEND T_IDOC_DATA.
    “Creating other Segments.
    loop at t_zempmast into wa_zempmast.
    CLEAR T_IDOC_DATA.
    “Filling item segment
    T_IDOC_DATA-SEGNAM = 'ZEMPMASTSEG'.
    perform prepare_segment1 using wa_zempmast.
    T_IDOC_DATA-SDATA = wa_ZEMPMASTSEG.
    “Adding the item segments into idoc table
    APPEND T_IDOC_DATA.
    CLEAR T_IDOC_DATA.
    endloop.
    “Filling Control data.
    F_IDOC_CONTRL-MESTYP = P_MESTYP.
    F_IDOC_CONTRL-IDOCTP = C_BASIC_IDOC_TYPE.
    F_IDOC_CONTRL-SNDPRT = P_SNDPRT.
    F_IDOC_CONTRL-SNDPRN = P_SNDPRN.
    F_IDOC_CONTRL-SNDPFC = P_SNDPFC.
    F_IDOC_CONTRL-RCVPRT = P_RCVPRT.
    F_IDOC_CONTRL-RCVPRN = P_RCVPRN.
    F_IDOC_CONTRL-RCVPFC = P_RCVPFC.
    “Creating idoc
    PERFORM DISTRIBUTE_THE_IDOC TABLES T_IDOC_DATA
    T_COMM_CONTROL
    USING F_IDOC_CONTRL.
    endif.
    ENDFORM. " creat_idoc
    *& Form prepare_segment
    text
    -->P_T_ZEMPMAST text
    FORM prepare_segment USING P_T_ZEMPMAST like ZEMPMAST.
    “Filling header Segment
    wa_ZEMPMASTHEADERSEG-REPNAME = sy-repid.
    wa_ZEMPMASTHEADERSEG-DATE = sy-datum.
    wa_ZEMPMASTHEADERSEG-TIME = sy-uzeit.
    ENDFORM. " prepare_segment
    *& Form prepare_segment1
    text
    -->P_WA_ZEMPMAST text
    FORM prepare_segment1 USING P_T_ZEMPMAST like ZEMPMAST.
    “filling item segment
    wa_ZEMPMASTSEG-EMPNO = P_T_ZEMPMAST-EMPNO.
    wa_ZEMPMASTSEG-EMPNAME = P_T_ZEMPMAST-EMPNAME.
    ENDFORM. " prepare_segment1
    *& Form DISTRIBUTE_THE_IDOC
    text
    -->P_T_IDOC_DATA text
    -->P_T_COMM_CONTROL text
    -->P_F_IDOC_CONTRL text
    FORM DISTRIBUTE_THE_IDOC TABLES T_IDOC_DATA STRUCTURE EDIDD
    T_COMM_CONTROL STRUCTURE EDIDC
    USING F_IDOC_CONTRL STRUCTURE EDIDC.
    READ TABLE T_IDOC_DATA INDEX 1.
    IF SY-SUBRC = 0.
    insert and distribute the idoc
    CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
    EXPORTING
    MASTER_IDOC_CONTROL = F_IDOC_CONTRL
    TABLES
    COMMUNICATION_IDOC_CONTRO

  • IDOC Structure

    Hi..
    How do we know which message type is appropriate for our document type.?
    Can any one give the whole list of message types used in interface.
    Regards
    Sampath

    Hi
    You can go to transaction WE64 to see detail message type including the process code (FM).
    There are different message types for different partners depending on your requirement u have to use that
    Sending data to sap/non sap is same but the it makes some difference in configuration in bd64 ie distribution model, as a abaper our work is same while sending idocs to legas as to be send sap.
    here i am giving entire material for ALE/IDOCS and let me know if u have any doubts.
    It gives, entire idoc documentation.
    http://help.sap.com/saphelp_nw04/helpdata/en/3b/beb13b00ae793be10000000a11402f/frameset.htm
    To develop a new custom ALE scenario, comprises 5 steps:
    1. Design and develop the custom IDoc with it’s segments and a new message type
    2. Configure the ALE environment with the new IDoc and message type (customer model, partner profiles and linking IDoc to message type)
    3. Develop the outbound process which does the following:
    • Populates the custom IDoc with control info and functional data
    • Sends the IDoc to the ALE layer for distribution
    • Updates status and handles errors
    4. Configure the ALE inbound side (partner profiles with inbound process code)
    5. Develop the inbound process which does the following:
    • Reads the IDoc into a BDC table; selects other data that is required
    • Runs transaction using call transaction or BDC session
    • Updates status and handles errors
    Below is a pictorial representation of the flow of a complete ALE scenario from the sending system to the receiving system.
    Figure 1: ALE Scenario model
    1.1. ALE Example
    For the purposes of this example we will develop a small ALE scenario. This scenario is described below.
    “The receiver of an internal service must be able to reverse (cancel) the invoice receipt which will then cancel the applicable billing document automatically on the service provider’s system.”
    Figure 2: Example Purchasing & Selling scenario
    We will develop a custom IDoc to carry the billing number from the Service Receiver’s system to the Service Provider’s system. We will populate the IDoc in a user exit on the sending side and we will process the transaction on the receiving side using a custom function module and a BDC transaction call.
    No rule conversion, segment filtering or version conversion will be implemented in the model as described in Figure 1.
    Requirements
    • Working ALE environment - See ALE Basis Configuration Guide;
    • ALE scenario design together with the business requirement;
    • Development access; and
    • ALE configuration access.
    NOTES:
    1. All IMG references to transactions are located in the transaction SALE which is the ALE portion of the IMG
    2. This is one way of developing a scenario where no message control exists. If message control exist (EG. On purchase orders) then NAST can be used to call an outbound function module that would create the required IDocs.
    3. Extensive knowledge of IDocs and ALE basis configuration is required in order to understand this guide.
    2. OUTBOUND PROCESSING
    2.1. Create IDoc type (WE30) Client independent
    The IDoc type refers to the IDoc structure that you will require for your development. In our case the IDoc type is called ZINVRV01. This IDoc type will have 1 segment called Z1INVRV with 2 fields, LIFNR & XBLNR, in this segment. If you require many segments or nested segments then they are also created using the same procedure.
    We will create the IDoc of the following structure:
    ZINVRV01
    Purchasing and Selling - Invoice receipt reversal
    Z1INVRV P&S - Segment 1
    Segment fields
    LIFNR Vendor account number
    XBLNR Reference document number
    Figure 3: IDoc type ZINVRV01
    To create the IDoc type, follow these next few steps:
    • Enter transaction WE30 (ALE -> Extensions -> IDoc types -> Maintain IDoc type)
    • Type in ZINVRV01 and click on Basic IDoc type, click the Create icon
    • Click on Create new (we are creating an IDoc from scratch but you may want to copy another IDoc if it is similar to your requirements) and enter a description, and press enter
    • Click on ZINVRV01 and then on the Create icon
    • Enter Z1INVRV as the segment type (must start with Z1), check mandatory if the segment must exist (in this case check it), enter 1 in minimum number and 1 as maximum number. (Make the maximum number 9999999999 if there are going to be many of these segments in each IDoc. IE. When line items are passed via IDocs), click on Segment editor
    • Enter a description for your segment type and create
    • Enter a description for your segment, enter each field required in your IDoc, in our case type LIFNR across for Field name, DE structure and DE documentation, repeat for XBLNR and press enter to validate.
    • Save and generate, press back
    • To release the segment choose Goto, Release from the menu
    • Check the box on the line of your new segment
    • Save, back and enter
    • Your IDoc type structure should be displayed with your new segment
    • Save and back
    • To release the IDoc type choose Extras, Release type from the menu and Yes
    Your IDoc is now ready for use. If you need to add fields or segments to your IDoc type, you will need to cancel the release of the IDoc type as well as the segment release using a similar procedure followed above (except now you uncheck the release box for the segment and you choose cancel release for the IDoc type).
    2.2. Create message type (WE81) Client independent
    To create a new message type, follow these next few steps:
    • Enter transaction WE81 (ALE -> Extensions -> IDoc types -> Maintain message type for intermed. Structure -> Create logical message type)
    • Choose Create logical message type by double clicking on it
    • Click on change icon to enter change mode
    • Click on New entries to add a new type
    • Enter the required message type, in our case it is ZINVRV and an appropriate description
    • Save and exit.
    Your message type has now been created. The next step will be to link it to the IDoc.
    2.2.1. Link message to IDoc type (WE82 & BD69) Client independent
    To link the message type to the IDoc type follow these next few steps:
    • Enter transaction WE82 (ALE -> Extensions -> IDoc types -> Maintain message type for intermed. Structure -> EDI: Message Types and Assignment to IDoc Types)
    • Click on change icon to enter change mode
    • Click on New entries to create the link
    • Enter the message type ZINVRV and the BasicIDoc type as ZINVRV01
    • Save and exit
    • Enter transaction BD69 (ALE -> Extensions -> IDoc types -> Maintain message type for intermed. Structure -> Assign message type to IDoc for ALE)
    • Click on change icon to enter change mode
    • Click on New entries to create the link
    • Enter the message type ZINVRV and the BasicIDoc type as ZINVRV01
    • Save and exit
    Your IDoc is now linked to your message type. We still need to link object types and add the message to the model before we can use the message.
    2.2.2. Maintain object type for message type (BD59) Client independent
    The ALE objects are used to create links between IDocs and applications objects, to control the serialisation, to filter messages in the customer model and to use listings.
    For our own message type and IDoc you must maintain object types for the links.
    If you want to check the serialisation for the message type, then you must maintain object types for the serialisation. If no serialisation object has been maintained for a given message type, then the serialisation will not be checked for this message type.
    To add an object type to our message type, follow these next few steps:
    • Enter transaction BD59 (ALE -> Extensions -> ALE object maintenance -> Maintain object types)
    • Type in your message type ZINVRV and press enter
    • Click on New entries
    • Enter your object type, LIFNR (We need to use the vendor as a filter object), the segment name where LIFNR resides, Z1INVRV, a number 1 for the sequence followed by the actual field name LIFNR
    • Save and exit.
    You have now created an object that we’ll use as a filter object in the customer model to direct the flow of messages to the various logical systems based on the vendors in the filter of the message type ZINVRV.
    We now need to add our new message type to the distribution model.
    2.3. Configuring the Distribution Model
    This task is performed on your ALE reference client.
    2.3.1. Manual Configuration (BD64) Client dependent
    To manually configure the customer distribution model, read the ALE configuration procedure, and follow these steps:
    • Perform the Maintain customer distribution model directly function. (ALE -> Distribution customer model -> Maintain customer distribution model directly)
    • Specify the customer model you want to maintain and the logical system that is to be the sender of the messages OR create a new model. (Create model ALE with logical system ALELS1C400)
    • Choose the receiving systems to which the sending system must forward message type ZINVRV to.
    • For each receiving logical system allocate the message type necessary for communication to the receiving systems as per ALE configuration procedure.
    • Create filter objects (in our case LIFNR as the object type with the associated vendor number, 0000018001 with leading zeros, in the object area) for the message types.
    • Save the entries.
    NOTES:
    You cannot maintain a message type between the same sender and receiver in more than one customer distribution model.
    Only the owner is authorised to modify the model.
    To change the owner of a model, choose the 'Maintain ownership of customer distribution model' function. Make sure that all changes will be distributed to all systems that know the corresponding model. To do so, you can use the correction and transport system.
    To transport the customer distribution model you should use the Distribute customer model function of the IMG as described below.
    2.3.2. Distribute customer model (BD71) Client dependent
    After the customer model has been created centrally, it must be distributed to the other remote systems. This entails first of all setting up the communication for the distributed systems and then sending the model.
    2.3.2.1. Distribute Model (BD71) Client dependent
    This task is performed on your ALE reference client. To distribute the customer distribution model, read the ALE configuration procedure and follow these steps:
    • Make the settings for the communication with the other decentral systems, you have not set them yet.
    • Define the RFC destination for R/3 connections whose names correspond to the name of the corresponding logical system.
    • Create the output partner profile.
    • Distribute the customer model
    • Specify the name of the customer model.
    • You must specify the target system to which you want to distribute the customer model.
    • You must repeat this function for every distributed logical system.
    2.3.2.2. Maintain sending system partner profile (WE20) Client dependent
    With this function, you define the partner profiles for all outbound and inbound messages on the basis of the customer distribution model.
    After you have defined and distributed the customer model, you will have to maintain the partner profiles locally. To do this read the ALE configuration procedure.
    • Enter the output mode (background, immediately) and the package size for outbound processing.
    Requirements
    • The customer model must be maintained.
    • RFC destinations must be maintained.
    • The customer model must be distributed.
    • To ensure that the appropriate persons in charge are informed if a processing error occurs, you must make settings in: Error processing Maintain organisational units.
    2.4. Populate & distribute IDoc using ABAP
    An IDoc consists of a control record with structure edidc and one or more data records with structure edidd. The control record contains the sender and recipient of the IDoc, as well as information on the type of message.
    To be able to pass an IDoc to the ALE layer, you must set up a field string with structure edidc and an internal table with structure edidd. They are used to call function module master_idoc_distribute, which performs the save to the database and triggers the dispatch if necessary.
    2.4.1. Example code
    The code displayed below does the following:
    • populates our IDoc segment Z1INVR with the 2 fields XBLNR and LIFNR, populates the segment name and appends this to an internal table used to store the IDoc data;
    • populates the control record info with the message type and IDoc type; and
    • calls the MASTER_IDOC_DISTRIBUTE function module which distributes the IDoc as configured in the customer distribution model.
    *--- Data declaration statements
    DATA: C_INVREV_SEGNAME(7) TYPE C VALUE 'Z1INVRV',
    C_INVREV_MESTYPE(6) TYPE C VALUE 'ZINVRV',
    C_INVREV_IDOC_TYPE(8) TYPE C VALUE 'ZINVRV01',
    Z1INVRV LIKE Z1INVRV,
    C_INVREV_DOCTYPE LIKE BKPF-BLART VALUE 'YY',
    IDOC_CONTROL LIKE EDIDC,
    T_COMM_CONTROL LIKE EDIDC OCCURS 0 WITH HEADER LINE,
    IDOC_DATA LIKE EDIDD OCCURS 0 WITH HEADER LINE.
    *--- Move the document header into a structure
    LOOP AT DOC_HEAD_TAB INTO DOC_HEAD.
    ENDLOOP.
    *--- Move the document item data into a structure
    LOOP AT DOC_ITEM_TAB INTO DOC_ITEM WHERE NOT ( LIFNR IS INITIAL ).
    ENDLOOP.
    *--- Populate the IDoc segment’s field with the required data
    CLEAR Z1INVRV.
    Z1INVRV-LIFNR = DOC_ITEM-LIFNR. “Store vendor number for filter
    Z1INVRV-XBLNR = DOC_HEAD-XBLNR. “Billing number
    IDOC_DATA-SEGNAM = C_INVREV_SEGNAME. “Segment name
    IDOC_DATA-SDATA = Z1INVRV. “Segment data
    APPEND IDOC_DATA. “Populate IDoc internal table
    *--- Move the control data info required for the distribution
    IDOC_CONTROL-MESTYP = C_INVREV_MESTYPE.
    IDOC_CONTROL-DOCTYP = C_INVREV_IDOC_TYPE.
    *--- Call the distribute function with the required parameters
    CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE' IN UPDATE TASK
    EXPORTING
    MASTER_IDOC_CONTROL = IDOC_CONTROL
    TABLES
    COMMUNICATION_IDOC_CONTROL = T_COMM_CONTROL
    MASTER_IDOC_DATA = IDOC_DATA
    EXCEPTIONS
    ERROR_IN_IDOC_CONTROL = 1
    ERROR_WRITING_IDOC_STATUS = 2
    ERROR_IN_IDOC_DATA = 3
    SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
    OTHERS = 5.
    Figure 4: Outbound processing example code
    NOTE:
    For debugging purposes, use transaction WE05 (IDoc overview) to see check your IDoc status, or to see whether an IDoc was created/
    3. INBOUND PROCESSING
    3.1. Create Function Module
    This function module is called when a message type, of type ZINVRV, comes into the receiving system. This needs to be configured and is dealt with later in this section. The function module is passed the IDoc as a parameter.
    Example parameters
    Import parameters Reference field Opt Y/N
    INPUT_METHOD BDWFAP_PAR-INPUTMETHD N
    MASS_PROCESSING BDWFAP_PAR-MASS_PROC N
    Export Parameters Reference field Opt Y/N
    WORKFLOW_RESULT BDWFAP_PAR-RESULT N
    APPLICATION_VARIABLE BDWFAP_PAR-APPL_VAR N
    IN_UPDATE_TASK BDWFAP_PAR-UPDATETASK N
    CALL_TRANSACTION_DONE BDWFAP_PAR-CALLTRANS N
    Table Parameters Reference field Optional Y/N
    IDOC_CONTRL EDIDC
    IDOC_DATA EDIDD
    IDOC_STATUS BDIDOCSTAT
    RETURN_VARIABLES BDWFRETVAR
    SERIALIZATION_INFO BDI_SER
    Exceptions
    WRONG_FUNCTION_CALLED
    Example code
    The code displayed below does the following:
    • populates a BDC table with the IDoc info;
    • calls the transaction via a BDC call; and
    • updates the IDoc status according to the BDC error status.
    EXTRACT FROM: Z_IDOC_INPUT_ZINVRV
    *--- Declaration of local variables
    DATA: C_SEGNAM(10) TYPE C VALUE 'Z1INVRV'.
    *-Loop through the IDOCs
    LOOP AT IDOC_CONTRL.
    *---Loop through the data for the IDOC
    LOOP AT IDOC_DATA WHERE DOCNUM = IDOC_CONTRL-DOCNUM.
    CASE IDOC_DATA-SEGNAM.
    WHEN C_SEGNAM.
    Here we get the info from the idoc table
    IT_Z1INVRV = IDOC_DATA-SDATA.
    ENDCASE.
    PERFORM REV_INV.
    ENDLOOP.
    PERFORM UPDATE_IDOC_STATUS.
    ENDLOOP.
    FORM REV_INV "Reverse invoice form
    *--- Local variables & constants
    DATA: C_TCODE LIKE BKPF-TCODE VALUE 'VF11'. "BDC transaction code
    *--- Now we can build the bdc table to call the reversal transaction start of screen 109
    CLEAR BDC_TAB.
    BDC_TAB-PROGRAM = 'SAPMV60A'.
    BDC_TAB-DYNPRO = '109'.
    BDC_TAB-DYNBEGIN = 'X'.
    APPEND BDC_TAB.
    *--- Document number
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = 'KOMFK-VBELN(01)'.
    BDC_TAB-FVAL = IT_Z1INVRV-XBLNR. "Billing document number
    APPEND BDC_TAB.
    *--- OK Code for screen 109
    CLEAR BDC_TAB.
    BDC_TAB-FNAM = 'BDC_OKCODE'.
    BDC_TAB-FVAL = 'SICH'.
    APPEND BDC_TAB.
    *--- Now we can call transaction 'VF11' with the populated bdc table. The transaction is called inside the idoc-contrl loop, so a transaction will be called for every idoc (journal). the transaction is called in no-display mode ('N') because this code runs in background as it is called by ale. The update is specified to be synchronous ('S') because we have to wait for the result to update the idoc status correctly.
    CALL TRANSACTION C_TCODE USING BDC_TAB MODE 'N' UPDATE 'S'.
    *--- Store the return code for use in another form (status update)
    RETURN_CODE = SY-SUBRC.
    *--- Here we check the return code, if there was an error, we put the transaction in a bdc session for the user to review and correct.
    IF SY-SUBRC NE 0.
    CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
    CLIENT = SY-MANDT
    GROUP = 'ZINVRV'
    USER = C_ALE_USER
    KEEP = 'X'.
    CALL FUNCTION 'BDC_INSERT'
    EXPORTING
    TCODE = C_TCODE
    TABLES
    DYNPROTAB = BDC_TAB.
    CALL FUNCTION 'BDC_CLOSE_GROUP'
    EXCEPTIONS
    NOT_OPEN = 1
    QUEUE_ERROR = 2
    OTHERS = 3.
    ELSE. "No problems
    C_EXISTS = 'N'.
    Select from the billing document table to get sales doc number
    SELECT * FROM VBRP WHERE VBELN = IT_Z1INVRV-XBLNR.
    Select from the sales document table to get user status number
    SELECT SINGLE * FROM VBAP WHERE VBELN = VBRP-AUBEL AND
    POSNR = VBRP-AUPOS.
    Select from the status table to change the user status to pending
    SELECT * FROM JEST WHERE OBJNR = VBAP-OBJNR AND
    STAT LIKE C_USER_STATUS.
    IF JEST-STAT = C_US_PENDING. "User status is pending
    JEST-INACT = C_UNCHECKED. "Make pending the active status
    UPDATE JEST.
    C_EXISTS = 'Y'. "I.E. An entry is already in table
    ELSEIF JEST-INACT = C_UNCHECKED AND JEST-STAT NE C_US_PENDING.
    JEST-INACT = C_CHECKED. "Make everything else inactive
    UPDATE JEST.
    ENDIF.
    ENDSELECT.
    IF C_EXISTS = 'N'. "I.E. Pending has never been a status before
    JEST-OBJNR = VBAP-OBJNR.
    JEST-STAT = C_US_PENDING.
    JEST-INACT = C_UNCHECKED. "Make pending the active status
    INSERT JEST.
    ENDIF.
    ENDSELECT. "Select from VBRP (Billing document table)
    ENDIF.
    ENDFORM. " REV_INV
    FORM UPDATE_IDOC_STATUS.
    *--- Now we check the CALL TRANSACTION return code and set IDOC status
    CLEAR IDOC_STATUS.
    IF RETURN_CODE = 0.
    WORKFLOW_RESULT = '0'.
    IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
    IDOC_STATUS-STATUS = '53'.
    IDOC_STATUS-UNAME = SY-UNAME.
    IDOC_STATUS-REPID = SY-REPID.
    IDOC_STATUS-MSGTY = SY-MSGTY.
    IDOC_STATUS-MSGID = SY-MSGID.
    IDOC_STATUS-MSGNO = SY-MSGNO.
    IDOC_STATUS-MSGV1 = SY-MSGV1.
    IDOC_STATUS-MSGV2 = SY-MSGV2.
    IDOC_STATUS-MSGV3 = SY-MSGV3.
    IDOC_STATUS-MSGV4 = SY-MSGV4.
    RETURN_VARIABLES-WF_PARAM = 'Processed_IDOCs'.
    RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
    APPEND RETURN_VARIABLES.
    ELSE.
    WORKFLOW_RESULT = '99999'.
    IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
    IDOC_STATUS-STATUS = '51'.
    IDOC_STATUS-UNAME = SY-UNAME.
    IDOC_STATUS-REPID = SY-REPID.
    IDOC_STATUS-MSGTY = SY-MSGTY.
    IDOC_STATUS-MSGID = SY-MSGID.
    IDOC_STATUS-MSGNO = SY-MSGNO.
    IDOC_STATUS-MSGV1 = SY-MSGV1.
    IDOC_STATUS-MSGV2 = SY-MSGV2.
    IDOC_STATUS-MSGV3 = SY-MSGV3.
    IDOC_STATUS-MSGV4 = SY-MSGV4.
    RETURN_VARIABLES-WF_PARAM = 'ERROR_IDOCS'.
    RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
    APPEND RETURN_VARIABLES.
    ENDIF.
    APPEND IDOC_STATUS.
    ENDFORM. " UPDATE_IDOC_STATUS
    Figure 5: Inbound processing example code
    3.1.1. Debugging inbound FM
    Use transaction WE19 to test inbound function module in debugging mode. Also use WE05 to view the IDocs and their statuses.
    3.2. Maintain ALE attributes
    The inbound function module needs to be linked to the message type and the message type needs to be linked to the appropriate inbound process code at the partner profile level before the scenario is enabled. These steps are described below in detail.
    3.2.1. Link Message Type to Function Module (WE57) Client independent
    To link a message (ZINVRV) type to a function module (Z_IDOC_INPUT_ZINVRV) follow these steps:
    • Enter transaction WE57 (ALE -> Extensions -> Inbound -> Allocate function module to logical message)
    • Select an entry (EG. IDOC_INPUT_ORDERS) and copy
    • Type in module name Z_IDOC_INPUT_ZINVRV
    • Type in basic IDoc type as ZINVRV01
    • Type in message type as ZINVRV
    • Type object type as IDOCINVOIC (Invoice document) - Used for workflow
    • Direction should be set to 2 for inbound
    • Enter and save
    3.2.2. Define FM settings (BD51) Client independent
    • Enter transaction BD51 (ALE -> Extensions -> Inbound -> Define settings for input modules)
    • Click on New entries
    • Type in the name of the new function module Z_IDOC_INPUT_ZINVRV
    • Enter 0 for mass processing in the output column
    • Save and Exit
    3.2.3. Maintain process codes (WE42) Client dependent
    A process code needs to be maintained on each client. It then needs to be linked to the message via the partner profiles on each client. This allows the various clients to use a unique function module for the same message type.
    To maintain the process code follow these steps:
    • Log on to the appropriate receiving system client
    • Execute WE42 (ALE -> Extensions -> Inbound -> Maintaining process codes inbound)
    • Choose Inbound with ALE service
    • Choose Processing with function module
    • Click on Processing with function module and choose create icon
    • Click on New Entries
    • Type in process code ZINR and give it a description and save
    • Now you are asked to Please maintain codes added in ALE entry methods, enter and choose Z_IDOC_INPUT_FIRVSL and copy it. You should choose a FM similar to your one.
    • Enter your process code ZINR
    • Enter your function module Z_IDOC_INPUT_ZINVRV
    NOTE: The next 6 steps are used in workflow error handling.
    • Enter IDPKFIDCMT in object type
    • Enter MASSINPUTFINISHED in End event
    • Enter IDOCINVOIC in IDoc object type
    • Enter INPUTERROROCCURREDFI in IDoc start event
    • Enter INPUTFINISHEDFI in IDoc End event
    • Enter IDOCINVOIC in Application object type
    You will need to determine the task associated with object IDOCINVOIC, and then assign the appropriate position to it. This position will then receive the application error messages via workflow.
    To set up the workflow area please consult the Workflow config guide.
    3.3. Create inbound partner profile
    For each message type you need to maintain the inbound partner profiles.
    3.3.1. Maintain receiving system partner profile (WE20) Client dependent
    To maintain inbound partner profiles read the document ALE configuration procedure:
    • Add the message type ZINVRV with process code ZINR.
    • Enter the output mode (background, immediately) for inbound processing and NO message code.
    • Enter the position S and choose the ALE administrator 50000085. This position will then receive all the technical ALE errors via workflow.
    3.4. Test
    Once the inbound function module has been debugged the scenario should be ready to test in its entirety. If problems occur, read through the relevant areas of this document to check your configuration or code.
    IDOC Programming
    Index
    Process Steps for IDOC Programming 3
    Interpreting An IDoc Segment Info 3
    IDoc Type – The Structure of The IDoc File 5
    Defining The Message Type 6
    Define Valid Combination Of Message and IDoc Types 6
    Process Steps for Inbound IDOC Programming 7
    Characteristics of Inbound function module 7
    Assigning a processing function 8
    Processing Codes 9
    Workflow Handling 12
    Create Inbound Partner Profile 12
    Sample Code Snippet 14
    Execution Steps for inbound Idoc: 17
    Testing of Inbound Idoc: 19
    Process Steps for Outbound IDOC Programming 21
    Common Steps 21
    Create Outbound Partner Profile 21
    Sample Code Snippet 23
    Execution Steps: 26
    Testing of Outbound Idoc: 26
    Change Pointers & Reduction of IDOCs. 26
    What is IDOC
    IDocs are SAP’s file format to exchange data with a foreign system. IDocs is the acronym for Intermediate Document. This indicates a set of (electronic) information, which builds a logical entity. An IDoc is e.g. all the data of a single customer in your customer master data file. Or the Idoc is all the data of a single invoice.
    • IDocs are an ASCII file format to exchange data between computers; the format is chosen arbitrarily
    • IDocs are similar to segmented files; they are not a description language like ANSI X.12, EDIFACT or XML
    • The IDoc contents are processed by function modules, which can be assigned in customizing
    Process Steps for IDOC Programming
    The following steps are required for inbound and outbound IDOC Programming.
    Interpreting An IDoc Segment Info
    All IDoc data records are exchanged in a fixed format, regardless of the segment type. The segment’s true structure is stored in R/3’s repository as a DDIC structure of the same name.
    Go to transaction code WE31. Enter the name of the Segment, which is to be created (fig 2.1).
    E.g. Create the segment ZEMPMASTSEG
    Fig 2.1 WE31- IDOC Segment main screen.
    Fig 2.2 WE31 IDOC Segment definition screen.
    In the above screen user can enter the fields, which are necessary for the segment. Once all the necessary fields will be populated then Save the transaction. After Saving release the version of the Segment by selecting the version and through menu Edit -> Set release.
    Same way create one or more segment.
    Fig 2.3 WE31 – IDOC Segment definition screen for another segment (ZEMPMASTHEADERSEG).
    IDoc Type – The Structure of the IDoc File
    The IDoc type is the name of the data structure used to describe the file format of a specific IDoc.
    An IDoc is a segmented data file. It has typically several segments. The segments are usually structured into fields, however different segments use different fields.
    The IDoc type is defined with transaction WE30, the respective segments are defined with transaction WE31 as per the point 2
    Go to transaction code WE30. Enter the IDOC Type name.
    Fig 3.1 WE30 – IDOC Type main screen.
    Add the segments to the IDOC Type as per the requirement.
    For e.g. in the fig 3.2 it shown that IDOC Type is having only one segment ZEMPMASTHEADERSEG, which is having one child segment ZEMPMASTSEG
    Fig 3.2 WE30 – IDOC Type segment screen
    For each segment developer (double click on the segment) can set the minimum, maximum number of segment in a sequence.
    Fig 3.3 fig 3.4
    Defining the Message Type
    The message type defines the context under which an IDoc is transferred to its destination. It allows using the same IDoc file format to use for several different applications.
    The message type together with the IDoc type determines the processing function.
    The message type defined using transaction code WE81.
    fig 4.1 WE81 – Message Types
    Define Valid Combination Of Message and IDoc Types
    The valid combinations of message type and IDoc type are stored in table EDIMSG, using transaction WE82.
    The declaration of valid combinations is done to allow validation, if the system can handle a certain combination.
    Fig 5.1 WE82 – Message Type Assignment
    Process Step for Inbound IDOC Programming
    Characteristics of Inbound function module
    Before assigning the function module to Inbound process code, its characteristics must be set with the transaction BD51. This step is mandatory before assigning the function module to Inbound process code.
    For inbound processing you need to tell, whether the function will be capable of dialog processing. This is meant for those functions, which process the inbound data via call transaction. Those functions can be replayed in visible batch input mode to check why the processing might have failed.
    Here the main characteristic is Input Type. It means “How are IDoc packages processed?” and having values like
    Input Type Short Text
    0 Mass Processing
    1 Individual input
    2 Individual input with IDOC locked in CALL TRANSACTION
    Also another property Dialog Allowed can be set here. With “Dialog allowed” IDocs can be processed in dialog mode.
    Fig 6.2 – BD51 Characteristics of Inbound Function Module
    Assigning a processing function
    The combination of message type and IDoc type determine the processing algorithm. This is usually a function module with a well-defined interface or a SAP business object and is set up in table EDIFCT.
    The entry made the points to a function module, which will be called when the IDoc is to be processed. The entries for message code and message function are usually left blank. They can be used to derive sub types of messages together with the partner profile used.
    Used transaction code WE57 for assigning function module to IDOC Type.
    Fig 7.1 WE57 – Assign Function Module to Message and IDOC Type
    Fig 7.2 Assign a handler function to a message/message type
    Process Codes
    R/3 uses the method of logical process codes to detach the Idoc processing and the processing function module. They assign a logical name to function instead of specifying the physical function name.
    The combination message type/IDoc will determine the logical processing code, which itself points to a function. If the function changes, only the definition of the processing codes will be changed and the new function will be immediately effective for all IDocs associated with the process code.
    For inbound processing codes you have to specify the method to use for the determination of the inbound function.
    The Inbound processing code can be attach to the function module using transaction code WE42
    8.1 WE42 – Define Inbound Process Code
    You need to tick, if your function can be used via the ALE engine. This is the option you would usually choose. It allows processing via the ALE scenarios. See fig below
    WE42 – Set properties of Inbound Process Code
    WE42 – Set the Message type for the Inbound Process Code
    Fig 8.4 WE42 – Fill the details of the Inbound Process Code.
    The properties set in the above fig 8.4 are used for the workflow handling when the IDOC is having any error.
    Properties, which are useful in the workflow processing, are as follows.
    • Object Type – It is a business object created using transaction code SWO1 and used as a handler
    • Starting Event - Will triggered the workflow on occur of Error.
    • Ending Event - Will terminate the workflow after processing the
    Workflow Handling
    Refer: - Workflow Guide
    Create Inbound Partner Profile
    For each message type you need to maintain the inbound partner profiles. Maintain receiving system partner profile using WE20 (See fig. 10.3). Add the message type in the Senders inbound parameter.
    Following steps will be followed for creation of partner profile (Inbound).
    • Add the message type (e.g. ZEMPMSG) into the inbound parameter by clicking .
    WE20 – Addition of message type in Inbound Partner Profile
    • On the next screen enter the message type , process code. In the Processing by function module block select the radio button based on the need. If you clicked on Triggered by background program then the IDOC will be collected and will triggered by another program which will run in background and if the second option Triggered immediately is clicked then the IDOC will be processed by the function module as soon as it is triggered.
    WE20 – Inbound Parameters.
    WE20 – Create Partner profile
    Sample Code Snippet
    Important Steps are as follows.
    1) Unpacking of IDOC: - Unpack the IDOC into the respective segments.
    2) Process Data: - Process the unpacked data.
    3) Error Handling.
    4) Workflow triggering.
    FUNCTION Z_IDOC_INPUT_EMPMAST.
    ""Local interface:
    *” IMPORTING
    *" REFERENCE (INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
    *" REFERENCE (MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
    *” EXPORTING
    *" REFERENCE (WORKFLOW_RESULT) LIKE BDWFAP_PAR-RESULT
    *" REFERENCE (APPLICATION_VARIABLE) LIKE BDWFAP_PAR-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
    DATA: S_EMPMAST LIKE ZEMPMASTHEADERSEG.
    DATA: T_EMPMAST LIKE ZEMPMASTSEG OCCURS 0 WITH HEADER LINE.
    DATA: WA_EMPMAST LIKE ZEMPMAST.
    DATA: L_FLAG VALUE 'Y'.
    CLEAR S_EMPMAST.
    REFRESH T_EMPMAST.
    check if the function is called correctly *
    IF IDOC_CONTRL-MESTYP 'ZEMPMSG'.
    RAISE WRONG_FUNCTION_CALLED.
    ENDIF.
    WORKFLOW_RESULT = 0.
    Unpacking the IDoc
    LOOP AT IDOC_DATA.
    CASE IDOC_DATA-SEGNAM.
    WHEN 'ZEMPMASTHEADERSEG'.
    MOVE IDOC_DATA-SDATA TO S_EMPMAST.
    WHEN 'ZEMPMASTSEG'.
    MOVE IDOC_DATA-SDATA TO T_EMPMAST.
    APPEND T_EMPMAST.
    ENDCASE.
    ENDLOOP.
    IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
    IDOC_STATUS-MSGV1 = IDOC_CONTRL-IDOCTP.
    IDOC_STATUS-MSGID = '00'.
    IDOC_STATUS-MSGNO = '398'.
    Processing Data
    LOOP AT T_EMPMAST.
    MOVE-CORRESPONDING T_EMPMAST TO WA_EMPMAST.
    INSERT INTO ZEMPMAST VALUES WA_EMPMAST.
    G_OKCODE = SY-SUBRC.
    IF G_OKCODE 0.
    L_FLAG = 'N'.
    Error Handling
    IDOC_STATUS-STATUS = '51'.
    IDOC_STATUS-MSGTY = 'E'.
    IDOC_STATUS-MSGV2 = 'Employee & already exists'.
    REPLACE '&' WITH WA_EMPMAST-EMPNO INTO IDOC_STATUS-MSGV2.
    IDOC_STATUS-SEGNUM = SY-TABIX + 1.
    APPEND IDOC_STATUS.
    ENDIF.
    AT LAST.
    ENDAT.
    ENDLOOP.
    IF L_FLAG 'Y'.
    Workflow Triggering
    CLEAR RETURN_VARIABLES.
    RETURN_VARIABLES-WF_PARAM = 'Error_IDOCs'.
    RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
    APPEND RETURN_VARIABLES.
    WORKFLOW_RESULT = '99999'.
    ROLLBACK WORK.
    ELSE.
    IDOC_STATUS-STATUS = '53'.
    IDOC_STATUS-MSGTY = 'S'.
    IDOC_STATUS-MSGV2 = 'Employee Info inserted'.
    APPEND IDOC_STATUS.
    ENDIF.
    ENDFUNCTION.
    Execution Steps for inbound Idoc:
    To execute inbound idoc go to Transaction we19 give the Idoc number execute the transaction
    It displays a screen with control, data, and status records. Click Standard inbound OR inbound function module buttons and process the idoc.
    i) Standard inbound:
    If you have selected the standard inbound button it displays a screen with the standard setup:
    II) Inbound function module:
    If you select the in bound function module button displays the below screen you can enter the function module name which you want to execute
    If you select Check box Call in debug mode you can execute the function module in debug mode.
    Call transaction Processing:
    In Background:
    The function module is called in the background
    This setting is only important if the function module to be called reacts accordingly to the importing parameter 'INPUT_METHOD'. This is therefore only valid for function modules which implement the application functionality using the command 'CALL TRANSACTION'.
    In foreground :
    The function module is called in the foreground.
    This setting is only important if the function module to be called reacts accordingly to the importing parameter 'INPUT_METHOD'. This is therefore only true for function modules which implement application functionality using the command 'CALL TRANSACTION'.
    In foreground After error:
    The function module is called in a background session. This becomes a session in the foreground after the first error has occurred.
    This setting is only important if the function module to be called reacts accordingly to the importing parameter 'INPUT_METHOD'. This is therefore only true for function modules which implement application functionality using the command 'CALL TRANSACTION'.
    Now it will post the idoc.
    Testing of Inbound Idoc:
    If you need to check the status of idoc Go to Transaction ZE05 give the idoc number in the idoc number select option execute the transaction.
    Then displays a screen with Out box and Inbox . select the idoc number in the Inbox Shows the control record , data record ,status record .select the status record and check for the idoc status Then you will be known the idoc is successful posted or not.
    The idoc which has been posted into SAP successfully will have the status 53.
    The list of the other valid status for Inbound Idoc are as follows:
    Status Message Description
    50 IDoc added
    51 Error: Application document not posted
    52 Application document posted
    62 IDoc passed to application
    64 IDoc ready to be transferred to application
    74 IDoc was created by test transaction
    Process Steps for Outbound IDOC Programming
    The following steps are required for Outbound IDOC Programming.
    Common Steps
    The steps for new segment creation, new Idoc Type, new Message Type and linking between message type and Idoc Type are same as Inbound Idoc Programming. The detail Steps for such activities are mentioned in the Page 2 to Page 5.
    Create Outbound Partner Profile
    Use Transaction WE20 and select the Receiver Partner. Then add message type ZEMPMSG in the outbound parameters. The partner profile needs to be created at the ReceiverLogical System(LS)/Customer(KU)/Vendor(LI)/Bank(B)/Benefits provider(BP)/ User(US) only.
    Then double click on the Message type ZEMPMSG and it navigates to the following screen where user has to set the following attributes:
    • Receiver port as A000000001 for RFC
    • Packet Size field as 1
    • Idoc type Z_EMPMAT_IN in basic type field
    • Set the Syntax check box
    • Set the output mode as Transfer Idoc immediately
    • Save the changes.
    Coding Steps:
    1) Create an Executable Program Based on specification.
    2) All the Important Data should be displayed as Parameters with mandatory.
    i) Message type
    ii) Sender port
    iii) Sender partner
    iv) Sender partner function
    v) Receiver port
    vi) Receiver partner
    vii) Receiver partner function
    3) Select the data based on selection screen into an internal table.
    4) Read the selected internal table and fill the Header segment.
    5) Now Loop the internal table to fill other Segments.
    6) Fill the Control segment data.
    7) Call the proper Function module and pass the data to the function module
    To create the idoc.
    8) Change the status of idoc based on the function module return code.
    9) If FM return code is 0 set status to 03.
    10) See the demo program Z_IDOC_OUTBOUND_EMP for more Clarification.
    Sample Code Snippet
    REPORT Z_IDOC_OUTBOUND_EMP .
    TABLES: ZEMPMAST.
    DATA: F_IDOC_CONTRL LIKE EDIDC,
    T_COMM_CONTROL LIKE EDIDC OCCURS 0 WITH HEADER LINE,
    T_IDOC_DATA LIKE EDIDD OCCURS 0 WITH HEADER LINE.
    Data: Begin of t_zempmast occurs 0.
    include structure zempmast.
    Data: end of t_zempmast.
    data:wa_ZEMPMAST like ZEMPMAST.
    data:wa_ZEMPMASTSEG like ZEMPMASTSEG.
    Data: wa_ZEMPMASTHEADERSEG like ZEMPMASTHEADERSEG.
    CONSTANTS: C_BASIC_IDOC_TYPE LIKE EDIDC-IDOCTP VALUE 'Z_EMPMAT_IN',
    C_Z1CLIPS_SEG_NAME LIKE EDIDD-SEGNAM VALUE 'Z1CLIPS',
    TRUE VALUE 'X',
    FALSE VALUE SPACE.
    “Selection Screen----
    SELECTION-SCREEN BEGIN OF BLOCK EMP WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_EMPNO FOR ZEMPMAST-EMPNO.
    SELECTION-SCREEN END OF BLOCK EMP.
    PARAMETERS: P_MESTYP LIKE EDIDC-MESTYP
    DEFAULT 'ZEMPMSG'
    OBLIGATORY.
    PARAMETERS: P_SNDPRT LIKE EDIDC-SNDPRT,
    P_SNDPRN LIKE EDIDC-SNDPRN,
    P_SNDPFC LIKE EDIDC-SNDPFC.
    PARAMETERS: P_RCVPRT LIKE EDIDC-RCVPRT,
    P_RCVPRN LIKE EDIDC-RCVPRN,
    P_RCVPFC LIKE EDIDC-RCVPFC.
    “Selection of data
    Perform select_data.
    “Create Idoc
    perform creat_idoc.
    CLEAR F_IDOC_CONTRL.
    *& Form select_data
    text
    --> p1 text
    <-- p2 text
    FORM select_data.
    “Selecting the required data based on Selection Screen
    select * into corresponding fields of table t_ZEMPMAST from ZEMPMAST
    where EMPNO in s_EMPNO.
    ENDFORM. " select_data
    *& Form creat_idoc
    text
    --> p1 text
    <-- p2 text
    FORM creat_idoc.
    “Creating Header Segment
    if not t_zempmast[] is initial.
    T_IDOC_DATA-SEGNAM = 'ZEMPMASTHEADERSEG'.
    “Populating Idoc data table with header Segment
    perform prepare_segment using wa_zempmast.
    T_IDOC_DATA-SDATA = wa_ZEMPMASTHEADERSEG.
    APPEND T_IDOC_DATA.
    “Creating other Segments.
    loop at t_zempmast into wa_zempmast.
    CLEAR T_IDOC_DATA.
    “Filling item segment
    T_IDOC_DATA-SEGNAM = 'ZEMPMASTSEG'.
    perform prepare_segment1 using wa_zempmast.
    T_IDOC_DATA-SDATA = wa_ZEMPMASTSEG.
    “Adding the item segments into idoc table
    APPEND T_IDOC_DATA.
    CLEAR T_IDOC_DATA.
    endloop.
    “Filling Control data.
    F_IDOC_CONTRL-MESTYP = P_MESTYP.
    F_IDOC_CONTRL-IDOCTP = C_BASIC_IDOC_TYPE.
    F_IDOC_CONTRL-SNDPRT = P_SNDPRT.
    F_IDOC_CONTRL-SNDPRN = P_SNDPRN.
    F_IDOC_CONTRL-SNDPFC = P_SNDPFC.
    F_IDOC_CONTRL-RCVPRT = P_RCVPRT.
    F_IDOC_CONTRL-RCVPRN = P_RCVPRN.
    F_IDOC_CONTRL-RCVPFC = P_RCVPFC.
    “Creating idoc
    PERFORM DISTRIBUTE_THE_IDOC TABLES T_IDOC_DATA
    T_COMM_CONTROL
    USING F_IDOC_CONTRL.
    endif.
    ENDFORM. " creat_idoc
    *& Form prepare_segment
    text
    -->P_T_ZEMPMAST text
    FORM prepare_segment USING P_T_ZEMPMAST like ZEMPMAST.
    “Filling header Segment
    wa_ZEMPMASTHEADERSEG-REPNAME = sy-repid.
    wa_ZEMPMASTHEADERSEG-DATE = sy-datum.
    wa_ZEMPMASTHEADERSEG-TIME = sy-uzeit.
    ENDFORM. " prepare_segment
    *& Form prepare_segment1
    text
    -->P_WA_ZEMPMAST text
    FORM prepare_segment1 USING P_T_ZEMPMAST like ZEMPMAST.
    “filling item segment
    wa_ZEMPMASTSEG-EMPNO = P_T_ZEMPMAST-EMPNO.
    wa_ZEMPMASTSEG-EMPNAME = P_T_ZEMPMAST-EMPNAME.
    ENDFORM. " prepare_segment1
    *& Form DISTRIBUTE_THE_IDOC
    text
    -->P_T_IDOC_DATA text
    -->P_T_COMM_CONTROL text
    -->P_F_IDOC_CONTRL text
    FORM DISTRIBUTE_THE_IDOC TABLES T_IDOC_DATA STRUCTURE EDIDD
    T_COMM_CONTROL STRUCTURE EDIDC
    USING F_IDOC_CONTRL STRUCTURE EDIDC.
    READ TABLE T_IDOC_DATA INDEX 1.
    IF SY-SUBRC = 0.
    insert and distribute the idoc
    CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
    EXPORTING
    MASTER_IDOC_CONTROL = F_IDOC_CONTRL
    TABLES
    COMMUNICATION_IDOC_CONTROL = T_COMM_CONTROL
    MASTER_IDOC_DATA = T_IDOC_DATA
    EXCEPTIONS
    ERROR_IN_IDOC_CONTROL = 1
    ERROR_WRITING_IDOC_STATUS = 2
    ERROR_IN_IDOC_DATA = 3
    SENDING_LOGICAL_SYSTEM_UNKNOWN = 4
    OTHERS = 5.
    IF SY-SUBRC 0.
    “displays the message if creation of idoc is not sucessfull
    MESSAGE ID 'ZI'
    TYPE 'E'
    NUMBER '017'
    WITH 'MASTER_IDOC_DISTRIBUTE' SY-SUBRC.
    STOP.
    else.
    COMMIT WORK.
    “Displays message with success message
    MESSAGE ID 'ZI'
    TYPE 'I'
    NUMBER '020'
    WITH F_IDOC_CONTRL-IDOCTP SY-SUBRC.
    ENDIF.
    CLEAR: T_IDOC_DATA.
    REFRESH: T_IDOC_DATA.
    ENDIF.
    ENDFORM. " DISTRIBUTE_THE_IDOC
    Execution Steps
    To execute the outbound idoc Go to SE38 screen&#61672;Give the program name and fill the Selection and execute it.
    Testing of Outbound Idoc:
    If you need to check the status of idoc Go to Transaction ZE05 give the idoc number in the idoc number select option execute the transaction.
    Then displays a screen with Out box and Inbox . select the idoc number in the Outbox Shows the control record , data record ,status record .select the status record and check for the idoc status Then you will be known the idoc is successful posted or not.
    The idoc which has been successful will have the status 03.
    The bellow are the some of the Out bound status:
    Status Message Description
    01 IDoc created
    02 Error passing data to port
    03 Data passed to port OK
    29 Error in ALE service
    30 IDoc ready for dispatch (ALE service)
    31 Error - no further processing
    Change Pointers & Reduction of IDOCs.
    Applications, which write change documents, will also try to write change
    pointers for ALE operations. These are log entries to remember all modified
    data records relevant for ALE. The change point is used for extending or reducing the Idoc structure.
    Following Steps must be followed in case of Change Pointer.
    1) Goto Transaction BD60.
    Note down the Details of the Message Type for which change pointer has to activate. Details like Function Module, Classification Object, ALE object Type etc.
    E.g. ZDEBP3
    2) Next step is goto transaction BD53
    Click on change button.
    First select the segment for which the fields has to modified (either remove or
    add ).
    It will show the fields in a pop-up window where the user can select, deselect the respective fields.
    Save the settings for the Message type. Don’t forget to deactivate and activate the change pointers by clicking Deactivate change pointer and Activate Change pointers button on the main screen. It is mandatory to first Deactivate the change pointer and then activate it.
    Do not save the changes in the same transport request. Create separate transport request, which will be not transported. This is because once you transport the changes then it will not allow you to do the changes on the server on which it has transported.
    3) Once the activation is done system will reset the settings for the Message type in Change pointers (BD60). Maintained the old settings for the Message type like Function Module, Classification Object, and ALE object Type etc.
    Check this link
    http://www.intelligententerprise.com/channels/applications/feature/archive/kasturi2.jhtml
    Regards
    Pavan

  • Required a program to list out custom dependent object used in a program

    sorry already in the forums
    Edited by: Krishna Gowrneni on Jul 16, 2009 7:51 PM
    Edited by: Krishna Gowrneni on Jul 16, 2009 7:52 PM
    Edited by: Krishna Gowrneni on Jul 16, 2009 7:53 PM

    Hello
    There is no exist such table.
    But try this snippet:
    REPORT ZSEARCH.
    PARAMETERS: P_NAME LIKE D010SINF-PROG.
    DATA: PROGTXT(72) TYPE C OCCURS 0 WITH HEADER LINE.
    DATA: TMP(72) TYPE C OCCURS 0 WITH HEADER LINE.
    DATA: FUNCT TYPE RS38L_FNAM OCCURS 0 WITH HEADER LINE.
    DATA: INCL TYPE RSEUINC OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'RS_GET_ALL_INCLUDES'
         EXPORTING PROGRAM    = P_NAME
         TABLES    INCLUDETAB = INCL.
    LOOP AT INCL.
      READ REPORT INCL-MASTER INTO TMP.
      APPEND LINES OF TMP TO PROGTXT.
      REFRESH TMP.
    ENDLOOP.
    READ REPORT P_NAME INTO TMP.
    APPEND LINES OF TMP TO PROGTXT.
    LOOP AT PROGTXT.
      IF PROGTXT CS 'CALL FUNCTION'.
        SEARCH PROGTXT FOR ''''.
        IF SY-SUBRC = 0.
          DO.
            SHIFT PROGTXT LEFT BY 1 PLACES.
            IF PROGTXT(1) = ''''.
              SHIFT PROGTXT LEFT BY 1 PLACES.
              DO.
                SHIFT PROGTXT RIGHT BY 1 PLACES.
                IF PROGTXT+71(1) = ''''.
                  SHIFT PROGTXT RIGHT BY 1 PLACES.
                  CONDENSE PROGTXT.
                  FUNCT = PROGTXT. COLLECT FUNCT. EXIT.
                ENDIF.
              ENDDO.
              EXIT.
            ENDIF.
          ENDDO.
        ENDIF.
      ENDIF.
    ENDLOOP.
    SORT FUNCT.
    LOOP AT FUNCT.
      WRITE: FUNCT. NEW-LINE.
    ENDLOOP.

  • Cfreport param

    i have a report that has an input parameter of inputquoteid.
    In report builder, using the F12 preview It asks for my input
    parameter and then displays the report fine. However when I use the
    cfreport tag in coldfusion i get an error message
    Code:
    <cfreport format="pdf" template="apauth.cfr">
    <cfreportparam name="inputquoteid"
    value="#session.qt.id#">
    </cfreport>
    Error: Variable inputquoteid is undefined.
    This is my first time using the cfreport. So sorry if I'm
    just easily missing something. Thanks in advance.

    thanks. I did try that as well but it still doesn't work. I
    even took the code from the code snippet report builder created and
    I am getting the same error. So I am really confused!

  • Cant send message to other carriers

    why i cant send pictures to other phone and without using imessage

    Hello
    Try this snippet:
    REPORT ZTEST NO STANDARD PAGE HEADING.
    TABLES: RFCDES.
    SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-001.
    PARAMETERS:
    DEST LIKE RFCDES-RFCDEST OBLIGATORY,
    MANDT LIKE SY-MANDT MATCHCODE OBJECT DDSEF4CLNT,
    USER LIKE SY-UNAME MATCHCODE OBJECT USER_ADDR OBLIGATORY,
    MESSAGE(255) TYPE C.
    SELECTION-SCREEN END OF BLOCK BL1.
    INITIALIZATION.
    AT SELECTION-SCREEN ON DEST.
    IF DEST IS INITIAL.
      CONCATENATE SYST-SYSID MANDT INTO DEST.
    ELSE.
    ENDIF.
    START-OF-SELECTION.
    CALL FUNCTION 'TH_POPUP'
    DESTINATION DEST
    EXPORTING
    CLIENT               = MANDT
    USER                 = USER
    MESSAGE              = MESSAGE
    CUT_BLANKS           = SY-LANGU
    EXCEPTIONS
    USER_NOT_FOUND       = 1
    OTHERS               = 2.
      CASE SY-SUBRC.
        WHEN 0.
          CALL FUNCTION 'POPUP_CONTINUE_YES_NO'
               EXPORTING
                    TEXTLINE1 = 'Message was sent'
                    TITEL     = 'Information'.
        WHEN 1.
          CALL FUNCTION 'POPUP_CONTINUE_YES_NO'
               EXPORTING
                    TEXTLINE1 = USER
                    TEXTLINE2 = 'User not found !'
                    TITEL     = 'Error'.
        WHEN OTHERS.
      ENDCASE.
    END-OF-SELECTION.

  • HTML Snippet widget bug report.

    Dear Apple iWeb 08 Engineers.
    I didn't know where to send this bug report and so I have resorted to this forum. I hope it gets to you somehow.
    When creating a simple HTML Snippet in a page it seems that the piece of code that refers to the newly created widget in the .html for the page has a bug in it. For example, I have a page on my website called "Animation"; it has a simple HTML Snippet the code for which has been tested (by viewing the file widget0_markup.html in a browser). In Animation.html the following line appears
    <iframe id="widget0-frame" src=".//Animationfiles/widget0markup.html" frameborder="0" style="width: 100%; height: 100%;" scrolling="no" marginheight="0" marginwidth="0" allowTransparency="true"></iframe>
    Surely the pathname in the "src" option is in error (what the **** is .//?). If I change it to ./ by hand then everything works. Please change this asap, because at the moment I have to go into every page and change it by hand after publishing.
    Many thanks, Marvin.

    Thanks for the reply, but I'm afraid that I'm not convinced.
    In all the flavours of unix that I've ever used ./ is the current directory, ../ is the parent directory and ../../ is the grandparent directory (not .// as you suggest). In any case, the path name of source file in question is ./Animationfiles/widget0markup.html (assuming the code in question is in the file Animation.html) and so going up the tree into the grandparent directory is not what you want to do anyway; the directory Animation_files is always in the same directory as Animation.html and the file widget0_markup.html is saved, by iWeb upon publication, in the directory ./Animation_files.
    In short, I still think it's a bug, but thanks for the advice; I apologise if I am wrong.
    Marvin.

  • Code snippet in a ALV report

    hello experts
    I would like to calclute the invoice value and display in the output (invoice value = VBEP-NETWR/VBEP-FKIMG) , where should i add the code? In the select stament? code help is higly appreciated.
    Thanks
    mohan 
    follows the program
    Global structure of list
    type-pools: slis.
    tables: likp,
            lips,
            vbfa,
            kssk,
            klah,
            ausp,
            cabn,
            vbak,
            mara,
            vbrk,
            ser01,
            vbpa,
            nast,
            zseri,
            ltap,
            pa0001,
            kna1,
            objk,
            viqmel,
            viqmma.
    types:  begin of i_delivery,
                 vbeln like likp-vbeln,
                 posnr  like lips-posnr,
                 kunnr like likp-kunnr,
                 kunag like likp-kunag,
                 vkorg  like vbak-vkorg,
                 matnr  like lips-matnr,
                 lfart  like likp-lfart,
                 arktx  like vbap-arktx,
                 vgbel  like lips-vgbel,
                 vgpos  like lips-vgpos,
                 pstyv   like lips-pstyv,
                 wadat type likp-wadat,
                 lfdat type likp-lfdat,
                 prodh type lips-prodh,
                 lfimg type lips-lfimg,
                 vkbur type lips-vkbur,
                 werks type lips-werks,
                 vkgrp type lips-vkgrp,
                 mvgr1 type lips-mvgr1,
                 sernr like equi-sernr,
                 sernp like equi-sernr,
                 equnr like equi-equnr,
                 kttxt like qpct-kurztext,
                 bstnk  like vbak-bstnk,
                 vbelv  like lips-vgbel,
                 posnv  like lips-posnv,
                 uecha  like lips-uecha,
                 ernam  like vbak-ernam,
                 erdat like vbak-erdat,
                 serail like lips-serail,
                 anzsn like lips-anzsn,
                 auart like vbak-auart ,
                 netwr like vbap-netwr,
                 fstno like vbpa-pernr,
                 fstnm like pa0001-ename,
                 ename like pa0001-ename,
                 qname like ltap-qname,
                 name1 like kna1-name1,
                 name3 like kna1-name2,
                 pernr like vbpa-pernr,
                 aufnr like viqmel-aufnr,
                 qmnum like viqmel-qmnum,
                 mngrp like viqmma-mngrp,
                 qmcod like viqmel-qmcod,
                 qmcol like viqmma-mncod,
                 cotxt(20),
             end of i_delivery.
    Global structure of list
    */ Selection and Input Parameters
    selection-screen begin of block block2 with frame title text-003.
    select-options: s_vkorg for likp-vkorg no intervals.
    select-options: s_vbeln  for likp-vbeln,
                    s_lfart  for likp-lfart,
                    s_kunnr  for likp-kunnr,
                    s_erdat  for likp-erdat,
                    s_wadat  for likp-wadat,
                    s_werks  for lips-werks,
                    s_matnr  for lips-matnr,
                    s_prodh  for lips-prodh,
                    s_qmnum for viqmel-qmnum.
    selection-screen end of block block2.
    selection-screen begin of block block4 with frame title text-002.
    select-options:  s_vbelv for vbak-vbeln,
                     s_auart for vbak-auart.
    selection-screen end of block block4.
    parameters: p_vari like disvariant-variant.
    ranges: r_vbeln for likp-vbeln.
    data:   gt_fieldcat type slis_t_fieldcat_alv.
    data:   gt_outtab type i_delivery occurs 0 with header line,
            rt_outtab1 type i_delivery occurs 0 with header line,
            i_nast type nast occurs 0 with header line,
            gt_list_top_of_page type slis_t_listheader,
            gt_events   type slis_t_event,
            gc_formname_top_of_page type slis_formname value 'TOP_OF_PAGE'.
    data:   g_repid like sy-repid,
             g_count like sy-tabix.
    data: begin of i_serial occurs 0,
            obknr type ser01-obknr,
            lief_nr type ser01-lief_nr,
            posnr type ser01-posnr,
            anzsn type ser01-anzsn,
          end of i_serial.
    data: begin of i_object_numbers occurs 0,
            obknr type objk-obknr,
            obzae type objk-obzae,
            sernr type objk-sernr,
            equnr type objk-equnr,
            matnr type objk-matnr,
            taser type objk-taser,
          end of i_object_numbers.
    data:   g_save(1) type c,
           g_default(1) TYPE c,
            g_exit(1) type c,
            gx_variant like disvariant,
            g_variant like disvariant.
    data:  g_mnkat like viqmma-mnkat,
           g_mngrp like viqmma-mngrp,
           g_atinn like ausp-atinn.
    Initialization fieldcatalog
    initialization.
      g_repid = sy-repid.
      perform fieldcat_init using gt_fieldcat[].
    move: 'I' to  s_vkorg-sign,
           'EQ' to  s_vkorg-option,
           '5090' to s_vkorg-low.
      append  s_vkorg.
      move: 'I' to  s_lfart-sign,
           'EQ' to s_lfart-option,
           'LF' to s_lfart-low.
      append  s_lfart.
      g_save = 'A'.
      perform variant_init.
    Get default variant
      gx_variant = g_variant.
      call function 'REUSE_ALV_VARIANT_DEFAULT_GET'
           exporting
                i_save     = g_save
           changing
                cs_variant = gx_variant
           exceptions
                not_found  = 2.
      if sy-subrc = 0.
        p_vari = gx_variant-variant.
      endif.
    at selection-screen on value-request for p_vari.
      perform f4_for_variant.
    at selection-screen.
      perform pai_of_selection_screen.
    Start of Selection
    start-of-selection.
      perform e03_eventtab_build using gt_events[].
      perform select_data tables gt_outtab.
    Display list
    end-of-selection.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_background_id         = 'ALV_BACKGROUND'
                i_callback_user_command = 'USER_COMMAND'
                is_variant              = g_variant
                i_save                  = g_save
                i_callback_program      = g_repid
                it_fieldcat             = gt_fieldcat[]
           tables
                t_outtab                = gt_outtab.
       Forms
    Initialization fieldcatalog
    form fieldcat_init
          using rt_fieldcat type slis_t_fieldcat_alv.
      data: ls_fieldcat type slis_fieldcat_alv.
      data: pos type i value 1.
      clear ls_fieldcat.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'VBELN'.
      ls_fieldcat-seltext_s     = 'Delivery'.
      ls_fieldcat-seltext_m     = 'Delivery'.
      ls_fieldcat-key           = 'X'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'POSNR'.
      ls_fieldcat-key           = 'X'.
      ls_fieldcat-seltext_s     = 'Item'.
      ls_fieldcat-seltext_m     = 'Item'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'LFART'.
      ls_fieldcat-seltext_s     = 'Del Type'.
      ls_fieldcat-seltext_m     = 'Delivery Type'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'VGBEL'.
      ls_fieldcat-seltext_s     = 'Source Doc'.
      ls_fieldcat-seltext_m     = 'Source Doc'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'AUART'.
      ls_fieldcat-seltext_s     = 'Type'.
      ls_fieldcat-seltext_m     = 'Type'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'KUNNR'.
      ls_fieldcat-seltext_s     = 'Customer'.
      ls_fieldcat-seltext_m     = 'Customer'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'NAME1'.
      ls_fieldcat-seltext_s     = 'Name'.
      ls_fieldcat-seltext_m     = 'Name1'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'WERKS'.
      ls_fieldcat-seltext_s     = 'Plant'.
      ls_fieldcat-seltext_m     = 'Plant'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'MATNR'.
      ls_fieldcat-seltext_s     = 'Material'.
      ls_fieldcat-seltext_m     = 'Material'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'MVGR1'.
      ls_fieldcat-seltext_s     = 'Speciality'.
      ls_fieldcat-seltext_m     = 'Speciality'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
    pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'PRODH'.
      ls_fieldcat-seltext_s     = 'Hierarchy'.
      ls_fieldcat-seltext_m     = 'Prod Hierarchy'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'ARKTX'.
      ls_fieldcat-seltext_s     = 'Description'.
      ls_fieldcat-seltext_m     = 'Description'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'ERNAM'.
      ls_fieldcat-seltext_s     = 'Created By'.
      ls_fieldcat-seltext_m     = 'Created By'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'ERDAT'.
      ls_fieldcat-seltext_s     = 'Created On'.
      ls_fieldcat-seltext_m     = 'Created On'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'WADAT'.
      ls_fieldcat-seltext_s     = 'GoodsMvt.Date'.
      ls_fieldcat-seltext_m     = 'Goods Mvt Date'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'SERNR'.
      ls_fieldcat-seltext_s     = 'Serial Shipped'.
      ls_fieldcat-seltext_m     = 'Serial Shipped'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'SERNP'.
      ls_fieldcat-seltext_s     = 'Old Serial'.
      ls_fieldcat-seltext_m     = 'Old Serial'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'VBELV'.
      ls_fieldcat-seltext_s     = 'Invoice'.
      ls_fieldcat-seltext_m     = 'Invoice'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'NETWR'.
      ls_fieldcat-seltext_s     = 'Invoice Amt'.
      ls_fieldcat-seltext_m     = 'Invoice Value'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'QMNUM'.
      ls_fieldcat-seltext_s     = 'Notification'.
      ls_fieldcat-seltext_m     = 'Notification'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'QMCOD'.
      ls_fieldcat-seltext_s     = 'Rep LevKST'.
      ls_fieldcat-seltext_m     = 'Repair Level KST'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
    pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'COTXT'.
      ls_fieldcat-seltext_s     = 'CdTXT KST'.
      ls_fieldcat-seltext_m     = 'Repair Level Text KST'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'QMCOL'.
      ls_fieldcat-seltext_s     = 'Rep LevKSE'.
      ls_fieldcat-seltext_m     = 'Repair Level KSE'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
    pos = pos + 1.
      ls_fieldcat-col_pos       =  pos.
      ls_fieldcat-fieldname     = 'KTTXT'.
      ls_fieldcat-seltext_s     = 'CdTXT KSE'.
      ls_fieldcat-seltext_m     = 'Repair Level Text KSE'.
      append ls_fieldcat to rt_fieldcat.
      clear ls_fieldcat.
    endform.   "fieldcat_init
    Data selection
    form select_data tables rt_outtab like gt_outtab[].
      clear: r_vbeln[].
    Read all Invoices for the Selection
      select distinct h~vbeln  h~kunnr h~kunag
                     d~posnr  d~matnr d~anzsn
                     d~serail d~vgbel d~vgpos
                     d~posnv  d~lfimg d~arktx
                     d~uecha  h~lfart h~erdat
                     h~ernam  h~lfdat d~prodh
                     h~vkorg  d~vkbur d~vkgrp
                     d~mvgr1  h~wadat_ist d~pstyv
                     d~werks
             into (rt_outtab-vbeln, rt_outtab-kunnr,
                    rt_outtab-kunag, rt_outtab-posnr,
                    rt_outtab-matnr, rt_outtab-anzsn,
                    rt_outtab-serail, rt_outtab-vgbel,
                    rt_outtab-vgpos,  rt_outtab-posnv,
                    rt_outtab-lfimg,  rt_outtab-arktx,
                    rt_outtab-uecha, rt_outtab-lfart,
                    rt_outtab-erdat, rt_outtab-ernam,
                    rt_outtab-lfdat, rt_outtab-prodh,
                    rt_outtab-vkorg, rt_outtab-vkbur,
                    rt_outtab-vkgrp, rt_outtab-mvgr1,
                    rt_outtab-wadat, rt_outtab-pstyv,
                    rt_outtab-werks)
            from likp as h inner join lips as d
                     on h~vbeln = d~vbeln
                    where h~vbeln in s_vbeln
                    and  h~vkorg in s_vkorg
                    and  h~lfart in s_lfart
                     and  h~kunnr in s_kunnr
                     and  h~erdat in s_erdat
                     and  d~matnr in s_matnr
                     and  d~werks in s_werks
                     and  d~prodh in s_prodh
                     and  d~vgbel in s_vbelv
                     and  d~matnr like 'S%'.
        select single * from vbak where vbeln = rt_outtab-vgbel.
        if: sy-subrc eq 0.
          move vbak-vbeln to rt_outtab-vgbel.
          move vbak-auart to rt_outtab-auart.
        endif.
        select single * from mara where matnr = rt_outtab-matnr
                                    and  mtart eq 'FERT'.
        check sy-subrc eq 0.
        if not rt_outtab-posnv is initial.
          rt_outtab-vgpos = rt_outtab-posnv.
        endif.
        clear: vbfa.
        select single vbeln rfwrt into (rt_outtab-vbelv, rt_outtab-netwr)
    from vbfa  where vbelv eq rt_outtab-vbeln
                               and   posnv eq rt_outtab-posnr
                               and   vbtyp_n eq 'M'.
        append rt_outtab.
        if not  r_vbeln-low is initial.
          if r_vbeln-low gt rt_outtab-vbeln.
            r_vbeln-low =  rt_outtab-vbeln.
          endif.
          if r_vbeln-high lt rt_outtab-vbeln.
            r_vbeln-high =  rt_outtab-vbeln.
          endif.
        else.
          r_vbeln-low  =  rt_outtab-vbeln.
          r_vbeln-high =  rt_outtab-vbeln.
        endif.
        clear: rt_outtab.
      endselect.
      if not r_vbeln is initial.
        move: 'I' to  r_vbeln-sign,
               'BT' to  r_vbeln-option.
        append r_vbeln.
        select * into corresponding fields of table i_serial
                                  from   ser01 where lief_nr in r_vbeln.
      endif.
      sort i_serial.
      if not i_serial[] is initial.
        select * into corresponding fields of table i_object_numbers
                                   from   objk
                                   for all entries in i_serial
                                   where obknr eq i_serial-obknr
                                   and  taser eq 'SER01'.
      endif.
      sort i_object_numbers by  obknr obzae.
      loop at rt_outtab.
    Read the Sold To Name
        select single name1 into rt_outtab-name1
                          from kna1 where kunnr eq rt_outtab-kunnr.
    Read Ship-to Customer
        clear: objk.
        if not rt_outtab-serail is initial.
          read table i_serial with key lief_nr = rt_outtab-vbeln
                                        posnr = rt_outtab-posnr.
          if sy-subrc eq 0.
            do i_serial-anzsn times.
              read table i_object_numbers  with key obknr = i_serial-obknr
                                                    matnr = rt_outtab-matnr
                                                binary search.
              if sy-subrc eq 0.
                rt_outtab-sernr = i_object_numbers-sernr.
                delete i_object_numbers index sy-tabix.
                move '1'   to rt_outtab-lfimg.
    clear: rt_outtab-aufnr, rt_outtab-qmnum,
                         rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat.
    select single aufnr qmnum equnr qmcod qmgrp qmkat
                            into (rt_outtab-aufnr, rt_outtab-qmnum,
                         rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat)
                         from viqmel  where matnr = rt_outtab-matnr
                             and serialnr = rt_outtab-sernr
                             and qmart  eq 'S4'
                             and qmnum in s_qmnum.
    clear: rt_outtab-cotxt.
    select single kurztext into rt_outtab-cotxt
                             from qpct where katalogart eq g_mnkat
                              and codegruppe eq  g_mngrp
                              and code eq rt_outtab-qmcod
                              and sprache eq sy-langu.
    Read Serial Number from Name Plate Data.
                clear: klah, kssk, ausp, cabn, g_atinn.
                select single atinn into (g_atinn) from cabn
                                    where atnam = 'SBANK_SERIAL_NUMBER'.
                select single  atwrt
                      into  (rt_outtab-sernp)
                      from  ( klah as a inner join kssk as k
                               on aclint = kclint )
                          join ausp as p
                                on kobjek = pobjek
                                and p~atinn = g_atinn
                                and pklart = aklart
                      where a~klart = '002'
                       and  a~class = 'KSE_SN_ENDOSCOPES'
                        and  k~objek = rt_outtab-equnr.
    *KSE Repair level (activity code text from KSE-SM07 code group)
    clear: rt_outtab-qmcol, g_mngrp, g_mnkat.
                clear: rt_outtab-qmcol.
                clear:   g_mnkat, g_mngrp.
                select single mnkat mngrp mncod into
                                    (g_mnkat, g_mngrp, rt_outtab-qmcol)
                              from viqmma where qmnum = rt_outtab-qmnum
                                    and  mngrp eq 'KSE-SM07'
                                    and kzloesch eq space.
    clear: rt_outtab-kttxt.
                select single kurztext into rt_outtab-kttxt
                             from qpct where katalogart eq g_mnkat
                                    and codegruppe eq  g_mngrp
                                    and code eq rt_outtab-qmcol
                                    and sprache eq sy-langu.
                rt_outtab1 = rt_outtab.
                append rt_outtab1.
              endif.
            enddo.
          endif.
          endif.
        endloop.
        clear: rt_outtab[].
        rt_outtab[] = rt_outtab1[].
        sort rt_outtab by vbeln posnr.
      endform.
          FORM get_repname                                              *
    -->  P_VBELN                                                       *
    -->  P_POSNR                                                       *
    -->  P_PERNR                                                       *
    -->  P_ENAME                                                       *
    form get_repname using  p_vbeln
                              p_posnr
                     changing  p_pernr
                              p_ename. "
      data: i_vbpa like vbpa occurs 0 with header line.
      clear: i_vbpa[].
      call function 'Z_DETERMINE_ACTIVE_SALES_REP'
           exporting
                g_salesdocument = p_vbeln
                g_sales_item    = p_posnr
           tables
                st_vbpa         = i_vbpa.
      read table i_vbpa index 1.
      if sy-subrc = 0.
        p_pernr = i_vbpa-pernr.
        select single ename into p_ename
          from pa0001
         where pernr = i_vbpa-pernr.
      endif.
    endform.                    " get_repname
          FORM E03_EVENTTAB_BUILD                                       *
    -->  E03_LT_EVENTS                                                 *
    form e03_eventtab_build using e03_lt_events type slis_t_event.
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = e03_lt_events.
      read table e03_lt_events with key name =  slis_ev_top_of_page
                               into ls_event.
      if sy-subrc = 0.
        move gc_formname_top_of_page to ls_event-form.
        append ls_event to e03_lt_events.
      endif.
    endform.
          FORM TOP_OF_PAGE                                              *
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = gt_list_top_of_page.
    endform.
    *&      Form  USER_COMMAND
    form user_command  using r_ucomm like sy-ucomm
                             rs_selfield type slis_selfield.
      case r_ucomm.
        when '&IC1'.
          perform display_delivery using r_ucomm
                                        rs_selfield.
      endcase.
    endform.
    *&      Form  display_delivery
    form display_delivery
    using r_ucomm like sy-ucomm
                                 rs_selfield type slis_selfield.
      case rs_selfield-sel_tab_field.
        when '1-VBELN'.
          set parameter id 'VL' field rs_selfield-value.
          call transaction 'VL03N' and skip first screen.
        when '1-VBELV'.
          set parameter id 'VF' field rs_selfield-value.
          call transaction 'VF03N' and skip first screen.
      endcase.
    endform.
    *&      Form  VARIANT_INIT
          text
    -->  p1        text
    <--  p2        text
    form variant_init.
      clear g_variant.
      g_variant-report = g_repid.
    endform.                               " VARIANT_INIT
    *&      Form  F4_FOR_VARIANT
          text
    -->  p1        text
    <--  p2        text
    form f4_for_variant.
      call function 'REUSE_ALV_VARIANT_F4'
           exporting
                is_variant          = g_variant
                i_save              = g_save
              it_default_fieldcat =
           importing
                e_exit              = g_exit
                es_variant          = gx_variant
           exceptions
                not_found = 2.
      if sy-subrc = 2.
        message id sy-msgid type 'S'      number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      else.
        if g_exit = space.
          p_vari = gx_variant-variant.
        endif.
      endif.
    endform.
    *&      Form  PAI_OF_SELECTION_SCREEN
          text
    form pai_of_selection_screen.
      if not p_vari is initial.
        move g_variant to gx_variant.
        move p_vari to gx_variant-variant.
        call function 'REUSE_ALV_VARIANT_EXISTENCE'
             exporting
                  i_save     = g_save
             changing
                  cs_variant = gx_variant.
        g_variant = gx_variant.
      else.
        perform variant_init.
      endif.
    endform.

    Well, I've made some assumptions here, but I think this will work.  Of course you need to create a new field in your internal table to hold the calculated value.  Here I call it INVVALUE.   The issue here is that I'm a little concerned with the SELECT to VBFA, not sure that this is correct if you are trying to get the billing document.
    form select_data tables rt_outtab like gt_outtab[].
      clear: r_vbeln[].
    * Read all Invoices for the Selection
      select distinct h~vbeln h~kunnr h~kunag
      d~posnr d~matnr d~anzsn
      d~serail d~vgbel d~vgpos
      d~posnv d~lfimg d~arktx
      d~uecha h~lfart h~erdat
      h~ernam h~lfdat d~prodh
      h~vkorg d~vkbur d~vkgrp
      d~mvgr1 h~wadat_ist d~pstyv
      d~werks
      into (rt_outtab-vbeln, rt_outtab-kunnr,
      rt_outtab-kunag, rt_outtab-posnr,
      rt_outtab-matnr, rt_outtab-anzsn,
      rt_outtab-serail, rt_outtab-vgbel,
      rt_outtab-vgpos, rt_outtab-posnv,
      rt_outtab-lfimg, rt_outtab-arktx,
      rt_outtab-uecha, rt_outtab-lfart,
      rt_outtab-erdat, rt_outtab-ernam,
      rt_outtab-lfdat, rt_outtab-prodh,
      rt_outtab-vkorg, rt_outtab-vkbur,
      rt_outtab-vkgrp, rt_outtab-mvgr1,
      rt_outtab-wadat, rt_outtab-pstyv,
      rt_outtab-werks)
      from likp as h inner join lips as d
      on h~vbeln = d~vbeln
      where h~vbeln in s_vbeln
      and h~vkorg in s_vkorg
      and h~lfart in s_lfart
      and h~kunnr in s_kunnr
      and h~erdat in s_erdat
      and d~matnr in s_matnr
      and d~werks in s_werks
      and d~prodh in s_prodh
      and d~vgbel in s_vbelv
      and d~matnr like 'S%'.
        select single * from vbak where vbeln = rt_outtab-vgbel.
        if: sy-subrc eq 0.
          move vbak-vbeln to rt_outtab-vgbel.
          move vbak-auart to rt_outtab-auart.
        endif.
        select single * from mara where matnr = rt_outtab-matnr
        and mtart eq 'FERT'.
        check sy-subrc eq 0.
        if not rt_outtab-posnv is initial.
          rt_outtab-vgpos = rt_outtab-posnv.
        endif.
        clear: vbfa.
    <b>    select single vbeln rfwrt into (rt_outtab-vbelv, rt_outtab-netwr)
        from vbfa where vbelv eq rt_outtab-vbeln
        and posnv eq rt_outtab-posnr
        and vbtyp_n eq 'M'.</b>
    <b>    data: xvbrp type vbrp.
        select Single * from vbrp into xvbrp
                        where vbeln = rt_outtab-vbeln   " Need to be billing document
                          and posnr = rt_outtab-posnr.
         rt_outtab-INVVALUE = xvbrp-netwr / xvbrp-fkimg. </b>               
        append rt_outtab.
        if not r_vbeln-low is initial.
          if r_vbeln-low gt rt_outtab-vbeln.
            r_vbeln-low = rt_outtab-vbeln.
          endif.
          if r_vbeln-high lt rt_outtab-vbeln.
            r_vbeln-high = rt_outtab-vbeln.
          endif.
        else.
          r_vbeln-low = rt_outtab-vbeln.
          r_vbeln-high = rt_outtab-vbeln.
        endif.
        clear: rt_outtab.
      endselect.
    Regards,
    Rich Heilman

  • Creating PL/SQL Report

    Hi
    I have several reports written in plsql procedures which work fine provided I place them in a plsql region. I now have a need to run a long running report which branches to a page which displays a animated gif and runs the long running job (3 Minutes) which I have acheived.
    What I want to do is return to the original page and display the results from the procedure ( I figure I could do this by changing the procedure to a function and return the results), what I would really like to know is how to have the procedure output the html (htp.p etc) for the tabs to keep a consistant web view or output the results from a pl/sql procedure to a particular region, at present it outputs to a blank page with the results but without the the tabs. A perfect solution would be to generate a popup window from a pl/sql procedure.
    Just to explain the full process briefly of what I am trying to achieve.
    1. A user selects from a select list what report they want to run (Working).
    2. If the selected report is long running, display animated gif (Working).
    3. Output the results consistant with the web interface (Tabs etc) ???,
    If anyones knows of a easier/better method it would be greatly appreciated.
    Thanks
    Wayne

    Chris:
    I'd like to try your suggestion for a similar problem I am having. Do you have some code snippets that I can review. I'm not familiar with how to kick off a backround pl/sql package.
    What I have is a user who selects a report, presses a button that starts a process that calls a pl/sql package. The web page is locked up and eventually times out. I've played with the timeout parms and not enough benefit. What I'd like to do is:
    1 User selects report and presses button
    2 a process runs a pl/sql package in backround
    3.pl/sql updates a status table
    4.app monitors and provides a status
    5 once pl/sql completes a report region shows a report created
    This is beyond current knowledge and would appreciate samples.
    Thanks,
    Jerry

  • Exporting Crystal Report to HTML is not working in Windows 7

    Hi Sir,
    I am trying to export Crystal Report to HTML format using VB.NET code. Functionality is working fine at Windows XP Environment (Save to Disk, Open an Application and Email Attachment). But the same functionality is not working at Windows 7 Environment (both 32-Bit as well as 64-Bit).
    Below is the code to Exporting Crystal Report to HTML in VB.NET.
    Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions
    Dim CrFormatTypeOptions          As New HTMLFormatOptions
    Dim vFormat As Integer
    Dim CrExportOptions As New ExportOptions
    Dim vRdReport As New ReportDocument
    Dim sfd As SaveFileDialog
    Dim vFileName As String = Nothing
    vRdReport = vRptSource
    sfd = New SaveFileDialog
    If Not (vRptPath = "") Then
        sfd.InitialDirectory = vRptPath
    End If
    sfd.Filter = "Webpage, Complete(.htm;.htm)|.htm|Web Archive, Single file(.mht)|.mht|Webpage, HTML only(.htm;.html)|.html"
    If sfd.ShowDialog = DialogResult.OK Then
        ' Set the disk file options.
         CrDiskFileDestinationOptions.DiskFileName = sfd.FileName.ToString()
    Else
         Return
    End If
    CrExportOptions = vRdReport.ExportOptions
    CrFormatTypeOptions.HTMLFileName = vFileName
    CrFormatTypeOptions.HTMLEnableSeparatedPages = True
    CrFormatTypeOptions.HTMLEnableSeparatedPages = True
    CrFormatTypeOptions.HTMLHasPageNavigator = True
    CrFormatTypeOptions.UsePageRange = True
    With CrExportOptions
                        .ExportDestinationType = ExportDestinationType.DiskFile
                        .ExportFormatType = ExportFormatType.HTML32
                        .DestinationOptions = CrDiskFileDestinationOptions.DiskFileName
                        .FormatOptions = CrFormatTypeOptions
    End With
    vRdReport.Export()
    Catch ex As Exception
            MsgBox(ex.ToString)
    End Try
    Code working fine at Windows XP, But it is not woking in Windows 7 environment.
    Please can anyone share your valuable thoughts or ideas reg. this.
    Thanks in Advance
    Deivanayaga Perumal D.

    user13509659 wrote:
    Run this code to reproduce the issue.Which issue?
    It looks like inheritance is broken in the component hierarchy for JFrame in Windows 7 JDK 1.6.0_23-b05. The only thing remotely related to inheritance in your code snippet is the WindowListener, which does little. See camickr's advice about built-in exit management.
    EDIT - using the post title as a clue, I realize you may be talking about the component hierarchy, and whether the contentPane's background is visible through the upper layers. Instead of guessing, I'd prefer you describe your "issue" accurately (observed vs expected behavior).
    Edited by: jduprez on Feb 10, 2011 1:01 PM

Maybe you are looking for