2018年12月19日星期三

add customer append items(BAPI_DELIVERYPROCESSING_EXEC)

1. Add append Items to structure (LESHP_DELIVERY_CREATE,SHP_VORGABE_DATEN)

2. BAPI_DELIVERYPROCESSING_EXEC (Line:186 OR Line:211)
  if not gi_bapi_dlvexec_ex is initial.

      call badi gi_bapi_dlvexec_ex->process_extensions
        exporting
          it_request            request[]
          it_partner_addr   partner_addr[]
          it_partner            partner[]
          it_bapiextc          extension1[]
          it_bapiext            extension2[]
          it_extensionin     extensionin[]
        changing
          ct_package_to_deliver lt_package_to_deliver
          ct_delivery_extend      ls_delivery_extend
          cs_control                    ls_control
          ct_interface_internal    lt_interface_internal.

    endif.

   perform userexit_prepare_001       tables     
                                                   request
                                                   extension1
                                                   extension2
                                          using    

                                               techn_control "n_711530
                                               delivery_extend
                                       changing 

                                                ls_delivery_extend
                                                ls_control
                                                lt_interface_internal
                                                lt_package_to_deliver
                                                lf_subrc.


USERExit Sample:
  userexit_prepare_001

  DATA:
  l_tbl_interface_internal TYPE STANDARD TABLE OF leshp_delivery_create,
  l_rec_extension2         LIKE LINE OF it_extension2,
  l_field                  TYPE string.

FIELD-SYMBOLS:
  <lfs_interface_internal> LIKE LINE OF ct_interface_internal,
  <lfs_field>              TYPE any.

APPEND LINES OF ct_interface_internal TO l_tbl_interface_internal.

LOOP AT it_extension2 INTO l_rec_extension2.

* READ Interface table
  READ TABLE l_tbl_interface_internal
    ASSIGNING <lfs_interface_internal>
    INDEX l_rec_extension2-row.

  IF sy-subrc IS INITIAL.

*   Field assign
    CONCATENATE '<lfs_interface_internal>-'
                l_rec_extension2-field
           INTO l_field.
    ASSIGN (l_fieldTO <lfs_field>.

    IF sy-subrc IS INITIAL.

      MOVE:
        l_rec_extension2-value TO <lfs_field>.

    ENDIF.

  ENDIF.

ENDLOOP.

CLEAR ct_interface_internal.

INSERT LINES OF l_tbl_interface_internal INTO TABLE ct_interface_internal.



3.LV50R_CREAF34 (Line.13)
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  userexit_prepare_002
*&---------------------------------------------------------------------*
FORM userexit_prepare_002
     USING    is_create_interface   TYPE leshp_delivery_create
     CHANGING cs_vorgabe_daten      TYPE shp_vorgabe_daten.



  CALL CUSTOMER-FUNCTION '002'
       EXPORTING is_interface_internal is_create_interface
       CHANGING  cs_vorgabe_daten      cs_vorgabe_daten.



ENDFORM.                    " userexit_prepare_002



For Example:

MOVE:
  is_interface_internal-yyXXX  TO cs_vorgabe_daten-yyXXX,
  is_interface_internal-yyXXX2 TO cs_vorgabe_daten-yyXXXX2,
  is_interface_internal-yyXXXX TO cs_vorgabe_daten-yyXXXX.



4.LV50R_CREAF34 (Line.33)


*&---------------------------------------------------------------------*
*&      Form  userexit_prepare_003
*&---------------------------------------------------------------------*
FORM userexit_prepare_003
     USING    is_create_interface TYPE leshp_delivery_create
     CHANGING cs_komdlgn          TYPE komdlgn.


  CALL CUSTOMER-FUNCTION '003'
       EXPORTING is_interface_internal is_create_interface
       CHANGING  cs_komdlgn            cs_komdlgn.



ENDFORM.                    " userexit_prepare_003

For Example:
MOVE:
  is_interface_internal-yyXXX  TO cs_komdlgn-yyXXXX,
  is_interface_internal-yyXXXX2 TO cs_komdlgn-yyXXXX2,
  is_interface_internal-yyXXXX TO cs_komdlgn-yyXXXX.


5.MV50AFZ1 (Line77)
FORM USEREXIT_MOVE_FIELD_TO_LIPS.

*  LIPS-zzfield = xxxx-zzfield2.
*{   INSERT         FFDK905325                                        1
DATA:
  l_rec_cvbap LIKE LINE OF CVBAP.

* SD Create Delivery
  IF gs_vorgabe_daten IS NOT INITIAL.

*   Read CVBAP
    READ TABLE cvbap INTO l_rec_cvbap
      WITH KEY vbeln lips-vgbel
               posnr lips-vgpos.

    IF SY-SUBRC IS INITIAL.

*     Field Copy
      MOVE:
        l_rec_cvbap-yyXXXX  TO lips-yyXXXX,
        l_rec_cvbap-yyXXXX2 TO lips-yyXXXX2.

    ENDIF.

*   Field Copy
    MOVE:
      gs_vorgabe_daten-yyXXXXX TO lips-yyXXXX.

  ENDIF.

* MM Create Delivery
  IF gs_komdlgn IS NOT INITIAL.

*   Field Copy
    MOVE:
      gs_komdlgn-yyXXXX  TO lips-yyXXX,
      gs_komdlgn-yyXXXX2 TO lips-yyXXXX2,
      gs_komdlgn-yyXXXXX TO lips-yyXXXX.

  ENDIF.
*}   INSERT

ENDFORM.






 

没有评论:

发表评论

Customer Characteristic

  Characteristic Descriptions are stored in the table - CABNT - Language - SPRAS - Characteristic description - ATBEZ Characteristic Values ...