Ansicht
Dokumentation

MMPUR_PO_STD_ITEM_TE - Determine Standard Text Sent for Purchase Order Output Item

MMPUR_PO_STD_ITEM_TE - Determine Standard Text Sent for Purchase Order Output Item

CPI1466 during Backup   ABAP Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

The standard text that is used in the output of the purchase order item is picked up from the purchase order item directly. With this BAdI, you modify the standard purchase order item text that will be used in the purchase order output.

Parameters

Importing Parameters:

PURCHASE_ORDER_NO: This parameter carries the purchase order number.

ITEM_TEXT_DETAILS This parameter carries the standard text purchase order item text.

Changing Parameters:

ITEM_TEXT_DETAILS_ENH: Use this parameter to modify the standard purchase order item text that will be used in the purchase order output.

  METHOD if_mmpur_po_std_item_text~enrich_po_std_item_text.
* IMPORTING PURCHASE_ORDER_NO            Purchase Order Number
*           ITEM_TEXT_DETAILS            Text ID Fetched Based on SSCUIfor Text Object
*  CHANGING ITEM_TEXT_DETAILS_ENH        Modified Text IDs for Text Object

*Item Category: 0 -Standard, 2 -Consignment, 3 -Subcontracting, A  -Enhanced Limit,5 -Third-party

    DATA(lt_item_text_detail) = item_text_details.
    DATA(lt_item_text_detail_enh) = item_text_details_enh.
    DATA : ls_item_text_detail_enh LIKE LINE OF lt_item_text_detail_enh.

* Moving input table item text to output table item text
    LOOP AT lt_item_text_detail INTO DATA(ls_item_txt_det).
      CLEAR ls_item_text_detail_enh.
      MOVE-CORRESPONDING ls_item_txt_det TO ls_item_text_detail_enh.
      ls_item_text_detail_enh-purchaseorderitemcategory = ls_item_txt_det-purchasingdocumentitemcategory.
      APPEND ls_item_text_detail_enh TO lt_item_text_detail_enh.
    ENDLOOP.

    SORT lt_item_text_detail_enh BY purchaseorderitem
                                    purchaseorderitemcategory
                                    textobjecttype
                                    textobjectkey.

*Use Select Statements to read data from CDS Views i_purchaseorderapi01and i_purchaseorderitemapi01
    IF mo_po_data IS INITIAL.
      mo_po_data = NEW lcl_po_detail( ).
    ENDIF.
*Get Purchase Order and Supplier details
    mo_po_data->get_po_data( EXPORTING iv_purchase_order      = purchase_order_no
                             IMPORTING es_purchase_order_data = DATA(ls_purchase_order_details)
                                       et_purchase_order_item_data = DATA(lt_item_detail) ).


*deleting the enhanced limit items - "A is internal format for limit item
    DELETE lt_item_detail WHERE purchaseorderitemcategory = 'A'.

* Loop through the items to add or delete standard text
    LOOP AT lt_item_detail INTO DATA(ls_item_detail).
* Checking company code '1001'
        IF ls_item_detail-companycode = 'C100'.
* For material 1 adding a new text for other items no change
          IF ls_item_detail-material = 'Material1'.
            APPEND VALUE #( purchaseorderitem              = ls_item_detail-purchaseorderitem
                            purchaseorderitemcategory      = ls_item_detail-purchaseorderitemcategory
                            textobjecttype                 = 'MF03'
                            purgtextprintsequencevalue     = '99'
                            purgtextprintpriorityvalue     = '1'
                            textobjectkey                  = 'ZMM_PUR_PO_STD_TEXT_PG_001'
                            purgtexttitleisprinted         = abap_true ) TO lt_item_text_detail_enh.
          ENDIF.
        ELSE.
* For material6 deleting the standard text that was read with SSCUI
          IF ls_item_detail-material = 'Material6'.
            DELETE lt_item_text_detail_enh WHERE purchaseorderitem  = ls_item_detail-purchaseorderitem AND
                                                 textobjecttype  = 'MF01' AND
                                                 textobjectkey  = 'ZTEST_RJ_STD_INSTRUCTION_SUPPLIER'.
          ENDIF.
        ENDIF.

    ENDLOOP.

* Moving the entries to changing parameter
    item_text_details_enh = lt_item_text_detail_enh.

  ENDMETHOD.






General Data in Customer Master   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.

Length: 8079 Date: 20240523 Time: 203553     sap01-206 ( 60 ms )