Question on Search Help and Authorization Check for Sales Order Type
When I go to VA01 and click the search help, it shows only order type that are not blocked.
However, when I have sales order type in select-options of a Z program,
S_AUART FOR VBAK-AUART
I click on the search help, it gives all the sales order types. How can I have a list with unblocked sales order type only?
I want to check whether a use can extract data from a sales order type (e.g. OR and RE)that he/she authorized to use.
I have include the following in my program:
AUTHORITY-CHECK OBJECT 'AUART'
ID 'AUART' FIELD 'OR'.
It always returns SY-SUBRC = 12.
But order type 'OR' is granted to the user (he/she can create order with type OR in VA01)
Please kindly give me some ideas, thanks.
Dariusz Sobczak replied
use following code:
AT SELECTION-SCREEN ON VALUE-REQUEST FOR auart. PERFORM auartGet. FORM auartGet. CALL FUNCTION 'RV_HELP' EXPORTING KEY = VKORG KEY2 = VTWEG KEY3 = SPART KEY4 = '0' NUMBER = '008' FIELD_IN = AUART IMPORTING FIELD = AUART. ENDFORM.
AUTHORITY-CHECK OBJECT 'V_VBAK_AAT' ID 'AUART' FIELD 'OR' ID 'ACTVT' FIELD '01'. "01-create order, 02-change, 03 display check sy-subrc eq 0.