第二和第三行项目不使用`bapi_salesorder_change`进行更新

时间:2015-06-10 05:41:45

标签: sap abap

我的要求是更改销售订单项目详细信息 为此我使用BAPI_SALESOPDER_CHANGE

  1. 对于一个订单项,它运行正常。
  2. 包含两个订单项的销售订单,对于订单项10,其更新数量,但对于20个订单项,它会随机更新。
  3. SO包含三个显示异常的项目。
  4. 我的代码在这里:

     DATA: SALESDOCUMENT        TYPE           BAPIVBELN-VBELN.  
     DATA: LT_ORDER_HEADER_INX  TYPE TABLE OF  BAPISDH1X,  
            LS_ORDER_HEADER_INX  TYPE           BAPISDH1X.
    
    DATA: LT_ORDER_ITEM_IN     TYPE TABLE OF   BAPISDITM,  
           LS_ORDER_ITEM_IN    TYPE           BAPISDITM.
    
    DATA: LT_ORDER_ITEM_INX    TYPE TABLE OF   BAPISDITMX,     
    
           LS_ORDER_ITEM_INX    TYPE            BAPISDITMX.
    DATA: LT_SCHEDULE_LINES    TYPE TABLE OF   BAPISCHDL,            
          LS_SCHEDULE_LINES    TYPE            BAPISCHDL.   
    DATA: LT_SCHEDULE_LINESX   TYPE TABLE OF   BAPISCHDLX,   
          LS_SCHEDULE_LINESX   TYPE            BAPISCHDLX.
    
    DATA: LT_RETURN            TYPE TABLE OF   BAPIRET2,    
          LS_RETURN            TYPE            BAPIRET2.
    
    PARAMETERS: p_sonum        TYPE            BAPIVBELN-VBELN.   
      LS_ORDER_HEADER_INX-UPDATEFLAG = 'U'.    
    LS_ORDER_ITEM_IN-ITM_NUMBER = 10.    
    LS_ORDER_ITEM_IN-TARGET_QTY = 22.    
    APPEND LS_ORDER_ITEM_IN TO LT_ORDER_ITEM_IN.    
    clear: LS_ORDER_ITEM_IN.    
    
    LS_ORDER_ITEM_IN-ITM_NUMBER = 20.    
    LS_ORDER_ITEM_IN-TARGET_QTY = 33.      
    APPEND LS_ORDER_ITEM_IN TO LT_ORDER_ITEM_IN.     
    clear: LS_ORDER_ITEM_IN.   
    
    LS_ORDER_ITEM_IN-ITM_NUMBER = 30.     
    LS_ORDER_ITEM_IN-TARGET_QTY = 44.      
     APPEND LS_ORDER_ITEM_IN TO LT_ORDER_ITEM_IN.     
    clear: LS_ORDER_ITEM_IN.     
    
    LS_ORDER_ITEM_INX-ITM_NUMBER = 10.    
    LS_ORDER_ITEM_INX-UPDATEFLAG = 'U'.     
     LS_ORDER_ITEM_INX-TARGET_QTY = 'X'.     
    APPEND LS_ORDER_ITEM_INX TO LT_ORDER_ITEM_INX.      
    clear:LS_ORDER_ITEM_INX.      
    
    LS_ORDER_ITEM_INX-ITM_NUMBER = 20.    
    LS_ORDER_ITEM_INX-UPDATEFLAG = 'U'.    
    LS_ORDER_ITEM_INX-TARGET_QTY = 'X'.   
    APPEND LS_ORDER_ITEM_INX TO LT_ORDER_ITEM_INX.    
    clear:LS_ORDER_ITEM_INX.   
    
    LS_ORDER_ITEM_INX-ITM_NUMBER = 30.    
    LS_ORDER_ITEM_INX-UPDATEFLAG = 'U'.    
    LS_ORDER_ITEM_INX-TARGET_QTY = 'X'.    
    APPEND LS_ORDER_ITEM_INX TO LT_ORDER_ITEM_INX.   
    clear:LS_ORDER_ITEM_INX.   
    
    LS_SCHEDULE_LINES-ITM_NUMBER  = 10.   
    LS_SCHEDULE_LINES-SCHED_LINE  = 1.    
    LS_SCHEDULE_LINES-REQ_QTY     = 22.    
    APPEND LS_SCHEDULE_LINES  TO LT_SCHEDULE_LINES.    
    clear:LS_SCHEDULE_LINES.
    
    LS_SCHEDULE_LINES-ITM_NUMBER  = 20.   
    LS_SCHEDULE_LINES-SCHED_LINE  = 2.    
    LS_SCHEDULE_LINES-REQ_QTY     = 33.    
    APPEND LS_SCHEDULE_LINES  TO LT_SCHEDULE_LINES.    
    clear:LS_SCHEDULE_LINES.     
    
    LS_SCHEDULE_LINES-ITM_NUMBER  = 30.     
    LS_SCHEDULE_LINES-SCHED_LINE  = 3.      
    LS_SCHEDULE_LINES-REQ_QTY     = 44.    
    APPEND LS_SCHEDULE_LINES  TO LT_SCHEDULE_LINES.     
    clear:LS_SCHEDULE_LINES.      
    
    LS_SCHEDULE_LINESX-ITM_NUMBER  = 10.    
    LS_SCHEDULE_LINESX-SCHED_LINE  = 1.   
    LS_SCHEDULE_LINESX-UPDATEFLAG  = 'U'.   
    LS_SCHEDULE_LINESX-REQ_QTY     = 'X'.    
    APPEND LS_SCHEDULE_LINESX TO LT_SCHEDULE_LINESX.   
    CLEAR: LS_SCHEDULE_LINESX.     
    
    LS_SCHEDULE_LINESX-ITM_NUMBER  = 20.   
    LS_SCHEDULE_LINESX-SCHED_LINE  = 2.   
    LS_SCHEDULE_LINESX-UPDATEFLAG  = 'U'.    
    LS_SCHEDULE_LINESX-REQ_QTY     = 'X'.    
    APPEND LS_SCHEDULE_LINESX TO LT_SCHEDULE_LINESX.   
    CLEAR: LS_SCHEDULE_LINESX.    
    
    LS_SCHEDULE_LINESX-ITM_NUMBER  = 30.    
    LS_SCHEDULE_LINESX-SCHED_LINE  = 3.   
    LS_SCHEDULE_LINESX-UPDATEFLAG  = 'U'.     
    LS_SCHEDULE_LINESX-REQ_QTY     = 'X'.     
    APPEND LS_SCHEDULE_LINESX TO LT_SCHEDULE_LINESX.    
    CLEAR: LS_SCHEDULE_LINESX.      
    
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'     
      EXPORTING       
        salesdocument               = p_sonum     
        order_header_inx            = LS_ORDER_HEADER_INX     
      TABLES      
        return                      = LT_RETURN     
       ORDER_ITEM_IN                = LT_ORDER_ITEM_IN     
       ORDER_ITEM_INX               = LT_ORDER_ITEM_INX     
       SCHEDULE_LINES               = LT_SCHEDULE_LINES      
       SCHEDULE_LINESX              = LT_SCHEDULE_LINESX .        
    
    
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'       
     EXPORTING     
       WAIT          =  'X'
    

3 个答案:

答案 0 :(得分:0)

请确保您传递给BAPI的订单项编号带有前导零。

答案 1 :(得分:0)

除了添加前导零,我认为行项目编号是1,2,3而不是10,20,30尝试以单个数字增量运行代码。如果不起作用,也会发布 for (b in c(0.1,0.2))curve(abs(x^2 - b^2),add=TRUE,col='red') 的结果。

答案 2 :(得分:0)

计划行与订单行相关联,因此他们应该开始对每个订单项重新编号。

所以,在你的例子中所有的行都是

var zindexes = [100] ; // Because jQuery UI starts its dialogs at z-index 101
$( ".ui-dialog" ).each(function( ) {
    // for each ui-dialog that is currently displayed, push the z-index to the array
    if( $( this ).css("display") === "block" )
        zindexes.push( $( this ).css("z-index") );
}) ;
// If z-index is less than the greatest index in the array, bring it to the fore
if($(class_str).parent().css("display") === "block" &&
   parseInt($(class_str).parent().css("z-index")) < Math.max.apply(null, zindexes))
    $(class_str).parent().css("z-index", Math.max.apply(null, zindexes)+1) ;
// If already in the fore then minimize/restore.
else $(class_str).dialog( "moveToTop" ), $(class_str).parent().toggle("blind", 250) ;

LS_SCHEDULE_LINES-SCHED_LINE  = ???.

应该是

LS_SCHEDULE_LINESX-SCHED_LINE  = ???.

LS_SCHEDULE_LINES-SCHED_LINE  = 1.