Fill Idoc

We have a requirement where we need to Create a inbound IDOC Basic Type:WMMBID01 and Message Type: WMMBXY. can some one tell me the steps to create this idoc ?

hi
<b>The following code may help you</b>
REPORT  ZALE_USR.
CONSTANTS:   C_DOCTYP TYPE EDIDC-IDOCTP VALUE 'ZUSRDET01',Idoctype
           C_SEGNAM TYPE EDIDD-SEGNAM VALUE 'Z1USRDET01', segmenttype
             C_MESTYP TYPE EDIDC-MESTYP VALUE 'ZUSRDET'. message type
  DATA:      IT_ZUSR02 TYPE USR02 OCCURS 10,
             IT_EDIDC TYPE EDIDC OCCURS 0,
             IT_EDIDD TYPE EDIDD OCCURS 0,
             WA_ZUSR02 TYPE USR02,
             WA_EDIDC TYPE EDIDC,
             WA_EDIDD TYPE EDIDD,
             WA_Z1USRDET01 TYPE Z1USRDET01,
             V_OCCMAX TYPE IDOCSYN-OCCMAX,
             V_NBSEG TYPE I.
            CLEAR WA_ZUSR02.
            CLEAR WA_EDIDC.
            Save the message type and the basic IDoc type in the control segment.
            MOVE C_MESTYP TO WA_EDIDC-MESTYP.
            MOVE C_DOCTYP TO WA_EDIDC-IDOCTP.
            Retrieve the maximum number of segments in the basic IDoc type.
            SELECT MIN( OCCMAX )  FROM IDOCSYN  INTO V_OCCMAX  WHERE IDOCTYP EQ C_DOCTYP AND SEGTYP EQ C_SEGNAM.
            Save the whole USR02 table content in the IT_ZUSR02 internal table.
            SELECT * FROM USR02 INTO CORRESPONDING FIELDS OF TABLE IT_ZUSR02.
            Create a data segment for each line of IT_ZUSR02.
            LOOP AT IT_ZUSR02 INTO WA_ZUSR02 .
              MOVE-CORRESPONDING WA_ZUSR02  TO WA_Z1USRDET01.
              CLEAR WA_EDIDD.
              MOVE C_SEGNAM TO WA_EDIDD-SEGNAM.
              MOVE WA_Z1USRDET01 TO WA_EDIDD-SDATA.
              APPEND WA_EDIDD TO IT_EDIDD.
              CLEAR WA_ZUSR02.
             CLEAR WA_Z1USRDET01.
            ENDLOOP.
           Count the number of data segments.
              DESCRIBE TABLE IT_EDIDD LINES V_NBSEG.
           If the number of data segments exceeds the maximum allowed number,then display an error message.
              IF V_NBSEG GT V_OCCMAX.
              WRITE:/ 'ERROR'.
              ENDIF.
              CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
                EXPORTING
                  master_idoc_control                  = WA_EDIDC
                OBJ_TYPE                             = ''
                CHNUM                                = ''
                tables
                  communication_idoc_control           = IT_EDIDC
                  master_idoc_data                     = IT_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 <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
              ENDIF.
<b>Reward points for helpful ans</b>
Regards
Aarti

Similar Messages

  • Fill IDOC segment, E1IDBW1. For PEXR2002 Basic Type

    Hello Team.
    We send the IDOC for the Basic Type PEXR2002, Message Type PAYEXT.
    This IDOC doesn't fill the Segment E1IDBW1 (IDoc header - special instructions (INP) )
    I'm review some notes(1164524) and said to fill this segment it's neccesarie config the IHC.
    But doesn't have this functionality.
    It's possible fill the segment E1IDBW1 in a user exit or any other enhacement at creation idoc moment?
    My idea is used the FM
      CALL FUNCTION 'GET_SEGMENT_POS_FOR_INSERT'
        EXPORTING
          I_BASIS_TYPE            = ch_edidc-idoctp
          I_EXT_TYPE              = ch_edidc-cimtyp
          I_SEGMENT_TYPE          = 'E1IDBW1'
        IMPORTING
          E_INDEX                 = li_tabix
        TABLES
          IT_EDIDD                = t_edidd
        EXCEPTIONS
          BASIS_TYPE_NOT_FOUND    = 1
          EXTENSION_NOT_FOUND     = 2
          EXTENSION_ERROR         = 3
          INVALID_IDOC_DEFINITION = 4
          IDOC_ERROR              = 5
          INVALID_SEGMENT_TYPE    = 6
          INVALID_START_INDEX     = 7
          NO_MORE_POSITION        = 8
          TOO_MANY_SEGMENTS       = 9
          OTHERS                  = 10.
    To Fill 2 constants in this segment.
    Do you have any other idea?
    Thanks
    Edited by: David Lezama Gonzalez on Sep 1, 2011 2:51 PM

    Hi,
    Basically the segment E1IDBW1 will always be filled via user exit.
    If you work with the IHC (In-House-Cash) application you have to fill
    the E1IDBW1 segment as described in note 626577.
    If you don't work in an IHC environment the following conditions must
    be fulfilled:
    1. The payment program has to fill certain fields (e. g. REGUH-DTAWS,
    REGUH-DTWS1 - REGUH-DTWS4).
    2. If this is fulfilled the payment data (REGUH, REGUP tables) will
    be filled. The instruction keys will be moved to IDOC segment
    E1IDKU3.
    3. In user exit EXIT_SAPLIEDP_002 you can take over the instruction
    keys from segment E1IDKU3 into E1IDBW1.
    You may also read note 496663, this note explains about user exit
    EXIT_SAPLIEDP_002 to populate this field in the idoc.
    Also, you can check the note:
    580321 - RFFOEDI1: BTE process 00002441 (Change IDoc)
    REgards,
    Cristiano

  • Filling Idoc data in hierarchy

    Hi,
    I want to fill the Idoc segments which is in hierarchy
        E1IDPU1
             E1IDPU5
                 E1EDU03.
    for segment E1IDPU1, I am filling in this way.
        L_E1IDPU1-DOCNAME = 'FST'.
          L_E1IDPU1-DOCNUMMR = WA_BSID-BELNR.
          move L_E1IDPU1  TO wa_edidd-sdata.
          move 'E1IDPU1' TO wa_edidd-segnam.
          append wa_edidd TO TB_EDIDD.
    for segment E1IDPU5 and E1EDU03  I  tried to fill in the following way, but while checking the Idoc in WE05, it is not showing data in  hierachy, instead it is showing all segments  same  level.
         read table tb_edidd with key segnam = 'E1IDPU1'.
          lv_tabix = sy-tabix.
          clear wa_edidd.
          add 1 to lv_tabix.
          L_E1IDPU5-MOAQUAL = '002'.
          L_E1IDPU5-MOABETR = WA_BSID-DMBTR.
          L_E1IDPU5-CUXWAERZ = WA_BSID-WAERS.
          L_E1IDPU5-CUXDATUM = WA_BSID-BLDAT.
    Could you please tell me how to to fill hierachical segments.
    Regards,
    Sankar

    Hi,
    Please check all the mandatory segments are filled.
    compare the IDOC data (tb_edidd) hierarchy and basic type hierarchy before passing to the FM MASTER_IDOC_DISTRIBUTE . It has to be same.

  • Fill Idoc error status

    Hi Folks,
    I am trying to fill the IDoc error status when processing inbound ORDERS IDoc.
    Code looks OK.
    But i am not getting the IDoc in error status.
    Pl look @ the code and let me know.
    data: w_errtab like errtab occurs 0 with header line.
    if condition fails.
    move derrtab to w_errtab.
    w_ERRTAB-ARBGB = 'IDOC_ADAPTER'.
    w_ERRTAB-CLASS = 'E'.
    w_ERRTAB-MSGNR = '902'.
    w_ERRTAB-MSGV1 = xvbak-bstdk.
    w_ERRTAB-MSGV2 = s_kunnr.
    w_ERRTAB-MSGV3 = s_vbeln.
    append w_ERRTAB.
    DESCRIBE TABLE w_errtab LINES sy-tfill.
    derrtab = w_errtab.
    endif.
    The IDoc status is still 53.
    Thanks,
    Matt

    call customer-function '011'
             exporting
                  dxvbak  = xvbak
                  docnum  = idoc_contrl-docnum
             tables
                  derrtab = errtab
                  dxvbap  = xvbap
                  dxvbep  = xvbep
                  dxvbadr = xvbadr
                  dxvbpa  = xvbpa
                  dxvbuv  = xvbuv
                  dedidc  = idoc_contrl
                  dedidd  = idoc_data
                  dxkomv  = xkomv
                  dxvekp  = xvekp
                  dyvekp  = yvekp.
        describe table errtab lines anzahl.
        if anzahl gt 0 and input_method = 'X'.
          export errtab to memory id 'idoc_test_errtab'.
        endif.
        if anzahl gt  0  and
           xaprau eq 'D'.
          loop at errtab where arbgb eq 'VG' and
                               msgnr eq '219'.
            anzahl = anzahl - 1.
          endloop.
          if anzahl eq 0.
            refresh errtab.
          endif.
        endif.
        if anzahl ne 0
         and input_method is initial.
          perform determine_user.
          perform statusrecord tables errtab.   " This is place in which IDOC_STATUS table get filled from
                                                " ERRTAB. Please check whether your IDOC_STATUS have
                                                " the Error record 51 that you inserted
          call customer-function '010'
               exporting
                    docnum      = idoc_contrl-docnum
               tables
                    derrtab     = errtab
                    xbdidocstat = idoc_status.
        else.

  • How to fill controlrecord in File to Idoc scenario

    Dear experts,
    Currently I have a working file->Idoc scenario in which I fill Idoc-controlrecordvariables as follows:
    - field SNDPOR: name of XI developmentsystem (via a constant)
    - field RCVPOR: name of SAP developmentsystem (also via a constant)
    - same for fields like SNDPRN and RCVPRN etc.
    In Development this works fine. Then I transport the design objects to the next environment. But when I want to test the same in Acceptence or Production, it won't work because the fields are still filled with the settings for the Development system.
    Can I fill these fields via some systemvariable in stead of a constant? Or is there another way?
    Thanks,
    William
    Edited by: JWD on Aug 31, 2010 2:20 PM

    Hi,
    1)Uncheck option Apply contraol record values from Payload in IDoc receiver channel.
    2)Disable EDI_DC40 control record in message mapping.
    this two steps will solve your problem at configuration time it will take the values irresctive of environment.so you no need to maiantain constant values..
    Regards,
    Raj

  • IDOC related Query

    hi
    i am adding one field VBKD-IHREZ in the IDOC.
    i have added following code in the Include which exists inside a User exit corresponding to fill Idoc Structure to BDC data structure.
    z1edk05 is the new segment which i have add in z1orders through we30.
    the code is below which i have added in Include.
    when i activate this code i got error
    the field z1edko5 is unknown. there are similer fields with name "z1edk03","z1edk01"
    include LVEDACOM.
    in UNICODE programs the character "-"  can not appears in names as it does appear in the names 'IVBEP-POSNER'
    if not z1edk05-ihrez is initial.
      perform zzdynpro_setvalue tables dxbdcdata
                                 using 'BDC_OKCODE' EQ '=SICH'.
      PERFORM zzdynpro_new tables dxbdcdata
                             using 'SAPMV45A' '4002'.
      perform zzdynpro_setvalue tables dxbdcdata
                             using 'VBKD-IHREZ' z1edk05-ihrez.
      perform zzdynpro_setvalue tables dxbdcdata
                             using 'BDC_OKCODE' 'BACK'.
    ENDIF.
    regards
    Atul

    Hi,
    Check if you released your idoc. Have you added the extended idoc to the message type in tcode we82. Also check if the partner profiles contain the zidoc in extension.
    And as you have mentioned....it is showing 'o' in the error but your segment name contains 'zero(05)'. So please check it once.
    Regards,
    Sumalatha

  • Send idoc to SAP using FTP

    Hi All,
    The below mentioned is my requirement:
    From legacy system need to send idocs i.e..
    Flat File --> Data services --  via ftp -->SAP
    Material master date is available in the file file.I have to fill the idoc matmas using the data services and send it to sap.
    So in order to achieve this I have performed the below mentioned steps:
    1.Created data store and Imported the idoc matmas from sap(All types of configurations are done)
    2.created datastore for flatfile
    3.mapped the fields in flatfile to idoc in dataflow.
    Now here are the show stopper's for me:
    1.How to send this filled idoc through ftp?
    2.How to extend the idoc in data services?(if an indicator in flat file is  '1' then I have to extend the material to all the plants available)
    Please share ur inputs.
    Thanks,
    Ugandhar

    Ricky,
    Is it ok if you can schedule your file adapter for every 1 hour. If yes then see this weblog:
    /people/shabarish.vijayakumar/blog/2006/11/26/adapter-scheduling--hail-sp-19-
    But what I see is one disadvantage. If you send Idocs from R3 it will reach to XI and will stay in XI till the adapter process it.
    One other option is collect the Idocs in R3 and send to xi.
    ---Satish

  • CRMXIF_ORDER_SAVE_M02 Idoc status 53, but no transaction created in CRM

    Hi,
    Via transaction WE19, I have filled idoc CRMXIF_ORDER_SAVE_M02.
    When I click on "standard inbound", the idoc is generated and get the status 53 which seems to be OK, but no Transaction is created in CRM.
    Any idea ?
    I've tried to fill more fields of the idoc structure but nothing changed.
    Is there a step I am missing ?
    What's the use of these fields in the idoc structure ?
    APPL_SNAME
    DATAX
    Thanks for any help !
    Aussie

    Hi Aussie,
    In transaction WE19 for the Idoc CRMXIF_ORDER_SAVE_M02.
    It has no problem with data instead check the receiver Port, sender port, Partner No,
    Partner type, role . If these didnot match then the data will not be reflected in CRM.
    regarding  APPL_SNAME: it is not relevant with the problem, its a structure of teh description.
    Please see the ports.
    have a nice day!!
    receiver Port , sender port, Partner No, type, role Partner profile not maintained
    Name of structure for the technical description
    With regards,
    Lakshmi Narayana

  • HRMD_A06 IDOC is in error.

    IDOC is showing status 51.
    Status Notification says - Make Entry in all required fields.
    We are filling IDOC using Proxy Code.
    How to Trace what are the necessary fields to pass?
    Regards,
    Akshay.

    Hi ..
    the idoc has been sent from xi ..it means the idoc is failing in the recieving system owing to some validation it is failing ...
    so what you can do ...run transaction we05 ..select your idoc ..see what error it gives there...based on that error ...you can choose to handel it in xi ..or in the recieving system function module (you can find it in transaction we20..against your message type ...) ..You might want to coordinate with your funtional guy as well by taking this idoc number and trying sending it again by using transaction
    we19...where you first you need to check wether all the segements necessary are created properly or  wether your xi is creating a segement which has some mandetory missing  for eg you are sending a recordset from the source where some values are not coming but you  are creating those segements unnecessarly...this you can handel in xi mapping easily ... by checking the source fields length after trimming it , if it is greater then 0 then nly create the segement (use appropriate standard text funtions like trim and length and createif)
    Regards,
    Deepak

  • FBV1 - create using idoc ACC_INVOICE_RECEIPT03 - Error F5702

    Hi all,
    I'm trying to create a preliminary document like I do with transaction FBV1. For that, I'm trying with idoc  ACC_INVOICE_RECEIPT03, which uses BAPI BAPI_ACC_INVOICE_RECEIPT_POST.
    I'm filling idoc segments as follows:
    Header: E1BPACHE03
    OBJ_TYPE     BKPFF
    OBJ_KEY     0000000000TEST
    OBJ_SYS     I01CLNT100
    USERNAME     IBEAPLI1
    HEADER_TXT     G3689
    COMP_CODE     FI14
    FISC_YEAR     2009
    DOC_DATE     20090831
    PSTNG_DATE     20090831
    TRANS_DATE     20090831
    FIS_PERIOD     08
    DOC_TYPE     IV
    REF_DOC_NO     G3689
    Account Payable: E1BPACAP03
    ITEMNO_ACC     1
    VENDOR_NO     0000000503
    GL_ACCOUNT     0000400000
    PMNTTRMS     C000
    BLINE_DATE     20090830
    PYMT_METH     C
    ITEM_TEXT     text
    Account GL: E1BPACGL03
    ITEMNO_ACC     2
    GL_ACCOUNT     0000629001
    COMP_CODE     FI14
    PSTNG_DATE     20090830
    FISC_YEAR     2009
    FIS_PERIOD     08
    TAX_CODE     S3
    ITEM_TEXT     text2
    ORDERID     000000006932
    PROFIT_CTR     0000000999
    Taxes: E1BPACTX01
    ITEMNO_ACC     3
    TAX_CODE     S3
    Currencies:
    E1BPACCR01
    ITEMNO_ACC     1
    CURR_TYPE     00
    CURRENCY     EUR
    CURRENCY_ISO     EUR
    AMT_DOCCUR     -0000000000116.00
    EXCH_RATE     1
    E1BPACCR01
    ITEMNO_ACC     2
    CURR_TYPE     00
    CURRENCY     EUR
    CURRENCY_ISO     EUR
    AMT_DOCCUR     0000000000100.00
    EXCH_RATE     1
    E1BPACCR01
    ITEMNO_ACC     3
    CURR_TYPE     00
    CURRENCY     EUR
    CURRENCY_ISO     EUR
    EXCH_RATE     1
    AMT_BASE     000000000016.00
    Creating same document in FBV1 I get success, but when I try it via idoc in we19, I get following error:
    *Balance in transaction currency*
    *Message no. F5702*
    *Diagnosis*
    *A balance has occurred in transaction currency 'EUR' with the following details:*
    *Exchange rate '00', amount '           116,00-' and currency key 'EUR'.*
    *The data in the transaction currency were transferred from the calling application.*
    *System Response*
    *Your data cannot be processed in FI.*
    *Procedure*
    *The error is probably in the calling application*
    How can I solve this problem? Any idea?
    Thanks in advance!!
    REgards.

    Hi,
    Chekc the IDoc received, may the amounts are in proper format, check with the ABAPer for correct format.
    VVR

  • Idoc not fully posted

    Dear All,
    I am trying to download employees from HR to CRM system. Connection is already set up. When I process an Idoc in BD87 in CRM, system gives me a warning message that Object 01,CP,<pernr number> does not exist: infotype 5580 cannot be created. Same is the case with other infotypes like 1001, 5585 etc. and status of Idoc is 52(no fully posted).
    I browsed through related SDN posts and found that T77S0 table settings and general configurations might be an issue. I tested them with another system which is already connected to HR and validated above settings.
    Up on debugging, I found that BP is created in CRM for the PERNR but the HRP* tables are not being filled. Also the above warning message is coming from the peform CHECK_PNNNN inside include LRHA0F05 and method CREATE_PD_OBJECTS.
    Any pointers on this would be very helpful.
    Thanks and Regards,
    Narendra

    Solved by myself.
    The mandatory CP infotype 1000 is not created since the segment E1P0001 is not populated. After it is filled, Idoc is processed fully.
    Regards,
    Narendra

  • Soft errors/warnings are creating idocs in 51 status, and creating orders

    In our SAP 4.7 environment, inbound orders that encounter credit checks, materials in the wrong status, blocked customers, and several other issues that should just be warnings or messages rather than resulting in status 51 idocs, are hitting 51 error status, and they are creating orders in SAP as well (51 status idocs are still creating orders, and nuisance messages are creating 51 status idocs, and still creating orders). I assume someone made some programming changes years ago to cause this to happen. This is really polluting workflow and BD87, and customer service is duplicating orders as they process 51 status idocs through workflow, unaware that orders already created immediately regardless of the 51 status.
    Can anyone point me in the direction of where I can specify what warnings or errors constitute 51 status, and where I can stop 51 status idocs from creating orders until the error is repaired?
    Would it be in program RBDAPP01, or the inbound function module EDI_DATA_INCOMING?
    Any help would be appreciated. Thanks!

    Hi Kevin,
    so then it is time to check it out in WE19 debug mode. After each PERFORM in the EDIDC Loop in the FM IDOC_INPUT_ORDERS, check the control and status data, this will lead you to the point where the unexpected and/or unwanted behavior appears.
    In the LOOP AT IDOC_CONTRL, in our system line 183 you find the comment fill IDOC Status. Check if field OK is not cleared here. If OK is set although you should have errors, then it's already too late.
    But please double-check EXIT_SAPL_VEDA_004 if it changes the tables parameter didoc_status = idoc_status.
    What I did not mention yet as I think you are talking only about IDoc not about online processing, applies to both:
    Customizing SPRO, SAP Reference IMG, Sales and Distribution -> Sales -> Sales Documents -> Define variable messages:
    Here you may have entries for application area V4, Sales messages (variable messages and EDI messages). Check if you find suspicious messages set to 'W' here.
    If this is the case and table logging is switched on as it should be, you can use menu uitilities -> change logs to find out who changed what when.
    Good luck!
    Regards
    Clemens

  • Idoc extraction from erp

    Hi colleagues,
    i'm trying to create xi scenario which transfers idoc from erp system to the xml file for the mdm system.
    I've already created all the neccessary things in integration repository and integration directory. And now i got stuck with ALE configuration and sending idoc from erp system. Let me describe what i did in ERP:
    1. I created logical system for reciever system (MYMDM)
    2. I created rfc destination to my PI system (MYMDM)
    3. I created port and associated it with my RFC destination (MDMPORT)
    4. I created partner profile for MYMDM LS and add MATMAS message type as outbound parameter. I set MDMPORT port created earlier as reciever port there and choose the option transfer idoc immed.
    5. I created distibution model (bd64) choosing CIVCLNT010 logical system as sender and MYMDM as reciever.
    *CIVCLNT010 - logical system  of ERP system for 010 client (the one i'm working in)
    6. I'm going to we19 TCode and choose:
    Reciever system: MYMDM
    Reciever port: MDMPORT
    Sender system: CIVCLNT010
    Sender port: SAPCIV010 (to be honest i have no clue what should be here... but somewhere i saw it should be like SAPSIDSYSNumber so i did in this way)
    I fill idoc with some data and click start outbound processing.
    I get a message that idoc was sent to SAP system or external system.
    BUT I cannot see the message in PI!
    Actually after that i can find my message just in we05 IDOC's sent list and nowhere else
    Could you please help me with this issue? Any help is very appreciated.
    Thanks and regards,
    Stanislav.

    YEAH! I changed Sender port in we19 to the one i found in IDX1 TCode in PI for my ERP (CIV) system. It was called SAPCIV and not SAPCIV010 and now seems it works!!! I got the message in PI!
    Thanks a lot, Suraj!
    Edited by: Stanislav Shkodkin on Oct 26, 2009 1:51 PM

  • Change pointers and Idoc creation

    Hello,
    I would like to create change pointers for any changes regarding one of our customer infotypes: 9002 (hrp9002)
    I was able to do that, however, I'm struggeling with the details.
    The problem is that I do not want to send any data related to infotype 9002. I just need this change pointer to trigger idoc creation for the related objects.
    Example: Let's assume that infotype 9002 gets created for position S 40001234. Once a night a customer report is executed via a job which reads all unprocessed change pointers (including the one mentioned above) and sends the corresponding object. In this case, an Idoc for the holder of position 40001234 should be created WITHOUT data for infotype 9002.
    The message type is HRMD_A.
    What do I need to do?
    Thank you for your input.

    Hi,
    For Info type 9002 we need to implement Badi HRALE00CHANGE_PTRS using below code.
       LOOP AT  t_changed_objects  INTO   wa_changed_objects .
        CASE  wa_changed_objects-infty.
          WHEN '9002'.
            wa_cp_data-tabname = 'HROBJINFTY'.
            wa_changed_objects-plvar = '01' .
            wa_cp_data-tabkey  = wa_changed_objects .
            wa_cp_data-cdchgid = 'U'.
    *  wa_cp_data-CDOBJCL = 'HRMD_A'.
            APPEND wa_cp_data TO t_cp_data1 .
        ENDCASE.
      ENDLOOP.
      IF t_cp_data1 IS NOT INITIAL .
        CALL FUNCTION 'CHANGE_POINTERS_CREATE_DIRECT'
          EXPORTING
            message_type          = 'HRMD_A'
          TABLES
            t_cp_data             = t_cp_data1
          EXCEPTIONS
            number_range_problems = 1
            OTHERS                = 2.
        IF sy-subrc <> 0.
    * Implement suitable error handling here
        ENDIF.
      ENDIF.
    This code will create entry in BDCP2 table.
    After thsi populating segemnet you need to code for below exit as .
    EXIT_SAPLRHAL_003
       IF PNNNN_NAME = 'P9002' .
    *FIELD-SYMBOLS: <FS_plog> TYPE ANY.   "Field Symbol for dynamic filling of data based on the structure
    *Clearing the SUBRC
    CLEAR SUBRC.
    * fill workarea for infotype with infotype-data
    ASSIGN pnnnn_data TO <FS_plog> CASTING TYPE P9002.
    LS_9002 = <FS_plog>.
    * move fields
    MOVE-CORRESPONDING LS_9002 TO LS_p9002.
    * fill IDoc-data with workarea for segmenttype
    ASSIGN sdata_data TO <FS_plog> CASTING TYPE Z1P9002.
    <FS_plog> = LS_P9002.
    CONVERTED = ZCDP_IF_CONSTANTS_DTIRIS=>GC_CROSS .
    ENDIF.
    It will work fine.
    Thanks
    Anju

  • Doubt in IDOC's - Process Codes

    Hi,
    Currently i am working on an object related to IDOC generation. This is my first object in IDOC's. I am doing it from the scratch including creation of segments, IDOC type, message type, process codes...
    In this process, I am developing a function module that should be assigned to the process code. My doubt here is, is there any standard interface to the function module that we have  to assign to the process code?
    I am also giving the flow which i will be using in developing the Function module. Please go through it and kindly let me know if I am doing it in the right way or not?
    1. Extract data from data base based on the entry in NAST
    2. Filling IDOC DATA & Control records
    3. Calling the FM MASTER_IDOC_DISTRIBUTE to generate the IDOC
    Please suggest me whether i am doing it in the correct way or not?
    Thanks in Advance,
    Best Regards,
    Phani

    Hi,
    For outbound u need to attach ur FM to the process code in WE41 tcode..I think u r using message control method for ur requirement.please look at the configurations for outbound using message control method.we use we41 (outbound process code) and we use this in the message control tab in the partner profiles. 
    The transaction codes that are required for this method are
    We81
    We30
    We31
    We82
    We21
    We20
    Bd64
    Nace
    Me22n (purchase order), va02 (sales order) etc.
    Ex: purchase order.
    Message type: ORDERS
    Idoc type: ORDERS05
    Outbound process code for purchase order: me10
    Regards,
    Nagaraj

Maybe you are looking for