In this document we will see how to create a table extension in SRM documents. This example is for PO Header but the same process can be applied to other documents.
Go to SPRO to the following path:
SAP Supplier Relationship Management -> SRM Server ->Cross-Application Basic Settings -> Extensions and Field Control (Personalization) -> Create Table Extensions and Supply with Data -> Define Customer Table Extensions on Header Level
And create an append estructure on header on Database and also on PO header:
- - Define Append for Fields of Customer Table on Header on Database
- - Define Append for Fields of Customer Table on PO Header
In this example we’re going to create a table with the fields ‘User’ and ‘Name’:
Active both structures.
Return to SPRO and go to:
Control Table Extensions and Their Fields and Actions -> Set Visibility of Table Extensions -> Configure Visibility of Table-Like Header Enhancements.
And add a new entry for Customer Table Ext. Header (THCUS) and PO (BUS2201).
Then go to:
Configure Control of Fields of Table Extensions -> Customer metadata for substructure fields in normal entries
And add one entry for each field, set the field as Visible and Enabled.
At this point you can assign a dynamic class and method for change the visualization of the fields in run time.
You need to add also the lines in “Default customer metadata for set fields in initial entries” if you want to be allowed to edit the lines:
Now, if you go to the portal or NWBC and create a new PO, you can see a subtab called “Table Extension” within the PO header. Click there and you can see the table with the two fields we’ve added:
As you can see the buttons for add or delete lines are disabled. For active these buttons we need to do the following. Go to “Configure Control of Actions”:
And a line for each button:
Then you can see the buttons enabled and you can add or delete lines:
Change the place where the table is displayed
If you want to change the place where the table is displayed, for example adding a new header tab, you can do the following:
Goto to the PO and with the right button of the mouse choose “More field help” :
Here we can see the Component name and the Configuration ID:
Go to se80 to the component FPM_OIF_COMPONENT and find the Configuration ID/SAPSRM/WDCC_FPM_OIF_PO_PURCH, the push the button “Start Configurator”:
A new internet explorer browser will be opened. Choose “Change”.
If you go to the Header tab and do click in the table extension subtab you can see the view is been used isIV_L_FPC_CA_DETAILS of component /SAPSRM/WDC_DODC_CT. Save somewhere this names we’ll need it later.
We’re going to create a new header tab, so use the button “Add Main View”:
A new tab will be added, change the description of that tab.
Then expand the node of this new tab and set the view wich we want to be displayed, adding the Component/SAPSRM/WDC_DODC_CT the view IV_L_FPC_CA_DETAILS and the Component configuration name.
Save the changes and go to the portal to create a new PO:
- Using badi BBP_DOC_CHANGE_BADI for add or modify the table.
Go to se18 and create a new implementation for badi BBP_DOC_CHANGE_BADI.
Add a filter for object type BUS2201 and go to the method BBP_PO_CHANGE. We have a parameter called IT_HCF“Tabular Customer and Solution Fields on PO Header” in wich we have the data of our table.
With the following sample code you can add some initial lines to the table:
- DATA: ls_i_item LIKE LINE OF it_item,
- ls_e_item LIKE LINE OF et_item,
- ls_i_acc LIKE LINE OF it_acc,
- ls_e_acc LIKE LINE OF et_acc,
- ls_hcf LIKE LINE OF it_hcf.
- * Move data from import parameter to export parameters:
- MOVE-CORRESPONDING is_header TO es_header.
- LOOP AT it_item INTO ls_i_item.
- MOVE-CORRESPONDING ls_i_item TO ls_e_item.
- APPEND ls_e_item TO et_item.
- ENDLOOP.
- LOOP AT it_acc INTO ls_i_acc.
- MOVE-CORRESPONDING ls_i_acc TO ls_e_acc.
- APPEND ls_e_acc TO et_acc. CLEAR ls_e_acc.
- ENDLOOP.
- et_partner[] = it_partner[].
- et_orgdata[] = it_orgdata[].
- et_hcf[] = it_hcf[].
- * Add some initial lines to the custom table:
- IF iv_mode EQ 'C'. "Creation mode
- CALL FUNCTION 'BBP_LA_UTILITY_GENERATE_GUID'
- IMPORTING
- e_guid = ls_hcf-guid.
- ls_hcf-p_guid = is_header-guid.
- ls_hcf-zz_user = '0000012345'.
- ls_hcf-zz_name = 'My name'.
- APPEND ls_hcf TO et_hcf.
- ENDIF.
No comments:
Post a Comment