Multiple Instance Push Function Module

All,
I am referring to the service order tutorial as given in following link http://help.sap.com/saphelp_nwmobile71/helpdata/en/45/ac4bed74372733e10000000a155369/frameset.htm
I have succefully created the Data Object/BAPI Wrappers and other objects. Everything works perfectly fine. Now I am trying to create a "Intance PUSH" function module in Mobile Server that will be called from backend to push the service orders. Till now using the same structure as in the tutorial I can send PUSH one instance. However I was wondering what if I have to PUSH Multiple instance at one shot.
I am confused as to how should the structures for the same should look like. In the example given here, the customer node and equipment node do not have the order ID parameter in it. So when I have to push the same, how will the system know which instance of customer/equipment belongs to which instance of orderheader.
If any one can clarify the same it will be really great.
Regards,
Shubham

The backend key added by the DOE is a 'generated' field (and therefore internal to the DOE). This is why it is not exposed in the instance push FM.
When you do not switch on automatic keymapping, the DOE creates this generated field, and fills it after calling GetDetail in the case of a delta download or a key push (since getdetail itself is called per instance, resolution is simple).
If you switch on automatic keymapping, DOE will try to find existing backend fields in the child which match the root keys. (i.e. by name and type), and use these to resolve the children. If it cannot find such fields in the child that match the root keys, it will again generate fields on its own. And again these generated fields will be filled by the DOE after calling GetDetail during a delta load or key push.
However, in the case of Instance Push, the only way to let the DOE resolve child instances is to send a field from the backend itself (i.e. not generated), which can be used to resolve the child instances (because GetDetail is not called in this case)
If you do multiple instance push with the example given without changes, I am not sure if resolution will happen.
An alternative to automatic keymapping is 'explicit keymapping' where you yourself decide which backend field in the child maps to which backend KEY in the parent (at all levels).
Edited by: Arjun Shankar on Oct 1, 2009 1:36 PM

Similar Messages

  • Backend Adapter Activation error on providing Instance Push Function

    Dear Experts,
    We want to create Backend Triggered Adapter. We were able to successfully activate it BUT when we tried to put "Instance Push Function" and then try to activate then its throws following error:
    Unable to get the structure type of  in bapiwrapper  (adapter: <Backend Adapter Name> )
    And then Backend Adapter becomes Inactive.
    Can anyone please try to help me out?
    DOE Server Version is 7.1 with Support Pack 7.
    Thanks and Regards,
    Gopal

    Dear All,
    First of all sorry for soooooo late response. Got stuck in some other work.
    We are still stuck at the issue. "Check" did not result in any error in Backend Adapter Screen.
    There is no "GetDetail" BAPI Wrapper defined in Backend Adapter. Is that a must for Push Functionality?
    And one more point. There was no problem in Activation and Generation of Node Structure and DATA Objects.
    Its only that Backend Adapter is not getting activated when it is Backend Triggered AND when Instance Push Function is specified.
    DOE Triggered Backend Adapter or Backend Triggered Backend Adapter without Instance Push function is working fine and they are getting activated and generated.
    Thanks and Regards,
    Gopal
    Edited by: Gopal on Sep 17, 2009 6:58 PM

  • Multiple selection in Function Module

    Hi Experts,
      Can we go for mutiple selection in our own Function Module? How we can go for mutiple selection in our own Function Module? Anyone help me.
    Example:
    we have to give multiple input values for company code when we execute the function module .
    suppose import parameter are
      company code   3000
               4000
               5000
               6000
      plant          3215
      matnr          100002992
       i have to select the records based on this multiple company codes.Here i want multiple selection for company code.

    Hi ,
    I agree with Suresh.
    It is my mistake I thought you are using standard function.
    Lanka
    Message was edited by: Lanka Murthy
    Message was edited by: Lanka Murthy

  • Loading Multiple Instances Of A Module

    I am creating an applciation that will control golf simulators from a central location. The application will display information panels about each simulator in a tile component. The panels are modules. The below code tries to load 6 info panels if your press the button. When you press it, only 1 panel appears. If you press it a second time, 6 more appear. Does anyone have any insight as to why this occurs?
    Main App:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo">
        <fx:Script>
            <![CDATA[
                import mx.core.Application;
                import mx.managers.PopUpManager;
                import mx.events.ListEvent;
                import mx.events.FlexEvent;
                import mx.controls.Alert;
                import mx.modules.ModuleManager;
                import mx.modules.IModuleInfo;
                import mx.controls.ProgressBar;
                import flash.events.TimerEvent;
                import flash.utils.Timer;
                import mx.events.ModuleEvent;
                public var info:IModuleInfo;
                public var mySimCount:int = 6;
                protected function button5_clickHandler(event:MouseEvent):void
                    testPanels();
                 public function testPanels():void
                    var i:int;
                    for (i = 0; i < mySimCount; i++)
                        info = ModuleManager.getModule("simPanel.swf");
                        info.addEventListener(ModuleEvent.READY, modEventHandler);          
                        // Load the module into memory. Calling load() makes the
                        // IFlexModuleFactory available. You can then get an
                        // instance of the class using the factory's create()
                        // method.
                        info.load();
                private function modEventHandler(e:ModuleEvent):void {
                    // Add an instance of the module's class to the
                    // display list.
                    myTile.addChild(info.factory.create() as DisplayObject);
            ]]>
        </fx:Script>
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <s:Button  x="562" y="20" label="Button" click="button5_clickHandler(event)"/>
        <mx:Tile x="10" y="66" width="100%" height="100%" id="myTile">
        </mx:Tile>
    </s:Application>
    Module:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/halo" layout="absolute" width="250" height="350">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <s:Panel x="0" y="0" width="250" height="346" dropShadowVisible="false">
            <s:Label y="-21" text="Sim Name" left="10"/>
            <s:Label y="-21" text="Sim Status" right="6"/>
            <mx:TabNavigator x="10" y="10" width="228" height="252">
                <s:NavigatorContent label="View Stats" width="100%" height="100%">
                    <s:Label y="10" text="Course and Hole" left="10"/>
                    <mx:DataGrid x="10" y="24" height="190" width="206">
                        <mx:columns>
                            <mx:DataGridColumn headerText="Plyr" dataField="col1"/>
                            <mx:DataGridColumn headerText="Scr" dataField="col2" resizable="false"/>
                        </mx:columns>
                    </mx:DataGrid>
                </s:NavigatorContent>
                <s:NavigatorContent label="View Screen" width="100%" height="100%">
                </s:NavigatorContent>
            </mx:TabNavigator>
            <s:Label y="270" text="Time Information" x="84"/>
            <s:Label y="290" text="Alerts" height="18" x="109"/>
        </s:Panel>
    </mx:Module>

    Try something more like this:
              public function testPanels(event:Event = null):void
                    info = ModuleManager.getModule("simPanel.swf");
                    if (!info.ready)
                        info.addEventListener(ModuleEvent.READY, testPanels);                                            
                        // Load the module into memory. Calling load() makes the
                        // IFlexModuleFactory available. You can then get an
                        // instance of the class using the factory's create()
                        // method.
                        info.load();
                        return;
                    var i:int;
                    for (i = 0; i < mySimCount; i++)
                        myTile.addChild(info.factory.create() as DisplayObject);                   
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Problem with multiple instances of same module

    I want to call the same module in several different
    viewstates. Based on a variable for each viewstate the module
    returns different results. Here is a shortened version of my code:
    private var lm:linkModule;
    private function moduleHandler(promotion:String):void
    lm = linkModule(lm1.child);
    lm.initHandler(promotion);
    <mx:ViewStack id="estonishViewStack" width="100%"
    height="100%">
    <mx:Canvas x="0" y="0" width="100%" height="100%"
    id="saleView" label="Sales">
    <mx:ModuleLoader id="lm1" url="modules/linkModule.swf"
    ready="moduleHandler('sale');" />
    </mx:Canvas>
    <mx:Canvas x="0" y="0" width="100%" height="100%"
    id="seasonalView" label="Seasonal">
    <mx:ModuleLoader id="lm1" url="modules/linkModule.swf"
    ready="moduleHandler('seasonal');" />
    </mx:Canvas>
    </mx:ViewStack>
    Is there a more elegant (shorter) way to code the
    actionscript function other than a number of "if" statements based
    upon the variable or module id?

    Thanks for the comment. I purposely used the same id in the
    example. I need to call the same module in about 10 different
    viewstates. I was wondering is there a way around 10 different "if"
    statements in my moduleHandler function with lm1.child, lm2.child,
    etc.
    Possibly some way to write the function with lm(i).child?
    Then I give each component a different component name.

  • Effect of Multiple cursors in Function Module Extractors

    Hi,
    I am trying to use multiple cursors in an FM extractor, like this:
    OPEN CURSOR WITH HOLD c1 FOR <select query 1>.
    OPEN CURSOR WITH HOLD c2 FOR <select query 2>.
    FETCH NEXT CURSOR c1
                   INTO CORRESPONDING FIELDS
                   OF TABLE i_equi.
    FETCH NEXT CURSOR c2
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE i_equi.
    " Further processing of equipments
    " obtained in i_equi
    I am also checking SY-SUBRC, after each Fetch statement. If both cursors happen to be empty, the extractor exits by raising no_more_data, like other extractors.
    It is possible to do so, since I just tried it. The question is, are there any disadvantages of this kind of approach in terms of memory or speed?
    Edited by: Suhas Karnik on Sep 29, 2008 12:06 PM

    hI kiran,
    The simple way is to create a data element & domain with value range where u provide set of fixed values or provide a check table to it.
    Use that data element in a table <ztable>.
    Code:
    Parameters:
          p_burks like <ztable>-dataelement.
    Call Function <function_name>
    exporting
    p_burks = p_burks,

  • How to make input parameter with multiple values in function module?

    Dear Experts,
    I want to add BUKRS as import field to a FM, what is the best way of of making it accept multiple enteries.
    Regards,
    Kiran

    hI kiran,
    The simple way is to create a data element & domain with value range where u provide set of fixed values or provide a check table to it.
    Use that data element in a table <ztable>.
    Code:
    Parameters:
          p_burks like <ztable>-dataelement.
    Call Function <function_name>
    exporting
    p_burks = p_burks,

  • Transfer multiple rows to function module

    Hi Friends,
    I have th following requirement.
    In Visula composer I have 1 Input table.
    Here I read rows from material master and I have a checkbox and a button transfer.
    And I have a second table view with similar fields.
    In the first table view I check several rows and when I press transfer.
    Now I want all the checked rows of table view 1 to appear in table view 2.
    For this reason I want to create a FM to keep the data in a table I have created.
    In fact, I want to transfer the rows from table view 1  in a temp table and from there into table view 2.
    But how can I transfer multiple rows from visual composer into the temp table by means of FM.
    Many thanks for your help.
    RG. Jimbob

    Connect your table view 1 to your FM (make sure you flip the table on your FM to a input port).
    Select the connector you just created and configure element. Set mapping scope to 'Selected Data Rows'.

  • Interface parameters in Function Module -- Doubts

    Hi,
    We are developing a custom function group which will have 5-6 custom function module. When you create a function module and specify its Export/Import and table parameters, SAP mark them as "Local Interface".(You can look at the Function module source code's first line)
    But if you goto the Menu and click Edit>Interface>Globalize parameter and it will change from "Local Interface" to "Global Interface". So now you can use these interface parameters (Export/Emport or tables) without passing them explicitly in perform statement. So in other words they are easily available in the function module.
    My question are:
    1. Whats the difference between Local interface and Global interface and when should we use which. (SAP normaly use Local interface in all there function modules).
    2. If we use Global interface then is it possible that multiple instances (same fuction module called at same time with different or same data) will somehow mix the data from different calls and show unpredictable results.
    Will appreciate if someone can help me understand it from conceptual point of view.
    Thanks in advance.
    Jeet

    Hi Jeet,
    1). The difference between Local and GLobal are identified by the name itself. One makes the interface locally available and one makes it globally available. This means that, within the function group, you can access the function parameters in subroutines, as well as PBO and PAI modules.
    When to use depends, if your function module consists huge code and does massive processing in such cases its better to write subroutines and split the code into smaller sections for parallel processing. In Such cases its better to use Global interface so that you dont have to pass the interface each and every time.
    2). Yes it might affect the gloabl parameters as Unlike other global data, the contents of the global parameters of a function module are known only from the time of the call until you leave the module.
    Due to this limitations SAP has come up with OOPS concept where the data integrity is maintained.
    Cheers
    VJ

  • Function Modules or BAPI for CK91N transaction Please

    Hi,
    To upate CK91N transaction , Is there any function module or BAPI exist?
    Thanks,
    Krishna

    Hi
        go to se80 ->package->type CKMLMV as package name.
    This package has multiple programs and function modules which update the transaction. You can choose from them according to your requirement.
    Hope this helps!
    Viquar Iqbal

  • Backend apdatper with Push function fails to be activated

    Hi,
      I would like to specify a "instance push function" for a backend triggered BO.
    I followed the steps from  Vinodh Nagarajan in
    DOE Backend Push
    I inserted ZMOB_PUSHMISSIONE in the "Instance Push Function" field of backend adapter but I'm not able to activate the BO. I have the following error:
    "Client specific data object is mapped to client independent BAPI Wrapper"
    Message number MAPPING_TOOL_MSG173
    The BO has 2 bapi wrapper: GET LIST and MODIFY.
    Without the "Instance Push function" the BO works correctly in bidirectional way
    Any suggestion?
    regards
      Leonardo

    Hello Leonardo,
    "Client specific data object is mapped to client independent BAPI Wrapper" is a warning. Ideally, you should be able to proceed even if you get this warning.
    Could you do a consistency check of your backend adapter and see if you get any other messages (Click on the 'View Messages' button)?
    Regards,
    Ullas

  • Pushing data in packets from Function Module to BW

    Hi All,
    I have been struggling with a problem for about a week and a half and I find myself at an in-pass. I firstly created a function module to pull data from SAP and join multiple tables so I could use it to report in Crystal. The problem was that it was so much data that I received errors due to processing time.
    Thus to solve this problem I now use the function module to push data into a datasource so that it executes in the background.
    The main problem I am experiencing is how to code a function module so that it will retrieve the data in segments then commit then retrieve next segment. At the moment the program works but if the data increases like it should I will run into the no more space in the internal table error.
    Example of my code below. (much simplified to just demonstrate functionality). Sorry that it is still long but didn't  want to leave out parts that might be important.
    So how would one get the data to retrieve from the SAP tables and commit to BW in segments instead of like I do to retrieve all the data then pump into BW in segments.
    FUNCTION ZBOBJ_COMMISSION.
    *"  IMPORTING
    *"     VALUE(I_REQUNR) TYPE  SRSC_S_IF_SIMPLE-REQUNR
    *"     VALUE(I_DSOURCE) TYPE  SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
    *"     VALUE(I_MAXSIZE) TYPE  SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL
    *"     VALUE(I_INITFLAG) TYPE  SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
    *"     VALUE(I_READ_ONLY) TYPE  SRSC_S_IF_SIMPLE-READONLY OPTIONAL
    *"     VALUE(I_REMOTE_CALL) TYPE  SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF
    *"  TABLES
    *"      I_T_SELECT TYPE  SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
    *"      I_T_FIELDS TYPE  SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
    *"      E_T_DATA STRUCTURE  ZDGB_COMMISION_REPORT OPTIONAL
    *"  EXCEPTIONS
    *"      NO_MORE_DATA
    *"      ERROR_PASSED_TO_MESS_HANDLER
      STATICS : counter type i.
    ** Example: DataSource for table SFLIGHT
      TABLES: ZDGB_COMMISION_REPORT.
    ** Auxiliary Selection criteria structure
      DATA: L_S_SELECT TYPE SRSC_S_SELECT.
    ** Maximum number of lines for DB table
      STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE,
    ** counter
              S_COUNTER_DATAPAKID LIKE SY-TABIX,
    ** cursor
              S_CURSOR TYPE CURSOR.
    ** Initialization mode (first call by SAPI) or data transfer mode
    ** (following calls) ?
      IF I_INITFLAG = SBIWA_C_FLAG_ON.
    ** Check DataSource validity
        CASE I_DSOURCE.
          WHEN 'ZBOBJ_COMMISSION'.
          WHEN OTHERS.
            IF 1 = 2. MESSAGE E009(R3). ENDIF.
    ** this is a typical log call. Please write every error message like this
            LOG_WRITE 'E'                  "message type
                      'R3'                 "message class
                      '009'                "message number
                      I_DSOURCE   "message variable 1
                      ' '.                 "message variable 2
            RAISE ERROR_PASSED_TO_MESS_HANDLER.
        ENDCASE.
        APPEND LINES OF I_T_SELECT TO S_S_IF-T_SELECT.
    * Fill parameter buffer for data extraction calls
        S_S_IF-REQUNR    = I_REQUNR.
        S_S_IF-DSOURCE = I_DSOURCE.
        S_S_IF-MAXSIZE   = I_MAXSIZE.
        APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS.
      ELSE.                 "Initialization mode or data extraction ?
        STATICS: st_itab TYPE ZDGB_COMMISION_REPORT OCCURS 0 WITH HEADER LINE.
        IF S_COUNTER_DATAPAKID = 0.
    ORIGINAL - DIRECT CUSTOMER**********************************************************
          Select
                 VBPA~KUNNR
                VBRK~VBTYP
                INTO CORRESPONDING FIELDS OF TABLE itab1
                  FROM
                    VBRK
                    INNER JOIN VBRP ON VBRK~VBELN = VBRP~VBELN
                    INNER JOIN MARA ON VBRP~MATNR = MARA~MATNR
                    INNER JOIN ZCUWE ON ZCUWE~BOT_MAN = MARA~ZZBOTTMANU
                    INNER JOIN VBPA ON VBPA~VBELN = VBRP~AUBEL
                  WHERE              VBPA~PARVW in s_parvw.
          SORT ITAB1 BY KUNNR.     
          LOOP AT itab2.
            st_itab-BUKRS = itab2-BUKRS.
          ENDLOOP.
        endif.
        INSERT LINES OF st_itab TO S_S_IF-MAXSIZE INTO TABLE e_t_data.
        DELETE st_itab TO S_S_IF-MAXSIZE.
          IF lines( st_itab ) IS INITIAL.
            counter = counter + 1.
            if counter = 2.
              RAISE NO_MORE_DATA.
            endif.
          ENDIF.
              S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
      ENDIF.       
    ENDFUNCTION.

    I'm not sure, but I think there's something wrong with your select instruction
          Select
                 VBPA~KUNNR
                VBRK~VBTYP
                INTO CORRESPONDING FIELDS OF TABLE itab1
                  FROM
                    VBRK
                    INNER JOIN VBRP ON VBRKVBELN = VBRPVBELN
                    INNER JOIN MARA ON VBRPMATNR = MARAMATNR
                    INNER JOIN ZCUWE ON ZCUWEBOT_MAN = MARAZZBOTTMANU
                    INNER JOIN VBPA ON VBPAVBELN = VBRPAUBEL
                  WHERE              VBPA~PARVW in s_parvw.
    You're making a join within vbrk vbrp mara zcuwe and vbpa using a non-key field such vbpa-parvw. Are you sure we're talking about an over-size problem?
    You should separate INNER JOIN, using FOR ALL ENTRIES instruction, with range datas.

  • How to keep multiple function modules under one Web service

    Hi Experts,
    I have Three RFC function modules and i need to create one web service for these three RFC function modules. I know How to crearte a web service for one function module.
    please suggest me How to keep multiple function modules under one Web service.
    Thanks in advance
    Lakshminarayana

    Hi Lakshmi,
    The best way to do it is to assign all the three RFC Enabled FM's to one function group. Later on the top menu in Utilities you get an option to Create a Webservice from a Function Group.
    You can create one single Webservice using all the the 3 FM's.
    I hope this helps.
    Thanks,
    Manu

  • Generic datasource by function module to fetch data from multiple tables?

    I'm writing a function module to fetch price, for generic datasource.
    At first, extract test is OK. But InfoPackage never stop  when loading data to PSA in BW.
    And I find the example codes:
         OPEN CURSOR WITH HOLD S_CURSOR FOR
          SELECT (S_S_IF-T_FIELDS) FROM SFLIGHT
                                   WHERE CARRID  IN L_R_CARRID AND
                                         CONNID  IN L_R_CONNID.
        ENDIF.                             "First data package ?
    * Fetch records into interface table.
    *   named E_T_'Name of extract structure'.
        FETCH NEXT CURSOR S_CURSOR
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE E_T_DATA
                   PACKAGE SIZE S_S_IF-MAXSIZE.
        IF SY-SUBRC <> 0.
          CLOSE CURSOR S_CURSOR.
          RAISE NO_MORE_DATA.
        ENDIF.
        S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
      ENDIF.
    There using Cursor to fetch data package by package, and raise exception NO_MORE_DATA to stop the loading process.
    Now I fetch data from multiple tables, I don't think I can use Cursor.
    Then How can I handle this?  
    Thanks a lot.

    Thanks
    IF IT_999[] IS INITIAL.
        SELECT A~KNUMH A~MATNR A~KSCHL VKORG VTWEG A~DATBI A~DATAB KBETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
          TABLE TP_DATA
            FROM A999 AS A
              INNER JOIN KONP AS B
                  ON A~KNUMH = B~KNUMH
              INNER JOIN MARA AS C
                 ON A~MATNR = C~MATNR
    *          FOR ALL ENTRIES IN IT_999
                    WHERE
    *      A~KNUMH = IT_999-KNUMH  AND
           ( ( A~KSCHL = 'ZPRC' AND VKORG = 'Z000' AND VTWEG = 'Z1' ) OR
                          ( A~KSCHL = 'ZPRD' AND VKORG = 'A000' AND VTWEG = 'Y3' ) ) AND
    *                      A~DATBI >= SY-DATUM AND
                          LOEVM_KO = ''.
        SELECT A~KNUMH A~MATNR A~KSCHL VKORG VTWEG A~DATBI A~DATAB KBETR AS KHETR  KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
          TABLE TP_DATA
            FROM A999 AS A
              INNER JOIN KONP AS B
                  ON A~KNUMH = B~KNUMH
              INNER JOIN MARA AS C
                 ON A~MATNR = C~MATNR
    *          FOR ALL ENTRIES IN IT_999
                    WHERE
    *      A~KNUMH = IT_999-KNUMH AND
          A~KSCHL = 'ZPR3' AND A~VKORG = 'I000' AND
    *                      DATBI >= SY-DATUM AND
                          LOEVM_KO = ''.
      ENDIF.
      IF IT_997[] IS INITIAL.
        SELECT A~KNUMH A~MATNR A~KSCHL VTWEG A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
          TABLE TP_DATA
            FROM A997 AS A
              INNER JOIN KONP AS B
                  ON A~KNUMH = B~KNUMH
              INNER JOIN MARA AS C
                 ON A~MATNR = C~MATNR
    *          FOR ALL ENTRIES IN IT_997
                    WHERE
    *      A~KNUMH = IT_997-KNUMH      AND
          A~KSCHL = 'ZPRA' AND VTWEG = 'Y1' AND
    *                      DATBI >= SY-DATUM AND
                      LOEVM_KO = ''.
      ENDIF.
      IF IT_996[] IS INITIAL.
        SELECT A~KNUMH A~MATNR A~KSCHL A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
           TABLE TP_DATA
             FROM A996 AS A
               INNER JOIN KONP AS B
                   ON A~KNUMH = B~KNUMH
               INNER JOIN MARA AS C
                  ON A~MATNR = C~MATNR
    *          FOR ALL ENTRIES IN IT_996
                    WHERE
    *      A~KNUMH = IT_996-KNUMH AND
          A~KSCHL = 'ZPRB' AND
    *                       DATBI >= SY-DATUM AND
          LOEVM_KO = ''.
      ENDIF.
      SELECT   MATNR     "u7269u6599u53F7u7801
               MEINH     "u4ED3u50A8u5355u4F4Du7684u5907u7528u8BA1u91CFu5355u4F4D
               UMREZ     "u57FAu672Cu8BA1u91CFu5355u4F4Du8F6Cu6362u5206u5B50
               UMREN     "u8F6Cu6362u4E3Au57FAu672Cu8BA1u91CFu5355u4F4Du7684u5206u6BCD
          FROM MARM
          INTO CORRESPONDING FIELDS OF TABLE IT_MARM
           FOR ALL ENTRIES IN TP_DATA
         WHERE MATNR = TP_DATA-MATNR AND  MEINH = TP_DATA-KMEIN.
      LOOP AT TP_DATA.
        IF TP_DATA-KPEIN NE 0.
          TP_DATA-KBETR =  TP_DATA-KBETR / TP_DATA-KPEIN.
          TP_DATA-KHETR =  TP_DATA-KHETR / TP_DATA-KPEIN.
        ENDIF.
        IF TP_DATA-KSCHL = 'ZPRA'.
    *       TP_DATA-MEINH = 'ZI'.
    *      TP_DATA-KSCHL = 'B4'.
          IF TP_DATA-KMEIN = 'ZI'.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ELSE.
            READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
    *           READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'CT'.
            TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
    *           * WA_MARM2-UMREZ / WA_MARM2-UMREN.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ENDIF.
        ELSEIF TP_DATA-KSCHL = 'ZPRB'.
    *      TP_DATA-KSCHL = 'L0'.
    *       TP_DATA-MEINH = 'ZI'.
          IF TP_DATA-KMEIN = 'ZI'.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ELSE.
            READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
    *           READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'BAG'.
            TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
    *           * WA_MARM2-UMREZ / WA_MARM2-UMREN.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ENDIF.
        ELSEIF TP_DATA-KSCHL = 'ZPRC' OR TP_DATA-KSCHL = 'ZPRD'.
    *       TP_DATA-MEINH = 'ZI'.
          IF TP_DATA-KMEIN = 'ZI'.
            TP_DATA-KHETR = TP_DATA-KBETR * '1.17'.
          ELSE.
            READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
    *           READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'WZI'.
            TP_DATA-KBETR = TP_DATA-KBETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
    *           * WA_MARM2-UMREZ / WA_MARM2-UMREN.
            TP_DATA-KHETR = TP_DATA-KBETR * '1.17'.
          ENDIF.
        ELSEIF TP_DATA-KSCHL = 'ZPR3'.
    *      TP_DATA-KSCHL = 'B2'.
          IF TP_DATA-KMEIN = 'ZI'.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ELSE.
            READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
    *           READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'BAG'.
            TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
    *           * WA_MARM2-UMREZ / WA_MARM2-UMREN.
            TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
          ENDIF.
        ENDIF.
        TP_DATA-MEINH = '01'.
        MODIFY TP_DATA.
    E_T_DATA-MATNR =   TP_DATA-MATNR.
    E_T_DATA-KSCHL =   TP_DATA-KSCHL.
    E_T_DATA-KHETR =   TP_DATA-KHETR.
    E_T_DATA-KBETR =   TP_DATA-KBETR.
    E_T_DATA-KMEIN =   TP_DATA-KMEIN.
    E_T_DATA-DATAB =   TP_DATA-DATAB.
    E_T_DATA-DATBI =   TP_DATA-DATBI.
    APPEND E_T_DATA.
        CLEAR WA_MARM1.
        CLEAR WA_MARM2.
      ENDLOOP.
    Edited by: Shen Peng on Oct 20, 2010 10:09 AM

  • Multiple call of update function module

    Hi Everybody,
    I have made implementation to the definition MB_DOCUMENT_BADI( material Document creation).
    While executing this BADI I am getting short dum with this error  Multiple call of update function module.
    Here is the short dump--
    In the FORM routine Buchen_Ausfuehren (program SAPMM07M), an error
    message was issued by a Business Add-In (BAdI) or function module.
    This is not permitted, because it could lead to data             
    inconsistencies. For this reason, the update of the material     
    document was also terminated with a termination message (dump).  
    Note that this message (M7 372) is not the responsible error     
    message.                                                         
    Please any body suggest the way forward.
    Regards,
    Sandeep.

    Hi Kiran,
    Thanks for the reply.
    I have created one implementation to the BADI MB_DOCUMENT_BADI. This badi will hit while creation of material document.I have write the code in method MB_DOCUMENT_BEFORE_UPDATE such that it will act only for certain movement types specially for t-codeMb1a and MB31.
    What problem I am facing i have used a error message "MB_DOCUMENT_BEFORE_UPDATE" in this method.If we got the erroe message then we dont need to post the material dcoument,but here problem is that if the material document could not posted then it corrupt the material and when we performing 261/101 we got error message like " Inconsistency between MM and ML for material and plant"
    I have used following things like-
    1-while updating the customized table using " Commit Work".
    2-Call function vb_change_batch for updating the batch and not in update task.
    3. Dequeue the table after updating the table.
    Will thos things can create any inconsistency to  the MM and ML.
    Please suggest me uor thoughts.
    Thanks
    sandeep.
    Thanks ,
    sandeep.

Maybe you are looking for