Tuesday, October 6, 2015

Table extensions in SRM documents

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

1.JPG
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
2.JPG
In this example we’re going to create a table with the fields ‘User’ and ‘Name’:
3.JPG
4.JPG

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.
5.JPG
And add a new entry for Customer Table Ext. Header (THCUS) and PO (BUS2201).
6.JPG
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.

7.JPG
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:
8.JPG
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:
9.JPG
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”:
10.JPG
And a line for each button:
11.JPG
12.JPG
Then you can see the buttons enabled and you can add or delete lines:
13.JPG

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” :

14.JPG
Here we can see the Component name and the Configuration ID:
15.JPG

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”:
16.JPG
A new internet explorer browser will be opened. Choose “Change”.
17.JPG
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.
18.JPG
We’re going to create a new header tab, so use the button “Add Main View”:
19.JPG
A new tab will be added, change the description of that tab.
20.JPG
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.
21.JPG
Save the changes and go to the portal to create a new PO:
22.JPG

-          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.
23.JPG
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:
  1. DATA: ls_i_item    LIKE LINE OF it_item,  
  2.         ls_e_item    LIKE LINE OF et_item,  
  3.         ls_i_acc     LIKE LINE OF it_acc,  
  4.         ls_e_acc     LIKE LINE OF et_acc,  
  5.         ls_hcf       LIKE LINE OF it_hcf.  
  6. * Move data from import parameter to export parameters:  
  7.   MOVE-CORRESPONDING is_header TO es_header.  
  8.   LOOP AT it_item INTO ls_i_item.  
  9.     MOVE-CORRESPONDING ls_i_item TO ls_e_item.  
  10.     APPEND ls_e_item TO et_item.  
  11.   ENDLOOP.  
  12.   LOOP AT it_acc INTO ls_i_acc.  
  13.     MOVE-CORRESPONDING ls_i_acc TO ls_e_acc.  
  14.     APPEND ls_e_acc TO et_acc. CLEAR ls_e_acc.  
  15.   ENDLOOP.  
  16.   et_partner[] =  it_partner[].  
  17.   et_orgdata[] = it_orgdata[].  
  18.   et_hcf[] = it_hcf[].  
  19. * Add some initial lines to the custom table:  
  20.   IF iv_mode EQ 'C'. "Creation mode  
  21.     CALL FUNCTION 'BBP_LA_UTILITY_GENERATE_GUID'  
  22.       IMPORTING  
  23.         e_guid = ls_hcf-guid.  
  24.     ls_hcf-p_guid = is_header-guid.      
  25.     ls_hcf-zz_user = '0000012345'.  
  26.     ls_hcf-zz_name = 'My name'.  
  27.     APPEND ls_hcf TO et_hcf.  
  28.   ENDIF.  

No comments:

Post a Comment