admin管理员组

文章数量:1400161

Im using BAPI_PRODORDCONF_CREATE_TT to create a Prod-Order. I set postg_date in the Structure for the Timetickets to our budat, but that also changes everytime the bldat in the mkpf.

How to avoid that? we want budat to a custom date, but bldat the current day. Debugging, googling and looking through the structures didnt help at all.

Here is a short example:

CLASS z_prodord_test DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC.

  PUBLIC SECTION.
    INTERFACES if_oo_adt_classrun.

    TYPES: timeticket_tt     TYPE STANDARD TABLE OF bapi_pp_timeticket WITH NON-UNIQUE DEFAULT KEY,
           goods_movement_tt TYPE STANDARD TABLE OF bapi2017_gm_item_create WITH NON-UNIQUE DEFAULT KEY,
           link_tt           TYPE STANDARD TABLE OF bapi_link_conf_goodsmov WITH NON-UNIQUE DEFAULT KEY,
           return_tt         TYPE STANDARD TABLE OF bapi_coru_return WITH NON-UNIQUE DEFAULT KEY.

    CONSTANTS: start_date TYPE dats VALUE '20250301',
               start_time TYPE tims VALUE '200000',
               end_date   TYPE dats VALUE '20250331',
               end_time   TYPE tims VALUE '060000'.

    METHODS
      get_props EXPORTING e_get_timetickets     TYPE timeticket_tt
                          e_get_goods_movements TYPE goods_movement_tt
                          e_get_link            TYPE link_tt.
ENDCLASS.


CLASS z_prodord_test IMPLEMENTATION.
  METHOD get_props.
    DATA: get_return TYPE bapiret1,
          get_detail TYPE return_tt.

    e_get_timetickets = VALUE #( ( orderid   = 'INSERT ORDID HERE'
                                   sequence  = '000000'
                                   operation = '0010' ) ).
    CALL FUNCTION 'BAPI_PRODORDCONF_GET_TT_PROP' EXPORTING propose            = VALUE bapi_pp_conf_prop( quantity      = abap_true
                                                                                                         activity      = abap_true
                                                                                                         date_and_time = abap_true
                                                                                                         personnel     = abap_true
                                                                                                         goodsmovement = abap_true )
                                                 IMPORTING return             = get_return
                                                 TABLES    timetickets        = e_get_timetickets
                                                           goodsmovements     = e_get_goods_movements
                                                           link_conf_goodsmov = e_get_link
                                                           detail_return      = get_detail.
    DELETE get_detail WHERE table_line IS INITIAL.
    IF line_exists( get_detail[ type = 'E' ] )
    OR line_exists( get_detail[ type = 'A' ] )
    OR line_exists( get_detail[ type = 'X' ] )
    OR e_get_timetickets IS INITIAL
    OR get_return-type    = 'E'
    OR get_return-type    = 'A'
    OR get_return-type    = 'X'.
      MESSAGE 'Error in getting Props' TYPE 'E'.
    ENDIF.
    LOOP AT e_get_timetickets ASSIGNING FIELD-SYMBOL(<timeticket>).
      <timeticket>-exec_start_date     = start_date.
      <timeticket>-exec_start_time     = start_time.
      <timeticket>-exec_fin_date       = end_date.
      <timeticket>-exec_fin_time       = end_time.
      <timeticket>-proc_start_date     = start_date.
      <timeticket>-proc_start_time     = start_time.
      <timeticket>-proc_fin_date       = end_date.
      <timeticket>-proc_fin_time       = end_time.
      <timeticket>-setup_fin_date      = start_date.
      <timeticket>-setup_fin_time      = start_time.
      <timeticket>-teardown_start_date = end_date.
      <timeticket>-teardown_start_time = end_time.
      <timeticket>-yield               = 0.
      <timeticket>-postg_date          = start_date.
    ENDLOOP.
    MODIFY e_get_goods_movements FROM VALUE #( entry_qnt = 0 ) TRANSPORTING entry_qnt WHERE entry_qnt <> 0.
  ENDMETHOD.

  METHOD if_oo_adt_classrun~main.
    DATA: create_return TYPE bapiret1,
          create_detail TYPE return_tt.

    get_props( IMPORTING e_get_timetickets     = DATA(timetickets)
                         e_get_goods_movements = DATA(goods_movements)
                         e_get_link            = DATA(link) ).

    CALL FUNCTION 'BAPI_PRODORDCONF_CREATE_TT' EXPORTING post_wrong_entries    = '0'
                                                         testrun               = abap_false
                                                         call_on_inbound_queue = space
                                               IMPORTING return                = create_return
                                               TABLES    timetickets           = timetickets
                                                         goodsmovements        = goods_movements
                                                         link_conf_goodsmov    = link
                                                         detail_return         = create_detail.
    IF create_return IS NOT INITIAL.
      APPEND CORRESPONDING #( create_return ) TO create_detail.
    ENDIF.
    DELETE create_detail WHERE table_line IS INITIAL.
    IF line_exists( create_detail[ type = 'E' ] )
    OR line_exists( create_detail[ type = 'A' ] )
    OR line_exists( create_detail[ type = 'X' ] )
    OR timetickets        IS INITIAL
    OR create_return-type  = 'E'
    OR create_return-type  = 'A'
    OR create_return-type  = 'X'.
      MESSAGE 'Error in Creating' TYPE 'E'.
    ENDIF.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = abap_true.
  ENDMETHOD.
ENDCLASS.

I broke down my code to this, so sorry if some aspects are not necessarily needed. Without setting postg_date, both budat and bldat get set to todays date. Filling it, fills both dates to that value. But i want distinct ones.

I know that FM G_PCA_0_POSTING does this, cause it runs as Update task and gets called by the bapi (and some others too), but i dont find the point where the MATDOC gets updated :( maybe i still didnt find the right one, there are multiple that get called.

But even if i find it i still dont know how to change the value. My initial guess was to change the Column in the MKPF (or the corresponding CDS-Proxy/Matdoc) myself, but the values only exists after the update task ends and im not even sure, the commit work and wait is enough to wait for that.

And even then i dont have the MBLNR for all of the Entries. I know afwi has them after processing, but it seems they are just temporarily there, cause the Table is nearly empty on our system and only has the most recent ones in it

本文标签: abapHow to set BLDAT on a different value than BUDAT with BAPIPRODORDCONFCREATETTStack Overflow