Need Code to generate Inbound Idocs

Hi friends
i have a flat file consists of delivery confirmation data
by using this i need to generate inbound idocs
i filled all the segments in idoc type /afs/delvry03 and message type whscon
can any one have the code to generate inbound idocs
please remember that here i am not using XI
thanks
Anil

Hi this is for Stand alone Programs, I hope it is useful to you.
Program Flow 
The program logic contains the following blocks: 
  1.  Provide a selection screen to allow a user to specify the various objects for which IDocs are to be generated. 
  2.  Determine the key of the application document from the object specified in step 1. 
  3.  Select application data from the database using the object key identified in step 2. 
  4.  Populate control record information. 
  5.  Populate an internal table of type EDIDD with data records for the various segments. 
  6.  Call the ALE service layer (MASTER_IDOC_DISTRIBUTE) to create the IDocs in the database. 
  7.  Commit work. 
The program in Listing 32-2 generates the monthly report IDoc ZMREPT01, which illustrates a stand-alone outbound process. 
Listing 32-2 
REPORT ZARNEDI1 MESSAGE-ID ZE. 
Parameters 
object key (Social security number for the employee) 
  PARAMETERS: P_SSN LIKE ZEMPDETAIL-SSN. 
message type 
  PARAMETERS: P_MESTYP LIKE EDMSG-MSGTYP OBLIGATORY. 
destination system 
  PARAMETERS: P_LOGSYS LIKE TBDLST-LOGSYS. 
Constants 
  DATA: 
    segment names 
        C_HEADER_SEGMENT           LIKE EDIDD-SEGNAM VALUE 'Z1EMHDR', 
        C_WEEKLY_DETAILS_SEGMENT   LIKE EDIDD-SEGNAM VALUE 'Z1WKDET', 
        C_CLIENT_DETAILS_SEGMENT   LIKE EDIDD-SEGNAM VALUE 'Z1CLDET', 
        C_SUMMARY_SEGMENT          LIKE EDIDD-SEGNAM VALUE 'Z1SUMRY', 
    idoc type 
        C_MONTHLY_REPORT_IDOC_TYPE LIKE EDIDC-IDOCTP VALUE 'ZMREPT01'. 
Data declarations 
idoc control record 
  data: control_record_out like edidc. 
employee header data 
  DATA: FS_EMPHDR_DATA LIKE Z1EMHDR. 
employee weekly details data 
  DATA: FS_WEEKDET_DATA LIKE Z1WKDET. 
client details data 
  DATA: FS_CLIENTDET_DATA LIKE Z1CLDET. 
employee monthly summary data 
  DATA: FS_SUMMARY_DATA LIKE Z1SUMRY. 
total hours and amount for the summary segment 
  DATA: TOTAL_HRS_MONTH TYPE I, 
        TOTAL_AMT_MONTH TYPE I. 
Database Tables 
Application data tables 
  TABLES: ZEMPDETAIL, ZEMPWKDET. 
Internal tables 
  DATA: 
    weekly details - appplication data 
        IT_WKDET LIKE ZEMPWKDET OCCURS 0 WITH HEADER LINE, 
    data records 
        INT_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE, 
    communication idocs geneerated 
        IT_COMM_IDOCS LIKE EDIDC OCCURS 0 WITH HEADER LINE. 
Program logic 
  ********************Select Application Data*************************** 
  SELECT SINGLE * FROM ZEMPDETAIL WHERE SSN = P_SSN. 
  IF SY-SUBRC NE 0. 
     MESSAGE E001 WITH P_SSN. 
     EXIT. 
  ENDIF. 
  SELECT * FROM ZEMPWKDET INTO TABLE IT_WKDET WHERE SSN = P_SSN. 
  IF SY-SUBRC NE 0. 
     MESSAGE E002 WITH P_SSN. 
     EXIT. 
  ENDIF. 
  ********************Build Control Record****************************** 
Fill control record information 
  CONTROL_RECORD_OUT-MESTYP = P_MESTYP. 
  control_record_out-idoctp = c_monthly_report_idoc_type. 
  control_record_out-rcvprt = 'LS'. 
  control_record_out-rcvprn = p_logsys. 
  ********************Build Data Records******************************** 
  *--Employee header--
fill the employee header information 
  FS_EMPHDR_DATA-LNAME = ZEMPDETAIL-LNAME. 
  FS_EMPHDR_DATA-FNAME = ZEMPDETAIL-FNAME. 
  FS_EMPHDR_DATA-SSN   = ZEMPDETAIL-SSN. 
  FS_EMPHDR_DATA-DOB   = ZEMPDETAIL-DOB. 
fill the administrative section of the data record 
  INT_EDIDD-SEGNAM = C_HEADER_SEGMENT. 
  INT_EDIDD-SDATA = FS_EMPHDR_DATA. 
append the employee header data record to the IDoc data 
  APPEND INT_EDIDD. 
  *--Employee weekly details--
  LOOP AT IT_WKDET. 
fill the weekly details for each week 
    FS_WEEKDET_DATA-WEEKNO = IT_WKDET-WEEKNO. 
    FS_WEEKDET_DATA-TOTHOURS = IT_WKDET-TOTHOURS. 
    FS_WEEKDET_DATA-HRLYRATE = IT_WKDET-HRLYRATE. 
add administrative information to the data record 
    INT_EDIDD-SEGNAM = C_WEEKLY_DETAILS_SEGMENT. 
    INT_EDIDD-SDATA = FS_WEEKDET_DATA. 
append the data for the week to the IDoc data 
    APPEND INT_EDIDD. 
Client details of each week 
    FS_CLIENTDET_DATA-CLSITE = IT_WKDET-CLSITE. 
    FS_CLIENTDET_DATA-WORKDESC = IT_WKDET-WORKDESC. 
add administrative information to the data record 
    INT_EDIDD-SEGNAM = C_CLIENT_DETAILS_SEGMENT. 
    INT_EDIDD-SDATA = FS_CLIENTDET_DATA. 
append the client details for the week to the IDoc data 
    APPEND INT_EDIDD. 
  ENDLOOP. 
  *--Employee monthly summary--
compute total hours and amount for the month 
  LOOP AT IT_WKDET. 
    TOTAL_HRS_MONTH = TOTAL_HRS_MONTH + IT_WKDET-TOTHOURS. 
    TOTAL_AMT_MONTH = TOTAL_AMT_MONTH + ( IT_WKDET-TOTHOURS * 
                                          IT_WKDET-HRLYRATE ). 
  ENDLOOP. 
fill the summary information 
  FS_SUMMARY_DATA-TOTHRS = TOTAL_HRS_MONTH. 
  FS_SUMMARY_DATA-TOTAMT = TOTAL_AMT_MONTH. 
condense the summary record fields to remove spaces 
  CONDENSE FS_SUMMARY_DATA-TOTHRS. 
  CONDENSE FS_SUMMARY_DATA-TOTAMT. 
add administrative information to the data record 
  INT_EDIDD-SEGNAM = C_SUMMARY_SEGMENT. 
  INT_EDIDD-SDATA = FS_SUMMARY_DATA. 
append summary data to the IDoc data 
  APPEND INT_EDIDD. 
  *************Pass control to the ALE layer**************************** 
  CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE' 
       EXPORTING 
            master_idoc_control            = control_record_out 
       TABLES 
            COMMUNICATION_IDOC_CONTROL     = IT_COMM_IDOCS 
            MASTER_IDOC_DATA               = INT_EDIDD 
       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 NE 0. 
     MESSAGE E003 WITH P_SSN. 
  ELSE. 
     LOOP AT IT_COMM_IDOCS. 
       WRITE: / 'IDoc generated', IT_COMM_IDOCS-DOCNUM. 
     ENDLOOP. 
     COMMIT WORK. 
  ENDIF.

Similar Messages

  • Regarding getting data from excel file and need to generate  inbound idoc

    Hi guys,
    Please can u give some example how to get excel file data and need to generate the inbound idoc my questation ? Is it possible to generate inbound idoc with the same logical system ( it seems to be not possible using same logic to generate idoc ) can u suggest me any posssibule way to generate idoc.) if possible give me some example.
    Regardng
    anil
    Edited by: anil kumar on Aug 8, 2008 1:35 PM

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • How to write processing code for the Inbound IDOC to the R/3 ??

    i m having a file -> XI-->R/3 scenario,
    IDOC is being sent from XI to R/3,
    can u guide to me to write a processing code for the Inbound IDOC to the R/3,
    since i m new to ABAP and ALE technology, can we provide me any blog for doing that.......or guide me....

    Hi Sudeep
    Simple File to Idoc scenarion blog
    /people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping - Any flat file to any Idoc
    Also see the blog
    <a href="/people/ravikumar.allampallam/blog/2005/02/23/configuration-steps-required-for-posting-idocsxi Steps for Posting IDOC's</a> by Ravikumar.
    Configuration of IDOC adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/96/791c42375d5033e10000000a155106/frameset.htm
    Regards
    Santhosh
    *Reward points if useful*

  • Generate inbound IDOC

    Hi All,
    The scenario is like...   One system say S1 is sending an IDOC to second system say S2.
    Now is this idoc is coming through a middle ware AMTRIX. In S2 the IDOC is coming as file and saved in UNIX path (al11).
    From last 2 days IDOC is not getting generated from that file.
    I guess there must be some standard program which is generating IDOC from that file which might have been running every day. We also don't know the batch job name.
    Can you please tell me the name of the Standard program. Or is there ALE configuration is done ???
    Any kind of input will valuable.
    Thanks in advance
    Satyam

    Hi,
    You must configure a fileport(WE21) to pick the file from the server location
    Then configure the partner profile for the fileport in WE20 for the inbound process code.
    the inbound process code will internally trigger the processing FM and generate the corresponding inbound IDOC.
    Hence check the port and partner profile configuration and then check the test idoc tool in WE19
    Regards
    Shiva

  • DELV process code triggers unwanted inbound idoc!

    Hi,
    I am creating a delvry03 idoc with message type shpord.The process code is DELV.I am sending the idoc from LS to KU.I maintained the outbound parameters in both receiving and sender systems.The outbound is creating perfect.However, there is an unwanted inbound idoc that is being created.All the inbound idocs getting created in this way is in error.I am not able to understand why the inbound idoc is getting created.
    I see DELV as both outbound and inbound process codes, but then i am not able to understnad why shpord message type is getting processed.I have not done the distribution model as the receiving system is customer.
    Could someone help me out in this weird scenario.Thanks

    Duplicate in ABAP General deleted.  Post in ONE forum only, please.
    matt

  • Need code to generate IP Number.....

    I need to retrieve the IP number of the person filling out a
    form which has an e-mail function that notifies the client by
    e-mail the contents of the message.
    The script that captures the data input from a form is
    structured to forward the information via e-mail per below.
    Unfortunately, this particular structure returns a BLANK space for
    IP.
    What is incorrect with this code? Or, am I using the wrong
    expression?
    Name: {FirstName} {LastName}<br>
    Phone: {phone}<br>
    E-Mail: {e_mail}<br>
    IP Address: {Request.ServerVariables.REMOTE_ADDR}<br>
    Organization: {organization}<br>
    Event Name: {event_name}<br>
    Location: {location}<br>
    Event Date: {event_date}<br>
    Event Time: {event_time}<br>
    Admission: {admission}<br>
    Comments: {comments}<br>
    <br><br>
    This is the end of the report.
    I have attempted to use the code below in its place but, it
    generates an error message and the form will not execute.
    <%Request.ServerVariables("remote_addr")%> '
    Thank you for any help you can provide..

    Be aware that this IP number will only tell you who the
    visitor's ISP is,
    unless they have a STATIC IP address.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Slowtroll" <[email protected]> wrote in
    message
    news:g0kcva$bqc$[email protected]..
    >I need to retrieve the IP number of the person filling
    out a form which has
    >an
    > e-mail function that notifies the client by e-mail the
    contents of the
    > message.
    >
    > The script that captures the data input from a form is
    structured to
    > forward
    > the information via e-mail per below. Unfortunately,
    this particular
    > structure
    > returns a BLANK space for IP.
    >
    > What is incorrect with this code? Or, am I using the
    wrong expression?
    >
    > Name: {FirstName} {LastName}<br>
    > Phone: {phone}<br>
    > E-Mail: {e_mail}<br>
    > IP Address:
    {Request.ServerVariables.REMOTE_ADDR}<br>
    > Organization: {organization}<br>
    > Event Name: {event_name}<br>
    > Location: {location}<br>
    > Event Date: {event_date}<br>
    > Event Time: {event_time}<br>
    > Admission: {admission}<br>
    > Comments: {comments}<br>
    > <br><br>
    > This is the end of the report.
    >
    > I have attempted to use the code below in its place but,
    it generates an
    > error
    > message and the form will not execute.
    >
    > <%Request.ServerVariables("remote_addr")%> '
    >
    > Thank you for any help you can provide..
    >

  • How to create Inbound Idoc from XML file-Need help urgently

    Hi,
    can any one tell how to create inbound Idoc from XML file.
    we have xml file in application server Ex. /usr/INT/SMS/PAYTEXT.xml'  we want to generate inbound idoc from this file.we are successfully able to generate outbound XML file from outbound Idoc by using the XML port. But not able to generate idoc from XML file by using we19 or we16.
    Please let me know the process to trigger inbound Idoc with out using  XI and any other components.
    Thanks in advance
    Dora Reddy

    Hi .. Did either of you get a result on this?
    My question is the same really .. I am testing with WE19 and it seems SAP cannot accept an XML inbound file as standard.
    I see lots of mention of using a Function Module.
    Am I correct in saying therefore that ABAP development is required to create a program to run the FM and process the idoc?
    Or is there something tht can be done with Standard SAP?
    Thanks
    Lee

  • Re: ME51n through Inbound Idoc

    Hi Expert,
      Below is the required set up.
      "A non-sap system will generate a textfile and the textfile will be push to SAP automatically to trigger automatic creation of PR."
    This is my suppose approach but am not sure if this is feasible and how...
    1. The text file  be output in a ftp server or in a unix directory.
        the text file contain all the info needed to create a purchase
        request.
    2. FTP or unix script will push this file to SAP by means of unix or ftp script..
       - any ftp script or unix script for this
    3.SAP will acknowledge the textfile
       3.1 trigger event that will generate inbound idoc
           - how to set up the IDOC
       3.2 the inbound idoc will be use to create the PR
           - a customize program running in a background mode which as
             a mode of trigger event
       3.3. the customize program is made of bapi_create_purchase
    Does anyone have this requirement before?, any other alternative or better approach to accomplish this? Thanks in advance..
    She

    Hi,
    Please use BAPI_REQUISITION_CREATE to accomplish this.. You'd have to make a remote call and pass the data from the 3rd  party system in to the BAPI's structure as a string and it is the nsorted out based on the fields in teh structure..

  • Inbound IDOC using  XML

    Hi,
    I need to create an Inbound IDOC using Function modules using an XML file as Input.
    I am using mySAP ERP 2004(WAS 6.4).
    IDOC type : HRMD_A05
    Message Type : HRMD.
    I am using the FM's in an ABAP report for testing, reading the data from the XML File using the FM GUI_UPLOAD .
    I tried using the FM <b>IDOC_INBOUND_XML_VIA_HTTP</b>,with import parameters XML_STREAM, CONTENT_LENGTH, CONTENT_TYPE, REMOTE_ADDR.(ALL Type Strings)
    This FM creates the IDOC successfully but i do not get the status record for the IDOC as there are no export parameters or tables where i can get the value.
    I am trying using the FM <b>IDOC_INBOUND_XML_SOAP_HTTP</b>,with import Parameters as <b>XML_STREAM type XSTRING</b>,and there is the export parameter ASSIGN ,type IDOC_ASSIGN_TAB and i was wondering if this could return the status.
    I used the same XML and used the FM "SCMS_STRING_TO_XSTRING", to convert the file input string into XSTRING.
    On executing this i get the exception,"NO DATA RECEIVED" .
    Can anybody Please Tell me
    1)How to get the status of an IDOC if i use the FM IDOC_INBOUND_XML_VIA_HTTP ?
    2)How to use the FM IDOC_INBOUND_XML_SOAP_HTTP ?
    3)Is there any other way to create an IDOC with XML input?
    Thanks,
    regards,
    Siddhartha Jain

    HI Nagarajan,
    I had checked the first link mentioned by you and activated the required service from Transacttion SICF,but still it didn't help.
    The second link points to the IDOC Adaptor for XI,guess it won't help as i'm not using XI.
    I want to pass XML data read from file and call a FM which creates and posts and IDOC into R/3 and returns the IDOC Number and Status.
    For this i found the FM's IDOC_INBOUND_XML_SOAP_HTTP and IDOC_INBOUND_XML_VIA_HTTP.
    The FM IDOC_INBOUND_XML_VIA_HTTP accepts xml as string and posts IDOC succesully,but i do not get the status and IDOC Number.
    The IDOC_INBOUND_XML_SOAP_HTTP accepts xml as xstring,so i used the FM SCMS_STRING_TO_XSTRING to convert the same xml string to xstring and pass it to the FM.But it gives an error 'NO DATA RECEIVED'.
    If i make few changes to the XML doc,to include SOAP envelope ,like
    <?xml version="1.0" encoding="UTF-8"?><HRMD_A05>.......</HRMD_A05>
    to
    <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"><soap-env:Body><IDOC BEGIN="1">.......</IDOC></soap-env:Body></soap-env:Envelope>
    I get the error,the tag <IDOC BEGIN="1"> not found ,the IDOC XML should be of format <IDOC BEGIN="1"> <IDOC>.
    Can anybody please help on what to do/how to proceed.
    Thanks,
    Regards,
    Siddhartha

  • Inbound IDOC & Comminication in Nomination

    We have a scenario on the Mining industry where we created nomination (T Cd : O4NSN ) for transport of coal by railways . The outbound communication  IDOC was successfully sent to a Transport Agency and is reflected in the u201C Communication Tabu201D of the Nomination.
    I am getting following issues :
    1. Subsequently , the Transporter/railways has send a back a communication via incoming Idoc which fails with following Eror Message : EDI: Partner profile not available
    We have tried to create the partner function for processing of Inbound Idoc with following data .
    Message type     : OIJ_NOM_COMM
    Basic Type     : OIJ_NOM_DETAIL01
    Partner Type     : KU
    Can you please inform me the approriate Process Code for the inbound IDOC ?
    2. Also I have noticed that that  During Outbound Communication to the transporter the u201CActionu201D (Communication Tab of Nomination) field idicates as  u201C Current Itemu201D. But my understanding is that it should  show status : u201C New entry sentu201D .
    Can you please guide on how I can define the partner function and resolve these issues .

    An inbound IDOC in error will have the status 51, & it is marked for deletion it has a status of 68.
    http://www.dataxstream.com/2009/10/mass-status-change-sap-idoc/
    http://wiki.sdn.sap.com/wiki/display/ABAP/IDoc+Statuses
    Edited by: Krupaji on May 6, 2011 2:38 PM

  • Converting Inbound idoc to Outbound idoc

    Hii,,
    How to convert inbound idoc to outbound idoc.
    I have IDOC -> SOAP -> IDOC Scenario.
    In case of error at SOAP side , it return idoc with 51 status.
    Now i need to convert the Inbound idocs to Outbound Idocs and send it back to the Sender system...
    How to do accomplish this??
    Regards,
    Siya

    Hii,
    By using we19 and by exchanging sender & receiver we can convert outbound idoc to inbound idoc.
    Just want to confirm is it proper way??
    Regards,
    Siya

  • Inbound IDOC (change to delivery qty)

    Hi,
    I need to setup an inbound idoc to R3 which will change the delivery pick quantity. What is the idoc to be used and how to use it for changing the delivery pick quanitity for the already created delivery in R3
    appreciate your help.
    P.S

    reopened a thread in ABAP Development » ABAP, General

  • Can inbound Idoc Contain .PDF attachment?

    Hi there,
    I have a requirement where there is a need to create an Inbound Idoc in the CRM system containing a .PDF file attachment.
    1) Can and IDOC contain file attachments?
    2) If yes which segment woult contain it, or how it should be attached.
    The inbound idoc would be created from an XI system.
    Regards,
    Kiran

    Kiran,
    Its not going to be easy. If you plan to use that then
    1. Either you need to have two different interfaces one for the IDOC and one for PDF or design your interface to split that and send as two different messages to R/3.
    2. Moreover do you want to maintain the PDF as it is in R/3? If that is the case, then you might have to write some Custom RFC which can read the PDF and upload the same and attach the doc.
    Regards,
    Ravi
    Note : Please mark the helpful answers

  • Editing Inbound IDoc and store it in an Ztable

    Hi
    I need to Edit an inbound IDoc(IDOcs through mail or XI) and store the details in an Ztable depends upon the message type (eg UTILMD).plz help me with step by step process
    thanks in advance
    shibu

    for idoc stpes check this:
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/sapR3%28Idocs%29ToXI--Steps+Summarized&

  • Inbound IDoc to generate Billing Document - t.code VF01

    Hi,
    which is the inbound idoc to trigger Billing Document.
    pls suggest
    thanks in advance...
    Regards,
    Balaji

    Hi,
    >IDOC name- INVOIC.INVOIC02
    INVOIC02 can only be used as outbound from VF01 not as inbound (at least in standard)
    unless you know a process code that can be used for inbound?
    in general sales invoice can only be created via interface with the use of ERS (selfbilling) scenario
    but I'm not sure if this is what you need
    Regards,
    Michal Krawczyk

Maybe you are looking for

  • How to open smart object in camera raw

    Hi, As the subject line reads, I'm having trouble opening a smart object in camera raw.  Every tutorial I read or watch says, "double click on your smart object thumbnail to open the image in camera raw."  But every time I do, all it does is open a c

  • Disappearing Start Items

    I have a Start Button problem with a Windows 7 SP-1 computer. When I click Start / All Programs, the list of programs duly appears but when I then left-click on any folder in the resultant list (e.g. the "Microsoft Office" folder), although the folde

  • Online/cloud storage for use with Aperture?

    Can anyone tell me if there is an option for online/cloud storage for Aperture photo libraries?  I take a lot of photographs which progressively fill ip my hard drive. I'm interested in getting a  Air (especially if the rumors of updated Sandy Bridge

  • 60 fps video editing

    Is it possible somehow to edit your 60 fps video from GoPro Hero 3 on the ipad 4? Or do all editing apps have 30 fps output? Want to fully use my go pro! Thanks. Casper

  • Encountering Exception!!please help

    what should i do if i get this exception Exception in thread "main" java.lang.UnsupportedClassVersionError: org/jdesktop/ jdic/desktop/Message (Unsupported major.minor version 48.0)