Introduction
Opening the purchase order on some event through coding has been discussed quite often, In this blog, I will explain how to open the purchase order with a specific tab at the item level.
Table ESDUS.
In order to achieve this , table ESDUS can be used.
This table contains the dynamic user settings for the MM Area for every user. In this particular business Scenario, table record marked above is relevant.
The value in the column Active is basically the item detail tab number which will be active when the PO is opened. Index number of the last active tab remains in this field. In order to find the index number of the tab which you want to set active, simply open any PO, open that tab and close the PO. Index of that tab will be saved in this field.
Code sample to set a particular tab active and open PO
On the event to open the PO, simply set a particular index for that record for the current user and open the PO using the function module ME_DISPLAY_PURCHASE_DOCUMENT.
Conclusion
This approach should be possible for other areas as well, if you are able to find out the user settings table for that area.
If there are any questions, please comment below.
Regards
Ketan
Okumaya devam et...
Opening the purchase order on some event through coding has been discussed quite often, In this blog, I will explain how to open the purchase order with a specific tab at the item level.
Table ESDUS.
In order to achieve this , table ESDUS can be used.
Table Esdus
This table contains the dynamic user settings for the MM Area for every user. In this particular business Scenario, table record marked above is relevant.
The value in the column Active is basically the item detail tab number which will be active when the PO is opened. Index number of the last active tab remains in this field. In order to find the index number of the tab which you want to set active, simply open any PO, open that tab and close the PO. Index of that tab will be saved in this field.
Code sample to set a particular tab active and open PO
On the event to open the PO, simply set a particular index for that record for the current user and open the PO using the function module ME_DISPLAY_PURCHASE_DOCUMENT.
Kod:
SELECT single * FROM esdus INTO @DATA(ls_esdus2) WHERE uname = @sy-uname AND
action = 'PurchaseOrder' AND
element = 'item_view SUBVIEW_INDEX'.
IF ls_esdus2 IS NOT INITIAL.
ls_esdus2-active = '18'.
MODIFY esdus FROM ls_esdus2.
ENDIF.
CALL FUNCTION 'ME_DISPLAY_PURCHASE_DOCUMENT'
EXPORTING
i_ebeln = <data>-ebeln
i_ebelp = <data>-ebelp
EXCEPTIONS
not_found = 1
no_authority = 2
invalid_call = 3
preview_not_possible = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE 'Call Transaction not possible' TYPE 'I'.
ENDIF.
Conclusion
This approach should be possible for other areas as well, if you are able to find out the user settings table for that area.
If there are any questions, please comment below.
Regards
Ketan
Okumaya devam et...