RE:MAX_ERRORS

Version 9.2
I am trying to run a simple row based mapping so that either all rows are loaded or none. WHat setting of MAX_NO_OF_ERRORS and COMMIT_SIZE/BULK_SIZE will accomplish this?
- simple src to trg map (Insert). I know I can run this in SET based, but just for this example, I am running it in Row based.
- 300K good src rows
- 1 bad row
I have tried a number of settings, including MAX_NO_OF_ERRORS=0 and COMMIT_SIZE = some obscene huge number. And yet all the good rows end up in Target. In this case I wanted nothing to be loaded
What am I doing wrong ? Is this a bug ?

Sounds good to me, I'll give it a try and come back on this one.
Jean-Pierre

Similar Messages

  • Creation of Materials Using MATERIAL_MAINTAIN_DARK

    Hello All,
    Im trying to create Materials using the Function Module MATERIAL_MAINTAIN_DARK in program. Problem is that, In tables of the fuction module amarc_ueb, amakt_ueb and amard_ueb , Im passing 2 records in each tables. But the MARC, MAKT and MARD tables are populated with only one record in each loop pass.
    Please give me suggessions to solve this problem.
    Good answers will be appreciated.
    Thanks in advance.
    Best Regards,
    Sasidhar Reddy Matli.

    Hello Ajay,
    Please find my code below..
    * Create Material - Check for KZ_TEST for test
      CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
       EXPORTING
        flag_muss_pruefen               = 'X'
    *    SPERRMODUS                      = 'E'
        max_errors                      = 0
        p_kz_no_warn                    = 'E'
        kz_prf                          = ' '
        kz_verw                         = 'X'
        kz_aend                         = 'X'
        kz_dispo                        = 'X'
        kz_test                         =  kz_test
        no_database_update              = ' '
        call_mode                       = 'ACT'
    *   CALL_MODE2                      = ' '
        user                            = sy-uname
    *   SUPPRESS_ARRAY_READ             = ' '
    *   FLG_MASS                        = 'X'
    *   DONT_PROCESS_HEADERS            =
    IMPORTING
        matnr_last                      = g_f_matnr_last
        number_errors_transaction       = g_f_number_err
       TABLES
         amara_ueb                       = gt_mara_ueb
         amakt_ueb                       = gt_makt_ueb
         amarc_ueb                       = gt_marc_ueb
         amard_ueb                       = gt_mard_ueb
    *   AMFHM_UEB                       =
    *   AMARM_UEB                       =
    *   AMEA1_UEB                       =
         ambew_ueb                      = gt_mbew_ueb
         asteu_ueb                      = gt_steu_ueb
    *   ASTMM_UEB                       =
    *   AMLGN_UEB                       =
         amlgt_ueb                       = gt_mlgt_ueb
    *   AMPGD_UEB                       =
    *   AMPOP_UEB                       =
    *   AMVEG_UEB                       =
    *   AMVEU_UEB                       =
         amvke_ueb                       = gt_mvke_ueb
    *   ALTX1_UEB                       =
    *   AMPRW_UEB                       =
    *   AMFIELDRES                      =
         amerrdat                        = gt_errs
    EXCEPTIONS
       kstatus_empty                   = 1
       tkstatus_empty                  = 2
       t130m_error                     = 3
       internal_error                  = 4
       too_many_errors                 = 5
       update_error                    = 6
       error_propagate_header          = 7
       OTHERS                          = 8.
      IF NOT ( sy-subrc IS INITIAL ).
        ROLLBACK WORK.
      ELSE.
        COMMIT WORK.
    Best Regards,
    Sasidhar Reddy matli.

  • To Extend material to plant using MATERIAL_MAINTAIN_DARK .

    I am tryin to extend material into plants using MATERIAL_MAINTAIN_DARK  function module.Can someone please check the code below and tell me how i should modify it to work.Is BDC a better option?
    DATA: t_amara_ueb LIKE mara_ueb OCCURS 0 WITH HEADER LINE.
    DATA: t_amarc_ueb LIKE marc_ueb OCCURS 0 WITH HEADER LINE.
    t_amara_ueb-mandt = sy-mandt.
    t_amara_ueb-matnr = it_reqdata-material.
    t_amara_ueb-tcode = 'MM01'.
    t_amara_ueb-tranc = 1.
    APPEND t_amara_ueb.
    CLEAR t_amara_ueb.
    t_amarc_ueb-mandt = sy-mandt.
    t_amarc_ueb-matnr = it_reqdata-material.
    t_amarc_ueb-werks = it_reqdata-plant.
    t_amarc_ueb-tranc = 1.
    t_amarc_ueb-KZKRI = 'X'.
    APPEND t_amarc_ueb.
    CLEAR t_amarc_ueb.
    call function 'MATERIAL_MAINTAIN_DARK'
      exporting
      flag_muss_pruefen = 'X'
    p_kz_no_warn = 'N'
    kz_prf = space
    kz_verw = 'X'
    kz_aend = 'X'
    kz_dispo = 'X'
      tables
       amara_ueb                       = t_amara_ueb
       AMARC_UEB                       = t_AMARC_UEB
    EXCEPTIONS
       KSTATUS_EMPTY                   = 1
       TKSTATUS_EMPTY                  = 2
       T130M_ERROR                     = 3
       INTERNAL_ERROR                  = 4
       TOO_MANY_ERRORS                 = 5
       UPDATE_ERROR                    = 6
       OTHERS                          = 7
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ELSE.
    COMMIT WORK.
    ENDIF.
    Thanks and Regards,
    Pratima.

    Hi ,
    Use the below code.
    DATA : lt_mara_ueb TYPE TABLE OF mara_ueb INITIAL SIZE 0,
           lt_marc_ueb TYPE TABLE OF marc_ueb INITIAL SIZE 0,
           lt_errors TYPE TABLE OF merrdat INITIAL SIZE 0.
    DATA : wa_mara_ueb TYPE mara_ueb,
           wa_marc_ueb TYPE marc_ueb,
           wa_messtab TYPE merrdat.
    DATA : l_mstring(480).
    parameters: l_matnr like mara-matnr.
    * Set up I_MARA
    REFRESH lt_mara_ueb.
    wa_mara_ueb-mandt = sy-mandt.
    wa_mara_ueb-tcode = 'MM01'.
    wa_mara_ueb-matnr = l_matnr.
    wa_mara_ueb-tranc = '0000000001'.
    APPEND wa_mara_ueb TO lt_mara_ueb.
    CLEAR wa_mara_ueb.
    SELECT SINGLE * FROM marc INTO CORRESPONDING FIELDS OF wa_marc_ueb
    WHERE matnr EQ l_matnr AND werks EQ '01FC'.
      IF sy-subrc EQ 0.
        MOVE '01BV' TO wa_marc_ueb-werks.
        wa_marC_ueb-tranc = '0000000001'.
        WA_MARC_UEB-PSTAT = SPACE.
        APPEND wa_marc_ueb TO lt_marc_ueb.
      ENDIF.
      CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
        EXPORTING
    *   FLAG_MUSS_PRUEFEN               = 'X'
    *   SPERRMODUS                      = 'E'
    *   MAX_ERRORS                      = 0
          p_kz_no_warn                    = 'N'
          kz_prf                          = 'W'
    *   KZ_VERW                         = 'X'
    *   KZ_AEND                         = 'X'
    *   KZ_DISPO                        = 'X'
    *   KZ_TEST                         = ' '
    *   NO_DATABASE_UPDATE              = ' '
    *   CALL_MODE                       = ' '
    *   CALL_MODE2                      = ' '
    *   USER                            = SY-UNAME
    *   SUPPRESS_ARRAY_READ             = ' '
    *   FLG_MASS                        = ' '
    * IMPORTING
    *   MATNR_LAST                      =
    *   NUMBER_ERRORS_TRANSACTION       =
        TABLES
          amara_ueb                       = lt_mara_ueb
    *   AMAKT_UEB                       =
          amarc_ueb                       = lt_marc_ueb
    *   AMARD_UEB                       =
    *   AMFHM_UEB                       =
    *   AMARM_UEB                       =
    *   AMEA1_UEB                       =
    *   AMBEW_UEB                       =
    *   ASTEU_UEB                       =
    *   ASTMM_UEB                       =
    *   AMLGN_UEB                       =
    *   AMLGT_UEB                       =
    *   AMPGD_UEB                       =
    *   AMPOP_UEB                       =
    *   AMVEG_UEB                       =
    *   AMVEU_UEB                       =
    *   AMVKE_UEB                       =
    *   ALTX1_UEB                       =
    *   AMPRW_UEB                       =
    *   AMFIELDRES                      =
    *   AMERRDAT                        =
    EXCEPTIONS
       KSTATUS_EMPTY                   = 1
       TKSTATUS_EMPTY                  = 2
       T130M_ERROR                     = 3
       INTERNAL_ERROR                  = 4
       TOO_MANY_ERRORS                 = 5
       UPDATE_ERROR                    = 6
       OTHERS                          = 7
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      COMMIT WORK.
    Regards,
    Raghav

  • BAPI or FM Required to create Material Master

    IS there any BAPI or Function module avaiable in SAP to create Material Master.
    The following Two BAPIs uses Call transaction, which I dont want.
    BAPI_RETAILMATERIAL_CREATE 
    BAPI_STANDARDMATERIAL_CREATE
    Please let me know if any other Function module or BAPI Avaiable in the system.
    Thanks
    Aman

    Yep,  this one works pretty good.
    call function 'MATERIAL_MAINTAIN_DARK'
             exporting
                  sperrmodus                = ' '
                  kz_prf                    = 'W'
                  max_errors                = ' '
                  p_kz_no_warn              = 'X'
                  kz_verw                   = 'X'
                  kz_aend                   = 'X'
                  kz_dispo                  = 'X'
                  kz_test                   = ' '
                  flag_muss_pruefen         = ' '
                  call_mode                 = 'ACT'
             importing
                  number_errors_transaction = numerror
                  matnr_last     = last_matnr
             tables
                 amara_ueb      = i_mara    "Basic Data
    *             amakt_ueb      = i_makt    "Descriptions
                 amarc_ueb      = i_marc    "Plant
    *             amard_ueb      = i_mard    "Storage Location
    *            AMFHM_UEB      = I_MFHM    "Production Tools
    *             amarm_ueb      = i_marm    "Units of Measure
    *            AMEA1_UEB      = I_MEA1    "Internal Mangagement -  EANs
    *             ambew_ueb      = i_mbew    "Accounting/Costing
    *             asteu_ueb      = i_steu    "Tax Data
    *             astmm_ueb      = i_steumm  "Tax Data
    *            AMLGN_UEB      = I_MLGN    "Warehouse Data
    *            AMLGT_UEB      = I_MLGT    "Storage Type Data
    *            AMPGD_UEB      = I_MPGD    "Change Documents
    *            AMPOP_UEB      = I_MPOP    "Forcast Parameters
    *            AMVEG_UEB      = I_MVEG    "Total Consumption Data
    *            AMVEU_UEB      = I_MVEU    "Unplanned Consumption Data
    *             amvke_ueb      = i_mvke    "Sales Data
    *             altx1_ueb      = i_ltx1    "Sales Text
    *            AMPRW_UEB      = I_MPRW    "Forcast Values
                 amfieldres     = i_delfields
                 amerrdat       = i_errors
             exceptions
                  kstatus_empty             = 01
                  tkstatus_empty            = 02
                  t130m_error               = 03
                  internal_error            = 04
                  update_error              = 05
                  too_many_errors           = 06.
    Regards,
    Rich Heilman

  • Problem in BDC with ( MM01-Dynamic views )

    HI
    I am working with BDC on material Mater(mm01).
    Now while Creating Material,there is option of selecting different views based on MaterialType.
    But while recording a BDC i can record it for a particular Material Type.and can select view associated to that particular Material Type.
    Is there any solution to create a bdc progarm which can accept a new material based on
    any material type and having views on user's choice that are given by user in Input file.
    FOr that i think i need to create dynamic views and screen elements for input associated to those views.
    After scanning some sites and forums for this particular problem,i got some help on this:-----
    <b>SELECTION_VIEWS_FIND</b> should be very useful in this case.
    There are three FModules totally involved:
    a) <b>T130M_SINGLE_READ</b>
    Pass TCODE = MM01, and get T130M values
    b) <b>BILDSEQUENZ_IDENTIFY</b>
    Pass KZRFB = 'X',TCODE_REF=T130M-TRREF and get
    BILDSEQUENZ values
    c) <b>SELECTION_VIEWS_FIND</b>
    Pass BILDSEQUENZ and T130M-PSTAT
    Now, this function module holds the values of all the views and the next screen numbers
    But i am unable to interpret the solution..Can somebody Elaborate on this.or provide me some other solution for this.
    Thanks in Advance
    Help Will be appreciated.

    Yes, I agree with Christian.  You are gonna want to use the BAPI or the underlying function module.  It works good and isn't really that complex.  Here is sample program.  Here the function module is being used to change data,  it can also be used to create,  you will have to change the Tcode from MM02 to MM01.
    report zrich_0001.
    data: i_mara type table of mara_ueb with header line.
    data: i_marc type table of marc_ueb with header line.
    data: i_marcx type table of marc with header line.
    parameters: p_matnr type mara-matnr,
                p_plifz type marc-plifz.
    start-of-selection.
    * Get all plants for that material
      select * into corresponding fields of table i_marcx
            from marc where matnr = p_matnr.
    * Now maintain data for each plant
      loop at i_marcx.
    * Reset I_Mara to new material number
        clear i_mara. refresh i_mara.
        select * into corresponding fields of table i_mara
              from mara where matnr = p_matnr.
        read table i_mara index 1.
        i_mara-tcode = 'MM02'.
        i_mara-tranc = '0000000001'.
        modify i_mara index 1.
    * Get Plant Data
        clear i_marc. refresh i_marc.
        select * into corresponding fields of table i_marc
              from marc where matnr = i_marcx-matnr
                          and werks = i_marcx-werks.
        read table i_marc index 1.
        i_marc-plifz  = p_plifz.        " Plan Del time
        i_marc-tranc = '0000000001'.
        modify i_marc index 1.
    * Maintain material
        perform MATERIAL_MAINTAIN_DARK'.
      endloop.
    *  MATERIAL_MAINTAIN_DARK
    form MATERIAL_MAINTAIN_DARK.
    * Variable for "Maintain_Material_Dark" Function Module
      data: numerror like tbist-numerror.
      data: last_matnr type mara-matnr.
      data: i_delfields type table of mfieldres with header line.
      data: i_errors    type table of merrdat   with header line.
      call function 'MATERIAL_MAINTAIN_DARK'
             exporting
                  sperrmodus                = ' '
                  kz_prf                    = 'W'
                  max_errors                = ' '
                  p_kz_no_warn              = 'X'
                  kz_verw                   = 'X'
                  kz_aend                   = 'X'
                  kz_dispo                  = 'X'
                  kz_test                   = ' '
                  flag_muss_pruefen         = ' '
                  call_mode                 = 'ACT'
             importing
                  number_errors_transaction = numerror
                  matnr_last     = last_matnr
             tables
                 amara_ueb      = i_mara    "Basic Data
    *             amakt_ueb      = i_makt    "Descriptions
                 amarc_ueb      = i_marc    "Plant
    *             amard_ueb      = i_mard    "Storage Location
    *            AMFHM_UEB      = I_MFHM    "Production Tools
    *             amarm_ueb      = i_marm    "Units of Measure
    *            AMEA1_UEB      = I_MEA1    "Internal Mangagement -  EANs
    *             ambew_ueb      = i_mbew    "Accounting/Costing
    *             asteu_ueb      = i_steu    "Tax Data
    *             astmm_ueb      = i_steumm  "Tax Data
    *            AMLGN_UEB      = I_MLGN    "Warehouse Data
    *            AMLGT_UEB      = I_MLGT    "Storage Type Data
    *            AMPGD_UEB      = I_MPGD    "Change Documents
    *            AMPOP_UEB      = I_MPOP    "Forcast Parameters
    *            AMVEG_UEB      = I_MVEG    "Total Consumption Data
    *            AMVEU_UEB      = I_MVEU    "Unplanned Consumption Data
    *             amvke_ueb      = i_mvke    "Sales Data
    *             altx1_ueb      = i_ltx1    "Sales Text
    *            AMPRW_UEB      = I_MPRW    "Forcast Values
                 amfieldres     = i_delfields
                 amerrdat       = i_errors
             exceptions
                  kstatus_empty             = 01
                  tkstatus_empty            = 02
                  t130m_error               = 03
                  internal_error            = 04
                  update_error              = 05
                  too_many_errors           = 06.
      if sy-subrc <> 0.
        rollback work.
        call function 'DEQUEUE_ALL'.
      else.
        commit work and wait.
        call function 'DEQUEUE_ALL'.
      endif.
      clear: i_mara, i_marc.
      refresh: i_mara, i_marc.
    endform.
    Regards,
    Rich Heilman

  • Pl. help debug - PLS-00306: wrong number or types of arguments in call

    Hi,
    I am trying to create a wrapper function to all a procedure in Oracle EBusiness Suite 11i.
    When I compile the following code
    ==========
    CREATE OR REPLACE PROCEDURE gme.KIL_ProcessAlloc IS
    vFileName VARCHAR2(30) := '1006251.csv';
    vLoc VARCHAR2(20) := '/u041/applmgr/opm/opmappl/utllog';
    v_InHandle utl_file.file_type;
    vNewLine VARCHAR2(1000);
    vLineNo PLS_INTEGER;
    c1 PLS_INTEGER;
    c2 PLS_INTEGER;
    c3 PLS_INTEGER;
    c4 PLS_INTEGER;
    c5 PLS_INTEGER;
    c6 PLS_INTEGER;
    c7 PLS_INTEGER;
    c8 PLS_INTEGER;
    c9 PLS_INTEGER;
    c10 PLS_INTEGER;
    c11 PLS_INTEGER;
    c12 PLS_INTEGER;
    c13 PLS_INTEGER;
    c14 PLS_INTEGER;
    c15 PLS_INTEGER;
    c16 PLS_INTEGER;
    c17 PLS_INTEGER;
    c18 PLS_INTEGER;
    c19 PLS_INTEGER;
    c20 PLS_INTEGER;
    c21 PLS_INTEGER;
    c22 PLS_INTEGER;
    c23 PLS_INTEGER;
    c24 PLS_INTEGER;
    c25 PLS_INTEGER;
    c26 PLS_INTEGER;
    c27 PLS_INTEGER;
    c28 PLS_INTEGER;
    c29 PLS_INTEGER;
    c30 PLS_INTEGER;
    c31 PLS_INTEGER;
    c32 PLS_INTEGER;
    c33 PLS_INTEGER;
    c34 PLS_INTEGER;
    TYPE AllocArray IS TABLE OF GME_INVENTORY_TXNS_GTMP%ROWTYPE
    INDEX BY BINARY_INTEGER;
    l_Allocdata AllocArray;
    TYPE MtlDetailArray IS TABLE OF gme_material_details%ROWTYPE
    INDEX BY BINARY_INTEGER;
    l_MtlDetaildata MtlDetailArray;
    TYPE xTranArray IS TABLE OF GME_INVENTORY_TXNS_GTMP%ROWTYPE
    INDEX BY BINARY_INTEGER;
    l_xtrandata xTranArray;
    TYPE defTranArray IS TABLE OF GME_INVENTORY_TXNS_GTMP%ROWTYPE
    INDEX BY BINARY_INTEGER;
    l_deftrandata defTranArray;
    t_messagecount number;
    t_messagelist varchar2(10000);
    t_returnstatus varchar2(1);
    BEGIN
    v_InHandle := utl_file.fopen(vLoc, vFileName, 'r');
    vLineNo := 1;
    LOOP
    BEGIN
    utl_file.get_line(v_InHandle, vNewLine);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    EXIT;
    END;
    vNewLine := TRANSLATE(vNewLine, 'A''', 'A');
    c1 := INSTR(vNewLine, ',', 1,1);
    c2 := INSTR(vNewLine, ',', 1,2);
    c3 := INSTR(vNewLine, ',', 1,3);
    c4 := INSTR(vNewLine, ',', 1,4);
    c5 := INSTR(vNewLine, ',', 1,5);
    c6 := INSTR(vNewLine, ',', 1,6);
    c7 := INSTR(vNewLine, ',', 1,7);
    c8 := INSTR(vNewLine, ',', 1,8);
    c9 := INSTR(vNewLine, ',', 1,9);
    c10 := INSTR(vNewLine, ',', 1,10);
    c11 := INSTR(vNewLine, ',', 1,11);
    c12 := INSTR(vNewLine, ',', 1,12);
    c13 := INSTR(vNewLine, ',', 1,13);
    c14 := INSTR(vNewLine, ',', 1,14);
    c15 := INSTR(vNewLine, ',', 1,15);
    c16 := INSTR(vNewLine, ',', 1,16);
    c17 := INSTR(vNewLine, ',', 1,17);
    c18 := INSTR(vNewLine, ',', 1,18);
    c19 := INSTR(vNewLine, ',', 1,19);
    c20 := INSTR(vNewLine, ',', 1,20);
    c21 := INSTR(vNewLine, ',', 1,21);
    c22 := INSTR(vNewLine, ',', 1,22);
    c23 := INSTR(vNewLine, ',', 1,23);
    c24 := INSTR(vNewLine, ',', 1,24);
    c25 := INSTR(vNewLine, ',', 1,25);
    c26 := INSTR(vNewLine, ',', 1,26);
    c27 := INSTR(vNewLine, ',', 1,27);
    c28 := INSTR(vNewLine, ',', 1,28);
    c29 := INSTR(vNewLine, ',', 1,29);
    c30 := INSTR(vNewLine, ',', 1,30);
    c31 := INSTR(vNewLine, ',', 1,31);
    c32 := INSTR(vNewLine, ',', 1,32);
    c33 := INSTR(vNewLine, ',', 1,33);
    c34 := INSTR(vNewLine, ',', 1,34);
    -- l_allocdata(vLineNo).sourceno := SUBSTR(vNewLine,1,c1-1);
    -- l_allocdata(vLineNo).sizeno := SUBSTR(vNewLine,c1+1,c2-c1-1);
    -- l_allocdata(vLineNo).status := SUBSTR(vNewLine,c2+1,c3-c2-1);
    -- l_allocdata(vLineNo).latitude := SUBSTR(vNewLine,c3+1,c4-c3-1);
    -- l_allocdata(vLineNo).longitude := SUBSTR(vNewLine,c4+1,c5-c4-1);
    -- l_allocdata(vLineNo).testfor := SUBSTR(vNewLine,c5+1);
    l_allocdata(vLineNo).trans_id := SUBSTR(vNewLine,1,c1-1);
    l_allocdata(vLineNo).item_id := SUBSTR(vNewLine,c1+1,c2-c1-1);
    l_allocdata(vLineNo).co_code := SUBSTR(vNewLine,c2+1,c3-c2-1);
    l_allocdata(vLineNo).orgn_code := SUBSTR(vNewLine,c3+1,c4-c3-1);
    l_allocdata(vLineNo).whse_code := SUBSTR(vNewLine,c4+1,c5-c4-1);
    l_allocdata(vLineNo).lot_id := SUBSTR(vNewLine,c5+1,c6-c5-1);
    l_allocdata(vLineNo).location := SUBSTR(vNewLine,c6+1,c7-c6-1);
    l_allocdata(vLineNo).doc_id := SUBSTR(vNewLine,c7+1,c8-c7-1);
    l_allocdata(vLineNo).doc_type := SUBSTR(vNewLine,c8+1,c9-c8-1);
    l_allocdata(vLineNo).doc_line := SUBSTR(vNewLine,c9+1,c10-c9-1);
    l_allocdata(vLineNo).line_type := SUBSTR(vNewLine,c10+1,c11-c10-1);
    l_allocdata(vLineNo).reason_code := SUBSTR(vNewLine,c11+1,c12-c11-1);
    l_allocdata(vLineNo).trans_date := SUBSTR(vNewLine,c12+1,c13-c12-1);
    l_allocdata(vLineNo).trans_qty := SUBSTR(vNewLine,c13+1,c14-c13-1);
    l_allocdata(vLineNo).trans_qty2 := SUBSTR(vNewLine,c14+1,c15-c14-1);
    l_allocdata(vLineNo).qc_grade := SUBSTR(vNewLine,c15+1,c16-c15-1);
    l_allocdata(vLineNo).lot_status := SUBSTR(vNewLine,c16+1,c17-c16-1);
    l_allocdata(vLineNo).trans_stat := SUBSTR(vNewLine,c17+1,c18-c17-1);
    l_allocdata(vLineNo).trans_um := SUBSTR(vNewLine,c18+1,c19-c18-1);
    l_allocdata(vLineNo).trans_um2 := SUBSTR(vNewLine,c19+1,c20-c19-1);
    l_allocdata(vLineNo).completed_ind := SUBSTR(vNewLine,c20+1,c21-c20-1);
    l_allocdata(vLineNo).staged_ind := SUBSTR(vNewLine,c21+1,c22-c21-1);
    l_allocdata(vLineNo).gl_posted_ind := SUBSTR(vNewLine,c22+1,c23-c22-1);
    l_allocdata(vLineNo).event_id := SUBSTR(vNewLine,c23+1,c24-c23-1);
    l_allocdata(vLineNo).text_code := SUBSTR(vNewLine,c24+1,c25-c24-1);
    l_allocdata(vLineNo).transaction_no := SUBSTR(vNewLine,c25+1,c26-c25-1);
    l_allocdata(vLineNo).action_code := SUBSTR(vNewLine,c26+1,c27-c26-1);
    l_allocdata(vLineNo).material_detail_id := SUBSTR(vNewLine,c27+1,c28-c27-1);
    l_allocdata(vLineNo).organization_id := SUBSTR(vNewLine,c28+1,c29-c28-1);
    l_allocdata(vLineNo).locator_id := SUBSTR(vNewLine,c29+1,c30-c29-1);
    l_allocdata(vLineNo).subinventory := SUBSTR(vNewLine,c30+1,c31-c30-1);
    l_allocdata(vLineNo).alloc_um := SUBSTR(vNewLine,c31+1,c32-c31-1);
    l_allocdata(vLineNo).alloc_qty := SUBSTR(vNewLine,c32+1,c33-c32-1);
    l_allocdata(vLineNo).def_trans_ind := SUBSTR(vNewLine,c33+1,c34-c33-1);
    vLineNo := vLineNo+1;
    END LOOP;
    utl_file.fclose(v_InHandle);
    FOR i IN 1..vLineNo-1 loop
    GME_API_PUB.insert_line_allocation (
         1,
         100,
         FALSE,
         True,
         l_allocdata(i),
         null,
         null,
         false,
         false,
         false,
         l_MtlDetailData,
         l_xtrandata,
         l_deftrandata,
         t_messagecount,
         t_messagelist,
         t_returnstatus);
    end loop;
         IF (t_returnstatus <> 'S') THEN
    for i IN 1 .. t_messagecount LOOP
    dbms_output.put_line('The text is '||FND_MSG_PUB.get(i,t_messagelist));
    END LOOP;
    END IF;
    -- COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE;
    END KIL_ProcessAlloc;
    ===============
    I get this
    Warning: Procedure created with compilation errors.
    SQL> sho err
    Errors for PROCEDURE GME.KIL_PROCESSALLOC:
    LINE/COL ERROR
    145/8 PLS-00306: wrong number or types of arguments in call to
    'INSERT_LINE_ALLOCATION'
    145/8 PL/SQL: Statement ignored
    =================
    The package specs of GME_API_PU is under:
    ===============
    PROCEDURE insert_line_allocation (
    p_api_version IN NUMBER := gme_api_pub.api_version
    ,p_validation_level IN NUMBER := gme_api_pub.max_errors
    ,p_init_msg_list IN BOOLEAN := FALSE
    ,p_commit IN BOOLEAN := FALSE
    ,p_tran_row IN gme_inventory_txns_gtmp%ROWTYPE
    ,p_lot_no      IN     VARCHAR2 DEFAULT NULL
    ,p_sublot_no      IN     VARCHAR2 DEFAULT NULL
    ,p_create_lot     IN BOOLEAN DEFAULT FALSE
    ,p_ignore_shortage     IN BOOLEAN DEFAULT FALSE
    ,p_scale_phantom     IN BOOLEAN DEFAULT FALSE
    ,x_material_detail     OUT gme_material_details%ROWTYPE
    ,x_tran_row     OUT gme_inventory_txns_gtmp%ROWTYPE
    ,x_def_tran_row     OUT gme_inventory_txns_gtmp%ROWTYPE
    ,x_message_count OUT NUMBER
    ,x_message_list OUT VARCHAR2
    ,x_return_status     OUT VARCHAR2);
    GME_API_PUB.insert_line_allocation
    ===========
    What am I doing wrong...why am I getting PLS-00306.
    Can someone help?
    Thank you
    Sundar
    [email protected]

    Hi John,
    Thanks a ton - a nice Christmas gift. Thank you for being a Santa :-).
    I used the same subscript as the one used for in parameter and the procedure compiled without errors.
    A corollary: If (any of the) Out parameter is null (all columns of the row/array), will the array row element still be stored ? May be I cross the bridge when I come to it.
    Merry Christmas.
    Sundar

  • Create material view with MATERIAL_MAINTAIN_DARK

    Hello !
    I have done a material migration program with FM MATERIAL_MAINTAIN_DARK. The program integrate the basic data, and then each view one by one.
    It works fine except with material with internal number. It creats the basic data but when i use the number generated to create the other view i get this message :
    No external number assignment possible for mat. type GENERIC MATERIALS
    I found this field in mara_ueb : KZ_MAT_RES
    But when i put X in it, it returns that i forgot mandatory data. So I tried to select the data already in MARA and MAKT, but now the message is that the material already exist ! It is true but I want to create another view.
    Here's a piece of my code to help you to understand, the commentary part is what I tried to do to resolved my problem :
      ADD 1 TO v_count.
      ADD 1 TO v_line.
      MOVE v_line TO v_line_c.
    *---MARA
      MOVE sy-mandt TO t_mara_ueb-mandt.
      MOVE 'MM01' TO t_mara_ueb-tcode.
      MOVE v_count TO t_mara_ueb-tranc.
      MOVE k_purcha TO t_mara_ueb-vpsta.
      SELECT COUNT(*) FROM t134 WHERE mtart = t_data_pur-mtart
                                   AND envop = space.
      IF sy-subrc = 0.
        TABLES : mara, makt.
       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
         EXPORTING
           input         = t_data_pur-matnr
        IMPORTING
          OUTPUT        = t_data_pur-matnr.
       SELECT SINGLE * FROM mara WHERE matnr = t_data_pur-matnr.
       MOVE-CORRESPONDING mara TO t_mara_ueb.
       SELECT SINGLE * FROM makt WHERE matnr = t_data_pur-matnr.
       MOVE-CORRESPONDING makt TO t_makt_ueb.
         MOVE 'X' TO t_mara_ueb-KZ_MAT_RES.
      ENDIF.
      MOVE t_data_pur-matnr TO t_mara_ueb-matnr.
      MOVE t_data_pur-mbrsh TO t_mara_ueb-mbrsh.
      MOVE t_data_pur-mtart TO t_mara_ueb-mtart.
      MOVE t_data_pur-ekwsl TO t_mara_ueb-ekwsl.
      APPEND t_mara_ueb.
    *---MARC
      MOVE sy-mandt TO t_marc_ueb-mandt.
      MOVE v_count TO t_marc_ueb-tranc.
      MOVE t_data_pur-matnr TO t_marc_ueb-matnr.
      MOVE t_data_pur-werks TO t_marc_ueb-werks.
      MOVE t_data_pur-ekgrp TO t_marc_ueb-ekgrp.
      MOVE t_data_pur-mmsta TO t_marc_ueb-mmsta.
      MOVE t_data_pur-mmstd TO t_marc_ueb-mmstd.
      MOVE t_data_pur-webaz TO t_marc_ueb-webaz.
      MOVE t_data_pur-kordb TO t_marc_ueb-kordb.
      MOVE t_data_pur-usequ TO t_marc_ueb-usequ.
      APPEND t_marc_ueb.
    *---!!! Call FUNCTION MODULE !!!
      CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
        EXPORTING
        FLAG_MUSS_PRUEFEN               = 'X'
        SPERRMODUS                      = 'E'
        MAX_ERRORS                      = 0
         p_kz_no_warn                    = 'X'
         kz_prf                          = space
        KZ_VERW                         = 'X'
        KZ_AEND                         = 'X'
        KZ_DISPO                        = 'X'
         kz_test                         = lv_test
        NO_DATABASE_UPDATE              = ' '
         call_mode                       = ' '   "OR RMD OR space OR BAP
        CALL_MODE2                      = ' '
         user                            = sy-uname
        SUPPRESS_ARRAY_READ             = ' '
        FLG_MASS                        = ' '
        IMPORTING
         matnr_last                      = lv_matnr
         number_errors_transaction       = lv_nb_error
        TABLES
         amara_ueb                       = t_mara_ueb
         amakt_ueb                       = t_makt_ueb
         amarc_ueb                       = t_marc_ueb
         amard_ueb                       = t_mard_ueb
        AMFHM_UEB                       =
        AMARM_UEB                       =
        AMEA1_UEB                       =
         ambew_ueb                       = t_mbew_ueb
         asteu_ueb                       = t_steu_ueb
        ASTMM_UEB                       =
         amlgn_ueb                       = t_mlgn_ueb
         amlgt_ueb                       = t_mlgt_ueb
        AMPGD_UEB                       =
         ampop_ueb                       = t_mpop_ueb
        AMVEG_UEB                       =
        AMVEU_UEB                       =
         amvke_ueb                       = t_mvke_ueb
        ALTX1_UEB                       =
        AMPRW_UEB                       =
        AMFIELDRES                      =
         amerrdat                        = t_amerrdat
       EXCEPTIONS
         kstatus_empty                   = 1
         tkstatus_empty                  = 2
         t130m_error                     = 3
         internal_error                  = 4
         too_many_errors                 = 5
         update_error                    = 6
         OTHERS                          = 7.
    I really need you help !
    thank you in advance.

    OK I found the answer !
    It is because the matnr generate add 00000... before the number. So I have to add it for the other view. But it is not the case for material number define externally. And the message was not comprensive.
    *---MARA
      MOVE sy-mandt TO t_mara_ueb-mandt.
      MOVE 'MM01' TO t_mara_ueb-tcode.
      MOVE v_count TO t_mara_ueb-tranc.
      MOVE k_purcha TO t_mara_ueb-vpsta.
      SELECT COUNT(*) FROM t134 WHERE mtart = t_data_pur-mtart
                                  AND envop = space.
      IF sy-subrc = 0.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
                  input  = t_data_pur-matnr
             IMPORTING
                  output = t_data_pur-matnr.
      ENDIF.
      MOVE t_data_pur-matnr TO t_mara_ueb-matnr.
      MOVE t_data_pur-mbrsh TO t_mara_ueb-mbrsh.
      MOVE t_data_pur-mtart TO t_mara_ueb-mtart.
      MOVE t_data_pur-ekwsl TO t_mara_ueb-ekwsl.
      APPEND t_mara_ueb.
    *---MARC
      MOVE sy-mandt TO t_marc_ueb-mandt.
      MOVE v_count TO t_marc_ueb-tranc.
      MOVE t_data_pur-matnr TO t_marc_ueb-matnr.
      MOVE t_data_pur-werks TO t_marc_ueb-werks.
      MOVE t_data_pur-ekgrp TO t_marc_ueb-ekgrp.
      MOVE t_data_pur-mmsta TO t_marc_ueb-mmsta.
      MOVE t_data_pur-mmstd TO t_marc_ueb-mmstd.
      MOVE t_data_pur-webaz TO t_marc_ueb-webaz.
      MOVE t_data_pur-kordb TO t_marc_ueb-kordb.
      MOVE t_data_pur-usequ TO t_marc_ueb-usequ.
      APPEND t_marc_ueb.
    Edited by: Louis-Arnaud Bouquin on Mar 5, 2008 3:04 PM

  • Want to transfer data via idocs from one  R/3 to different R/3

    Hi!!
    May i hav nay step by step pdf which gives the complete flow of how to transfer idocs from from one  R/3 to different R/3.
    Though i have the basics steps but some where I m stuck.
    Also I have two doubts::
    1.Is thr Any relation bw port name and Logical System name?Can they be same.??I  hav kept Logical System name as SAPE60 AND PORT name also as SAPE60(in e60) and  SAPEI6(in ei6) servers respectively.
    2.Should the Logical System names be maintained same in both the servers??
    Kindly respond .
    Helpful answers will be rewarded points!!!

    Hi Deepika ,
    See the Example scenarios
    MASTER DATA TRANSFERMATION BETWEEN 2 DIFF CLIENTS
    •     For this scenario Client 800 is the Sender and 810 is the receiving system
    1. Creating Logical Systems
    o     Login using 800 client
    o     Go to T. Code SALE
    o     Expand Sending and Receiving Systems
    o     Expand Logical Systems
    o     Click on Define Logical System
    o     Click on New Entries
    o     Create STUD_S, STUD_R Logical Systems
    o     Save and come back
    o     Assign the STUD_S Logical System to client 800
    o     Assign the STUD_R Logical System to client 810
    2. Creating the RFCs
    o     Go to T. Code SM59
    o     Expand R/3 Connections
    o     Enter RFC Name as STUD_S
    o     Connection Type as 3
    o     Language as EN
    o     Client as 800
    o     User as  SAPUSER
    o     PWD as abap
    o     Target host as sap
    o     Click on Remote logon button to test the RFC
    o     Enter RFC Name as STUD_R
    o     Connection Type as 3
    o     Language as EN
    o     Client as 800
    o     User as  SATISH
    o     PWD as abap
    o     Target host as sap
    o     Click on Remote logon button to test the RFC
    3. Creating the Message Type
    o     Go to T. Code WE81
    o     Click on change, continue
    o     Click on New Entries button
    o     Give message type as ZBAPI_STUD_MAS and description
    o     Save and back
    4. Creating the Segment
    o     Go to T. Code WE31
    o     Give segment name as ZBAPI_STUD_SEG
    o     Enter Short Text
    o     Enter the Field Name and Data Element in the text boxes
    o     Save, continue,
    o     Click on Edit -> Set Release.
    5. Creating the Basic IDOC Object
    o     Go to T. code WE30
    o     Give obj. name as ZBAPI_STUD_IDOC
    o     Click on create
    o     Select create new radio button, give description and continue
    o     Select the IDOC obj name and click on create button
    o     Enter the segment name which is create earlier
    o     Select the check box if you want to make the segment mandatory
    o     Enter 1 in minimum number 99999 in maximum number, continue
    o     Save and back
    o     Click on Edit -> Set Release
    6. Creating Customer Distribution Model
    o     Go to T. Code BD64
    o     Click on change and Create model view button
    o     Enter the short text and Technical name as ZSTUDENT
    o     Select the model and click on Add Message Type Button
    o     Give the Sender as STUD_S,
    o                    Receiver as STUD_R,
    o                    Message Type as ZBAPI_STUD_MAS
    o     Select the model view & click on Environment -> Generate Partner Profiles
    o     Select Transfer IDOC Immediately and Trigger Immediately radio buttons
    o     Click on Execute
    o     You should get a list in green color which means it executed successfully.
    o     Back to main screen, select the model view
    o     Click Edit->Model view->Distribute
    o     Click on continue
    o     You should get a list saying model view is distributed successfully.
    7. Checking the Port
    o     Go to T. Code WE21
    o     Expand Transactional RFC
    o     Find the port from the list which is created using BD64 for STUD_R (Receiving system) RFC Destination.
    8. Checking the Partner Profiles.
    o     Go to T. Code WE20
    o     Expand Partner Type LS
    o     Select the Partner profile STUD_R
    o     Double click on Message Type ZBAPI_STUD_MAS in Outbound parmtrs.
    o     Check Receiver Port is assigned correctly
    o     Check the Basic type as your Basic IDOC object.
    9. Assigning the Message Type to Basic IDOC Object
    o     Go to T. Code WE82
    o     Click on Change & continue, New Entries button
    o     Give the Message type as ZBAPI_STUD_MAS
    o     Give Basic Type as ZBAPI_STUD_IDOC
    o     Release as 46C
    o     Save and back
    10. Creating Inbound Function Module (Posting Program)
    o     Go to T. Code SE37
    o     Create a function Module IDOC_INPUT_ZBAPI_STUD_MAS
    o     Set the Processing type as Remote Enabled Module and mode as start immed, in Attributes Tab.
    o     Import Parameters
    INPUT_METHOD                 LIKE     BDWFAP_PAR-INPUTMETHD
    MASS_PROCESSING     LIKE     BDWFAP_PAR-MASS_PROC
    NO_APPLICATION_LOG     LIKE     SY-DATAR
    MASSSAVEINFOS                 LIKE     MASSSAVINF
    o     Export Parameters
    WORKFLOW_RESULT          LIKE     BDWF_PARAM-RESULT
    APPLICATION_VARIABLE     LIKE     BDWF_PARAM-APPL_VAR
    IN_UPDATE_TASK          LIKE     BDWFAP_PAR-UPDATETASK
    CALL_TRANSACTION_DONE  LIKE     BDWFAP_PAR-CALLTRANS
    o     Tables
    IDOC_CONTRL     LIKE     EDIDC
    IDOC_DATA          LIKE     EDIDD
    IDOC_STATUS     LIKE     BDIDOCSTAT
    RETURN_VARIABLES     LIKE     BDWFRETVAR
    SERIALIZATION_INFO     LIKE     BDI_SER
    o     Exceptions
    WRONG_FUNCTION_CALLED
    o     Source Code
    DATA: FIRST_TRANC LIKE MARA_UEB-TRANC,
          ZBAPI_STUD_SEG like zbapi_stud.
    DATA: ZBAPI_STUD LIKE ZBAPI_STUD.
      DATA: I_ZBAPI_STUD LIKE ZBAPI_STUD.
      DATA: C_TRUE                         VALUE 'X'.
      DATA: C_FALSE                        VALUE ' '.
    DATA: BEGIN OF T_IDOC_ROLLNO OCCURS 0,
            DOCNUM LIKE EDIDC-DOCNUM,
            ROLLNO LIKE ZBAPI_STUD-ROLLNO,
          END   OF T_IDOC_ROLLNO.
      DEFINE APPEND_RESFIELDS.
        PERFORM APPEND_RES_FIELDS TABLES T_MFIELDRES
                                         T_RES_FIELDS
                                  USING  &1
                                         COUNTER-D_IND.
      END-OF-DEFINITION.
      DATA: I_MARA_UEB LIKE MARA_UEB.
      DATA: I_ZSTUD_UEB LIKE ZBAPI_STUD.
      DATA: I_MAKT_UEB LIKE MAKT_UEB.
      DATA: I_MARC_UEB LIKE MARC_UEB.
      DATA: I_MARD_UEB LIKE MARD_UEB.
      DATA: I_MFHM_UEB LIKE MFHM_UEB.
      DATA: I_MARM_UEB LIKE MARM_UEB.
      DATA: I_MEAN_UEB LIKE MEA1_UEB.
      DATA: I_MBEW_UEB LIKE MBEW_UEB.
      DATA: I_STEU_UEB LIKE STEU_UEB.
      DATA: I_STEUMM_UEB LIKE STEUMM_UEB.
      DATA: I_MLGN_UEB LIKE MLGN_UEB.
      DATA: I_MLGT_UEB LIKE MLGT_UEB.      " //br010797 neu zu 4.0
      DATA: I_MPGD_UEB LIKE MPGD_UEB.
      DATA: I_MPOP_UEB LIKE MPOP_UEB.
      DATA: I_MVEG_UEB LIKE MVEG_UEB.
      DATA: I_MVEU_UEB LIKE MVEU_UEB.
      DATA: I_MVKE_UEB LIKE MVKE_UEB.
      DATA: I_MPRW_UEB LIKE MPRW_UEB.
      DATA: I_LTX1_UEB LIKE LTX1_UEB.
      DATA: HELP_MARC_UEB LIKE MARC_UEB.
      DATA: T_MARA_UEB LIKE MARA_UEB OCCURS 0.
      DATA: T_MAKT_UEB LIKE MAKT_UEB OCCURS 0.
      DATA: T_MARC_UEB LIKE MARC_UEB OCCURS 0.
      DATA: T_MARD_UEB LIKE MARD_UEB OCCURS 0.
      DATA: T_MFHM_UEB LIKE MFHM_UEB OCCURS 0.
      DATA: T_MARM_UEB LIKE MARM_UEB OCCURS 0.
      DATA: T_MEAN_UEB LIKE MEA1_UEB OCCURS 0.
      DATA: T_MBEW_UEB LIKE MBEW_UEB OCCURS 0.
      DATA: T_STEU_UEB LIKE STEU_UEB OCCURS 0.
      DATA: T_STEUMM_UEB LIKE STEUMM_UEB OCCURS 0.
      DATA: T_MLGN_UEB LIKE MLGN_UEB OCCURS 0.
      DATA: T_MLGT_UEB LIKE MLGT_UEB OCCURS 0.    " //br010797 neu zu 4.0
      DATA: T_MPGD_UEB LIKE MPGD_UEB OCCURS 0.
      DATA: T_MPOP_UEB LIKE MPOP_UEB OCCURS 0.
      DATA: T_MVEG_UEB LIKE MVEG_UEB OCCURS 0.
      DATA: T_MVEU_UEB LIKE MVEU_UEB OCCURS 0.
      DATA: T_MVKE_UEB LIKE MVKE_UEB OCCURS 0.
      DATA: T_MPRW_UEB LIKE MPRW_UEB OCCURS 0.
      DATA: T_LTX1_UEB LIKE LTX1_UEB OCCURS 0.
    Internal fields/ tables
    DATA: FLAG_ERROR_HAPPENED.
    DATA: flag_material_exists. "//br210397 zu 4.0 keine Verwendung mehr
      DATA: FLAG_EXIT_TO_BE_DONE.
      DATA: HELP_TABIX LIKE SY-TABIX.
      DATA: HELP_TRANC LIKE MARA_UEB-TRANC.
      DATA: HELP_ALAND LIKE STEU_UEB-ALAND.
      DATA: HELP_VKORG LIKE MVKE-VKORG.
      DATA: HELP_WERKS LIKE T001W-WERKS.
      DATA: HELP_LFDNR LIKE STEU_UEB-LFDNR.
      DATA: LAST_MARC_TRANC LIKE MARA_UEB-TRANC.
      DATA: LAST_MLGN_TRANC LIKE MARA_UEB-TRANC.    " //br010797 neu zu 4.0
      DATA: LAST_TEXT_TRANC LIKE MARA_UEB-TRANC.
      DATA: CURRENT_TABIX LIKE SY-TABIX.
      DATA: GENERAL_SUBRC LIKE SY-SUBRC.
      DATA: HELP_FACTOR TYPE P DECIMALS 3.
      DATA: USER_SEGMENTS LIKE EDIDD OCCURS 0 WITH HEADER LINE.  " insert
      DATA: CUST_SEGMENT LIKE EDIDD.
      DATA: I_MFIELDRES LIKE MFIELDRES.
    DATA: I_MERRDAT LIKE MERRDAT.
      DATA: I_EDIDD LIKE EDIDD.
                                           " //br neu zu 3.1g
      DATA: T_RES_FIELDS LIKE DELFIELDS OCCURS 0 WITH HEADER LINE.
      DATA: T_MFIELDRES LIKE MFIELDRES OCCURS 0.
      DATA: T_MERRDAT LIKE MERRDAT OCCURS 0.
      DATA: T_EDIDD LIKE EDIDD OCCURS 0.
    DATA: BEGIN OF t_matnr OCCURS 0, "//br210397 zu 4.0
            matnr LIKE mara-matnr,   " wird nicht mehr verwendet
          END OF t_matnr.            "
      DATA: BEGIN OF COUNTER,
              TRANC LIKE MARA_UEB-TRANC,
              D_IND LIKE MARA_UEB-D_IND,
            END OF COUNTER.
    DATA: BEGIN OF t_idoc_tranc OCCURS 0,                          " 4.0
            docnum LIKE edidc-docnum,                              "
            tranc  LIKE mara_ueb-tranc,                            "
          END OF t_idoc_tranc.                                     "
      DATA T_IDOC_TRANC LIKE MATIDOCTRANC OCCURS 0 WITH HEADER LINE."
      DATA: FLAG_FITS.
      DATA: APPLICATION_SUBRC LIKE SY-SUBRC.
      DATA FLAG_MUSS_PRUEFEN LIKE SY-DATAR.
      DATA MAX_ERRORS LIKE T130S-ANZUM.    " 4.0
    note 419281
      DATA : FLG_MASS.
      CLEAR : FLG_MASS.
      FIELD-SYMBOLS: .            " 4.0
    ALE-distribution unity : IDOC status set by locking      "note0361838
      data:                                                     "note0361838
        it_dsp_idocstat like bdidocstat                         "note0361838
          occurs 0 with header line.                            "note0361838
    Initialize data - general
      REFRESH T_MFIELDRES.
      REFRESH T_IDOC_TRANC.
      REFRESH T_IDOC_TRANC.                "JH/02.02.98/4.0C  KPr100004993
    REFRESH t_idoc_tranc_segment.   " //br 40 : unnötig
    REFRESH matnr_tranc.            "    -"-
    REFRESH t_matnr.
      COUNTER-TRANC = 1.
      COUNTER-D_IND = 1.
      REFRESH T_MARA_UEB.
      REFRESH T_MAKT_UEB.
      REFRESH T_MARC_UEB.
      REFRESH T_MARD_UEB.
      REFRESH T_MFHM_UEB.
      REFRESH T_MARM_UEB.
      REFRESH T_MEAN_UEB.
      REFRESH T_MBEW_UEB.
      REFRESH T_STEU_UEB.
      REFRESH T_STEUMM_UEB.
      REFRESH T_MLGN_UEB.
      REFRESH T_MLGT_UEB.                  " //br010797 neu zu 4.0
      REFRESH T_MPGD_UEB.
      REFRESH T_MPOP_UEB.
      REFRESH T_MVEG_UEB.
      REFRESH T_MVEU_UEB.
      REFRESH T_MVKE_UEB.
      REFRESH T_MPRW_UEB.
    REFRESH VKORG_ALAND.
    REFRESH WERKS_ALAND.
      CLEAR APPLICATION_SUBRC.
      REFRESH T_MERRDAT.
    Check if right function is called
      READ TABLE IDOC_CONTRL INDEX 1.
      IF SY-SUBRC <> 0.
        EXIT.
      ELSE.
        IF  IDOC_CONTRL-IDOCTP <> 'ZBAPI_STUD_IDOC'.
          RAISE WRONG_FUNCTION_CALLED.
        ENDIF.
      ENDIF.
      LOOP AT IDOC_CONTRL.
      Initialize data - per IDOC
      t_idoc_tranc-docnum = counter-tranc.
        T_IDOC_TRANC-DOCNUM = IDOC_CONTRL-DOCNUM.
        T_IDOC_TRANC-FIRST_TRANC_IDOC = COUNTER-TRANC + 2.
        APPEND T_IDOC_TRANC.
      Select segments which belong to IDOC
        REFRESH T_EDIDD.
        LOOP AT IDOC_DATA WHERE DOCNUM = IDOC_CONTRL-DOCNUM.
          APPEND IDOC_DATA TO T_EDIDD.
        ENDLOOP.
       BUSINESS TRANSACTION EVENT (header / data)         "note0388000
         call function 'OPEN_FI_PERFORM_MGV00200_E'         "note0388000
              exporting                                     "note0388000
                  idoc_header       = idoc_contrl           "note0388000
                  FLG_APPEND_STATUS = 'X'                   "note0388000
              tables                                        "note0388000
    (DEL)       idoc_data         = idoc_data "note0388000 note0418561
                  idoc_data         = t_edidd               "note0418561
                  idoc_status       = idoc_status           "note0388000
              exceptions                                    "note0388000
                  others       = 1.                         "note0388000
         if sy-subrc = 1.                                   "note0388000
            continue.                                       "note0388000
         endif.                                             "note0388000
      Within one IDOC: loop through data segments:
      Prepare internal tables for the current material
        LOOP AT T_EDIDD INTO IDOC_DATA.
        Transform from CoreData to Normal Data if necesary
          CASE IDOC_DATA-SEGNAM.
           WHEN 'E1MARAC'.
    *--COMMENTED BY SATISH
             PERFORM MOVE_E1MARAC_TO_E1MARAM USING IDOC_DATA.
           WHEN 'E1MAKTC'.
             PERFORM MOVE_E1MAKTC_TO_E1MAKTM USING IDOC_DATA.
    *--COMMENTES ENDED BY SATISH
             WHEN 'ZBAPI_STUD_SEG'.
              PERFORM MOVE_E1MARAC_TO_E1MARAM USING IDOC_DATA.
                CLEAR I_ZBAPI_STUD.
    Second: Move E1MARAC into E1MARAM
                I_ZBAPI_STUD = IDOC_DATA-SDATA.
    Third: Move E1MARAM back into IDOC-line
                IDOC_DATA-SDATA =  I_ZBAPI_STUD.
                IDOC_DATA-SEGNAM = 'ZBAPI_STUD_SEG'.
          ENDCASE.
          CURRENT_TABIX = SY-TABIX.
          COUNTER-D_IND = COUNTER-D_IND + 1.
          COUNTER-TRANC = COUNTER-TRANC + 2.
          CASE IDOC_DATA-SEGNAM.
             WHEN 'ZBAPI_STUD_SEG'.
            Initialize data - per material
              COUNTER-D_IND = 1.
              FIRST_TRANC = COUNTER-TRANC.
            interpret segment
              ZBAPI_STUD_SEG = IDOC_DATA-SDATA.
              MOVE-CORRESPONDING ZBAPI_STUD TO I_ZSTUD_UEB.
              T_IDOC_ROLLNO-DOCNUM  = IDOC_CONTRL-DOCNUM.
              T_IDOC_ROLLNO-ROLLNO  = I_ZSTUD_UEB-ROLLNO.
              APPEND T_IDOC_ROLLNO.
           ENDCASE.
                if not ZBAPI_STUD_SEG is initial.
                 ZBAPI_STUD-MANDT  = ZBAPI_STUD_SEG-MANDT.
                 ZBAPI_STUD-ROLLNO = ZBAPI_STUD_SEG-ROLLNO.
                 ZBAPI_STUD-FNAME  = ZBAPI_STUD_SEG-FNAME.
                 ZBAPI_STUD-LNAME  = ZBAPI_STUD_SEG-LNAME.
                  INSERT ZBAPI_STUD FROM ZBAPI_STUD_SEG.
                  COMMIT WORK.
                ENDIF.
    *-- ALE ditribution unity : update IDOC status                "note03618
          LOOP AT it_dsp_idocstat.                                  "note036
             LOOP AT IDOC_STATUS WHERE DOCNUM = it_dsp_idocstat.    "note036
                DELETE idoc_status INDEX sy-tabix.                  "note036
             ENDLOOP.                                               "note036
             APPEND it_dsp_idocstat TO idoc_status.                 "note036
          ENDLOOP.                                                  "note036
    *--GENERATING THE IDOC STATUS
      PERFORM HANDLE_ERROR_EXT             " //br40
                  TABLES                                        "
                     IDOC_CONTRL                                "
                     IDOC_STATUS                                "
                     RETURN_VARIABLES                           "
                     T_MERRDAT                                  "
                     T_IDOC_TRANC                               "
                     T_IDOC_ROLLNO          "JH/4.0C/KPr100004993
                  USING                                         "
                     GENERAL_SUBRC                              "
                     NO_APPLICATION_LOG                         "
                     MASSSAVEINFOS         "wk/40c
                  CHANGING                                      "
                     WORKFLOW_RESULT.                           "
                  PERFORM HANDLE_ERROR
                              TABLES
                                 IDOC_CONTRL
                                 IDOC_STATUS
                                 RETURN_VARIABLES
                                 T_MERRDAT
                                 T_IDOC_ROLLNO     "JH/4.0C/KPr100004993
                              USING
                                 APPLICATION_SUBRC
                              CHANGING
                                 WORKFLOW_RESULT.
      SORT T_IDOC_ROLLNO BY ROLLNO. "note 315124
    React on general error
      DATA: I_MERRDAT LIKE MERRDAT.
      IF GENERAL_SUBRC <> 0.
        I_MERRDAT-MSGTY = 'E'.
        I_MERRDAT-MSGID = SY-MSGID.
        I_MERRDAT-MSGNO = SY-MSGNO.
        I_MERRDAT-MSGV1 = SY-MSGV1.
        I_MERRDAT-MSGV2 = SY-MSGV2.
        I_MERRDAT-MSGV3 = SY-MSGV3.
        I_MERRDAT-MSGV4 = SY-MSGV4.
        APPEND I_MERRDAT TO T_MERRDAT.
      ENDIF.
      LOOP AT T_MERRDAT INTO  I_MERRDAT
                        WHERE MSGTY = 'S'  "success
                        OR    MSGTY = 'D'  "dummy
                        OR    MSGTY = 'I'  "Information " //br011097 zu 3.1I
                        OR    MSGTY = 'H'  "dummy       " 4.0
                        OR    MSGTY = 'W'. "warning
        DELETE T_MERRDAT.
      ENDLOOP.
        ENDLOOP.
      ENDLOOP.
    ENDFUNCTION.
    *&      Form  handle_error_ext
    FORM HANDLE_ERROR_EXT
            TABLES
               IDOC_CONTRL                   STRUCTURE EDIDC
               IDOC_STATUS                   STRUCTURE BDIDOCSTAT
               RETURN_VARIABLES              STRUCTURE BDWFRETVAR
               T_MERRDAT                     STRUCTURE MERRDAT
               IDOC_TRANC                    STRUCTURE MATIDOCTRANC
    JH/02.02.98/4.0C  KPr100004993 (Anfang)
               T_IDOC_ROLLNO                 STRUCTURE T_IDOC_ROLLNO
    JH/02.02.98/4.0C  KPr100004993 (Ende)
            USING
               GENERAL_SUBRC                 LIKE SY-SUBRC
               NO_APPLICATION_LOG            LIKE SY-DATAR
               MASSSAVEINFOS                 LIKE MASSSAVINF
            CHANGING
               WORKFLOW_RESULT               LIKE BDWF_PARAM-RESULT.
      DATA FLAG_ERROR_HAPPENED.
      DATA I_MERRDAT LIKE MERRDAT.
      DATA IDOC_INDEX_2_SUBRC LIKE SY-SUBRC.
      DATA AL_HANDLES TYPE BAL_T_LOGH. "//br99
      SORT T_IDOC_ROLLNO BY ROLLNO.                        "note 315124
    React on general error
      IF GENERAL_SUBRC <> 0.
        REFRESH T_MERRDAT.
      i_merrdat-tranc = 0.                              " //br261197
        READ TABLE IDOC_TRANC INDEX 1.     " zu 40b
        I_MERRDAT-TRANC = IDOC_TRANC-FIRST_TRANC_IDOC.          "
        I_MERRDAT-MSGTY = 'E'.
        I_MERRDAT-MSGID = SY-MSGID.
        I_MERRDAT-MSGNO = SY-MSGNO.
        I_MERRDAT-MSGV1 = SY-MSGV1. I_MERRDAT-MSGV2 = SY-MSGV2.
        I_MERRDAT-MSGV3 = SY-MSGV3. I_MERRDAT-MSGV4 = SY-MSGV4.
        APPEND I_MERRDAT TO T_MERRDAT.
      ENDIF.
    DATA: C_TRUE,
          C_FALSE VALUE 'X'.
    If error happened ==> Rollback whole work....
      LOOP AT T_MERRDAT INTO I_MERRDAT WHERE MSGTY NA 'SDHWI'.
        EXIT.
      ENDLOOP.
      IF SY-SUBRC = 0.
        FLAG_ERROR_HAPPENED = C_TRUE.
        ROLLBACK WORK.
      ELSE.
        FLAG_ERROR_HAPPENED = C_FALSE.
      ENDIF.
    Set IDOC status
    two cases:
    single IDOC-processing: ==> error can be written in IDOC status
    package processing ==> anononymous "package error" for all IDOCs
      READ TABLE IDOC_CONTRL INDEX 2.
      IDOC_INDEX_2_SUBRC = SY-SUBRC.
      IF SY-SUBRC = 0.
        IF 1 = 2.                          "//br40
          MESSAGE E051(B1).                                     "
        ENDIF.                                                  "
        CLEAR I_MERRDAT.
        I_MERRDAT-MSGID = 'B1'.
        I_MERRDAT-MSGTY = 'E'.
        I_MERRDAT-MSGNO = '051'.
      ENDIF.
      IF IDOC_INDEX_2_SUBRC NE 0 OR FLAG_ERROR_HAPPENED = C_FALSE.
      Nur in diesen Fällen wird Application Log geschrieben
      Delete all Successes and Dummy records from t_merrdat
      DELETE t_merrdat WHERE msgty = 'S'  "success         " testweise
                       OR    msgty = 'D'. "dummy           "
        LOOP AT T_MERRDAT INTO I_MERRDAT WHERE MSGTY = 'D'.     "
          I_MERRDAT-MSGTY = 'S'.                                "
          MODIFY T_MERRDAT FROM I_MERRDAT.                      "
        ENDLOOP.                                                "
      ENDIF.
      WORKFLOW_RESULT = 0.
      LOOP AT IDOC_CONTRL.
      Set IDOC status
        CLEAR IDOC_STATUS.
        IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
        IF FLAG_ERROR_HAPPENED = C_FALSE.
    Application log
          PERFORM WRITE_APPL_LOG TABLES IDOC_TRANC
                                        T_MERRDAT
                                        IDOC_STATUS
                                 USING  IDOC_CONTRL
                                        FLAG_ERROR_HAPPENED
                                        NO_APPLICATION_LOG
                                        MASSSAVEINFOS
                                        AL_HANDLES.
        idoc_status-status = '53'.       "OK!
        APPEND idoc_status.
    JH/02.02.98/4.0C  KPr100004993 (Anfang)
        Fill Return variables
          CLEAR RETURN_VARIABLES.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
          RETURN_VARIABLES-WF_PARAM = 'Processed_IDOCs'.
          APPEND RETURN_VARIABLES.
        Verknüpfungseintrag anlegen
          READ TABLE T_IDOC_ROLLNO WITH KEY ROLLNO = IDOC_CONTRL-DOCNUM
                                  BINARY SEARCH.
          IF SY-SUBRC = 0.
            RETURN_VARIABLES-DOC_NUMBER = T_IDOC_ROLLNO-ROLLNO.
            RETURN_VARIABLES-WF_PARAM = 'Appl_Objects'.
            APPEND RETURN_VARIABLES.
          ENDIF.
    JH/02.02.98/4.0C  KPr100004993 (Ende)
        ELSE.
          IF IDOC_INDEX_2_SUBRC NE 0.
    Application Log
            PERFORM WRITE_APPL_LOG TABLES IDOC_TRANC
                                          T_MERRDAT
                                          IDOC_STATUS
                                   USING  IDOC_CONTRL
                                          FLAG_ERROR_HAPPENED
                                          NO_APPLICATION_LOG
                                          MASSSAVEINFOS
                                          AL_HANDLES.
          ELSE.
            IDOC_STATUS-MSGID = I_MERRDAT-MSGID.
            IDOC_STATUS-MSGTY = I_MERRDAT-MSGTY.
            IDOC_STATUS-MSGNO = I_MERRDAT-MSGNO.
            IDOC_STATUS-MSGV1 = I_MERRDAT-MSGV1.
            IDOC_STATUS-MSGV2 = I_MERRDAT-MSGV2.
            IDOC_STATUS-MSGV3 = I_MERRDAT-MSGV3.
            IDOC_STATUS-MSGV4 = I_MERRDAT-MSGV4.
            IDOC_STATUS-STATUS = '51'.     "ERROR!
            APPEND IDOC_STATUS.
          ENDIF.
        Fill Return variables
          CLEAR RETURN_VARIABLES.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
        return_variables-wf_param = c_wf_par_processed_idocs.
          RETURN_VARIABLES-WF_PARAM = 'Error_IDOCs'.
          APPEND RETURN_VARIABLES.
          WORKFLOW_RESULT = 99999.
        ENDIF.
      APPEND idoc_status.
      ENDLOOP.
      IF NO_APPLICATION_LOG IS INITIAL.
        CALL FUNCTION 'BAL_DB_SAVE'                           "//br99
             EXPORTING
                  I_IN_UPDATE_TASK = ' '
                  I_SAVE_ALL       = ' '
                  I_T_LOG_HANDLE   = AL_HANDLES.
           EXCEPTIONS
                LOG_NOT_FOUND    = 1
                SAVE_NOT_ALLOWED = 2
                NUMBERING_ERROR  = 3
                OTHERS           = 4.
        CALL FUNCTION 'BAL_GLB_MEMORY_REFRESH'                "//br99
             EXPORTING
                I_AUTHORIZATION          =
                  I_REFRESH_ALL            = ' '
                  I_T_LOGS_TO_BE_REFRESHED = AL_HANDLES.
           EXCEPTIONS
                NOT_AUTHORIZED           = 1
                OTHERS                   = 2
      ENDIF.
    ENDFORM.                               " handle_error
    Save, check and activate
    11. Assigning the Inbound Function Module to Basic Type & Message Type
    o     Go to T. Code WE57
    o     Click on change, continue, continue and New Entries Button
    o     Enter the Module as IDOC_INPUT_ZBAPI_STUD_MAS
    o     Type as “F”
    o     Basic Type as ZBAPI_STUD_IDOC
    o     Message Type as ZBAPI_STUD_MAS.
    o     Direction as 2
    o     Save and back
    Now Login in 810 client
    12. Assigning the Inbound Function Module in ALE Table
    o     Go to T. Code BD51
    o     Click on continue, New Entries button
    o     Give the Inbound Function Module IDOC_INPUT_ZBAPI_STUD_MAS
    o     Give Input t. as 0 (zero)
    o     Save and back
    13. Creating Process Code
    o     Go to T. Code WE42
    o     Click on Change, New Entries Button
    o     Give Process Code name as ZSTUD, give Description & Save
    o     Select Processing with ALE Services Radio button
    o     Select Processing by Function Module Radio button
    o     Click the ALE Table (arrow Icon) in Identification
    o     Give the Function Module Name ZIDOC_INPUT_ZBAPI_STUD_MAS
    o     Give maximum number of repeats 0
    o     Save and back, back
    o     Select the process code from the list & click on Logical Messages Icon
    o     Give the Message Type as ZBAPI_STUD_MAS
    o     Save & Back, Save & Back, Save & Back
    14. Changing the Customer Distribution model in Receiving system
    o     Go to T. Code BD64
    o     Click on change and Create model view button
    o     Select the model view & click on Environment -> Generate Partner Profiles
    o     Select Transfer IDOC Immediately and Trigger Immediately radio buttons
    o     Click on Execute
    o     You should get a list in green color which means it executed successfully.
    15. Assigning the Process Code to Message Type in Receiving System
    o     Go to T. Code WE20
    o     Expand Partner Type LS
    o     Select the Partner Profile STUD_S
    o     Double click on Message Type ZBAPI_STUD_MAS in Inbound parmtrs.
    o     Give the Process Code as ZSTUD
    o     Click on Trigger Immediately Radio button
    o     Save & Back
    o     Save & Back
    16. Creating the Selection Program (Outbound Program)
    •     Login in client 800.
    •     Go to T. Code SE38
    •     Create a Report Program as   ZSTUD_SEND with the following code
    REPORT ZSTUD_SEND
           NO STANDARD PAGE HEADING.
    TABLES: ZBAPI_STUD.
    DATA: IT_STUD LIKE ZBAPI_STUD OCCURS 0 WITH HEADER LINE.
    SELECTION-SCREEN:BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-H01.
    SELECT-OPTIONS: S_ROLLNO FOR ZBAPI_STUD-ROLLNO.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN:BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-H02.
    PARAMETERS:  P_MESTYP LIKE EDIDC-MESTYP,
                 P_RCVPRN LIKE TBDLST-LOGSYS.
    SELECTION-SCREEN:END OF BLOCK B2.
    SELECTION-SCREEN:END OF BLOCK B1.
    START-OF-SELECTION.
      PERFORM CREATE_STUDENT.
      PERFORM CREATE_IDOC.
    *&      Form  CREATE_STUDENT
          sending student
    FORM CREATE_STUDENT.
    SELECT * FROM ZBAPI_STUD
       INTO TABLE IT_STUD
       WHERE ROLLNO IN S_ROLLNO.
    ENDFORM.                    " CREATE_STUDENT
    *&      Form  CREATE_IDOC
          IDOC Creation
    FORM CREATE_IDOC.
    DATA : IMAS_DATA LIKE EDIDD OCCURS 10 WITH HEADER LINE,
           IMAS_CON LIKE EDIDC OCCURS 10 WITH HEADER LINE,
           ICOM_CON LIKE EDIDC OCCURS 10 WITH HEADER LINE.
    IMAS_CON-RCVPRT = 'LS'.
    IMAS_CON-RCVPRN = P_RCVPRN.
    IMAS_CON-IDOCTP = 'ZBAPI_STUD_IDOC'.
    IMAS_CON-MESTYP = P_MESTYP.
    IMAS_CON-DIRECT = 1.
    APPEND IMAS_CON.
    LOOP AT IT_STUD.
      IMAS_DATA-SEGNAM = 'ZBAPI_STUD_SEG'.
      IMAS_DATA-SDATA = IT_STUD.
      APPEND IMAS_DATA.
    ENDLOOP.
    CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
         EXPORTING
              MASTER_IDOC_CONTROL            = IMAS_CON
            OBJ_TYPE                       = ''
            CHNUM                          = ''
         TABLES
              COMMUNICATION_IDOC_CONTROL     = ICOM_CON
              MASTER_IDOC_DATA               = IMAS_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.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    COMMIT WORK.
    LOOP AT  ICOM_CON.
      WRITE :/ 'IDOC: ', ICOM_CON-DOCNUM, 'CREATED SUCCESSFULLY'.
    ENDLOOP.
    ENDFORM.                    " CREATE_IDOC
    17. Transferring the student records from 800 to 810 client
    •     Execute Report Program   ZSTUD_SEND
    •     Give the Range of Roll Nos to Transfer
    •     Give Message Type as    ZBAPI_STUD_MAS
    •     Give Receiver Logical system as   STUD_R
    •     Execute
    •     You should get the IDOC Number
    •     Take the IDOC Number and go to T. Code WE05 & Execute
    •     In Outbox you can see the IDOC Status
    •     Select the status record in left side window
    •     Double click on the Status record in right side window
    •     You can see the Control Record, Data Record and Status Records for that IDOC
    •     If the ICON is green and the status code is 3, it means the IDOC is passed to PORT Successfully.
    Now Login in 810 client
    •     Go to T. Code WE05 & Execute
    •     You can see the status record in left side window
    •     If the status no is 53 and color is green, it means the IDOC is Posted to Application successfully.
    •     You can see the Log Information by double clicking on the status record in right side window.
    •     Now in left side window, you can see the Control Record, Data Record & Status Record of the IDOC
    •     Now go to T. Code SE16
    •     Give the table name ZBAPI_STUD & press F7
    •     See the contents of the table
    •     The table is updated with the students records transferred from 800 client with our selection program.
    Reward if useful
    Thanks
    Jagadeesh.G

  • COMMIT FREQUENCY /BULK SIZE ignored ?

    OWB Client 9.2.0.2.8
    OWB Repository: 9.2.0.2.0
    I have a simple SRC to TRG toy map which does an update (row based)
    I was hoping to achieve the following: if any error is encountered , then 1) abort and 2) rollback any changes
    I could achieve 1) by setting MAX_ERRORS=0
    For 2) I tried COMMIT_FREQUENCY=BULKSIZE= some_very_high_number.
    But the map always insists on updating at least some rows before encountering the first error (and then aborting)
    I tried changing the bulk prcoessing to true, and got the same results. I changed UPDATE to INSERT=>similar behavior
    why is the COMMIT_FREQUENCY=BULK SIZE setting being ignored? Or is this just a bug with my version ?

    Hi,
    Good question... it should be the case as you describe (I think). I'd need to look at the code for this, but you may want to contact support on this one so they can reproduce this...
    Jean-Pierre

  • MATERIAL_MAINTAIN_DARK

    Hi folks,
    I am using this Funtion module  MATERIAL_MAINTAIN_DARK.
    But i am getting a error of No description transferred.
    Can any body give me sample code that uses this Function module.

    REPORT  ZSSS.
    INCLUDES                                                             *
    Definition data include
    INCLUDE ZPROGRAM_TOP.
    Forms definition include
    INCLUDE ZPROGRAM_SUB.
    Tables                                                               *
    TABLES: lfa1, LFB1,LFB5, lfm1,
            mara, marc, mbew, steu, mvke, mard.
    Types                                                                *
    Predefine classes                                                    *
    CLASS XXX.
    Data                                                                 *
    Data - Internal Tables
    Data - Structures
    Data - Variables and flags
    DATA:
      gt_errs       TYPE merrdat OCCURS 0 WITH HEADER LINE,
      gt_mara_ueb   TYPE mara_ueb OCCURS 0 WITH HEADER LINE,
      gt_marc_ueb   TYPE marc_ueb OCCURS 0 WITH HEADER LINE,
      gt_mard_ueb   TYPE mard_ueb OCCURS 0 WITH HEADER LINE,
      gt_mbew_ueb   TYPE mbew_ueb OCCURS 0 WITH HEADER LINE,
      gt_mvke_ueb   TYPE mvke_ueb OCCURS 0 WITH HEADER LINE.
    types: begin of g_ty_s_test,
             select_amount      type i,
             no_info_popup      type char1,
             info_popup_once    type char1,
             events             type lvc_fname occurs 0,
             events_info_popup  type lvc_fname occurs 0,
             bypassing_buffer   type char1,
             buffer_active      type char1,
           end   of g_ty_s_test,
      BEGIN OF tlfa1,
        lifnr LIKE lfa1-lifnr,
      AKONT LIKE LFB1-AKONT,
      ZUAWA LIKE LFB1-ZUAWA,
      FDGRV LIKE LFB1-FDGRV,
      VZSKZ LIKE LFB1-VZSKZ,
      ZINDT(10),
      ZINRT LIKE LFB1-ZINRT,
      DATLZ(10),
      ALTKN LIKE LFB1-ALTKN,
    qsskz like LFB1-qsskz,
      ZTERM LIKE LFB1-ZTERM,
      TOGRU LIKE LFB1-TOGRU,
    XVERR LIKE LFB1-XVERR,
    URLID LIKE LFB1-URLID,
    reprf like LFB1-reprf,
      ZWELS LIKE LFB1-ZWELS,
      ZAHLS LIKE LFB1-ZAHLS,
      XPORE LIKE LFB1-XPORE,
      XVERR LIKE LFB1-XVERR,
      HBKID LIKE LFB1-HBKID,
      ZGRUP LIKE LFB1-ZGRUP,
      KVERM LIKE LFB1-KVERM,
      busab LIKE LFB1-busab,
      BUKRS LIKE LFB1-BUKRS,
      END OF tlfa1.
    data: pol(2) type n, cnt1 type i, cnt2 type i.
    data: kostl1(10) type n.
    DATA: BEGIN OF ilfa1 OCCURS 100,
            lifnr LIKE lfa1-lifnr,
            bukrs LIKE LFB1-bukrs,
          END OF ilfa1.
    DATA: BEGIN OF tab OCCURS 500,
            text(500),
          END OF tab.
    DATA: BEGIN OF bdcdata OCCURS 500.
            INCLUDE STRUCTURE bdcdata.
    DATA: END OF bdcdata.
    data: plus(2), minus(2).
    type-pools: slis.
    constants: con_true     type char1 value 'X',
               con_event_05 type lvc_fname value 'BEFORE_LINE_OUTPUT'.
    data: gs_test type g_ty_s_test.
    data: layout        type slis_layout_alv,
          s_fieldcat    type slis_fieldcat_alv,
          it_fieldcat   type slis_t_fieldcat_alv,
          s_event       type slis_alv_event,
          it_event      type slis_t_event,
          s_sort        type slis_sortinfo_alv,
          it_sort       type slis_t_sortinfo_alv,
          keyinfo       type slis_keyinfo_alv,
          s_lineinfo    type slis_lineinfo,
          printinfo     type slis_print_alv,
          xlfa1 TYPE tlfa1 OCCURS 100 WITH HEADER LINE,
          TABPOOL LIKE TEXTPOOL OCCURS 50 WITH HEADER LINE,
          workdays type p,
          g_repid       like sy-repid.
    data: hodnota1 LIKE ANLC-KANSW.
    data: hodnota2 LIKE ANLC-KANSW.
    Ranges                                                               *
    Field Groups                                                         *
    Field Symbols                                                        *
    Parameters and select options                                        *
    PARAMETERS:
    WERKS1   LIKE marc-werks  DEFAULT 'Z621',
    WERKS2   LIKE LFB1-bukrs DEFAULT 'Z605',
    vkorg1   LIKE knvv-vkorg DEFAULT 'Z004',
    vkorg2   LIKE knvv-vkorg DEFAULT 'Z001',
    ekorg(4) DEFAULT 'CE01'.
    MAPA  LIKE APQI-GROUPID DEFAULT 'importdod'.
    kostl LIKE anlz-kostl DEFAULT '0000011101'.
    select-options:
      material for marc-matnr.
    parameters:
    test as checkbox.
    Define classes                                                       *
    CLASS XXX DEFINITION.
    EVENTS                                                               *
    INITIALIZATION
    INITIALIZATION.
    ======================================================================
                                  Macros
    ======================================================================
    define addfc.
        s_fieldcat-fieldname      = &1.
        s_fieldcat-ref_fieldname  = &2.
        s_fieldcat-ref_tabname    = &3.
        s_fieldcat-key            = &4.
        s_fieldcat-icon           = &6.
        s_fieldcat-reptext_ddic   = &7.
        s_fieldcat-seltext_l      = &7.
        s_fieldcat-seltext_m      = &7.
        s_fieldcat-seltext_s      = &7.
        s_fieldcat-do_sum         = &8.
        s_fieldcat-no_out         = &5.
        append s_fieldcat to it_fieldcat.
    end-of-definition.
    START-OF-SELECTION
    START-OF-SELECTION.
    *PERFORM upload_from_disk USING sub.
    clear: cnt1, cnt2.
    select  * from marc
      where
        werks eq werks1
    and matnr in material.
    CLEAR: gt_mara_ueb,gt_marc_ueb, gt_mard_ueb, gt_mbew_ueb, gt_mvke_ueb.
    REFRESH: gt_mara_ueb,gt_marc_ueb, gt_mard_ueb, gt_mbew_ueb, gt_mvke_ueb.
    MOVE-CORRESPONDING marc TO gt_marc_ueb.
    select  single * from marc
      where matnr eq marc-matnr
        and werks eq werks2.
    check  sy-subrc ne 0.
    gt_marc_ueb-werks = werks2.
    if gt_marc_ueb-prctr(1) eq 'Z'.
      gt_marc_ueb-prctr(4) = werks2.
    endif.
    append gt_marc_ueb.
      SELECT SINGLE * FROM mara WHERE matnr = gt_marc_ueb-matnr.
      IF sy-subrc = 0.
        MOVE-CORRESPONDING mara TO gt_mara_ueb.
        gt_mara_ueb-tcode = 'MM01'.
        append gt_mara_ueb.
      ENDIF.
    select  single * from mard
      where matnr eq gt_marc_ueb-matnr
        and werks eq werks1.
    MOVE-CORRESPONDING mard TO gt_mard_ueb.
    select  single * from mard
      where matnr eq gt_marc_ueb-matnr
        and werks eq werks2.
    if sy-subrc ne 0.
    gt_mard_ueb-werks = werks2.
    append gt_mard_ueb.
    endif.
    select  single * from mbew
      where matnr eq gt_marc_ueb-matnr
        and bwkey eq werks1.
    MOVE-CORRESPONDING mbew TO gt_mbew_ueb.
    select  single * from mbew
      where matnr eq gt_marc_ueb-matnr
        and bwkey eq werks2.
    if sy-subrc ne 0.
    gt_mbew_ueb-bwkey = werks2.
    append gt_mbew_ueb.
    endif.
    select  single * from mvke
      where matnr eq gt_marc_ueb-matnr
        and vkorg eq vkorg1.
    MOVE-CORRESPONDING mvke TO gt_mvke_ueb.
    select  single * from mvke
      where matnr eq gt_marc_ueb-matnr
        and vkorg eq vkorg2.
    if sy-subrc ne 0.
    gt_mvke_ueb-vkorg = vkorg2.
    append gt_mvke_ueb.
    endif.
    *write:/ gt_marc_ueb-matnr, gt_marc_ueb-werks, gt_mvke_ueb-vkorg.
    if test ne space.
      write:/ gt_marc_ueb-matnr, gt_marc_ueb-werks, gt_mvke_ueb-vkorg.
    else.
      CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
        EXPORTING
        FLAG_MUSS_PRUEFEN               = 'X'
        SPERRMODUS                      = 'E'
          max_errors                      = 0
          p_kz_no_warn                    = 'X'
          kz_prf                          = ''
        KZ_VERW                         = 'X'
        KZ_AEND                         = 'X'
        KZ_DISPO                        = 'X'
          kz_test                         = TEST
        NO_DATABASE_UPDATE              = ' '
        CALL_MODE                       = ' '
        CALL_MODE2                      = ' '
          user                            = sy-uname
        SUPPRESS_ARRAY_READ             = ' '
        FLG_MASS                        = ' '
        IMPORTING
          matnr_last                      = gt_marc_ueb-matnr
         number_errors_transaction       = g_trnerr
        TABLES
          amara_ueb                       = gt_mara_ueb
        AMAKT_UEB                       =
          amarc_ueb                       = gt_marc_ueb
          AMARD_UEB                       = gt_mard_ueb
        AMFHM_UEB                       =
        AMARM_UEB                       =
        AMEA1_UEB                       =
          ambew_ueb                       = gt_mbew_ueb
        ASTEU_UEB                       =
        ASTMM_UEB                       =
        AMLGN_UEB                       =
        AMLGT_UEB                       =
        AMPGD_UEB                       =
        AMPOP_UEB                       =
        AMVEG_UEB                       =
        AMVEU_UEB                       =
          amvke_ueb                       = gt_mvke_ueb
        ALTX1_UEB                       =
        AMPRW_UEB                       =
        AE1CUCFG_UEB                    =
        AE1CUINS_UEB                    =
        AE1CUVAL_UEB                    =
        AE1CUCOM_UEB                    =
         amfieldres                      = gt_fieldres
          amerrdat                        = gt_errs
        EXCEPTIONS
          kstatus_empty                   = 1
          tkstatus_empty                  = 2
          t130m_error                     = 3
          internal_error                  = 4
          too_many_errors                 = 5
          update_error                    = 6
          OTHERS                          = 7
      loop at gt_errs.
      if gt_marc_ueb-matnr ne space.
        format color col_group.
        write:/ gt_marc_ueb-matnr, gt_marc_ueb-werks, gt_mvke_ueb-vkorg.
      else.
        format color col_negative.
        write:/ gt_marc_ueb-matnr,gt_errs.
      endif.
      endloop.
    if sy-subrc eq 0.
      if gt_marc_ueb-matnr ne space.
        cnt1 = cnt1 + 1.
      else.
        cnt2 = cnt2 + 1.
      endif.
    endif.
    endselect.
    *perform prepare_alv_grid_data.
    uline.
      format color col_total.
    write: / poc, ilfa1-anlkl, ilfa1-txt50,  ilfa1-aktiv, ilfa1-afasl01,
    *skansw, slfafa.
      if test eq space.
      format color col_group.
      write: / 'Poèet správnych:', cnt1.
      format color col_negative.
      write: / 'Poèet chybných:', cnt2.
      else.
      write: / 'Testovací re¾im'.
    endif.
    ======================================================================
                                 Top of Page
    ======================================================================
    form f01_alv_event_top_of_page.
    write:/ 'Business pipeline'(020).
    write: 40 'Pracovné dni:'(021), workdays.
    perforM VYPIS_SEL_OPT.
    endform.
    form f01_alv_event_END_OF_LIST.
    perform prepare_alv_grid_data1.
    endform.
          FORM DYNPRO                                                   *
    -->  PROGRAM                                                       *
    -->  DYNPRO                                                        *
    FORM dynpro USING program dynpro.
      CLEAR bdcdata.
      bdcdata-program = program.
      bdcdata-dynpro = dynpro.
      bdcdata-dynbegin = 'X'.
      APPEND bdcdata.
    ENDFORM.
          FORM PRG                                                      *
    -->  FNAM                                                          *
    -->  FVAL                                                          *
    FORM prg USING fnam fval.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
    ENDFORM.
    FORM prg1 USING fnam fval.
    if fval ne space.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
    endif.
    ENDFORM.
    FORM prg2 USING fnam fval.
    data: hodn like anlc-kansw.
    perform hodnota using fval hodn.
    if hodn ne 0.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
    endif.
    ENDFORM.
    FORM prg3 USING fnam fval.
    data: hodn like anlc-kansw.
    perform hodnota using fval hodn.
    if hodn eq 0.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = '0'.
      APPEND bdcdata.
    endif.
    ENDFORM.
    FORM prg4 USING fnam fval.
    data: hodn like anlc-kansw.
    data: txt(30).
    perform hodnota using fval hodn.
    if hodn ne 0.
      if hodn lt 0.
        concatenate fnam '(' minus ')' into txt.
      else.
        concatenate fnam '(' plus ')' into txt.
      endif.
      CLEAR bdcdata.
      bdcdata-fnam = txt.
      bdcdata-fval = fval.
      APPEND bdcdata.
    else.
      CLEAR bdcdata.
      bdcdata-fnam = txt.
      bdcdata-fval = fval.
      APPEND bdcdata.
    endif.
    ENDFORM.
    FORM prg5 USING fnam pol.
    data: txt(30).
        concatenate fnam '(' pol ')' into txt.
      CLEAR bdcdata.
      bdcdata-fnam = txt.
      bdcdata-fval = '0'.
      APPEND bdcdata.
    ENDFORM.
    FORM prg6 USING fnam pol fval.
    data: txt(30).
        concatenate fnam '(' pol ')' into txt.
      CLEAR bdcdata.
      bdcdata-fnam = txt.
      bdcdata-fval = fval.
      APPEND bdcdata.
    ENDFORM.
    FORM prg7 USING fnam fval pol.
    data: txt(30).
      concatenate fval '(' pol ')' into txt.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = txt.
      APPEND bdcdata.
    ENDFORM.
    -->  FILENAME                                                      *
    FORM upload_from_disk USING filename.
      DATA: name(80).
      REFRESH: tab.
      CALL FUNCTION 'WS_UPLOAD'
           EXPORTING
                filename        = filename
                filetype        = 'ASC'
           TABLES
                data_tab        = tab
           EXCEPTIONS
                file_open_error = 1
                file_read_error = 2.
      name = filename.
      CASE sy-subrc.
        WHEN 1.
         MESSAGE e704 WITH name3 name0(2).
        WHEN 2.
         MESSAGE e705 WITH name3 name0(2).
        WHEN OTHERS.
      ENDCASE.
    ENDFORM.
    FORM WRITE_BTR USING P_BTR P_EXCEL.
      if p_btr eq 0. clear P_EXCEL. exit. endif.
      WRITE P_BTR TO P_EXCEL.
      TRANSLATE P_EXCEL USING '. '.
    TRANSLATE P_EXCEL USING '.,'.
      CONDENSE P_EXCEL NO-GAPS.
      SHIFT P_EXCEL RIGHT CIRCULAR.
    ENDFORM.                               " WRITE_BTR
    form hodnota using hodntext hodn.
    data: text(18).
      text = hodntext.
    replace '-' with ' ' into text.
      replace ',' with '.' into text.
      condense text no-gaps.
      hodn = text.
    endform.
    *&      Form  prepare_alv_grid_data
          text
    -->  p1        text
    <--  p2        text
    form prepare_alv_grid_data.
      clear: s_fieldcat,
             keyinfo,
             s_event,
             layout,
             s_sort.
      refresh: it_fieldcat,
               it_sort,
               it_event.
      s_fieldcat-tabname   = 'ilfa1'.
    Data: txt(100).
      addfc:
        POLE, REF_TAB, KEY, NO-OUT, ICON, TEXT, DO-SUM
         'LIFNR' 'LIFNR'   'LFB1' '' '' ''  'Dodávateµ'(001)      '',
         'BUKRS' 'BUKRS'   'LFB1' '' '' ''  'Úèt. okruh'(001)      ''.
       s_sort-spos           = 1.
       s_sort-fieldname      = 'BEZEI'.
       s_sort-tabname      = 'IT_SUMM'.
       s_sort-up             = 'X'.
       s_sort-subtot         = 'X'.
       append s_sort to it_sort.
      layout-zebra             =  'X'.
      layout-totals_text       = 'Súetový riadok'.
      layout-NUMC_SUM          =  'X'.
      layout-colwidth_optimize =  'X'.
      layout-window_titlebar   =
      'Inv. majetok'(020).
      clear s_event.
      s_event-form = 'TOP_OF_PAGE'.
      s_event-name =  slis_ev_top_of_page.
      append s_event to gs_test-events.
      s_event-form = 'END_OF_LIST'.
      s_event-name =  SLIS_EV_END_OF_LIST.
      append s_event to gs_test-events.
      perform f01_alv_set_events changing it_event.
      g_repid = sy-repid.
      printinfo-no_print_selinfos  = 'X'.
      printinfo-no_print_listinfos = 'X'.
    call function 'REUSE_ALV_LIST_DISPLAY'
       call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
         i_callback_program             = g_repid
         I_GRID_TITLE                   = 'Inv. majetok ASO'(020)
         is_layout                      = layout
         it_fieldcat                    = it_fieldcat
        i_default                      = space  "'X'
          i_save                         = 'A'
         it_sort                        = it_sort
        it_events                      = it_event
        i_screen_start_line            = 0
        is_print                       = printinfo
         I_STRUCTURE_NAME               = 'ilfa1'
        tables
          t_outtab                      = ilfa1
       exceptions
         program_error                  = 1
         others                         = 2.
    endform.                    " prepare_alv_grid_data
    form prepare_alv_grid_data1.
      clear: s_fieldcat,
             keyinfo,
             s_event,
             layout,
             s_sort.
      refresh: it_fieldcat,
               it_sort,
               it_event.
      s_fieldcat-tabname   = 'ilfa1'.
    Data: txt(100).
      addfc:
        POLE, REF_TAB, KEY, NO-OUT, ICON, TEXT, DO-SUM
         'ANLKL' 'ANLKL'   'ANLA' '' '' ''  'Trieda IM'(001)      '',
         'ANLN1' 'ANLN1'   'ANLA' '' '' ''  'Hlavné èíslo IM'(002)      '',
         'TXT50' 'TXT50'   'ANLA' '' '' ''  'Oznaèenie'(015) '',
        'INVNR' 'INVNR'   'ANLA' '' '' ''  'Inventárne èíslo'(003) '',
         'KOSTL' 'KOSTL'   'ANLA' '' '' ''  'Náklad. stredisko'(004) '',
         'LIFNR' 'LIFNR'   'ANLA' '' '' ''  'Dodavatel'(004) ''.
       s_sort-spos           = 1.
       s_sort-fieldname      = 'BEZEI'.
       s_sort-tabname      = 'IT_SUMM'.
       s_sort-up             = 'X'.
       s_sort-subtot         = 'X'.
       append s_sort to it_sort.
      layout-zebra             =  'X'.
      layout-totals_text       = 'Súetový riadok'.
      layout-NUMC_SUM          =  'X'.
      layout-colwidth_optimize =  'X'.
      layout-window_titlebar   =
      'Inv. majetok'(020).
      clear s_event.
      s_event-form = 'TOP_OF_PAGE'.
      s_event-name =  slis_ev_top_of_page.
      append s_event to gs_test-events.
      s_event-form = 'END_OF_LIST'.
      s_event-name =  SLIS_EV_END_OF_LIST.
      append s_event to gs_test-events.
      perform f01_alv_set_events changing it_event.
      g_repid = sy-repid.
      printinfo-no_print_selinfos  = 'X'.
      printinfo-no_print_listinfos = 'X'.
    call function 'REUSE_ALV_LIST_DISPLAY'
       call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
         i_callback_program             = g_repid
         I_GRID_TITLE                   = 'Inv. majetok - odavatele'(020)
         is_layout                      = layout
         it_fieldcat                    = it_fieldcat
        i_default                      = space  "'X'
          i_save                         = 'A'
         it_sort                        = it_sort
        it_events                      = it_event
        i_screen_start_line            = 0
        is_print                       = printinfo
         I_STRUCTURE_NAME               = 'ilfa1'
        tables
          t_outtab                      = ilfa1
       exceptions
         program_error                  = 1
         others                         = 2.
    endform.                    " prepare_alv_grid_data
    form f01_alv_event_before_line_outp
                          using rs_lineinfo type slis_lineinfo. "#EC *
      data: l_event type lvc_fname. "#EC NEEDED
              it_summ-hl_fu = it_summ-volum / it_summ-cntf.
    if pa_brand ne space.
    perform compute_averageb using it_sumb.
    if it_sumb-volum ne 0.
       it_sumb-sk_hl = it_sumb-netwr / it_sumb-volum.
    else.
       it_sumb-sk_hl = 0.
    endif.
    else.
    perform compute_average using it_summ.
    endif.
      if rs_lineinfo-endsum ne space.
       perform prepare_alv_grid_data1.
      endif.
    if rs_lineinfo-tabindex eq 0.
      if rs_lineinfo-sumindex ne 0.
         uline.
        it_summ-tonaz = wa_summ-bezei.
      endif.
    else.
      wa_summ = it_summ.
    endif.
    if s_lineinfo-tabindex eq 0.
      if s_lineinfo-sumindex ne 0.
         uline.
      endif.
    endif.
    s_lineinfo = rs_lineinfo.
      if gs_test-info_popup_once eq con_true.
        read table gs_test-events_info_popup into l_event
                   with key table_line = 'BEFORE_LINE_OUTPUT'.
        if sy-subrc ne 0.
          insert 'BEFORE_LINE_OUTPUT' into gs_test-events_info_popup
                                      index 1.
          message i000(0k) with text-t05.
        endif.
      elseif gs_test-no_info_popup eq space.
        message i000(0k) with text-t05.
      endif.
    endform.                               " F01_ALV_EVENT_BEFORE_LINE_OUTP
    form f01_alv_set_events changing ct_events type slis_t_event.
      field-symbols: -form.
          endif.
        endloop.
      endif.
    endform.                    " f01_alv_set_events
    Reward points..

  • MATERIAL_MAINTAIN_DARK no mara append table update

    Hello,
    I've a little problem using MATERIAL_MAINTAIN_DARK to modify some materials.
    I have to update fields in two append structures (one in mara, one in marm)
    when I use this function module, the update is ok on marm but not on mara
    if anyone have an idea ??
    Thanks in advance

    Hai Fabrice
    check the following Code
    DATA: h_anzfehler LIKE  tbist-numerror.
    DATA: BEGIN OF t_mara_ueb OCCURS 1.
            INCLUDE STRUCTURE mara_ueb.
    DATA: END OF t_mara_ueb.
    DATA: BEGIN OF t_mbew_ueb OCCURS 1.
            INCLUDE STRUCTURE mbew_ueb.
    DATA: END OF t_mbew_ueb.
    DATA: t_merrdat TYPE merrdat OCCURS 0 WITH HEADER LINE.
    aufbauen T_MARA_UEB
              CLEAR:    t_mara_ueb.
              REFRESH:  t_mara_ueb.
              t_mara_ueb-mandt = sy-mandt.
              t_mara_ueb-matnr = t_mbew-matnr.
              t_mara_ueb-tcode = 'MM02'.
              t_mara_ueb-tranc = h_tranc.  "Transaktionszähler
              APPEND t_mara_ueb.
    aufbauen T_MBEW_UEB
              CLEAR:    t_mbew_ueb.
              REFRESH:  t_mbew_ueb.
              t_mbew_ueb-mandt = sy-mandt.
              t_mbew_ueb-matnr = t_mbew-matnr.
              t_mbew_ueb-bwkey = t_mbew-bwkey.
              t_mbew_ueb-bwtar = t_mbew-bwtar.
              t_mbew_ueb-tranc = h_tranc.  "Transaktionszähler
    Änderung der Preissteuerung in der lfd. Periode
              IF t_mbew-vprsv NE p_vprsvn.
                t_mbew_ueb-vprsv = p_vprsvn. "neue Preissteuerung->lfd.Per.
              ENDIF.
    Änderung der Preissteuerung in der Vorperiode
              IF t_mbew-vmvpr NE p_vprsvn.
                t_mbew_ueb-vmvpr = p_vprsvn. "neue Preissteuerung-> Vorper.
              ENDIF.
    Änderung der Preissteuerung in der letzten Periode des Vorjahres
              IF flag_vm_eq_vj = 'X'.      "Vorperiode = Vorjahr
                IF t_mbew-vjvpr NE p_vprsvn.
                  t_mbew_ueb-vjvpr = p_vprsvn. "neue Preissteuerung-> Vorjahr
                ENDIF.
              ENDIF.
              APPEND t_mbew_ueb.
              CLEAR:    t_merrdat.
              REFRESH:  t_merrdat.
              CLEAR:    h_anzfehler.
              CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
                   EXPORTING
                    FLAG_MUSS_PRUEFEN         = 'X'
                    SPERRMODUS                = 'E'
                    MAX_ERRORS                = 0
                        p_kz_no_warn              = 'N'
                        kz_prf                    = 'E'
                        kz_aend                   = 'X'
                        kz_dispo                  = ' '
                   IMPORTING
                        number_errors_transaction = h_anzfehler
                   TABLES
                        amara_ueb                 = t_mara_ueb
                        ambew_ueb                 = t_mbew_ueb
                        amerrdat                  = t_merrdat
                   EXCEPTIONS
                        kstatus_empty             = 1
                        tkstatus_empty            = 2
                        t130m_error               = 3
                        internal_error            = 4
                        too_many_errors           = 5
                        update_error              = 6
                        OTHERS                    = 7.
              IF NOT h_anzfehler IS INITIAL.
                PERFORM build_message.
                EXIT.                   "Abbruch Form-Verarbeitung
              ELSE.
                flag_vprsv_upd = 'X'.
              ENDIF.
    Thanks & Regards
    Sreenivasulu P

  • BAPI for create material master (SAP version 40b)

    Hi,
    Anyone know BAPI for create material master for SAP version 40b?
    There's no BAPI_MATERIAL_SAVEDATA.
    I try to use BAPI_MATERIAL_MAINTAINDATA_RT,
    but seems that BAPI only for retail.
    Kindly advice!
    Thanks,
    Victor.

    Hi,
        this one works pretty good.
    call function 'MATERIAL_MAINTAIN_DARK'
             exporting
                  sperrmodus                = ' '
                  kz_prf                    = 'W'
                  max_errors                = ' '
                  p_kz_no_warn              = 'X'
                  kz_verw                   = 'X'
                  kz_aend                   = 'X'
                  kz_dispo                  = 'X'
                  kz_test                   = ' '
                  flag_muss_pruefen         = ' '
                  call_mode                 = 'ACT'
             importing
                  number_errors_transaction = numerror
                  matnr_last     = last_matnr
             tables
                 amara_ueb      = i_mara    "Basic Data
                amakt_ueb      = i_makt    "Descriptions
                 amarc_ueb      = i_marc    "Plant
                amard_ueb      = i_mard    "Storage Location
               AMFHM_UEB      = I_MFHM    "Production Tools
                amarm_ueb      = i_marm    "Units of Measure
               AMEA1_UEB      = I_MEA1    "Internal Mangagement -  EANs
                ambew_ueb      = i_mbew    "Accounting/Costing
                asteu_ueb      = i_steu    "Tax Data
                astmm_ueb      = i_steumm  "Tax Data
               AMLGN_UEB      = I_MLGN    "Warehouse Data
               AMLGT_UEB      = I_MLGT    "Storage Type Data
               AMPGD_UEB      = I_MPGD    "Change Documents
               AMPOP_UEB      = I_MPOP    "Forcast Parameters
               AMVEG_UEB      = I_MVEG    "Total Consumption Data
               AMVEU_UEB      = I_MVEU    "Unplanned Consumption Data
                amvke_ueb      = i_mvke    "Sales Data
                altx1_ueb      = i_ltx1    "Sales Text
               AMPRW_UEB      = I_MPRW    "Forcast Values
                 amfieldres     = i_delfields
                 amerrdat       = i_errors
             exceptions
                  kstatus_empty             = 01
                  tkstatus_empty            = 02
                  t130m_error               = 03
                  internal_error            = 04
                  update_error              = 05
                  too_many_errors           = 06.
    Otherwise try BAPI_RETAILMATERIAL_CREATE
    BAPI_STANDARDMATERIAL_CREATE
    <b>Reward points</b>
    Regards

  • What kind of wrapper Program for Running OWB 10g Packages

    Hi,
    We are migrating our mapping from OWB 9.i to OWB 10.g. Earlier we were using a scheduling tool and through that we used to execute the package for the OWB Mapping from SQL Prompt with th below mentioned command at SQL PLUS.
    execute &procname..main(:operating_mode,:audit_level,:max_errors,:commit_frequency,:bulk_size);
    Here &procname is the name of the OWB 9.i Package.
    Kindly Suggest how do we do this with an OWB 10.g Mapping.
    Thanks

    My new classroom is being set up and I have two computers to practice on at this moment. I did try internet sharing and it worked between the main computer and a student computer (that is the main computer was wired to the network, and the student iMac was the client), and this was without a router: the main computer had a wireless network "MacBook" and I connected to it through Airport, and I had perfect access to the internet.
    I'm going to sound very naive here but if all I have are the main and three student computers, can't they all just be connected directly to the main computer without a router, like I have done as described above?
    But isn't file sharing what I need not internet sharing?

  • EDI - IDoc Help

    Hi ABAP and EDI experts,
    I have a request, I am a trainer. I am working on a Training Software, not real time. Is there any way that i can create and IDoc and see. Kindly provide me any such.
    Help will be surely rewarded.
    Thanks
    Chinna

    Hi Chinna,
    See the example scenario  material
    MASTER DATA TRANSFERMATION BETWEEN 2 DIFF CLIENTS
    u2022     For this scenario Client 800 is the Sender and 810 is the receiving system
    1. Creating Logical Systems
    o     Login using 800 client
    o     Go to T. Code SALE
    o     Expand Sending and Receiving Systems
    o     Expand Logical Systems
    o     Click on Define Logical System
    o     Click on New Entries
    o     Create STUD_S, STUD_R Logical Systems
    o     Save and come back
    o     Assign the STUD_S Logical System to client 800
    o     Assign the STUD_R Logical System to client 810
    2. Creating the RFCs
    o     Go to T. Code SM59
    o     Expand R/3 Connections
    o     Enter RFC Name as STUD_S
    o     Connection Type as 3
    o     Language as EN
    o     Client as 800
    o     User as  SAPUSER
    o     PWD as abap
    o     Target host as sap
    o     Click on Remote logon button to test the RFC
    o     Enter RFC Name as STUD_R
    o     Connection Type as 3
    o     Language as EN
    o     Client as 800
    o     User as  SATISH
    o     PWD as abap
    o     Target host as sap
    o     Click on Remote logon button to test the RFC
    3. Creating the Message Type
    o     Go to T. Code WE81
    o     Click on change, continue
    o     Click on New Entries button
    o     Give message type as ZBAPI_STUD_MAS and description
    o     Save and back
    4. Creating the Segment
    o     Go to T. Code WE31
    o     Give segment name as ZBAPI_STUD_SEG
    o     Enter Short Text
    o     Enter the Field Name and Data Element in the text boxes
    o     Save, continue,
    o     Click on Edit -> Set Release.
    5. Creating the Basic IDOC Object
    o     Go to T. code WE30
    o     Give obj. name as ZBAPI_STUD_IDOC
    o     Click on create
    o     Select create new radio button, give description and continue
    o     Select the IDOC obj name and click on create button
    o     Enter the segment name which is create earlier
    o     Select the check box if you want to make the segment mandatory
    o     Enter 1 in minimum number 99999 in maximum number, continue
    o     Save and back
    o     Click on Edit -> Set Release
    6. Creating Customer Distribution Model
    o     Go to T. Code BD64
    o     Click on change and Create model view button
    o     Enter the short text and Technical name as ZSTUDENT
    o     Select the model and click on Add Message Type Button
    o     Give the Sender as STUD_S,
    o                    Receiver as STUD_R,
    o                    Message Type as ZBAPI_STUD_MAS
    o     Select the model view & click on Environment -> Generate Partner Profiles
    o     Select Transfer IDOC Immediately and Trigger Immediately radio buttons
    o     Click on Execute
    o     You should get a list in green color which means it executed successfully.
    o     Back to main screen, select the model view
    o     Click Edit->Model view->Distribute
    o     Click on continue
    o     You should get a list saying model view is distributed successfully.
    7. Checking the Port
    o     Go to T. Code WE21
    o     Expand Transactional RFC
    o     Find the port from the list which is created using BD64 for STUD_R (Receiving system) RFC Destination.
    8. Checking the Partner Profiles.
    o     Go to T. Code WE20
    o     Expand Partner Type LS
    o     Select the Partner profile STUD_R
    o     Double click on Message Type ZBAPI_STUD_MAS in Outbound parmtrs.
    o     Check Receiver Port is assigned correctly
    o     Check the Basic type as your Basic IDOC object.
    9. Assigning the Message Type to Basic IDOC Object
    o     Go to T. Code WE82
    o     Click on Change & continue, New Entries button
    o     Give the Message type as ZBAPI_STUD_MAS
    o     Give Basic Type as ZBAPI_STUD_IDOC
    o     Release as 46C
    o     Save and back
    10. Creating Inbound Function Module (Posting Program)
    o     Go to T. Code SE37
    o     Create a function Module IDOC_INPUT_ZBAPI_STUD_MAS
    o     Set the Processing type as Remote Enabled Module and mode as start immed, in Attributes Tab.
    o     Import Parameters
    INPUT_METHOD                 LIKE     BDWFAP_PAR-INPUTMETHD
    MASS_PROCESSING     LIKE     BDWFAP_PAR-MASS_PROC
    NO_APPLICATION_LOG     LIKE     SY-DATAR
    MASSSAVEINFOS                 LIKE     MASSSAVINF
    o     Export Parameters
    WORKFLOW_RESULT          LIKE     BDWF_PARAM-RESULT
    APPLICATION_VARIABLE     LIKE     BDWF_PARAM-APPL_VAR
    IN_UPDATE_TASK          LIKE     BDWFAP_PAR-UPDATETASK
    CALL_TRANSACTION_DONE  LIKE     BDWFAP_PAR-CALLTRANS
    o     Tables
    IDOC_CONTRL     LIKE     EDIDC
    IDOC_DATA          LIKE     EDIDD
    IDOC_STATUS     LIKE     BDIDOCSTAT
    RETURN_VARIABLES     LIKE     BDWFRETVAR
    SERIALIZATION_INFO     LIKE     BDI_SER
    o     Exceptions
    WRONG_FUNCTION_CALLED
    o     Source Code
    DATA: FIRST_TRANC LIKE MARA_UEB-TRANC,
          ZBAPI_STUD_SEG like zbapi_stud.
    DATA: ZBAPI_STUD LIKE ZBAPI_STUD.
      DATA: I_ZBAPI_STUD LIKE ZBAPI_STUD.
      DATA: C_TRUE                         VALUE 'X'.
      DATA: C_FALSE                        VALUE ' '.
    DATA: BEGIN OF T_IDOC_ROLLNO OCCURS 0,
            DOCNUM LIKE EDIDC-DOCNUM,
            ROLLNO LIKE ZBAPI_STUD-ROLLNO,
          END   OF T_IDOC_ROLLNO.
      DEFINE APPEND_RESFIELDS.
        PERFORM APPEND_RES_FIELDS TABLES T_MFIELDRES
                                         T_RES_FIELDS
                                  USING  &1
                                         COUNTER-D_IND.
      END-OF-DEFINITION.
      DATA: I_MARA_UEB LIKE MARA_UEB.
      DATA: I_ZSTUD_UEB LIKE ZBAPI_STUD.
      DATA: I_MAKT_UEB LIKE MAKT_UEB.
      DATA: I_MARC_UEB LIKE MARC_UEB.
      DATA: I_MARD_UEB LIKE MARD_UEB.
      DATA: I_MFHM_UEB LIKE MFHM_UEB.
      DATA: I_MARM_UEB LIKE MARM_UEB.
      DATA: I_MEAN_UEB LIKE MEA1_UEB.
      DATA: I_MBEW_UEB LIKE MBEW_UEB.
      DATA: I_STEU_UEB LIKE STEU_UEB.
      DATA: I_STEUMM_UEB LIKE STEUMM_UEB.
      DATA: I_MLGN_UEB LIKE MLGN_UEB.
      DATA: I_MLGT_UEB LIKE MLGT_UEB.      " //br010797 neu zu 4.0
      DATA: I_MPGD_UEB LIKE MPGD_UEB.
      DATA: I_MPOP_UEB LIKE MPOP_UEB.
      DATA: I_MVEG_UEB LIKE MVEG_UEB.
      DATA: I_MVEU_UEB LIKE MVEU_UEB.
      DATA: I_MVKE_UEB LIKE MVKE_UEB.
      DATA: I_MPRW_UEB LIKE MPRW_UEB.
      DATA: I_LTX1_UEB LIKE LTX1_UEB.
      DATA: HELP_MARC_UEB LIKE MARC_UEB.
      DATA: T_MARA_UEB LIKE MARA_UEB OCCURS 0.
      DATA: T_MAKT_UEB LIKE MAKT_UEB OCCURS 0.
      DATA: T_MARC_UEB LIKE MARC_UEB OCCURS 0.
      DATA: T_MARD_UEB LIKE MARD_UEB OCCURS 0.
      DATA: T_MFHM_UEB LIKE MFHM_UEB OCCURS 0.
      DATA: T_MARM_UEB LIKE MARM_UEB OCCURS 0.
      DATA: T_MEAN_UEB LIKE MEA1_UEB OCCURS 0.
      DATA: T_MBEW_UEB LIKE MBEW_UEB OCCURS 0.
      DATA: T_STEU_UEB LIKE STEU_UEB OCCURS 0.
      DATA: T_STEUMM_UEB LIKE STEUMM_UEB OCCURS 0.
      DATA: T_MLGN_UEB LIKE MLGN_UEB OCCURS 0.
      DATA: T_MLGT_UEB LIKE MLGT_UEB OCCURS 0.    " //br010797 neu zu 4.0
      DATA: T_MPGD_UEB LIKE MPGD_UEB OCCURS 0.
      DATA: T_MPOP_UEB LIKE MPOP_UEB OCCURS 0.
      DATA: T_MVEG_UEB LIKE MVEG_UEB OCCURS 0.
      DATA: T_MVEU_UEB LIKE MVEU_UEB OCCURS 0.
      DATA: T_MVKE_UEB LIKE MVKE_UEB OCCURS 0.
      DATA: T_MPRW_UEB LIKE MPRW_UEB OCCURS 0.
      DATA: T_LTX1_UEB LIKE LTX1_UEB OCCURS 0.
    Internal fields/ tables
    DATA: FLAG_ERROR_HAPPENED.
    DATA: flag_material_exists. "//br210397 zu 4.0 keine Verwendung mehr
      DATA: FLAG_EXIT_TO_BE_DONE.
      DATA: HELP_TABIX LIKE SY-TABIX.
      DATA: HELP_TRANC LIKE MARA_UEB-TRANC.
      DATA: HELP_ALAND LIKE STEU_UEB-ALAND.
      DATA: HELP_VKORG LIKE MVKE-VKORG.
      DATA: HELP_WERKS LIKE T001W-WERKS.
      DATA: HELP_LFDNR LIKE STEU_UEB-LFDNR.
      DATA: LAST_MARC_TRANC LIKE MARA_UEB-TRANC.
      DATA: LAST_MLGN_TRANC LIKE MARA_UEB-TRANC.    " //br010797 neu zu 4.0
      DATA: LAST_TEXT_TRANC LIKE MARA_UEB-TRANC.
      DATA: CURRENT_TABIX LIKE SY-TABIX.
      DATA: GENERAL_SUBRC LIKE SY-SUBRC.
      DATA: HELP_FACTOR TYPE P DECIMALS 3.
      DATA: USER_SEGMENTS LIKE EDIDD OCCURS 0 WITH HEADER LINE.  " insert
      DATA: CUST_SEGMENT LIKE EDIDD.
      DATA: I_MFIELDRES LIKE MFIELDRES.
    DATA: I_MERRDAT LIKE MERRDAT.
      DATA: I_EDIDD LIKE EDIDD.
                                           " //br neu zu 3.1g
      DATA: T_RES_FIELDS LIKE DELFIELDS OCCURS 0 WITH HEADER LINE.
      DATA: T_MFIELDRES LIKE MFIELDRES OCCURS 0.
      DATA: T_MERRDAT LIKE MERRDAT OCCURS 0.
      DATA: T_EDIDD LIKE EDIDD OCCURS 0.
    DATA: BEGIN OF t_matnr OCCURS 0, "//br210397 zu 4.0
            matnr LIKE mara-matnr,   " wird nicht mehr verwendet                                               
          END OF t_matnr.            "
      DATA: BEGIN OF COUNTER,
              TRANC LIKE MARA_UEB-TRANC,
              D_IND LIKE MARA_UEB-D_IND,
            END OF COUNTER.
    DATA: BEGIN OF t_idoc_tranc OCCURS 0,                          " 4.0
            docnum LIKE edidc-docnum,                              "
            tranc  LIKE mara_ueb-tranc,                            "
          END OF t_idoc_tranc.                                     "
      DATA T_IDOC_TRANC LIKE MATIDOCTRANC OCCURS 0 WITH HEADER LINE."
      DATA: FLAG_FITS.
      DATA: APPLICATION_SUBRC LIKE SY-SUBRC.
      DATA FLAG_MUSS_PRUEFEN LIKE SY-DATAR.
      DATA MAX_ERRORS LIKE T130S-ANZUM.    " 4.0
    note 419281
      DATA : FLG_MASS.
      CLEAR : FLG_MASS.
      FIELD-SYMBOLS: .            " 4.0
    ALE-distribution unity : IDOC status set by locking      "note0361838
      data:                                                     "note0361838
        it_dsp_idocstat like bdidocstat                         "note0361838
          occurs 0 with header line.                            "note0361838
    Initialize data - general
      REFRESH T_MFIELDRES.
      REFRESH T_IDOC_TRANC.
      REFRESH T_IDOC_TRANC.                "JH/02.02.98/4.0C  KPr100004993
    REFRESH t_idoc_tranc_segment.   " //br 40 : unnötig
    REFRESH matnr_tranc.            "    -"-
    REFRESH t_matnr.
      COUNTER-TRANC = 1.
      COUNTER-D_IND = 1.
      REFRESH T_MARA_UEB.
      REFRESH T_MAKT_UEB.
      REFRESH T_MARC_UEB.
      REFRESH T_MARD_UEB.
      REFRESH T_MFHM_UEB.
      REFRESH T_MARM_UEB.
      REFRESH T_MEAN_UEB.
      REFRESH T_MBEW_UEB.
      REFRESH T_STEU_UEB.
      REFRESH T_STEUMM_UEB.
      REFRESH T_MLGN_UEB.
      REFRESH T_MLGT_UEB.                  " //br010797 neu zu 4.0
      REFRESH T_MPGD_UEB.
      REFRESH T_MPOP_UEB.
      REFRESH T_MVEG_UEB.
      REFRESH T_MVEU_UEB.
      REFRESH T_MVKE_UEB.
      REFRESH T_MPRW_UEB.
    REFRESH VKORG_ALAND.
    REFRESH WERKS_ALAND.
      CLEAR APPLICATION_SUBRC.
      REFRESH T_MERRDAT.
    Check if right function is called
      READ TABLE IDOC_CONTRL INDEX 1.
      IF SY-SUBRC <> 0.
        EXIT.
      ELSE.
        IF  IDOC_CONTRL-IDOCTP <> 'ZBAPI_STUD_IDOC'.
          RAISE WRONG_FUNCTION_CALLED.
        ENDIF.
      ENDIF.
      LOOP AT IDOC_CONTRL.
      Initialize data - per IDOC
      t_idoc_tranc-docnum = counter-tranc.
        T_IDOC_TRANC-DOCNUM = IDOC_CONTRL-DOCNUM.
        T_IDOC_TRANC-FIRST_TRANC_IDOC = COUNTER-TRANC + 2.
        APPEND T_IDOC_TRANC.
      Select segments which belong to IDOC
        REFRESH T_EDIDD.
        LOOP AT IDOC_DATA WHERE DOCNUM = IDOC_CONTRL-DOCNUM.
          APPEND IDOC_DATA TO T_EDIDD.
        ENDLOOP.
       BUSINESS TRANSACTION EVENT (header / data)         "note0388000
         call function 'OPEN_FI_PERFORM_MGV00200_E'         "note0388000
              exporting                                     "note0388000
                  idoc_header       = idoc_contrl           "note0388000
                  FLG_APPEND_STATUS = 'X'                   "note0388000
              tables                                        "note0388000
    (DEL)       idoc_data         = idoc_data "note0388000 note0418561
                  idoc_data         = t_edidd               "note0418561
                  idoc_status       = idoc_status           "note0388000
              exceptions                                    "note0388000
                  others       = 1.                         "note0388000
         if sy-subrc = 1.                                   "note0388000
            continue.                                       "note0388000
         endif.                                             "note0388000
      Within one IDOC: loop through data segments:
      Prepare internal tables for the current material
        LOOP AT T_EDIDD INTO IDOC_DATA.
        Transform from CoreData to Normal Data if necesary
          CASE IDOC_DATA-SEGNAM.
           WHEN 'E1MARAC'.
    *--COMMENTED BY SATISH
             PERFORM MOVE_E1MARAC_TO_E1MARAM USING IDOC_DATA.
           WHEN 'E1MAKTC'.
             PERFORM MOVE_E1MAKTC_TO_E1MAKTM USING IDOC_DATA.
    *--COMMENTES ENDED BY SATISH
             WHEN 'ZBAPI_STUD_SEG'.
              PERFORM MOVE_E1MARAC_TO_E1MARAM USING IDOC_DATA.
                CLEAR I_ZBAPI_STUD.
    Second: Move E1MARAC into E1MARAM
                I_ZBAPI_STUD = IDOC_DATA-SDATA.
    Third: Move E1MARAM back into IDOC-line
                IDOC_DATA-SDATA =  I_ZBAPI_STUD.
                IDOC_DATA-SEGNAM = 'ZBAPI_STUD_SEG'.
          ENDCASE.
          CURRENT_TABIX = SY-TABIX.
          COUNTER-D_IND = COUNTER-D_IND + 1.
          COUNTER-TRANC = COUNTER-TRANC + 2.
          CASE IDOC_DATA-SEGNAM.
             WHEN 'ZBAPI_STUD_SEG'.
            Initialize data - per material
              COUNTER-D_IND = 1.
              FIRST_TRANC = COUNTER-TRANC.
            interpret segment
              ZBAPI_STUD_SEG = IDOC_DATA-SDATA.
              MOVE-CORRESPONDING ZBAPI_STUD TO I_ZSTUD_UEB.
              T_IDOC_ROLLNO-DOCNUM  = IDOC_CONTRL-DOCNUM.
              T_IDOC_ROLLNO-ROLLNO  = I_ZSTUD_UEB-ROLLNO.
              APPEND T_IDOC_ROLLNO.
           ENDCASE.
                if not ZBAPI_STUD_SEG is initial.
                 ZBAPI_STUD-MANDT  = ZBAPI_STUD_SEG-MANDT.
                 ZBAPI_STUD-ROLLNO = ZBAPI_STUD_SEG-ROLLNO.
                 ZBAPI_STUD-FNAME  = ZBAPI_STUD_SEG-FNAME.
                 ZBAPI_STUD-LNAME  = ZBAPI_STUD_SEG-LNAME.
                  INSERT ZBAPI_STUD FROM ZBAPI_STUD_SEG.
                  COMMIT WORK.
                ENDIF.
    *-- ALE ditribution unity : update IDOC status                "note03618
          LOOP AT it_dsp_idocstat.                                  "note036
             LOOP AT IDOC_STATUS WHERE DOCNUM = it_dsp_idocstat.    "note036
                DELETE idoc_status INDEX sy-tabix.                  "note036
             ENDLOOP.                                               "note036
             APPEND it_dsp_idocstat TO idoc_status.                 "note036
          ENDLOOP.                                                  "note036
    *--GENERATING THE IDOC STATUS
      PERFORM HANDLE_ERROR_EXT             " //br40
                  TABLES                                        "
                     IDOC_CONTRL                                "
                     IDOC_STATUS                                "
                     RETURN_VARIABLES                           "
                     T_MERRDAT                                  "
                     T_IDOC_TRANC                               "
                     T_IDOC_ROLLNO          "JH/4.0C/KPr100004993
                  USING                                         "
                     GENERAL_SUBRC                              "
                     NO_APPLICATION_LOG                         "
                     MASSSAVEINFOS         "wk/40c
                  CHANGING                                      "
                     WORKFLOW_RESULT.                           "
                  PERFORM HANDLE_ERROR
                              TABLES
                                 IDOC_CONTRL
                                 IDOC_STATUS
                                 RETURN_VARIABLES
                                 T_MERRDAT
                                 T_IDOC_ROLLNO     "JH/4.0C/KPr100004993
                              USING
                                 APPLICATION_SUBRC
                              CHANGING
                                 WORKFLOW_RESULT.
      SORT T_IDOC_ROLLNO BY ROLLNO. "note 315124
    React on general error
      DATA: I_MERRDAT LIKE MERRDAT.
      IF GENERAL_SUBRC <> 0.
        I_MERRDAT-MSGTY = 'E'.
        I_MERRDAT-MSGID = SY-MSGID.
        I_MERRDAT-MSGNO = SY-MSGNO.
        I_MERRDAT-MSGV1 = SY-MSGV1.
        I_MERRDAT-MSGV2 = SY-MSGV2.
        I_MERRDAT-MSGV3 = SY-MSGV3.
        I_MERRDAT-MSGV4 = SY-MSGV4.
        APPEND I_MERRDAT TO T_MERRDAT.
      ENDIF.
      LOOP AT T_MERRDAT INTO  I_MERRDAT
                        WHERE MSGTY = 'S'  "success
                        OR    MSGTY = 'D'  "dummy
                        OR    MSGTY = 'I'  "Information " //br011097 zu 3.1I
                        OR    MSGTY = 'H'  "dummy       " 4.0
                        OR    MSGTY = 'W'. "warning
        DELETE T_MERRDAT.
      ENDLOOP.
        ENDLOOP.
      ENDLOOP.
    ENDFUNCTION.
    *&      Form  handle_error_ext
    FORM HANDLE_ERROR_EXT
            TABLES
               IDOC_CONTRL                   STRUCTURE EDIDC
               IDOC_STATUS                   STRUCTURE BDIDOCSTAT
               RETURN_VARIABLES              STRUCTURE BDWFRETVAR
               T_MERRDAT                     STRUCTURE MERRDAT
               IDOC_TRANC                    STRUCTURE MATIDOCTRANC
    JH/02.02.98/4.0C  KPr100004993 (Anfang)
               T_IDOC_ROLLNO                 STRUCTURE T_IDOC_ROLLNO
    JH/02.02.98/4.0C  KPr100004993 (Ende)
            USING
               GENERAL_SUBRC                 LIKE SY-SUBRC
               NO_APPLICATION_LOG            LIKE SY-DATAR
               MASSSAVEINFOS                 LIKE MASSSAVINF
            CHANGING
               WORKFLOW_RESULT               LIKE BDWF_PARAM-RESULT.
      DATA FLAG_ERROR_HAPPENED.
      DATA I_MERRDAT LIKE MERRDAT.
      DATA IDOC_INDEX_2_SUBRC LIKE SY-SUBRC.
      DATA AL_HANDLES TYPE BAL_T_LOGH. "//br99
      SORT T_IDOC_ROLLNO BY ROLLNO.                        "note 315124
    React on general error
      IF GENERAL_SUBRC <> 0.
        REFRESH T_MERRDAT.
      i_merrdat-tranc = 0.                              " //br261197
        READ TABLE IDOC_TRANC INDEX 1.     " zu 40b
        I_MERRDAT-TRANC = IDOC_TRANC-FIRST_TRANC_IDOC.          "
        I_MERRDAT-MSGTY = 'E'.
        I_MERRDAT-MSGID = SY-MSGID.
        I_MERRDAT-MSGNO = SY-MSGNO.
        I_MERRDAT-MSGV1 = SY-MSGV1. I_MERRDAT-MSGV2 = SY-MSGV2.
        I_MERRDAT-MSGV3 = SY-MSGV3. I_MERRDAT-MSGV4 = SY-MSGV4.
        APPEND I_MERRDAT TO T_MERRDAT.
      ENDIF.
    DATA: C_TRUE,
          C_FALSE VALUE 'X'.
    If error happened ==> Rollback whole work....
      LOOP AT T_MERRDAT INTO I_MERRDAT WHERE MSGTY NA 'SDHWI'.
        EXIT.
      ENDLOOP.
      IF SY-SUBRC = 0.
        FLAG_ERROR_HAPPENED = C_TRUE.
        ROLLBACK WORK.
      ELSE.
        FLAG_ERROR_HAPPENED = C_FALSE.
      ENDIF.
    Set IDOC status
    two cases:
    single IDOC-processing: ==> error can be written in IDOC status
    package processing ==> anononymous "package error" for all IDOCs
      READ TABLE IDOC_CONTRL INDEX 2.
      IDOC_INDEX_2_SUBRC = SY-SUBRC.
      IF SY-SUBRC = 0.
        IF 1 = 2.                          "//br40
          MESSAGE E051(B1).                                     "
        ENDIF.                                                  "
        CLEAR I_MERRDAT.
        I_MERRDAT-MSGID = 'B1'.
        I_MERRDAT-MSGTY = 'E'.
        I_MERRDAT-MSGNO = '051'.
      ENDIF.
      IF IDOC_INDEX_2_SUBRC NE 0 OR FLAG_ERROR_HAPPENED = C_FALSE.
      Nur in diesen Fällen wird Application Log geschrieben
      Delete all Successes and Dummy records from t_merrdat
      DELETE t_merrdat WHERE msgty = 'S'  "success         " testweise
                       OR    msgty = 'D'. "dummy           "
        LOOP AT T_MERRDAT INTO I_MERRDAT WHERE MSGTY = 'D'.     "
          I_MERRDAT-MSGTY = 'S'.                                "
          MODIFY T_MERRDAT FROM I_MERRDAT.                      "
        ENDLOOP.                                                "
      ENDIF.
      WORKFLOW_RESULT = 0.
      LOOP AT IDOC_CONTRL.
      Set IDOC status
        CLEAR IDOC_STATUS.
        IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
        IF FLAG_ERROR_HAPPENED = C_FALSE.
    Application log
          PERFORM WRITE_APPL_LOG TABLES IDOC_TRANC
                                        T_MERRDAT
                                        IDOC_STATUS
                                 USING  IDOC_CONTRL
                                        FLAG_ERROR_HAPPENED
                                        NO_APPLICATION_LOG
                                        MASSSAVEINFOS
                                        AL_HANDLES.
        idoc_status-status = '53'.       "OK!
        APPEND idoc_status.
    JH/02.02.98/4.0C  KPr100004993 (Anfang)
        Fill Return variables
          CLEAR RETURN_VARIABLES.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
          RETURN_VARIABLES-WF_PARAM = 'Processed_IDOCs'.
          APPEND RETURN_VARIABLES.
        Verknüpfungseintrag anlegen
          READ TABLE T_IDOC_ROLLNO WITH KEY ROLLNO = IDOC_CONTRL-DOCNUM
                                  BINARY SEARCH.
          IF SY-SUBRC = 0.
            RETURN_VARIABLES-DOC_NUMBER = T_IDOC_ROLLNO-ROLLNO.
            RETURN_VARIABLES-WF_PARAM = 'Appl_Objects'.
            APPEND RETURN_VARIABLES.
          ENDIF.
    JH/02.02.98/4.0C  KPr100004993 (Ende)
        ELSE.
          IF IDOC_INDEX_2_SUBRC NE 0.
    Application Log
            PERFORM WRITE_APPL_LOG TABLES IDOC_TRANC
                                          T_MERRDAT
                                          IDOC_STATUS
                                   USING  IDOC_CONTRL
                                          FLAG_ERROR_HAPPENED
                                          NO_APPLICATION_LOG
                                          MASSSAVEINFOS
                                          AL_HANDLES.
          ELSE.
            IDOC_STATUS-MSGID = I_MERRDAT-MSGID.
            IDOC_STATUS-MSGTY = I_MERRDAT-MSGTY.
            IDOC_STATUS-MSGNO = I_MERRDAT-MSGNO.
            IDOC_STATUS-MSGV1 = I_MERRDAT-MSGV1.
            IDOC_STATUS-MSGV2 = I_MERRDAT-MSGV2.
            IDOC_STATUS-MSGV3 = I_MERRDAT-MSGV3.
            IDOC_STATUS-MSGV4 = I_MERRDAT-MSGV4.
            IDOC_STATUS-STATUS = '51'.     "ERROR!
            APPEND IDOC_STATUS.
          ENDIF.
        Fill Return variables
          CLEAR RETURN_VARIABLES.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
        return_variables-wf_param = c_wf_par_processed_idocs.
          RETURN_VARIABLES-WF_PARAM = 'Error_IDOCs'.
          APPEND RETURN_VARIABLES.
          WORKFLOW_RESULT = 99999.
        ENDIF.
      APPEND idoc_status.
      ENDLOOP.
      IF NO_APPLICATION_LOG IS INITIAL.
        CALL FUNCTION 'BAL_DB_SAVE'                           "//br99
             EXPORTING
                  I_IN_UPDATE_TASK = ' '
                  I_SAVE_ALL       = ' '
                  I_T_LOG_HANDLE   = AL_HANDLES.
           EXCEPTIONS
                LOG_NOT_FOUND    = 1
                SAVE_NOT_ALLOWED = 2
                NUMBERING_ERROR  = 3
                OTHERS           = 4.
        CALL FUNCTION 'BAL_GLB_MEMORY_REFRESH'                "//br99
             EXPORTING
                I_AUTHORIZATION          =
                  I_REFRESH_ALL            = ' '
                  I_T_LOGS_TO_BE_REFRESHED = AL_HANDLES.
           EXCEPTIONS
                NOT_AUTHORIZED           = 1
                OTHERS                   = 2
      ENDIF.
    ENDFORM.                               " handle_error
    Save, check and activate
    11. Assigning the Inbound Function Module to Basic Type & Message Type
    o     Go to T. Code WE57
    o     Click on change, continue, continue and New Entries Button
    o     Enter the Module as IDOC_INPUT_ZBAPI_STUD_MAS
    o     Type as u201CFu201D
    o     Basic Type as ZBAPI_STUD_IDOC
    o     Message Type as ZBAPI_STUD_MAS.
    o     Direction as 2
    o     Save and back
    Now Login in 810 client
    12. Assigning the Inbound Function Module in ALE Table
    o     Go to T. Code BD51
    o     Click on continue, New Entries button
    o     Give the Inbound Function Module IDOC_INPUT_ZBAPI_STUD_MAS
    o     Give Input t. as 0 (zero)
    o     Save and back
    13. Creating Process Code
    o     Go to T. Code WE42
    o     Click on Change, New Entries Button
    o     Give Process Code name as ZSTUD, give Description & Save
    o     Select Processing with ALE Services Radio button
    o     Select Processing by Function Module Radio button
    o     Click the ALE Table (arrow Icon) in Identification
    o     Give the Function Module Name ZIDOC_INPUT_ZBAPI_STUD_MAS
    o     Give maximum number of repeats 0
    o     Save and back, back
    o     Select the process code from the list & click on Logical Messages Icon
    o     Give the Message Type as ZBAPI_STUD_MAS
    o     Save & Back, Save & Back, Save & Back
    14. Changing the Customer Distribution model in Receiving system
    o     Go to T. Code BD64
    o     Click on change and Create model view button
    o     Select the model view & click on Environment -> Generate Partner Profiles
    o     Select Transfer IDOC Immediately and Trigger Immediately radio buttons
    o     Click on Execute
    o     You should get a list in green color which means it executed successfully.
    15. Assigning the Process Code to Message Type in Receiving System
    o     Go to T. Code WE20
    o     Expand Partner Type LS
    o     Select the Partner Profile STUD_S
    o     Double click on Message Type ZBAPI_STUD_MAS in Inbound parmtrs.
    o     Give the Process Code as ZSTUD
    o     Click on Trigger Immediately Radio button
    o     Save & Back
    o     Save & Back
    16. Creating the Selection Program (Outbound Program)
    u2022     Login in client 800.
    u2022     Go to T. Code SE38
    u2022     Create a Report Program as   ZSTUD_SEND with the following code
    REPORT ZSTUD_SEND
           NO STANDARD PAGE HEADING.
    TABLES: ZBAPI_STUD.
    DATA: IT_STUD LIKE ZBAPI_STUD OCCURS 0 WITH HEADER LINE.
    SELECTION-SCREEN:BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-H01.
    SELECT-OPTIONS: S_ROLLNO FOR ZBAPI_STUD-ROLLNO.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN:BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-H02.
    PARAMETERS:  P_MESTYP LIKE EDIDC-MESTYP,
                 P_RCVPRN LIKE TBDLST-LOGSYS.
    SELECTION-SCREEN:END OF BLOCK B2.
    SELECTION-SCREEN:END OF BLOCK B1.
    START-OF-SELECTION.
      PERFORM CREATE_STUDENT.
      PERFORM CREATE_IDOC.
    *&      Form  CREATE_STUDENT
          sending student
    FORM CREATE_STUDENT.
    SELECT * FROM ZBAPI_STUD
       INTO TABLE IT_STUD
       WHERE ROLLNO IN S_ROLLNO.
    ENDFORM.                    " CREATE_STUDENT
    *&      Form  CREATE_IDOC
          IDOC Creation
    FORM CREATE_IDOC.
    DATA : IMAS_DATA LIKE EDIDD OCCURS 10 WITH HEADER LINE,
           IMAS_CON LIKE EDIDC OCCURS 10 WITH HEADER LINE,
           ICOM_CON LIKE EDIDC OCCURS 10 WITH HEADER LINE.
    IMAS_CON-RCVPRT = 'LS'.
    IMAS_CON-RCVPRN = P_RCVPRN.
    IMAS_CON-IDOCTP = 'ZBAPI_STUD_IDOC'.
    IMAS_CON-MESTYP = P_MESTYP.
    IMAS_CON-DIRECT = 1.
    APPEND IMAS_CON.
    LOOP AT IT_STUD.
      IMAS_DATA-SEGNAM = 'ZBAPI_STUD_SEG'.
      IMAS_DATA-SDATA = IT_STUD.
      APPEND IMAS_DATA.
    ENDLOOP.
    CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
         EXPORTING
              MASTER_IDOC_CONTROL            = IMAS_CON
            OBJ_TYPE                       = ''
            CHNUM                          = ''
         TABLES
              COMMUNICATION_IDOC_CONTROL     = ICOM_CON
              MASTER_IDOC_DATA               = IMAS_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.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    COMMIT WORK.
    LOOP AT  ICOM_CON.
      WRITE :/ 'IDOC: ', ICOM_CON-DOCNUM, 'CREATED SUCCESSFULLY'.
    ENDLOOP.
    ENDFORM.                    " CREATE_IDOC
    17. Transferring the student records from 800 to 810 client
    u2022     Execute Report Program   ZSTUD_SEND
    u2022     Give the Range of Roll Nos to Transfer
    u2022     Give Message Type as    ZBAPI_STUD_MAS
    u2022     Give Receiver Logical system as   STUD_R
    u2022     Execute
    u2022     You should get the IDOC Number
    u2022     Take the IDOC Number and go to T. Code WE05 & Execute
    u2022     In Outbox you can see the IDOC Status
    u2022     Select the status record in left side window
    u2022     Double click on the Status record in right side window
    u2022     You can see the Control Record, Data Record and Status Records for that IDOC
    u2022     If the ICON is green and the status code is 3, it means the IDOC is passed to PORT Successfully.
    Now Login in 810 client
    u2022     Go to T. Code WE05 & Execute
    u2022     You can see the status record in left side window
    u2022     If the status no is 53 and color is green, it means the IDOC is Posted to Application successfully.
    u2022     You can see the Log Information by double clicking on the status record in right side window.
    u2022     Now in left side window, you can see the Control Record, Data Record & Status Record of the IDOC
    u2022     Now go to T. Code SE16
    u2022     Give the table name ZBAPI_STUD & press F7
    u2022     See the contents of the table
    u2022     The table is updated with the students records transferred from 800 client with our selection program.
    Reward if helpful
    Thanks
    Jagadesh.G

  • ALE/IDOC configurations?

    Hi Experts,
    Suppose i've two R/3 systems let say R1(Source system) and R2 (Target System). Now i want to send MATMAS05 IDOC from R1 to R2. Can anyone tell wht are ALE configuration's need to b done on both systems......plz give all Tcodes which are required at both systems with descriptions....
    Pts will b rewarded to approraite answers
    Regards
    Faisal

    Hi Friend ,
    Please the process in steps .
    MASTER DATA TRANSFERMATION BETWEEN 2 DIFF CLIENTS
    •     For this scenario Client 800 is the Sender and 810 is the receiving system
    1. Creating Logical Systems
    o     Login using 800 client
    o     Go to T. Code SALE
    o     Expand Sending and Receiving Systems
    o     Expand Logical Systems
    o     Click on Define Logical System
    o     Click on New Entries
    o     Create STUD_S, STUD_R Logical Systems
    o     Save and come back
    o     Assign the STUD_S Logical System to client 800
    o     Assign the STUD_R Logical System to client 810
    2. Creating the RFCs
    o     Go to T. Code SM59
    o     Expand R/3 Connections
    o     Enter RFC Name as STUD_S
    o     Connection Type as 3
    o     Language as EN
    o     Client as 800
    o     User as  SAPUSER
    o     PWD as abap
    o     Target host as sap
    o     Click on Remote logon button to test the RFC
    o     Enter RFC Name as STUD_R
    o     Connection Type as 3
    o     Language as EN
    o     Client as 800
    o     User as  SATISH
    o     PWD as abap
    o     Target host as sap
    o     Click on Remote logon button to test the RFC
    3. Creating the Message Type
    o     Go to T. Code WE81
    o     Click on change, continue
    o     Click on New Entries button
    o     Give message type as ZBAPI_STUD_MAS and description
    o     Save and back
    4. Creating the Segment
    o     Go to T. Code WE31
    o     Give segment name as ZBAPI_STUD_SEG
    o     Enter Short Text
    o     Enter the Field Name and Data Element in the text boxes
    o     Save, continue,
    o     Click on Edit -> Set Release.
    5. Creating the Basic IDOC Object
    o     Go to T. code WE30
    o     Give obj. name as ZBAPI_STUD_IDOC
    o     Click on create
    o     Select create new radio button, give description and continue
    o     Select the IDOC obj name and click on create button
    o     Enter the segment name which is create earlier
    o     Select the check box if you want to make the segment mandatory
    o     Enter 1 in minimum number 99999 in maximum number, continue
    o     Save and back
    o     Click on Edit -> Set Release
    6. Creating Customer Distribution Model
    o     Go to T. Code BD64
    o     Click on change and Create model view button
    o     Enter the short text and Technical name as ZSTUDENT
    o     Select the model and click on Add Message Type Button
    o     Give the Sender as STUD_S,
    o                    Receiver as STUD_R,
    o                    Message Type as ZBAPI_STUD_MAS
    o     Select the model view & click on Environment -> Generate Partner Profiles
    o     Select Transfer IDOC Immediately and Trigger Immediately radio buttons
    o     Click on Execute
    o     You should get a list in green color which means it executed successfully.
    o     Back to main screen, select the model view
    o     Click Edit->Model view->Distribute
    o     Click on continue
    o     You should get a list saying model view is distributed successfully.
    7. Checking the Port
    o     Go to T. Code WE21
    o     Expand Transactional RFC
    o     Find the port from the list which is created using BD64 for STUD_R (Receiving system) RFC Destination.
    8. Checking the Partner Profiles.
    o     Go to T. Code WE20
    o     Expand Partner Type LS
    o     Select the Partner profile STUD_R
    o     Double click on Message Type ZBAPI_STUD_MAS in Outbound parmtrs.
    o     Check Receiver Port is assigned correctly
    o     Check the Basic type as your Basic IDOC object.
    9. Assigning the Message Type to Basic IDOC Object
    o     Go to T. Code WE82
    o     Click on Change & continue, New Entries button
    o     Give the Message type as ZBAPI_STUD_MAS
    o     Give Basic Type as ZBAPI_STUD_IDOC
    o     Release as 46C
    o     Save and back
    10. Creating Inbound Function Module (Posting Program)
    o     Go to T. Code SE37
    o     Create a function Module IDOC_INPUT_ZBAPI_STUD_MAS
    o     Set the Processing type as Remote Enabled Module and mode as start immed, in Attributes Tab.
    o     Import Parameters
    INPUT_METHOD                 LIKE     BDWFAP_PAR-INPUTMETHD
    MASS_PROCESSING     LIKE     BDWFAP_PAR-MASS_PROC
    NO_APPLICATION_LOG     LIKE     SY-DATAR
    MASSSAVEINFOS                 LIKE     MASSSAVINF
    o     Export Parameters
    WORKFLOW_RESULT          LIKE     BDWF_PARAM-RESULT
    APPLICATION_VARIABLE     LIKE     BDWF_PARAM-APPL_VAR
    IN_UPDATE_TASK          LIKE     BDWFAP_PAR-UPDATETASK
    CALL_TRANSACTION_DONE  LIKE     BDWFAP_PAR-CALLTRANS
    o     Tables
    IDOC_CONTRL     LIKE     EDIDC
    IDOC_DATA          LIKE     EDIDD
    IDOC_STATUS     LIKE     BDIDOCSTAT
    RETURN_VARIABLES     LIKE     BDWFRETVAR
    SERIALIZATION_INFO     LIKE     BDI_SER
    o     Exceptions
    WRONG_FUNCTION_CALLED
    o     Source Code
    DATA: FIRST_TRANC LIKE MARA_UEB-TRANC,
          ZBAPI_STUD_SEG like zbapi_stud.
    DATA: ZBAPI_STUD LIKE ZBAPI_STUD.
      DATA: I_ZBAPI_STUD LIKE ZBAPI_STUD.
      DATA: C_TRUE                         VALUE 'X'.
      DATA: C_FALSE                        VALUE ' '.
    DATA: BEGIN OF T_IDOC_ROLLNO OCCURS 0,
            DOCNUM LIKE EDIDC-DOCNUM,
            ROLLNO LIKE ZBAPI_STUD-ROLLNO,
          END   OF T_IDOC_ROLLNO.
      DEFINE APPEND_RESFIELDS.
        PERFORM APPEND_RES_FIELDS TABLES T_MFIELDRES
                                         T_RES_FIELDS
                                  USING  &1
                                         COUNTER-D_IND.
      END-OF-DEFINITION.
      DATA: I_MARA_UEB LIKE MARA_UEB.
      DATA: I_ZSTUD_UEB LIKE ZBAPI_STUD.
      DATA: I_MAKT_UEB LIKE MAKT_UEB.
      DATA: I_MARC_UEB LIKE MARC_UEB.
      DATA: I_MARD_UEB LIKE MARD_UEB.
      DATA: I_MFHM_UEB LIKE MFHM_UEB.
      DATA: I_MARM_UEB LIKE MARM_UEB.
      DATA: I_MEAN_UEB LIKE MEA1_UEB.
      DATA: I_MBEW_UEB LIKE MBEW_UEB.
      DATA: I_STEU_UEB LIKE STEU_UEB.
      DATA: I_STEUMM_UEB LIKE STEUMM_UEB.
      DATA: I_MLGN_UEB LIKE MLGN_UEB.
      DATA: I_MLGT_UEB LIKE MLGT_UEB.      " //br010797 neu zu 4.0
      DATA: I_MPGD_UEB LIKE MPGD_UEB.
      DATA: I_MPOP_UEB LIKE MPOP_UEB.
      DATA: I_MVEG_UEB LIKE MVEG_UEB.
      DATA: I_MVEU_UEB LIKE MVEU_UEB.
      DATA: I_MVKE_UEB LIKE MVKE_UEB.
      DATA: I_MPRW_UEB LIKE MPRW_UEB.
      DATA: I_LTX1_UEB LIKE LTX1_UEB.
      DATA: HELP_MARC_UEB LIKE MARC_UEB.
      DATA: T_MARA_UEB LIKE MARA_UEB OCCURS 0.
      DATA: T_MAKT_UEB LIKE MAKT_UEB OCCURS 0.
      DATA: T_MARC_UEB LIKE MARC_UEB OCCURS 0.
      DATA: T_MARD_UEB LIKE MARD_UEB OCCURS 0.
      DATA: T_MFHM_UEB LIKE MFHM_UEB OCCURS 0.
      DATA: T_MARM_UEB LIKE MARM_UEB OCCURS 0.
      DATA: T_MEAN_UEB LIKE MEA1_UEB OCCURS 0.
      DATA: T_MBEW_UEB LIKE MBEW_UEB OCCURS 0.
      DATA: T_STEU_UEB LIKE STEU_UEB OCCURS 0.
      DATA: T_STEUMM_UEB LIKE STEUMM_UEB OCCURS 0.
      DATA: T_MLGN_UEB LIKE MLGN_UEB OCCURS 0.
      DATA: T_MLGT_UEB LIKE MLGT_UEB OCCURS 0.    " //br010797 neu zu 4.0
      DATA: T_MPGD_UEB LIKE MPGD_UEB OCCURS 0.
      DATA: T_MPOP_UEB LIKE MPOP_UEB OCCURS 0.
      DATA: T_MVEG_UEB LIKE MVEG_UEB OCCURS 0.
      DATA: T_MVEU_UEB LIKE MVEU_UEB OCCURS 0.
      DATA: T_MVKE_UEB LIKE MVKE_UEB OCCURS 0.
      DATA: T_MPRW_UEB LIKE MPRW_UEB OCCURS 0.
      DATA: T_LTX1_UEB LIKE LTX1_UEB OCCURS 0.
    Internal fields/ tables
    DATA: FLAG_ERROR_HAPPENED.
    DATA: flag_material_exists. "//br210397 zu 4.0 keine Verwendung mehr
      DATA: FLAG_EXIT_TO_BE_DONE.
      DATA: HELP_TABIX LIKE SY-TABIX.
      DATA: HELP_TRANC LIKE MARA_UEB-TRANC.
      DATA: HELP_ALAND LIKE STEU_UEB-ALAND.
      DATA: HELP_VKORG LIKE MVKE-VKORG.
      DATA: HELP_WERKS LIKE T001W-WERKS.
      DATA: HELP_LFDNR LIKE STEU_UEB-LFDNR.
      DATA: LAST_MARC_TRANC LIKE MARA_UEB-TRANC.
      DATA: LAST_MLGN_TRANC LIKE MARA_UEB-TRANC.    " //br010797 neu zu 4.0
      DATA: LAST_TEXT_TRANC LIKE MARA_UEB-TRANC.
      DATA: CURRENT_TABIX LIKE SY-TABIX.
      DATA: GENERAL_SUBRC LIKE SY-SUBRC.
      DATA: HELP_FACTOR TYPE P DECIMALS 3.
      DATA: USER_SEGMENTS LIKE EDIDD OCCURS 0 WITH HEADER LINE.  " insert
      DATA: CUST_SEGMENT LIKE EDIDD.
      DATA: I_MFIELDRES LIKE MFIELDRES.
    DATA: I_MERRDAT LIKE MERRDAT.
      DATA: I_EDIDD LIKE EDIDD.
                                           " //br neu zu 3.1g
      DATA: T_RES_FIELDS LIKE DELFIELDS OCCURS 0 WITH HEADER LINE.
      DATA: T_MFIELDRES LIKE MFIELDRES OCCURS 0.
      DATA: T_MERRDAT LIKE MERRDAT OCCURS 0.
      DATA: T_EDIDD LIKE EDIDD OCCURS 0.
    DATA: BEGIN OF t_matnr OCCURS 0, "//br210397 zu 4.0
            matnr LIKE mara-matnr,   " wird nicht mehr verwendet
          END OF t_matnr.            "
      DATA: BEGIN OF COUNTER,
              TRANC LIKE MARA_UEB-TRANC,
              D_IND LIKE MARA_UEB-D_IND,
            END OF COUNTER.
    DATA: BEGIN OF t_idoc_tranc OCCURS 0,                          " 4.0
            docnum LIKE edidc-docnum,                              "
            tranc  LIKE mara_ueb-tranc,                            "
          END OF t_idoc_tranc.                                     "
      DATA T_IDOC_TRANC LIKE MATIDOCTRANC OCCURS 0 WITH HEADER LINE."
      DATA: FLAG_FITS.
      DATA: APPLICATION_SUBRC LIKE SY-SUBRC.
      DATA FLAG_MUSS_PRUEFEN LIKE SY-DATAR.
      DATA MAX_ERRORS LIKE T130S-ANZUM.    " 4.0
    note 419281
      DATA : FLG_MASS.
      CLEAR : FLG_MASS.
      FIELD-SYMBOLS: .            " 4.0
    ALE-distribution unity : IDOC status set by locking      "note0361838
      data:                                                     "note0361838
        it_dsp_idocstat like bdidocstat                         "note0361838
          occurs 0 with header line.                            "note0361838
    Initialize data - general
      REFRESH T_MFIELDRES.
      REFRESH T_IDOC_TRANC.
      REFRESH T_IDOC_TRANC.                "JH/02.02.98/4.0C  KPr100004993
    REFRESH t_idoc_tranc_segment.   " //br 40 : unnötig
    REFRESH matnr_tranc.            "    -"-
    REFRESH t_matnr.
      COUNTER-TRANC = 1.
      COUNTER-D_IND = 1.
      REFRESH T_MARA_UEB.
      REFRESH T_MAKT_UEB.
      REFRESH T_MARC_UEB.
      REFRESH T_MARD_UEB.
      REFRESH T_MFHM_UEB.
      REFRESH T_MARM_UEB.
      REFRESH T_MEAN_UEB.
      REFRESH T_MBEW_UEB.
      REFRESH T_STEU_UEB.
      REFRESH T_STEUMM_UEB.
      REFRESH T_MLGN_UEB.
      REFRESH T_MLGT_UEB.                  " //br010797 neu zu 4.0
      REFRESH T_MPGD_UEB.
      REFRESH T_MPOP_UEB.
      REFRESH T_MVEG_UEB.
      REFRESH T_MVEU_UEB.
      REFRESH T_MVKE_UEB.
      REFRESH T_MPRW_UEB.
    REFRESH VKORG_ALAND.
    REFRESH WERKS_ALAND.
      CLEAR APPLICATION_SUBRC.
      REFRESH T_MERRDAT.
    Check if right function is called
      READ TABLE IDOC_CONTRL INDEX 1.
      IF SY-SUBRC <> 0.
        EXIT.
      ELSE.
        IF  IDOC_CONTRL-IDOCTP <> 'ZBAPI_STUD_IDOC'.
          RAISE WRONG_FUNCTION_CALLED.
        ENDIF.
      ENDIF.
      LOOP AT IDOC_CONTRL.
      Initialize data - per IDOC
      t_idoc_tranc-docnum = counter-tranc.
        T_IDOC_TRANC-DOCNUM = IDOC_CONTRL-DOCNUM.
        T_IDOC_TRANC-FIRST_TRANC_IDOC = COUNTER-TRANC + 2.
        APPEND T_IDOC_TRANC.
      Select segments which belong to IDOC
        REFRESH T_EDIDD.
        LOOP AT IDOC_DATA WHERE DOCNUM = IDOC_CONTRL-DOCNUM.
          APPEND IDOC_DATA TO T_EDIDD.
        ENDLOOP.
       BUSINESS TRANSACTION EVENT (header / data)         "note0388000
         call function 'OPEN_FI_PERFORM_MGV00200_E'         "note0388000
              exporting                                     "note0388000
                  idoc_header       = idoc_contrl           "note0388000
                  FLG_APPEND_STATUS = 'X'                   "note0388000
              tables                                        "note0388000
    (DEL)       idoc_data         = idoc_data "note0388000 note0418561
                  idoc_data         = t_edidd               "note0418561
                  idoc_status       = idoc_status           "note0388000
              exceptions                                    "note0388000
                  others       = 1.                         "note0388000
         if sy-subrc = 1.                                   "note0388000
            continue.                                       "note0388000
         endif.                                             "note0388000
      Within one IDOC: loop through data segments:
      Prepare internal tables for the current material
        LOOP AT T_EDIDD INTO IDOC_DATA.
        Transform from CoreData to Normal Data if necesary
          CASE IDOC_DATA-SEGNAM.
           WHEN 'E1MARAC'.
    *--COMMENTED BY SATISH
             PERFORM MOVE_E1MARAC_TO_E1MARAM USING IDOC_DATA.
           WHEN 'E1MAKTC'.
             PERFORM MOVE_E1MAKTC_TO_E1MAKTM USING IDOC_DATA.
    *--COMMENTES ENDED BY SATISH
             WHEN 'ZBAPI_STUD_SEG'.
              PERFORM MOVE_E1MARAC_TO_E1MARAM USING IDOC_DATA.
                CLEAR I_ZBAPI_STUD.
    Second: Move E1MARAC into E1MARAM
                I_ZBAPI_STUD = IDOC_DATA-SDATA.
    Third: Move E1MARAM back into IDOC-line
                IDOC_DATA-SDATA =  I_ZBAPI_STUD.
                IDOC_DATA-SEGNAM = 'ZBAPI_STUD_SEG'.
          ENDCASE.
          CURRENT_TABIX = SY-TABIX.
          COUNTER-D_IND = COUNTER-D_IND + 1.
          COUNTER-TRANC = COUNTER-TRANC + 2.
          CASE IDOC_DATA-SEGNAM.
             WHEN 'ZBAPI_STUD_SEG'.
            Initialize data - per material
              COUNTER-D_IND = 1.
              FIRST_TRANC = COUNTER-TRANC.
            interpret segment
              ZBAPI_STUD_SEG = IDOC_DATA-SDATA.
              MOVE-CORRESPONDING ZBAPI_STUD TO I_ZSTUD_UEB.
              T_IDOC_ROLLNO-DOCNUM  = IDOC_CONTRL-DOCNUM.
              T_IDOC_ROLLNO-ROLLNO  = I_ZSTUD_UEB-ROLLNO.
              APPEND T_IDOC_ROLLNO.
           ENDCASE.
                if not ZBAPI_STUD_SEG is initial.
                 ZBAPI_STUD-MANDT  = ZBAPI_STUD_SEG-MANDT.
                 ZBAPI_STUD-ROLLNO = ZBAPI_STUD_SEG-ROLLNO.
                 ZBAPI_STUD-FNAME  = ZBAPI_STUD_SEG-FNAME.
                 ZBAPI_STUD-LNAME  = ZBAPI_STUD_SEG-LNAME.
                  INSERT ZBAPI_STUD FROM ZBAPI_STUD_SEG.
                  COMMIT WORK.
                ENDIF.
    *-- ALE ditribution unity : update IDOC status                "note03618
          LOOP AT it_dsp_idocstat.                                  "note036
             LOOP AT IDOC_STATUS WHERE DOCNUM = it_dsp_idocstat.    "note036
                DELETE idoc_status INDEX sy-tabix.                  "note036
             ENDLOOP.                                               "note036
             APPEND it_dsp_idocstat TO idoc_status.                 "note036
          ENDLOOP.                                                  "note036
    *--GENERATING THE IDOC STATUS
      PERFORM HANDLE_ERROR_EXT             " //br40
                  TABLES                                        "
                     IDOC_CONTRL                                "
                     IDOC_STATUS                                "
                     RETURN_VARIABLES                           "
                     T_MERRDAT                                  "
                     T_IDOC_TRANC                               "
                     T_IDOC_ROLLNO          "JH/4.0C/KPr100004993
                  USING                                         "
                     GENERAL_SUBRC                              "
                     NO_APPLICATION_LOG                         "
                     MASSSAVEINFOS         "wk/40c
                  CHANGING                                      "
                     WORKFLOW_RESULT.                           "
                  PERFORM HANDLE_ERROR
                              TABLES
                                 IDOC_CONTRL
                                 IDOC_STATUS
                                 RETURN_VARIABLES
                                 T_MERRDAT
                                 T_IDOC_ROLLNO     "JH/4.0C/KPr100004993
                              USING
                                 APPLICATION_SUBRC
                              CHANGING
                                 WORKFLOW_RESULT.
      SORT T_IDOC_ROLLNO BY ROLLNO. "note 315124
    React on general error
      DATA: I_MERRDAT LIKE MERRDAT.
      IF GENERAL_SUBRC <> 0.
        I_MERRDAT-MSGTY = 'E'.
        I_MERRDAT-MSGID = SY-MSGID.
        I_MERRDAT-MSGNO = SY-MSGNO.
        I_MERRDAT-MSGV1 = SY-MSGV1.
        I_MERRDAT-MSGV2 = SY-MSGV2.
        I_MERRDAT-MSGV3 = SY-MSGV3.
        I_MERRDAT-MSGV4 = SY-MSGV4.
        APPEND I_MERRDAT TO T_MERRDAT.
      ENDIF.
      LOOP AT T_MERRDAT INTO  I_MERRDAT
                        WHERE MSGTY = 'S'  "success
                        OR    MSGTY = 'D'  "dummy
                        OR    MSGTY = 'I'  "Information " //br011097 zu 3.1I
                        OR    MSGTY = 'H'  "dummy       " 4.0
                        OR    MSGTY = 'W'. "warning
        DELETE T_MERRDAT.
      ENDLOOP.
        ENDLOOP.
      ENDLOOP.
    ENDFUNCTION.
    *&      Form  handle_error_ext
    FORM HANDLE_ERROR_EXT
            TABLES
               IDOC_CONTRL                   STRUCTURE EDIDC
               IDOC_STATUS                   STRUCTURE BDIDOCSTAT
               RETURN_VARIABLES              STRUCTURE BDWFRETVAR
               T_MERRDAT                     STRUCTURE MERRDAT
               IDOC_TRANC                    STRUCTURE MATIDOCTRANC
    JH/02.02.98/4.0C  KPr100004993 (Anfang)
               T_IDOC_ROLLNO                 STRUCTURE T_IDOC_ROLLNO
    JH/02.02.98/4.0C  KPr100004993 (Ende)
            USING
               GENERAL_SUBRC                 LIKE SY-SUBRC
               NO_APPLICATION_LOG            LIKE SY-DATAR
               MASSSAVEINFOS                 LIKE MASSSAVINF
            CHANGING
               WORKFLOW_RESULT               LIKE BDWF_PARAM-RESULT.
      DATA FLAG_ERROR_HAPPENED.
      DATA I_MERRDAT LIKE MERRDAT.
      DATA IDOC_INDEX_2_SUBRC LIKE SY-SUBRC.
      DATA AL_HANDLES TYPE BAL_T_LOGH. "//br99
      SORT T_IDOC_ROLLNO BY ROLLNO.                        "note 315124
    React on general error
      IF GENERAL_SUBRC <> 0.
        REFRESH T_MERRDAT.
      i_merrdat-tranc = 0.                              " //br261197
        READ TABLE IDOC_TRANC INDEX 1.     " zu 40b
        I_MERRDAT-TRANC = IDOC_TRANC-FIRST_TRANC_IDOC.          "
        I_MERRDAT-MSGTY = 'E'.
        I_MERRDAT-MSGID = SY-MSGID.
        I_MERRDAT-MSGNO = SY-MSGNO.
        I_MERRDAT-MSGV1 = SY-MSGV1. I_MERRDAT-MSGV2 = SY-MSGV2.
        I_MERRDAT-MSGV3 = SY-MSGV3. I_MERRDAT-MSGV4 = SY-MSGV4.
        APPEND I_MERRDAT TO T_MERRDAT.
      ENDIF.
    DATA: C_TRUE,
          C_FALSE VALUE 'X'.
    If error happened ==> Rollback whole work....
      LOOP AT T_MERRDAT INTO I_MERRDAT WHERE MSGTY NA 'SDHWI'.
        EXIT.
      ENDLOOP.
      IF SY-SUBRC = 0.
        FLAG_ERROR_HAPPENED = C_TRUE.
        ROLLBACK WORK.
      ELSE.
        FLAG_ERROR_HAPPENED = C_FALSE.
      ENDIF.
    Set IDOC status
    two cases:
    single IDOC-processing: ==> error can be written in IDOC status
    package processing ==> anononymous "package error" for all IDOCs
      READ TABLE IDOC_CONTRL INDEX 2.
      IDOC_INDEX_2_SUBRC = SY-SUBRC.
      IF SY-SUBRC = 0.
        IF 1 = 2.                          "//br40
          MESSAGE E051(B1).                                     "
        ENDIF.                                                  "
        CLEAR I_MERRDAT.
        I_MERRDAT-MSGID = 'B1'.
        I_MERRDAT-MSGTY = 'E'.
        I_MERRDAT-MSGNO = '051'.
      ENDIF.
      IF IDOC_INDEX_2_SUBRC NE 0 OR FLAG_ERROR_HAPPENED = C_FALSE.
      Nur in diesen Fällen wird Application Log geschrieben
      Delete all Successes and Dummy records from t_merrdat
      DELETE t_merrdat WHERE msgty = 'S'  "success         " testweise
                       OR    msgty = 'D'. "dummy           "
        LOOP AT T_MERRDAT INTO I_MERRDAT WHERE MSGTY = 'D'.     "
          I_MERRDAT-MSGTY = 'S'.                                "
          MODIFY T_MERRDAT FROM I_MERRDAT.                      "
        ENDLOOP.                                                "
      ENDIF.
      WORKFLOW_RESULT = 0.
      LOOP AT IDOC_CONTRL.
      Set IDOC status
        CLEAR IDOC_STATUS.
        IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
        IF FLAG_ERROR_HAPPENED = C_FALSE.
    Application log
          PERFORM WRITE_APPL_LOG TABLES IDOC_TRANC
                                        T_MERRDAT
                                        IDOC_STATUS
                                 USING  IDOC_CONTRL
                                        FLAG_ERROR_HAPPENED
                                        NO_APPLICATION_LOG
                                        MASSSAVEINFOS
                                        AL_HANDLES.
        idoc_status-status = '53'.       "OK!
        APPEND idoc_status.
    JH/02.02.98/4.0C  KPr100004993 (Anfang)
        Fill Return variables
          CLEAR RETURN_VARIABLES.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
          RETURN_VARIABLES-WF_PARAM = 'Processed_IDOCs'.
          APPEND RETURN_VARIABLES.
        Verknüpfungseintrag anlegen
          READ TABLE T_IDOC_ROLLNO WITH KEY ROLLNO = IDOC_CONTRL-DOCNUM
                                  BINARY SEARCH.
          IF SY-SUBRC = 0.
            RETURN_VARIABLES-DOC_NUMBER = T_IDOC_ROLLNO-ROLLNO.
            RETURN_VARIABLES-WF_PARAM = 'Appl_Objects'.
            APPEND RETURN_VARIABLES.
          ENDIF.
    JH/02.02.98/4.0C  KPr100004993 (Ende)
        ELSE.
          IF IDOC_INDEX_2_SUBRC NE 0.
    Application Log
            PERFORM WRITE_APPL_LOG TABLES IDOC_TRANC
                                          T_MERRDAT
                                          IDOC_STATUS
                                   USING  IDOC_CONTRL
                                          FLAG_ERROR_HAPPENED
                                          NO_APPLICATION_LOG
                                          MASSSAVEINFOS
                                          AL_HANDLES.
          ELSE.
            IDOC_STATUS-MSGID = I_MERRDAT-MSGID.
            IDOC_STATUS-MSGTY = I_MERRDAT-MSGTY.
            IDOC_STATUS-MSGNO = I_MERRDAT-MSGNO.
            IDOC_STATUS-MSGV1 = I_MERRDAT-MSGV1.
            IDOC_STATUS-MSGV2 = I_MERRDAT-MSGV2.
            IDOC_STATUS-MSGV3 = I_MERRDAT-MSGV3.
            IDOC_STATUS-MSGV4 = I_MERRDAT-MSGV4.
            IDOC_STATUS-STATUS = '51'.     "ERROR!
            APPEND IDOC_STATUS.
          ENDIF.
        Fill Return variables
          CLEAR RETURN_VARIABLES.
          RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
        return_variables-wf_param = c_wf_par_processed_idocs.
          RETURN_VARIABLES-WF_PARAM = 'Error_IDOCs'.
          APPEND RETURN_VARIABLES.
          WORKFLOW_RESULT = 99999.
        ENDIF.
      APPEND idoc_status.
      ENDLOOP.
      IF NO_APPLICATION_LOG IS INITIAL.
        CALL FUNCTION 'BAL_DB_SAVE'                           "//br99
             EXPORTING
                  I_IN_UPDATE_TASK = ' '
                  I_SAVE_ALL       = ' '
                  I_T_LOG_HANDLE   = AL_HANDLES.
           EXCEPTIONS
                LOG_NOT_FOUND    = 1
                SAVE_NOT_ALLOWED = 2
                NUMBERING_ERROR  = 3
                OTHERS           = 4.
        CALL FUNCTION 'BAL_GLB_MEMORY_REFRESH'                "//br99
             EXPORTING
                I_AUTHORIZATION          =
                  I_REFRESH_ALL            = ' '
                  I_T_LOGS_TO_BE_REFRESHED = AL_HANDLES.
           EXCEPTIONS
                NOT_AUTHORIZED           = 1
                OTHERS                   = 2
      ENDIF.
    ENDFORM.                               " handle_error
    Save, check and activate
    11. Assigning the Inbound Function Module to Basic Type & Message Type
    o     Go to T. Code WE57
    o     Click on change, continue, continue and New Entries Button
    o     Enter the Module as IDOC_INPUT_ZBAPI_STUD_MAS
    o     Type as “F”
    o     Basic Type as ZBAPI_STUD_IDOC
    o     Message Type as ZBAPI_STUD_MAS.
    o     Direction as 2
    o     Save and back
    Now Login in 810 client
    12. Assigning the Inbound Function Module in ALE Table
    o     Go to T. Code BD51
    o     Click on continue, New Entries button
    o     Give the Inbound Function Module IDOC_INPUT_ZBAPI_STUD_MAS
    o     Give Input t. as 0 (zero)
    o     Save and back
    13. Creating Process Code
    o     Go to T. Code WE42
    o     Click on Change, New Entries Button
    o     Give Process Code name as ZSTUD, give Description & Save
    o     Select Processing with ALE Services Radio button
    o     Select Processing by Function Module Radio button
    o     Click the ALE Table (arrow Icon) in Identification
    o     Give the Function Module Name ZIDOC_INPUT_ZBAPI_STUD_MAS
    o     Give maximum number of repeats 0
    o     Save and back, back
    o     Select the process code from the list & click on Logical Messages Icon
    o     Give the Message Type as ZBAPI_STUD_MAS
    o     Save & Back, Save & Back, Save & Back
    14. Changing the Customer Distribution model in Receiving system
    o     Go to T. Code BD64
    o     Click on change and Create model view button
    o     Select the model view & click on Environment -> Generate Partner Profiles
    o     Select Transfer IDOC Immediately and Trigger Immediately radio buttons
    o     Click on Execute
    o     You should get a list in green color which means it executed successfully.
    15. Assigning the Process Code to Message Type in Receiving System
    o     Go to T. Code WE20
    o     Expand Partner Type LS
    o     Select the Partner Profile STUD_S
    o     Double click on Message Type ZBAPI_STUD_MAS in Inbound parmtrs.
    o     Give the Process Code as ZSTUD
    o     Click on Trigger Immediately Radio button
    o     Save & Back
    o     Save & Back
    16. Creating the Selection Program (Outbound Program)
    •     Login in client 800.
    •     Go to T. Code SE38
    •     Create a Report Program as   ZSTUD_SEND with the following code
    REPORT ZSTUD_SEND
           NO STANDARD PAGE HEADING.
    TABLES: ZBAPI_STUD.
    DATA: IT_STUD LIKE ZBAPI_STUD OCCURS 0 WITH HEADER LINE.
    SELECTION-SCREEN:BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-H01.
    SELECT-OPTIONS: S_ROLLNO FOR ZBAPI_STUD-ROLLNO.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN:BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-H02.
    PARAMETERS:  P_MESTYP LIKE EDIDC-MESTYP,
                 P_RCVPRN LIKE TBDLST-LOGSYS.
    SELECTION-SCREEN:END OF BLOCK B2.
    SELECTION-SCREEN:END OF BLOCK B1.
    START-OF-SELECTION.
      PERFORM CREATE_STUDENT.
      PERFORM CREATE_IDOC.
    *&      Form  CREATE_STUDENT
          sending student
    FORM CREATE_STUDENT.
    SELECT * FROM ZBAPI_STUD
       INTO TABLE IT_STUD
       WHERE ROLLNO IN S_ROLLNO.
    ENDFORM.                    " CREATE_STUDENT
    *&      Form  CREATE_IDOC
          IDOC Creation
    FORM CREATE_IDOC.
    DATA : IMAS_DATA LIKE EDIDD OCCURS 10 WITH HEADER LINE,
           IMAS_CON LIKE EDIDC OCCURS 10 WITH HEADER LINE,
           ICOM_CON LIKE EDIDC OCCURS 10 WITH HEADER LINE.
    IMAS_CON-RCVPRT = 'LS'.
    IMAS_CON-RCVPRN = P_RCVPRN.
    IMAS_CON-IDOCTP = 'ZBAPI_STUD_IDOC'.
    IMAS_CON-MESTYP = P_MESTYP.
    IMAS_CON-DIRECT = 1.
    APPEND IMAS_CON.
    LOOP AT IT_STUD.
      IMAS_DATA-SEGNAM = 'ZBAPI_STUD_SEG'.
      IMAS_DATA-SDATA = IT_STUD.
      APPEND IMAS_DATA.
    ENDLOOP.
    CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
         EXPORTING
              MASTER_IDOC_CONTROL            = IMAS_CON
            OBJ_TYPE                       = ''
            CHNUM                          = ''
         TABLES
              COMMUNICATION_IDOC_CONTROL     = ICOM_CON
              MASTER_IDOC_DATA               = IMAS_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.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    COMMIT WORK.
    LOOP AT  ICOM_CON.
      WRITE :/ 'IDOC: ', ICOM_CON-DOCNUM, 'CREATED SUCCESSFULLY'.
    ENDLOOP.
    ENDFORM.                    " CREATE_IDOC
    17. Transferring the student records from 800 to 810 client
    •     Execute Report Program   ZSTUD_SEND
    •     Give the Range of Roll Nos to Transfer
    •     Give Message Type as    ZBAPI_STUD_MAS
    •     Give Receiver Logical system as   STUD_R
    •     Execute
    •     You should get the IDOC Number
    •     Take the IDOC Number and go to T. Code WE05 & Execute
    •     In Outbox you can see the IDOC Status
    •     Select the status record in left side window
    •     Double click on the Status record in right side window
    •     You can see the Control Record, Data Record and Status Records for that IDOC
    •     If the ICON is green and the status code is 3, it means the IDOC is passed to PORT Successfully.
    Now Login in 810 client
    •     Go to T. Code WE05 & Execute
    •     You can see the status record in left side window
    •     If the status no is 53 and color is green, it means the IDOC is Posted to Application successfully.
    •     You can see the Log Information by double clicking on the status record in right side window.
    •     Now in left side window, you can see the Control Record, Data Record & Status Record of the IDOC
    •     Now go to T. Code SE16
    •     Give the table name ZBAPI_STUD & press F7
    •     See the contents of the table
    •     The table is updated with the students records transferred from 800 client with our selection program.
    Reward if useful
    Regrds
    Jagadeesh.G

Maybe you are looking for