SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

BAPI_PO_GETDETAIL



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Wed Sep 19, 2007 6:39 pm    Post subject: BAPI_PO_GETDETAIL Reply with quote

Display Purchase Order Details

Code:
*&---------------------------------------------------------------------*
*& Report ZBAPI_1
*&
*&---------------------------------------------------------------------*
*&
*& BAPI TO GET PO ITEM DETAILS
*&---------------------------------------------------------------------*
REPORT ZBAPI_PO_GETDETAIL.
DATA : BEGIN OF I_POITEM OCCURS 0.
  INCLUDE STRUCTURE BAPIEKPO. “Include the Structure of dictionary Ref.
DATA : END OF I_POITEM.
PARAMETERS P_EBELN LIKE EKKO-EBELN default '4500012164'.. “ Input .

CALL FUNCTION 'BAPI_PO_GETDETAIL'
  EXPORTING
    PURCHASEORDER = P_EBELN
* ITEMS = 'X'
* ACCOUNT_ASSIGNMENT = ' '
* SCHEDULES = ' '
* HISTORY = ' '
* ITEM_TEXTS = ' '
* HEADER_TEXTS = ' '
* SERVICES = ' '
* CONFIRMATIONS = ' '
* SERVICE_TEXTS = ' '
* EXTENSIONS = ' '
* IMPORTING
* PO_HEADER =
* PO_ADDRESS =
  TABLES
* PO_HEADER_TEXTS =
    PO_ITEMS = I_POITEM. “ Assign the Internal Table
* PO_ITEM_ACCOUNT_ASSIGNMENT =
* PO_ITEM_SCHEDULES =
* PO_ITEM_CONFIRMATIONS =
* PO_ITEM_TEXTS = .
* PO_ITEM_HISTORY =
* PO_ITEM_HISTORY_TOTALS =
* PO_ITEM_LIMITS =
* PO_ITEM_CONTRACT_LIMITS =
* PO_ITEM_SERVICES =
* PO_ITEM_SRV_ACCASS_VALUES =
* RETURN =
* PO_SERVICES_TEXTS =
* EXTENSIONOUT =

LOOP AT I_POITEM.
  WRITE :/ 'PO NUMBER = ' , I_POITEM-PO_NUMBER COLOR COL_HEADING,
  / 'ITEM = ' , I_POITEM-PO_ITEM,
  / 'MATERIAL NAME = ' , I_POITEM-MATERIAL,
  / 'MATERIAL = ' , I_POITEM-PUR_MAT,
  / 'CHANGED ON = ', I_POITEM-CHANGED_ON,
  / 'SHORT TEXT = ' , I_POITEM-SHORT_TEXT,
  / 'COMPANY CODE = ' , I_POITEM-CO_CODE,
  / 'PLANT = ' , I_POITEM-PLANT,
  / 'MATERIAL GROUP = ' , I_POITEM-MAT_GRP,
  / 'QUANTITY = ' , I_POITEM-QUANTITY LEFT-JUSTIFIED,
  / 'UNIT = ' , I_POITEM-UNIT,
  / 'NET PRICE = ' , I_POITEM-NET_PRICE LEFT-JUSTIFIED.
  ULINE.
ENDLOOP.



Code:

PARAMETERS: P_EBELN LIKE BAPIEKKO-PO_NUMBER OBLIGATORY.
DATA: L_LAND1 LIKE T001-LAND1,
      L_KALSM LIKE T005-KALSM.
DATA: L_KBETR LIKE BSET-KBETR.
 
DATA: POHEAD LIKE BAPIEKKOL,
      POITEM LIKE BAPIEKPO OCCURS 0 WITH HEADER LINE,
      IT_KONV LIKE KONV OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF IT_TAX_RATE OCCURS 0,
        KSCHL LIKE KONV-KSCHL,
        MWSK1 LIKE KONV-MWSK1,
        KBETR LIKE KONV-KBETR,
      END OF IT_TAX_RATE.
 
CALL FUNCTION 'BAPI_PO_GETDETAIL'
  EXPORTING
    PURCHASEORDER                    = P_EBELN
 IMPORTING
   PO_HEADER                        = POHEAD
 TABLES
   PO_ITEMS                         = POITEM.
 
CALL FUNCTION 'MRM_DBTAB_KONV_READ'
  EXPORTING
    I_KNUMVE       = POHEAD-DOC_COND
    I_KNUMVL       = POHEAD-DOC_COND
  TABLES
    T_KONV         = IT_KONV.
 
SORT IT_KONV BY KNUMV KPOSN STUNR.
DELETE ADJACENT DUPLICATES FROM IT_KONV.
 
SELECT SINGLE LAND1 INTO L_LAND1 FROM T001
       WHERE BUKRS EQ POHEAD-CO_CODE.
SELECT SINGLE KALSM INTO L_KALSM FROM T005 WHERE LAND1 = L_LAND1.
LOOP AT IT_KONV WHERE NOT MWSK1 IS INITIAL.
     CALL FUNCTION 'FI_TAX_GET_CONDITION'
      EXPORTING
        I_BUKRS                   = POHEAD-CO_CODE
        I_LAND1                   = L_LAND1
        I_KALSM                   = L_KALSM
        I_MWSKZ                   = IT_KONV-MWSK1
        I_TXJCD                   = ' '
        I_KSCHL                   = IT_KONV-KSCHL
        I_KTOSL                   = ' '
        I_TDATE                   = SY-DATUM
      IMPORTING
        E_KBETR                   = L_KBETR
      EXCEPTIONS
        INPUT_PARAM_INVALID       = 1
        BUKRS_INVALID             = 2
        COUNTRY_INVALID           = 3
        TXJCD_INVALID             = 4
        CONDITION_NOT_FOUND       = 5
        OTHERS                    = 6.
 
  IT_TAX_RATE-KSCHL = IT_KONV-KSCHL.
  IT_TAX_RATE-MWSK1 = IT_KONV-MWSK1.
  IT_TAX_RATE-KBETR = L_KBETR / 10.
  APPEND IT_TAX_RATE.
ENDLOOP.
SORT IT_TAX_RATE BY KSCHL MWSK1.
DELETE ADJACENT DUPLICATES FROM IT_TAX_RATE.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.