Ansicht
Dokumentation

/ISDFPS/MATPLN_C_SEL - BAdI: Customer Enhancement for Planning Workbench

/ISDFPS/MATPLN_C_SEL - BAdI: Customer Enhancement for Planning Workbench

General Material Data   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.
SAP E-Book

In the DFPS solution, you may have to extend the reports for requesting and planning materials (NCG budget execution, for example, material situation transaction /ISDFPS/DISP_MAT_SIT, or Planning Workbench transaction /ISDFPS/DSP1).

You may also have to add customer-specific fields to the selection screen and the ALV grid, such as "Display the Item Text for a PReq".

The composite enhancement spot /ISDFPS/ESC_MATPLN_CUST_SEL is therefore provided with BAdI definition /ISDFPS/BADI_MATPLN_CUST_SEL (enhancement spot /ISDFPS/ES_MATPLN_CUST_SEL) and the relevant enhancement points for the reports.

  1. Enhancement points

If selection fields are to be added to a report, the following enhancement points must be implemented in each case:

  • /ISDFPS/SEL_#Reportname# for selection fields
  • /ISDFPS/SSO_#Reportname# for selection field texts

To enhance the selection screen, each explicit enhancement option can be implemented with the required parameters, for example, PARAMETER text TYPE field as part of the enhancement concept.

(Enhancement implementations are processed using the Enhancement Builder tool in the ABAP Workbench.)

  1. BAdI definition /ISDFPS/BADI_MATPLN_CUST_SEL

To fill the fields, a BAdI implementation must be created for the BAdI definition /ISDFPS/BADI_MATPLN_CUST_SEL, and the corresponding logic must be implemented.

  • BAdI method EXPAND_SCREEN - Processing Selection Fields

Transfer parameters:

  • IT_PARAMS contains all of the selection screen parameters

  • IT_DATA and IT_DATA_SER contain all necessary data

  • BAdI method CHANGE_FCAT - Enhance Field Catalog

Transfer parameters:

  • IV_DETAIL_MODE indicates material or serial view

  • IV_PLACEMENT contains usage information

  • CT_FCAT contains the field catalog for the material view

  • CT_FCAT_SER contains the field catalog for the serial view

Alternatively, you can create an APPEND with the required fields in the structure /ISDFPS/FDPMAT_STOCKLIST (for example, ZZ_MEMO_TEXT TYPE TEXT128).

The fields must begin with the letters "ZZ" or "YY", which are reserved for customers. Otherwise, they cannot be displayed in the ALV.

Example 1: Reading the item text for an item in a PReq:

The field ZZ_MEMO_TEXT TYPE TEXT128 is added to the structure /ISDFPS/FDPMAT_STOCKLIST. The method for data selection is enhanced as follows:

method /ISDFPS/IF_MATPLN_CUST_SEL~EXPAND_SCREEN.

* DATA: lt_reqitem_old TYPE TABLE OF bapieban,

* lt_reqtexts TYPE TABLE OF bapiebantx.

*

* DATA: lr_banfn TYPE RANGE OF eban-banfn,

* ls_banfn LIKE LINE OF lr_banfn VALUE 'IEQ'.

*

* FIELD-SYMBOLS: <ls_data> LIKE LINE OF it_data,

* <ls_banfn> LIKE LINE OF lr_banfn,

* <ls_reqtexts> TYPE bapiebantx,

* <ls_params> LIKE LINE OF it_params.

*

** field of include z_customer_sel_screen

* READ TABLE it_params ASSIGNING <ls_params>

* WITH KEY selname = 'TEXT'

* low = 'X'.

* CHECK sy-subrc = 0.

*

*

* CHECK it_data IS NOT INITIAL.

* LOOP AT it_data ASSIGNING <ls_data>.

* ls_banfn-low = <ls_data>-preq_no.

* COLLECT ls_banfn INTO lr_banfn.

* ENDLOOP.

*

* LOOP AT lr_banfn ASSIGNING <ls_banfn>.

*

** read PR item text

* CALL FUNCTION 'BAPI_REQUISITION_GETDETAIL'

* EXPORTING

* number = <ls_banfn>-low

* item_texts = 'X'

* TABLES

* requisition_items = lt_reqitem_old

* requisition_text = lt_reqtexts.

*

* IF lt_reqtexts IS NOT INITIAL.

* LOOP AT lt_reqtexts ASSIGNING <ls_reqtexts>

* WHERE text_id = 'B01' " B01 = Customizing (text options)

* AND text_form = '*'.

* READ TABLE it_data ASSIGNING <ls_data>

* WITH KEY preq_no = <ls_reqtexts>-preq_no

* preq_item = <ls_reqtexts>-preq_item.

* IF sy-subrc = 0.

** at first: create field 'zz_memo_text' in structur /ISDFPS/FDPMAT_STOCKLIST_T

* <ls_data>-zz_memo_text = <ls_reqtexts>-text_line.

* ENDIF.

* ENDLOOP.

* ENDIF.

* ENDLOOP.

endmethod.

Example 2: New "Material Type" selection field in transaction /ISDFPS/DISP_MAT_SIT

  1. Implement enhancement spot /ISDFPS/SEL_DISPLAY_MAT_OR_EQU.

SELECTION-SCREEN BEGIN OF BLOCK zcustomer WITH FRAME TITLE ztitle.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT (20) z_mtart MODIF ID CUS. "FOR FIELD P_MTART.

PARAMETERS: P_MTART type MARA-MTART MODIF ID CUS.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK zcustomer.

  1. Implement enhancement spot /ISDFPS/SEL_DISPLAY_MAT_OR_EQU.

DATA: para TYPE tpara-paramid VALUE 'Z_BADI_CUS_SEL',

para_v TYPE char1.

* test

ztitle = '!!! Test - Customer-Specific Enhancements!'.

z_mtart = 'Material Type'.

" user para Z_BADI_CUS_SEL

GET PARAMETER ID para FIELD para_v.

* not for transaction /ISDFPS/DISP_EQUI_SIT - indicator x_equi

IF x_equi IS NOT INITIAL or

para_v IS INITIAL.

LOOP AT SCREEN.

IF screen-group1 = 'CUS'.

screen-invisible = '1'.

screen-active = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

  1. method /ISDFPS/IF_MATPLN_CUST_SEL~EXPAND_SCREEN.

FIELD-SYMBOLS: <ls_params> TYPE rsparams.

IF it_params IS NOT INITIAL.

READ TABLE it_params ASSIGNING <ls_params>

WITH KEY selname = 'P_MTART'.

IF sy-subrc = 0.

IF <ls_params>-low IS NOT INITIAL.

DELETE it_data WHERE mtart <> <ls_params>-low.

DELETE it_data_ser WHERE mtart <> <ls_params>-low.

ENDIF.

ENDIF.

ENDIF.

* fill range lr_matkl from select-option S_MATKL

DATA: lr_matkl TYPE RANGE OF mara-matkl,

ls_matkl LIKE LINE OF lr_matkl.

LOOP AT it_params ASSIGNING <ls_params>

WHERE selname = 'S_MATKL'.

MOVE-CORRESPONDING <ls_params> TO ls_matkl.

APPEND ls_matkl TO lr_matkl.

ENDLOOP.

IF lr_matkl[] IS NOT INITIAL.

DELETE it_data WHERE matkl NOT IN lr_matkl.

DELETE it_data_ser WHERE matkl NOT IN lr_matkl.

ENDIF.

  1. method /ISDFPS/IF_MATPLN_CUST_SEL~CHANGE_FCAT

LOOP AT ct_fcat ASSIGNING <fs_fcat>.

IF <fs_fcat>-fieldname = 'MTART'.

CONCATENATE 'BADI:' <fs_fcat>-scrtext_l

INTO <fs_fcat>-scrtext_l SEPARATED BY space.

ENDIF.

ENDLOOP.






ABAP Short Reference   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.

Length: 8838 Date: 20240425 Time: 230731     sap01-206 ( 77 ms )