Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Bapi/Function for Packing Instructions

former_member611006
Active Participant
0 Likes
10,588

Hi Experts,

I've created Packing Instructions with POF1/POP1, and I want to read these pack.Instr. into an ABAP Program...

How/Where can I find/access to pack.instr. using a Function/BAPI ?

Regards,

David

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
5,616

hi David,

Below are the FM and Bapi that will help you in getting data related to Packing Instruction.

VHUPO_PACK_INSTRUCTION_CHANGE
VHUPO_PACK_INSTRUCTION_CREATE
VHUPO_PACK_INSTRUCTION_DELETE
VHUPO_PACK_INSTRUCTION_SHOW
VHUPO_PACK_INSTRUCTION_USED
VHUPO_PACK_INSTRUCT_READ_IDENT
VHUPO_PACK_INSTRUCT_UNDELETE

VHUPIBAPI_BUILD_PACK_INST_INFO
VHUPIBAPI_BUILD_PACK_INST_TREE
VHUPIBAPI_PACK_INST_FIND

ABI_PACK_INSTRUCTIONS_GET   -   Retrieve the packing instructions
LXVAS_PACKING_INSTRUCTION_READ - Read packing Instructions of  packing object

Example to read the instruction

** local variables
  DATA: l_pikp_exp    LIKE  pikp ,
            l_cmvhupo_exp LIKE  cmvhupo ,
            l_pikp_imp    LIKE  pikp .

  l_cmvhupo_exp-nodia = 'X' .   "No Dialog
  l_cmvhupo_exp-contxt = '3' .  "Display packing instructions
  l_pikp_exp-packnr    =  packnr " pass the Unique internal packing object number.
  l_pikp_exp-piid      = piid ." pass the Identification number of packing instruction

** call standard function to retrieve values
  CALL FUNCTION 'VHUPO_PACK_INSTRUCTION_SHOW'
    EXPORTING
      pikp_imp                = l_pikp_exp
      cmvhupo_imp         = l_cmvhupo_exp
   IMPORTING
     pikp_exp                = l_pikp_imp
   EXCEPTIONS
     locked                   = 1
     not_found              = 2
     data_missed          = 3
     data_wrong            = 4
     quantity_wrong       = 5
     missed_pos_type   = 6
     no_new_number     = 7
     baseunit_wrong      = 8
     not_saved               = 9
     inconsistent            = 10
     marked_for_delete   = 11
     exsist                     = 12
     material_unkown     = 13
     quantity_changed    = 14
     clint_unkown           = 15
     OTHERS                 = 16  .

regards,

Padma

Edited by: Padmashree RamMaghenthar on May 26, 2009 12:27 PM

8 REPLIES 8
Read only

Former Member
0 Likes
5,616

Hi,

Check this BAPI's

VHUPIBAPI_BUILD_PACK_INST_INFO

VHUPIBAPI_BUILD_PACK_INST_TREE

VHUPIBAPI_PACK_INST_FIND

Regards,

Jyothi CH.

Read only

Former Member
0 Likes
5,617

hi David,

Below are the FM and Bapi that will help you in getting data related to Packing Instruction.

VHUPO_PACK_INSTRUCTION_CHANGE
VHUPO_PACK_INSTRUCTION_CREATE
VHUPO_PACK_INSTRUCTION_DELETE
VHUPO_PACK_INSTRUCTION_SHOW
VHUPO_PACK_INSTRUCTION_USED
VHUPO_PACK_INSTRUCT_READ_IDENT
VHUPO_PACK_INSTRUCT_UNDELETE

VHUPIBAPI_BUILD_PACK_INST_INFO
VHUPIBAPI_BUILD_PACK_INST_TREE
VHUPIBAPI_PACK_INST_FIND

ABI_PACK_INSTRUCTIONS_GET   -   Retrieve the packing instructions
LXVAS_PACKING_INSTRUCTION_READ - Read packing Instructions of  packing object

Example to read the instruction

** local variables
  DATA: l_pikp_exp    LIKE  pikp ,
            l_cmvhupo_exp LIKE  cmvhupo ,
            l_pikp_imp    LIKE  pikp .

  l_cmvhupo_exp-nodia = 'X' .   "No Dialog
  l_cmvhupo_exp-contxt = '3' .  "Display packing instructions
  l_pikp_exp-packnr    =  packnr " pass the Unique internal packing object number.
  l_pikp_exp-piid      = piid ." pass the Identification number of packing instruction

** call standard function to retrieve values
  CALL FUNCTION 'VHUPO_PACK_INSTRUCTION_SHOW'
    EXPORTING
      pikp_imp                = l_pikp_exp
      cmvhupo_imp         = l_cmvhupo_exp
   IMPORTING
     pikp_exp                = l_pikp_imp
   EXCEPTIONS
     locked                   = 1
     not_found              = 2
     data_missed          = 3
     data_wrong            = 4
     quantity_wrong       = 5
     missed_pos_type   = 6
     no_new_number     = 7
     baseunit_wrong      = 8
     not_saved               = 9
     inconsistent            = 10
     marked_for_delete   = 11
     exsist                     = 12
     material_unkown     = 13
     quantity_changed    = 14
     clint_unkown           = 15
     OTHERS                 = 16  .

regards,

Padma

Edited by: Padmashree RamMaghenthar on May 26, 2009 12:27 PM

Read only

former_member611006
Active Participant
0 Likes
5,616

Thanks a lot, points OK.

Regards,

David

Read only

former_member611006
Active Participant
0 Likes
5,616

Hi,

now I'm using VHUPIBAPI_PACK_INST_FIND to fin the pack.instruction, but the BAPI return following pack.instr. number:

IVPHv6g}0MZX08002hqR8m

I can't give this number into VHUPIBAPI_BUILD_PACK_INST_TREE to expand the pack.instr. tree, how can I decode this number?

Regards,

David

Read only

Former Member
0 Likes
5,616

Hi,

From the FM "VHUPIBAPI_PACK_INST_FIND" you will get the PACKNR ( Packing instruction )

Using that PACKNR ( Packing instruction ) in the FM "LEINT_PACKNR_PARENT_GET" you will

get the POBJID ( identification number of packing object ). You can make use of that

POBJID ( identification number of packing object ) in the

FM "VHUPIBAPI_BUILD_PACK_INST_TREE" .

Hope this will help you.

Regards,

Smart Varghese

Read only

0 Likes
5,616

Hi,

It doesn't seems to work... There is no parent for my pack.instruction. I just want to look if a pack.instr. exists for the material and to build a the tree with all components from this pack.instruction....

Here is my coding:

DATA: lw_pinstr  TYPE STANDARD TABLE OF isauto_pinstruction,
        lw_pdetail TYPE STANDARD TABLE OF isauto_pinst_detail.

  DATA ls_komgp   TYPE komgp.
  DATA lw_likp    TYPE likp.
  DATA lw_lips    TYPE lips.
  DATA lw_kondp   TYPE kondp.
  DATA lv_packnr  TYPE LXHME_PACKNR.
  DATA lv_packpa  TYPE LEINT_PACKKP_T.
  DATA lv_packkp TYPE packkp-pobjid.

  SELECT SINGLE * FROM likp
    INTO lw_likp
    WHERE vbeln = lief.

  SELECT SINGLE matnr FROM lips
    INTO lw_lips-matnr
    WHERE vbeln = lief
    AND   posnr = '000001'.

  MOVE '0001'             TO ls_komgp-werks.
  MOVE lw_lips-matnr  TO ls_komgp-matnr.
  MOVE lw_likp-kunag  TO ls_komgp-kunag.

* Search the pack.instruction for the combination key plant/material/sold-to-party
  CALL FUNCTION 'VHUPIBAPI_PACK_INST_FIND'
    EXPORTING
      i_scheme          = 'ZFS1'
      i_komgp           = ls_komgp
*     I_DATE            =
   IMPORTING
     e_kondp            = lw_kondp
*     E_DATE            =
   EXCEPTIONS
     locked            = 1
     not_found         = 2
     fatal_error       = 3
     OTHERS            = 4.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  MOVE lw_kondp-packnr TO lv_packkp.

* Build pack.instr. Tree
  CALL FUNCTION 'VHUPIBAPI_BUILD_PACK_INST_TREE'
    EXPORTING
      pobjid_i      = lv_packkp
    TABLES
      tpinstruction = lw_pinstr
      tpinst_detail = lw_pdetail
    EXCEPTIONS
      locked        = 1
      not_found     = 2
      fatal_error   = 3
      OTHERS        = 4.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Regards,

David

Read only

former_member611006
Active Participant
0 Likes
5,616

How can I convert PACKNR = IVPHv6g}0MZX08002hqR8m ?

I can't use it with VHUPIBAPI_BUILD_PACK_INST_TREE...

Any idea please?

Regards,

David

Read only

former_member611006
Active Participant
0 Likes
5,616

It works by using "CONVERSION_EXIT_VHUPI_OUTPUT" !

Regards,

David