Register Login

BAPI for PIKMG update

Updated May 18, 2018

DATA BEGIN OF it OCCURS 0,
vbeln LIKE likp-vbeln,
kodat LIKE likp-kodat,
posnr like lips-posnr,
pikmg(13),
END OF it.

data :it_VBPOK type standard table of VBPOK,
      it_return type standard table of PROTT,
      it_return1 type standard table of PROTT,
      wa_return type prott,
      wa_VBPOK type VBPOK,
      wa_VBKOK type VBKOK.

parameter :p_file LIKE rlgrap-filename.
data file1 type string.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  CALL FUNCTION 'F4_FILENAME'
   EXPORTING
     PROGRAM_NAME        = SYST-CPROG
     DYNPRO_NUMBER       = SYST-DYNNR
     FIELD_NAME          = 'p_file'
   IMPORTING
     FILE_NAME           = p_file
            .
  start-of-selection.
  file1 = p_file.
CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    filename                      = file1
   FILETYPE                      = 'ASC'
   HAS_FIELD_SEPARATOR           = 'X'
*   HEADER_LENGTH                 = 0
*   READ_BY_LINE                  = 'X'
*   DAT_MODE                      = ' '
*   CODEPAGE                      = ' '
*   IGNORE_CERR                   = ABAP_TRUE
*   REPLACEMENT                   = '#'
*   CHECK_BOM                     = ' '
*   VIRUS_SCAN_PROFILE            =
*   NO_AUTH_CHECK                 = ' '
* IMPORTING
*   FILELENGTH                    =
*   HEADER                        =
  tables
    data_tab                      = it
 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.

LOOP AT it.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input         = it-vbeln
   IMPORTING
     OUTPUT        = it-vbeln
            .


  wa_vbkok-VBELN_VL = it-vbeln.
  wa_vbkok-vbtyp_vl = 'A'.
  wa_vbkok-vbeln = it-vbeln.
  wa_vbkok-wabuc = 'X'.
  wa_vbkok-kodat = it-kodat.

wa_vbpok-vbeln_vl = it-vbeln.
wa_vbpok-posnr_vl = it-posnr.
wa_vbpok-vbeln = it-vbeln.
wa_vbpok-posnn = it-posnr.
wa_vbpok-pikmg = it-pikmg.
APPEND wa_vbpok TO it_vbpok.

ENDLOOP.

CALL FUNCTION 'WS_DELIVERY_UPDATE_2'
  EXPORTING
    vbkok_wa                           = wa_vbkok
   SYNCHRON                           = 'X'
*   NO_MESSAGES_UPDATE_1               = ''
   COMMIT                             'X'
    delivery                           = it-vbeln
   UPDATE_PICKING                     = 'X'
   NICHT_SPERREN_1                    = 'X'
   IF_CONFIRM_CENTRAL                 = 'X'
*   IF_WMPP                            = ' '
*   IF_GET_DELIVERY_BUFFERED           = ' '
*   IF_NO_GENERIC_SYSTEM_SERVICE       = ' '
   IF_DATABASE_UPDATE_1               = '1'
*   IF_NO_INIT_1                       = ' '
*   IF_NO_READ_1                       = ' '
*   IF_ERROR_MESSAGES_SEND             = ''
*   IF_NO_BUFFER_REFRESH               = ' '
*   IT_PARTNER_UPDATE                  =
*   IT_SERNR_UPDATE                    =
*   IF_NO_REMOTE_CHG_1                 = ' '
*   IF_NO_MES_UPD_PACK                 = ' '
*   IF_LATE_DELIVERY_UPD               = ' '
*   IF_TXT_REINITIALIZE                =
*   IF_BOR_INIT                        = ' '
*   SPE_MES_NO_SEND_NODIAL             =
* IMPORTING
*   EF_ERROR_ANY                       =
*   EF_ERROR_IN_ITEM_DELETION          =
*   EF_ERROR_IN_POD_UPDATE             =
*   EF_ERROR_IN_INTERFACE              =
*   EF_ERROR_IN_GOODS_ISSUE            =
*   EF_ERROR_IN_FINAL_CHECK            =
*   EF_ERROR_PARTNER_UPDATE            =
*   EF_ERROR_SERNR_UPDATE              =
 TABLES
   VBPOK_TAB                          = it_vbpok
   PROT                               = it_return
*   VERKO_TAB                          =
*   VERPO_TAB                          =
*   VBSUPCON_TAB_1                     =
*   IT_VERPO_SERNR                     =
*   IT_PACKING                         =
*   IT_PACKING_SERNR                   =
*   IT_REPACK                          =
*   IT_HANDLING_UNITS_1                =
*   IT_OBJECTS                         =
*   ET_CREATED_HUS                     =
*   TVPOD_TAB                          =
*   IT_TEXTH                           =
*   IT_TEXTL                           =
*   IT_TMSTMP                          =
*   IT_OBJ_QUAN_CHG                    =
*   IT_VBPOK_SPLIT                     =
          .


loop at it_return into wa_return where msgty ne 'E'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
 EXPORTING
   WAIT          'X'
 IMPORTING
   RETURN        = it_return1
         .
clear wa_return.
endloop.

 

Flat file:

80015183    200111110    10    1

 

 


×