RUNNING BAPI BAPI_ROUTING_CREATE

I AM GETTING ERROR IN USING BAPI
A CP 205 The task list type in structure MTK_CLASS_DATA_INTERFACE does not match the task MATERIALTASKALLOCATI  1
HELP ME .

I AM GETTING ERROR IN USING BAPI
A CP 205 The task list type in structure MTK_CLASS_DATA_INTERFACE does not match the task MATERIALTASKALLOCATI  1
HELP ME .

Similar Messages

  • Problem while creation of Routing using BAPI "BAPI_ROUTING_CREATE"

    Hi.
    I am trying to create routing using the BAPI "BAPI_ROUTING_CREATE", when I execute I get the group number and the group counter number in the Export parameters. But it is not saved in the database, when we look at CA03 using the group number system says routing not found.
    I am passing "Space" to Bapiflag and i am passing input to tables TASK, MATERIAL ALLOCATON and OPERATION as follows:-
    MATERIALTASKALLOCATION-MATERIAL
    MATERIALTASKALLOCATION-PLANT
    TASK-TASK_LIST_USAGE
    TASK-PLANT
    TASK-TASK_LIST_STATUS
    TASK-TASK_MEASURE_UNIT
    OPERATION-ACTIVITY
    OPERATION-CONTROL_KEY
    OPERATION-WORK_CNTR                    
    OPERATION-PLANT
    OPERATION-DESCRIPTION
    OPERATION-NUMERATOR
    OPERATION-DENOMENATOR
    OPERATION-BASE_QUANTITY
    OPERATION-STD_UNIT_01
    OPERATION-STD_VALUE_01
    OPERATION-STD_UNIT_02
    OPERATION-STD_VALUE_02
    OPERATION-STD_UNIT_03
    OPERATION-STD_VALUE_03
    OPERATION-STD_UNIT_04
    OPERATION-STD_VALUE_04
    OPERATION-STD_UNIT_05
    OPERATION-STD_VALUE_05
    OPERATION-STD_UNIT_06
    OPERATION-STD_VALUE_06
    Appreciate your replies.
    Regards.
    Anand Ghawade.

    Use BAPI_TRANSACTION_COMMIT after you call the BAPI_ROUTING_CREATE

  • Error in run bapi in portal

    hi,
    i wont run bapi in portal and i get erorr :
    No storage space available for extending an internal table., error key: RFC_ERROR_SYSTEM_FAILURE
    the bapi is working o.k. in R.3
    what can be the problem?
    <REMOVED BY MODERATOR>
    Regards
    Edited by: Alvaro Tejada Galindo on Mar 5, 2008 3:51 PM

    hi,
    thanks!
    the fm running o.k. in r.3 but when i try to run it from the portal
    with same value i have error!
    from  your experience it's portal problem or bapi problem?
    i wasted on this problem 2 days...
    Regards

  • Problems with running BAPI   BAPI_SALESORDER_CREATEFROMDAT2

    Hi all,
    I’ve got a problem running BAPIs in SD invironment.
    I’m creating contract releases in SD via BAPI.
    First I run BAPI BAPISORDER_GETDETAILEDLIST in my program to get detaildata of the contract.
    Then I run the BAPI   BAPI_SALESORDER_CREATEFROMDAT2 filled with contract reference data and in addition with order data to create the contract release.This works properly so far. On both sides in the contract and in he contract release I find the correct document flow. Means: in document flow of the contract I find all the releases created . Also I find the contract in the documentflow of the releases.
    But…something does not work: In the contract the released values are not updated. When I create a release manually, the release values are accumulated  in the contract in field  ‘value released’ under flag ‘item detail’. But this does not work, when the leases are created via BAPI. However I checked several parameters in the BAPIS but I cannot find something that leads to an update .
    Can somebody help me and can tell me what is to be done to get this field updated? Thanks in advance.
    same in German...
    Ich habe ein Problem mit BAPIs im SD.
    Ich erzeuge Abrufe zum Kontrakt im SD mittels BAPIs.
    Zuerst lasse ich den BAPI BAPISORDER_GETDETAILEDLIST laufen, um mittels Kontraktnummer alle Daten zum Kontrakt zu bekommen. Dann lasse ich den BAPI   BAPI_SALESORDER_CREATEFROMDAT2 gefüllt mit SD-Abrufdaten und den Referenzdaten des Kontraktes laufen Dies funktioniert soweit sehr gut. Sowohl im Kontrakt als auch im Abruf sind jeweils die übergeordneten bzw. untergeordneten Vertiebsbelege zu sehen. Die Referenz wird also hergestellt. Jedoch wird im Kontrakt nicht die Abrufwerte aufsummiert. Normalerweise wird bei manueller Erstellung der Abrufe im Kontrakt die jeweilgen abgerufenen Werte gegen den Kontraktwert aufsummiert (Feld abgerufene Werte im Kontrakt unter Reiter ‚Positionsdetail‘. Ich habe alle möglichen Parameter im BAPI geprüft und getestet aber nichts gefunden, was mir die abgerufenen Werten aufsummiert.
    Kann mir dazu einen Tip geben, was ich tun kann, damit auch die Werte richtig referenzieren ? Danke im Voraus.

    the usage of exactly this BAPIs in the way I described  is in according to SAP note 370988.
    BAPI_SALES_DEL_SCHEDULE_CREATE ist for SD schedule agreements and not for SD contracts and does not offer Input parameters for e.g.  adding price conditions what is needed for my task.
    The field in contract I mentioned e.g. in Transaction VA42 VA43 is filled / gets its Information out of Infostructure/table S135. The BAPI seems not be able to fill this structure while creating the contract release.
    I'm looking for example an input parameter I did not found already or any other option that leads to an update of infostructure S135 while creating/posting a release via BAPI.

  • Create a new routing with BAPI BAPI_ROUTING_CREATE via JCo

    I try to create a new routing with BAPI BAPI_ROUTING_CREATE via JCo.
    I filled all necessary parameters. I also realized a commit_work. I get in the RETURN parameter of the BAPI the Message "S 000 Routing N/50001641/01". But the routing isn't in the database. Other JCo programs I wrote (create material master or costumer order) are working very well.
    Have anyone an idea?
    Thanks Jörg
    Here's my coding:
    public void createArbeitsplan() {
              doLogin();
    //          connectionAttributes();
              Plan plan = new Plan();
              for (int i = 0; i < planList.size(); i++)
                   plan = (Plan) planList.get(i);
                   //Ein Function-Objekt erzeugen
                   String bapi = "BAPI_ROUTING_CREATE";
                   JCO.Function savePlan = null;          
                   try { savePlan = this.createFunction(bapi); }
                   catch(Exception ex) { ex.printStackTrace(); System.exit(1); }
                   if(savePlan == null) { System.err.println(bapi + " not found in SAP"); System.exit(1); }
                   //Import und Tabellen füllen
                   // Plankopf
                   JCO.Table headData = savePlan.getTableParameterList().getTable("TASK");
                   headData.appendRow();
                   headData.setValue(plan.kurztext,"DESCRIPTION");
                   headData.setValue("1","TASK_LIST_USAGE");
                   headData.setValue(werks,"PLANT");
                   headData.setValue("4","TASK_LIST_STATUS");
                   headData.setValue("ST","TASK_MEASURE_UNIT");
                   headData.setValue("001","RESP_PLANNER_GROUP");
                   headData.setValue("20070101","VALID_FROM");
                   headData.setValue("20991231","VALID_TO_DATE");
                   headData.setValue("1","LOT_SIZE_FROM");
                   headData.setValue("99999999","LOT_SIZE_TO");
                   // Materialzuordnung
                   JCO.Table materialAlloc = savePlan.getTableParameterList().getTable("MATERIALTASKALLOCATION");
                   materialAlloc.appendRow();
                   materialAlloc.setValue(plan.material,"MATERIAL");
                   materialAlloc.setValue(werks,"PLANT");
                   materialAlloc.setValue("20070101","VALID_FROM");
                   materialAlloc.setValue("20991231","VALID_TO_DATE");
                   materialAlloc.setValue("1","GROUP_COUNTER");
                   // Vorgänge
                   JCO.Table operationData = savePlan.getTableParameterList().getTable("OPERATION");
                   for (int j = 0; j < plan.getAnzahl(); j++) {
                        operationData.appendRow();
                        operationData.setValue(plan.getVorgang(j).vorgang,"ACTIVITY");
                        operationData.setValue(plan.getVorgang(j).steuschl,"CONTROL_KEY");
                        operationData.setValue(plan.getVorgang(j).arbplatz,"WORK_CNTR");
                        operationData.setValue("1111","WORK_CNTR");
                        operationData.setValue(plan.getVorgang(j).text,"DESCRIPTION");
                        operationData.setValue(plan.getVorgang(j).basismenge,"BASE_QUANTITY");
                        operationData.setValue(plan.getVorgang(j).vw1,"STD_VALUE_01");
                        operationData.setValue(plan.getVorgang(j).vw2,"STD_VALUE_02");
                        operationData.setValue(plan.getVorgang(j).vw3,"STD_VALUE_03");
                        operationData.setValue(plan.getVorgang(j).ze1,"STD_UNIT_01");
                        operationData.setValue(plan.getVorgang(j).ze2,"STD_UNIT_02");
                        operationData.setValue(plan.getVorgang(j).ze3,"STD_UNIT_03");
                        operationData.setValue("1","DENOMINATOR");
                        operationData.setValue("1","NOMINATOR");
                        operationData.setValue("20070101","VALID_FROM");
                        operationData.setValue("20991231","VALID_TO_DATE");
                        operationData.setValue("ST","OPERATION_MEASURE_UNIT");
                   // Testflag
                   JCO.Structure test = savePlan.getImportParameterList().getStructure("TESTRUN");
                   test.setValue(" ","BAPIFLAG");
                   //BAPI ausführen (incl. Commit)
                   mConnection.execute(savePlan);
                   JCO.Function commit = null;
                   try {commit = this.createFunction("BAPI_TRANSACTION_COMMIT"); }
                   catch (Exception ex) { ex.printStackTrace();System.exit(1); }
                   JCO.ParameterList input = commit.getImportParameterList();
                   input.setValue("X","WAIT");
                   mConnection.execute(commit);
                   //Messages vom SAP-System holen
                   JCO.Table jcoReturn = savePlan.getTableParameterList().getTable("RETURN");
                   for (int k = 0; k < jcoReturn.getNumRows(); k++)
                        jcoReturn.setRow(i);
    //                    System.out.println(jcoReturn.getField("MESSAGE").getValue());
                        System.out.println(jcoReturn.getField("TYPE").getValue());
                        System.out.println(jcoReturn.getField("NUMBER").getValue());
                        System.out.println(jcoReturn.getField("MESSAGE_V1").getValue());
                        System.out.println(jcoReturn.getField("MESSAGE_V2").getValue());
                        System.out.println(jcoReturn.getField("MESSAGE_V3").getValue());
                        System.out.println(jcoReturn.getField("MESSAGE_V4").getValue());
                   JCO.Structure output = commit.getExportParameterList().getStructure("RETURN");;
                   System.out.println(output.getString("MESSAGE"));
                   System.out.println(output.getString("TYPE"));
                   System.out.println(output.getString("NUMBER"));
                   System.out.println(output.getString("MESSAGE_V1"));
              closeConnectionToSAP();
              System.exit(1);

    Hi,
    perhaps you could use
    BAPI_HRMASTER_SAVE_REPL_MULT
    Regards
    Bernd

  • What is the Procedure to run BAPI?

    Hi,
    May i know what is the Step by Step procedure to run BAPI?
    Regards,
    Chow

    Checkout !!
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    http://techrepublic.com.com/5100-6329-1051160.html#
    http://www.sap-img.com/bapi.htm
    http://www.sap-img.com/abap/bapi-conventions.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sap-img.com/bapi.htm
    http://www.sap-img.com/abap/bapi-conventions.htm
    http://www.planetsap.com/Bapi_main_page.htm
    http://www.sapgenie.com/abap/bapi/index.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sappoint.com/abap/bapilst.pdf
    http://www.sappoint.com/abap/bapiprg.pdf
    http://www.sappoint.com/abap/bapiexer.pdf
    http://www.sappoint.com/abap/bapiactx.pdf
    Reward if it is useful to you.

  • Erorr in run bapi in portal

    hi,
    i wont run bapi in portal and i get erorr :
    No storage space available for extending an internal table., error key: RFC_ERROR_SYSTEM_FAILURE
    the bapi is working o.k. in R.3
    what can be the problem?
    Regards

    hi ricardo.............
           check for the number entries that the bapi returns when run in r3.
            make sure that it is rfc enabled.
            tell the portal consulant to check whether the bapi is being called number of times so that the internal table is getting filled again and again... tell hi to debug the coding.
    ---regards,
       alex b justin

  • Erorr in run bapi

    hi,
    i wont run bapi in portal and i get erorr :
    No storage space available for extending an internal table., error key: RFC_ERROR_SYSTEM_FAILURE
    the bapi is working o.k. in R.3
    what can be the problem?
    Regards

    does the query too large, consuming large memory?
    This is most likely to happen when the system is being used extensively and the memory is not sufficient, or the query is very large or complex.
    - any relevant dump in ST22?
    - can simplify the bapi query definition ?
    - try execute $SYNC to clear the internal
    - can it be run in background somehow ?
    - what is the value of following parameters ?
    ztta/roll_extension =
    abap/heap_area_total
    abap/heap_area_dia =
    abap/heap_area_nondia
    em/initial_size_MB =
    - are you in 64bits or 32 bits ?
    - SAP note #649327     Analysis of memory consumption
    cheers,
    Vincent

  • BAPI : BAPI_ROUTING_CREATE

    Hi, I want to upload data operation and Inspection Char using BAPI : BAPI_ROUTING_CREATE.
    Can anybody explain me with coding.
    thanks
    naresh

    Dear gurus,
    we must see in the atp available chek (MDPV)  only storage location but the system see all the stock present in the mrp .
    Infact the stock is for example in the storage location :
    storage location 1 = 100 pz
    storage location 2 = 20 pz
    Is possible see only the stock in the storage location 2 = 20 pz.
    I insert in the details item BOM for the component the storage location (storage location2) but the avalaible check confirmed the quantity 120 , i vould like quantity 20 only.
    There are the method or customizing impostation for my problem?
    Thanks a lot for help.
    Daniele Pistilli
    PP TEAM

  • Running bapi in back ground

    hi all,
    i had to upload material master basic view, iam updating using bapi,
    i want to run this program in background. i am getting problem wen calling bapi. its not executing this bapi.
    wen i run the same program its working fine.
    could any body help me in this regard
    below is the code
    *& Report  ZTEST_BAPI_BASIC
    report  ztest_bapi_basic.
    types : begin of ty_mara,
            matnr type mara-matnr,
            mbrsh type mara-mbrsh,
            mtart type mara-mtart,
            meins type mara-meins,
            maktx type makt-maktx,
            end of ty_mara.
    data: begin of it_makt occurs 0.
            include structure bapi_makt.
    data end of it_makt.
    data:begin of it_ret occurs 0.
            include structure bapiret2.
    data end of it_ret.
    data : t_mara type standard table of ty_mara,
           st_mara type ty_mara.
    data: bapi_head like bapimathead,
          bapi_clientdata like bapi_mara,
          bapi_clientdatax like bapi_marax.
    selection-screen : begin of block b1 with frame title text-001.   "SELECTION SCREEN
    parameters: p_fnam like rlgrap-filename.
    selection-screen : end of block b1.
    at selection-screen on value-request for p_fnam.
      call function 'F4_FILENAME'                              "FUNCTION MODULE TO LOCATE THE FILE ON THE DISK
        exporting
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = ' '
        importing
          file_name     = p_fnam.
    start-of-selection.
      perform upload.
      perform bapi.
    *&      Form  UPLOAD
          text
    -->  p1        text
    <--  p2        text
    form upload .
      data : filename type string.
      filename = p_fnam.
      call function 'GUI_UPLOAD'
        exporting
          filename                      = filename
         filetype                      = 'ASC'
         has_field_separator           = 'X'
       HEADER_LENGTH                 = 0
       READ_BY_LINE                  = 'X'
       HEADER                        =
        tables
          data_tab                      = t_mara
    EXCEPTIONS
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.                    " UPLOAD
    *&      Form  BAPI
          text
    -->  p1        text
    <--  p2        text
    form bapi .
      sort t_mara by matnr.
      loop at t_mara into st_mara.
        perform conversion using st_mara-matnr changing  st_mara-matnr.
        bapi_head-material = st_mara-matnr.
        bapi_head-ind_sector = st_mara-mbrsh.
        bapi_head-matl_type = st_mara-mtart.
        bapi_head-basic_view ='X'.
        bapi_clientdata-base_uom = st_mara-meins.
        bapi_clientdatax-base_uom = 'x'.
        refresh it_makt.
        it_makt-langu = 'E'.
        it_makt-matl_desc = st_mara-maktx.
        append it_makt.
        clear it_ret.
        refresh it_ret.
        perform update_bapi  using bapi_head
                                         bapi_clientdata
                                         bapi_clientdatax .
        read table it_ret with key type = 'S'.
        if sy-subrc eq 0.
          commit work.
        else.
          call function 'BAPI_TRANSACTION_ROLLBACK'
                  IMPORTING
                    RETURN        =
        endif.
      endloop.
    endform.                    " BAPI
    *&      Form  CONVERSION
          text
         -->INPUT      text
         -->OUTPUT     text
    form conversion using input changing  output.
      call function 'CONVERSION_EXIT_ALPHA_INPUT'
        exporting
          input  = input
        importing
          output = output.
    endform.                    "conversion
    *&      Form  update_bapi
          text
         -->BAPI_HEAD         text
         -->BAPI_CLIENTDATA   text
         -->BAPI_CLIENTDATAX  text
    form update_bapi  using bapi_head bapi_clientdata  bapi_clientdatax .
      call function 'BAPI_MATERIAL_SAVEDATA' in background task as separate unit
        exporting
          headdata                   = bapi_head
         clientdata                 = bapi_clientdata
         clientdatax                = bapi_clientdatax
      FLAG_ONLINE                = ' '
      FLAG_CAD_CALL              = ' '
      NO_DEQUEUE                 = ' '
      NO_ROLLBACK_WORK           = ' '
      importing
         return                     = it_ret
       tables
         materialdescription        = it_makt
      append it_ret.
    endform.                    "update_bapi
    regards
    siva

    Hi,
    I'm a bit confused now - does the BAPI call work if you run it entirely in foreground or does it fail there too?
    You need to ensure your BAPI works correctly with the data you are passing to it - preferably in foreground so you can debug it and see what is happening.  If it throws errors there then add them to this thread.
    If it works in foreground then you probably need to schedule the job in background but as others have pointed out, you can't use the GUI_UPLOAD function to do this.
    Gareth.

  • USE BAPI  BAPI_ROUTING_CREATE

    HI ,
    THIS IS FIRST TIME I AM USING BAPI FOR CREATING ROUTING .
    I NEED HELP REGARDING DATA DECLERATION THAT I NEED TO TRANSFER TO THE FUNCTION MODULE,
    A HELP IS NEEDED SO THAT I CAN START.PLEASE TELL ME HOW TO PROCEDE TO UPLOAD DATA USING BAPI.
    PLEASE HELP ME.

    HI
    vijay here
    ******DECLARATION*******
    DATA : path TYPE string.
    DATA : flag type c.
    data: count(2) TYPE n.
    DATA : intern TYPE TABLE OF alsmex_tabline,
           wa_intern TYPE alsmex_tabline.
    DATA :
    testrun      TYPE    bapiflag,
    profile      TYPE    PROFID_STD,  "bapi1012_control_data-profile,
    bomusage     TYPE    STLAN ,      "bapi1012_control_data-bom_usage,
    application  TYPE    CAPID.      " bapi1012_control_data-application.
    internal tables declaration.
    DATA :
            it_task                    TYPE TABLE OF    bapi1012_tsk_c,
            it_materialtaskallocation  TYPE TABLE OF    bapi1012_mtk_c,
            it_operation               TYPE TABLE OF    bapi1012_opr_c,
            it_COMPONENTALLOCATION     TYPE TABLE OF    BAPI1012_COM_C,
    *text                    TYPE TABLE OF    bapi1012_txt_c,
            return                     TYPE TABLE OF    bapiret2,
            it_return                  TYPE TABLE OF    bapiret2.
    Work area declaration.
    DATA :
            wa_items_task           TYPE bapi1012_tsk_c ,
            wa_item_materailtask    TYPE bapi1012_mtk_c,
            wa_item_operation       TYPE bapi1012_opr_c,
            wa_item_componentallocation  TYPE BAPI1012_COM_C,
           wa_item_text            TYPE bapi1012_txt_c,
            wa_return               TYPE return.
    DATA : v_group          TYPE bapi1012_tsk_c-task_list_group,
           v_groupcounter   TYPE bapi1012_tsk_c-group_counter.
    DATA : filename TYPE string.
    *************INTERNAL TABLE DECLARATION***************
    TYPES: BEGIN OF routing,
             valid_from1             TYPE datuv,              "TASK(HEADER)
             valid_todate1           TYPE datub,
             usage                   TYPE pln_verwe ,
             werkstask(6),
             status                  TYPE plnst,
             task_measure_unit(3)    TYPE c,
             lot_size_from(010),
             lot_size_to(020),
             matnr(010),                                      " MATERIAL ALLOCATION(INITIAL SCREEN)
             werks2(006),
             valid_from2             TYPE datuv,
             valid_todate2           TYPE datub,
             valid_from3             TYPE datuv,
             valid_todate3           TYPE datub,
             optno                   TYPE VORNR,
             controlkey(004),
             work_cntr(006),
             werks3(006),
            description(20),
             denominator,
             quant(20),
             setup           TYPE      vgwrt,
             machine         TYPE      vgwrt,
             labor           TYPE      vgwrt,
              reqsplit        TYPE      splittung,
              noofsplits      TYPE      dec03,
              unitmax         TYPE      vgwrteh,
              maxwaittime     TYPE      dzlmax,
              unitstd         TYPE      vgwrteh,
              stdqtime        TYPE      dzwnor,
              unitmin         TYPE      vgwrteh,
              minqtime        TYPE      dzwmin,
              unitstdmove     TYPE      vgwrteh,
              stdmovetime     TYPE      dztnor,
              unitminmove     TYPE      vgwrteh,
              minmovetime     TYPE      dztmin,
              palnnedel           TYPE dec03,                   " IF CONTROL KEY PP02
              netprice(20)        TYPE c,
              priceunit           TYPE pack3,
              COSTELEMENT        TYPE KSTAR,
              currency            TYPE waers,
              purchorg(4)         TYPE c,
              purchgrp(3)         TYPE c,
              matgrp(9)           TYPE c ,
              subcontracting(1)   TYPE c,
              valid_from4         TYPE datuv,                   " COMPONENT ALLOCATION
              valid_todate4       TYPE datub,
              optno1(5),
              itemno(5),
              TEXT                TYPE TDLINE,
    END OF routing.
    DATA: it_record TYPE STANDARD TABLE OF record1.
    DATA: record TYPE record1.
    PARAMETERS : fname TYPE rlgrap-filename.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR fname .
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          program_name  = syst-repid
          dynpro_number = syst-dynnr
        CHANGING
          file_name     = fname
        EXCEPTIONS
          mask_too_long = 1
          OTHERS        = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    START OF SLECTION*************
    START-OF-SELECTION.
      filename = fname.
    UPLOADING DATA***************
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = filename
          filetype                = 'ASC'
          has_field_separator     = 'X'
          read_by_line            = 'X'
        TABLES
          data_tab                = it_record
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      SORT it_record BY  matnr.
      LOOP AT it_record INTO record.
      at new matnr.
            flag = 'X'.
      endat.
      if flag = 'X'.
      count = 1.
        bomusage           = '1'.
        application        = 'PP01'.
        REFRESH: task , materialtaskallocation , operation   ,   COMPONENTALLOCATION .
    *********HEADER DATA**********************
          wa_items_task-valid_from               = record-valid_from1.
          wa_items_task-valid_to_date            = record-valid_todate1.
          wa_items_task-task_list_usage          = record-usage.
          wa_items_task-plant                    = record-werkstask.
          wa_items_task-task_list_status         = record-status.
          wa_items_task-task_measure_unit        = record-task_measure_unit.
          wa_items_task-lot_size_from            = record-lot_size_from.
          wa_items_task-lot_size_to              = record-lot_size_to.
          APPEND wa_items_task TO task.
    *************INITIAL SCREEN DATA*************
          wa_item_materailtask-material      = record-matnr.
          wa_item_materailtask-plant         = record-werks2.
          wa_item_materailtask-valid_from               = record-valid_from2.
          wa_item_materailtask-valid_to_date           = record-valid_todate2.
          APPEND wa_item_materailtask TO materialtaskallocation.
      flag = ' '.
      endif.
      IF count = 20.
       count = 1.
      ENDIF.
    **************OPERATION DATA*******************
          wa_item_operation-valid_from               = record-valid_from3.
          wa_item_operation-valid_to_date            = record-valid_todate3.
          wa_item_operation-activity               = record-optno.
          wa_item_operation-control_key            = record-controlkey.
          wa_item_operation-work_cntr              = record-work_cntr.
          wa_item_operation-plant                  = record-werks3.
         wa_item_operation-description            = record-description.
          wa_item_operation-denominator            = record-denominator.
          wa_item_operation-base_quantity          = record-quant.
          wa_item_operation-std_value_01           = record-setup.
          wa_item_operation-std_value_02            = record-machine.
          wa_item_operation-std_value_03            = record-labor.
          wa_item_operation-ind_splitting_reqrd       = record-reqsplit .
          wa_item_operation-max_no_of_splits          = record-noofsplits.
          wa_item_operation-max_wait_time_unit        = record-unitmax.
          wa_item_operation-max_wait_time             = record-maxwaittime.
          wa_item_operation-standard_queue_time_unit  = record-unitstd.
          wa_item_operation-standard_queue_time       = record-stdqtime.
          wa_item_operation-min_queue_time_unit       = record-unitmin.
          wa_item_operation-min_queue_time            = record-minqtime.
          wa_item_operation-standard_move_time_unit   = record-unitstdmove.
          wa_item_operation-standard_move_time        = record-stdmovetime.
          wa_item_operation-min_move_time_unit        = record-unitminmove.
          wa_item_operation-min_move_time             = record-minmovetime.
    ************SUBCONTRACTING DATA********************
          wa_item_operation-plnd_delry                      = record-palnnedel.
          wa_item_operation-info_rec_net_price             = record-netprice.
          wa_item_operation-price_unit                      = record-priceunit.
          wa_item_operation-COST_ELEM                       = RECORD-COSTELEMENT.
          wa_item_operation-currency                        = record-currency.
          wa_item_operation-purch_org                       = record-purchorg.
          wa_item_operation-purch_group                     = record-purchgrp.
          wa_item_operation-matl_group                      = record-matgrp.
          wa_item_operation-ext_proc_with_subcontract_ind   = record-subcontracting.
         APPEND wa_item_operation TO operation.
    *****************COMPONENT ALLOCATION****************
          wa_item_componentallocation-valid_from      = record-valid_from4.
          wa_item_componentallocation-valid_to_date   = record-valid_todate4.
          wa_item_componentallocation-activity        = record-optno1.
          wa_item_componentallocation-item_no         = record-itemno.
          APPEND wa_item_componentallocation TO componentallocation.
    TEXT************************************
       wa_item_text-TEXT_LINE = RECORD-TEXT.
       APPEND wa_item_text TO TEXT.
          count = count + 1.
    AT END OF MATNR.
    ****************CALLING FUNCTION MODULE**************
      CALL FUNCTION 'BAPI_ROUTING_CREATE'
      EXPORTING
        bomusage                     = bomusage
        application                  = application
      IMPORTING
        group                        = group
        groupcounter                 = groupcounter
        TABLES
         task                        = task
         materialtaskallocation      = materialtaskallocation
        SEQUENCE                   =
         operation                   = operation
       SUBOPERATION                =
       REFERENCEOPERATION          =
       WORKCENTERREFERENCE         =
        componentallocation          =  componentallocation
       PRODUCTIONRESOURCE          =
       INSPCHARACTERISTIC          =
       TEXTALLOCATION              =
        text                        = text
         return                      = return.
    loop at return into wa_return.
    write: / 'message type:' ,wa_return.
    endloop.
    COMMIT WORK.
      WRITE:/ 'GROUP:', group.
      WRITE:/ 'GROUPCOUNTER:', groupcounter.
    ENDAT.
    ENDLOOP.
    this will help u
    @vijji

  • Blocking a running BAPI

    Hello,
    I am trying to work with a scenario which goes something like this -
    I have a Z-BAPI which calls an RFC on an external system. The RFC processes data sent over by the Z-BAPI and generates a link.
    The next steps are tricky - the generated link shall be sent back as an export parameter to the Z-BAPI. This BAPI then starts the link in a browser and then needs to wait until the application running in the browser is complete.
    The problem is that the application in the browser processes further data which needs to be written into the tables of the Z-BAPI. Only after these tables have been filled, should the custom BAPI go ahead with further processing.
    The problem is that after I send the generated URL back to the custom BAPI, the BAPI thinks (naturally) that the remote RFC is done with the data processing and after opening the browser goes on ahead with further processing without waiting until the application has filled tables in the BAPI.
    So, is there a way in which I can temporarily block the BAPI from processing after it has started the browser? And how do I ask the BAPI to "wake up" again after the browser application has filled up the tables?
    T00th.

    Hi Lakshmi,
    the BAPI may lock the material master data. Please try to call the FM BAPI_TRANSACTION_COMMIT with the parameter "wait = 'X'" after each call of the BAPI.
    Hope this solves the problem
    Uwe
    grrr, was too slow

  • Unable to run bapis for project status update and date update together

    Hi Experts,
    I have a requirement to update the dates and status of a project WBS at level 4. I am trying to do update the CJ02 Transaction using standard BAPI available. I need to do both Date update and status update in the same LOOP PASS   i am using the below mention bapi. when i am doing so i am getting an error Project 'A._____' has been currently processed by ID i.e. my id.
    I have tried putting  a wait for 2 seconds in the code but its still not working. please find the order below in which i am calling the bapi.
    Loop at itab.
    if  date_changed = 'X'.
          CALL FUNCTION 'BAPI_PROJECT_MAINTAIN'
          READ TABLE it_error WITH KEY message_type = c_e.
          IF sy-subrc <> 0.
    Commit
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
                 EXPORTING
                      wait   = c_x
                 IMPORTING
                      return = s_ret.
       endif.
    endif.
    if Status_change = 'X'.
          CALL FUNCTION 'BAPI_PS_INITIALIZATION' .
          CALL FUNCTION 'BAPI_BUS2054_SET_STATUS'
          READ TABLE t_result WITH KEY message_type = c_e.
          IF sy-subrc NE 0.
            CALL FUNCTION 'BAPI_PS_PRECOMMIT'
                 TABLES
                      et_return = t_ret.
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
                 EXPORTING
                      wait   = c_x
                 IMPORTING
                      return = s_ret.
         ENDIF.
    endif.
        WAIT UP TO 4 SECONDS.
    endloop.

    Try to use
    SET UPDATE TASK LOCAL.
    before each BAPI call.
    Did you try to debug through your code, leaving sufficient time between BAPI calls? If it does work like that, then the above statement might help.

  • ERROR IN BAPI  BAPI_ROUTING_CREATE

    Result of check lines:
    E BA 001
    A CP 205 The task list type in structure MTK_CLASS_DATA_INTERFACE does not match the task MATERIALTASKALLOCATI
    THIS ERROR I AM GETTING PLEASE HELP ME

    See BAPI_ROUTING_CREATE / Material Component Allocation
    Kanagaraja L

  • BAPI_ROUTING_CREATE Problem

    Hi Gurus,
    I'm using the BAPI  "BAPI_ROUTING_CREATE" for the creation of Routing.
    I'm trying to pass the Standard Value (STD_VALUE_01) to the Operation Strucutre.
    When i pass the Standard Value, the BAPI is giving the following error.
    "*Enter a unit for standard value Reqmts*"
    I think i'm missing some of the Parameters in the BAPI.
    Please suggest me the parameter which one i'm missing.
    I'm using the following parameters.
    IT_BAPI1012_OPR_C-ACTIVITY               = V1_VORNR.
          IT_BAPI1012_OPR_C-CONTROL_KEY            = IT_ITEM-STEUS.
          IT_BAPI1012_OPR_C-WORK_CNTR              = IT_ITEM-ARBPL.
          IT_BAPI1012_OPR_C-PLANT                  = IT_ITEM-WERKS.
          IT_BAPI1012_OPR_C-OPERATION_MEASURE_UNIT = IT_ITEM-PLNME.
          IT_BAPI1012_OPR_C-OPERATION_MEASURE_UNIT_ISO = 'KMT'.
          IT_BAPI1012_OPR_C-DESCRIPTION            = IT_ITEM-LTXA1.
          IT_BAPI1012_OPR_C-BASE_QUANTITY          = '1.000'.
          IT_BAPI1012_OPR_C-STD_VALUE_01           = IT_ITEM-STD_VALUE_01.
         IT_BAPI1012_OPR_C-STD_UNIT_01            = 'D'.
         IT_BAPI1012_OPR_C-STD_UNIT_01_ISO        = 'DAY'.
          IT_BAPI1012_OPR_C-DENOMINATOR            = 1.
          IT_BAPI1012_OPR_C-NOMINATOR              = 1.
          IT_BAPI1012_OPR_C-BASE_QUANTITY          = 1.
          APPEND IT_BAPI1012_OPR_C.
    we are not using any machine or operator etc, in this scenario we don't require those things.
    Thanks,
    Adi.

    Hi,
    whenever u pass a Quanity or Currency it is must to pass the coressponding unit. here in ur code i see u commented it. so, try to pass the STD_UNIT_01 to the structure and run.
    also, you should use a CONVERSION routine for STD_UNIT_01 like below before passing it..
    IT_BAPI1012_OPR_C-ACTIVITY = V1_VORNR.
    IT_BAPI1012_OPR_C-CONTROL_KEY = IT_ITEM-STEUS.
    IT_BAPI1012_OPR_C-WORK_CNTR = IT_ITEM-ARBPL.
    IT_BAPI1012_OPR_C-PLANT = IT_ITEM-WERKS.
    IT_BAPI1012_OPR_C-OPERATION_MEASURE_UNIT = IT_ITEM-PLNME.
    IT_BAPI1012_OPR_C-OPERATION_MEASURE_UNIT_ISO = 'KMT'.
    IT_BAPI1012_OPR_C-DESCRIPTION = IT_ITEM-LTXA1.
    IT_BAPI1012_OPR_C-BASE_QUANTITY = '1.000'.
    IT_BAPI1012_OPR_C-STD_VALUE_01 = IT_ITEM-STD_VALUE_01.
      CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
        EXPORTING
          input          = it_ka485-meins    --> (it_ka485-meins = DAY)
          language       = sy-langu
        IMPORTING
          output         = l_v_meins        
        EXCEPTIONS
          unit_not_found = 1
          OTHERS         = 2.
    lv_meins will have a value 'TAG' after from the above FM..
    IT_BAPI1012_OPR_C-STD_UNIT_01 = l_v_meins.
    IT_BAPI1012_OPR_C-STD_UNIT_01_ISO = 'DAY'.
    IT_BAPI1012_OPR_C-DENOMINATOR = 1.
    IT_BAPI1012_OPR_C-NOMINATOR = 1.
    IT_BAPI1012_OPR_C-BASE_QUANTITY = 1.
    APPEND IT_BAPI1012_OPR_C.
    Hope it helps!!
    Regards,
    Pavan

Maybe you are looking for