This is my first Blog, in this blog i will share my experience with adding an additional selection field (pop-up) in VA05 transaction.
In SDN, i came across many threads for additional selection fields in VA05 and found several OSS Notes, but could find the required field in the list of which SAP provides.
By using enhancement spot, we can add additional selection field by using a pop-up screen for the field.
Step 1:
Create a Function Module program with a pop-up screen of the required field. For Eg. I created a popup screen for requested delivery date in FM Z_VA05_POPUP as shown below.
Provide GUI Status and PF status for the pop-up screen as per your requirement.
Write a logic to read from pop-up screen in PAI module.
CASE sy-ucomm .
WHEN 'ENTER'.
IF vbak-vdatu GT vbak-erdat AND
not vbak-erdat is INITIAL.
MESSAGE 'Enter a valid range' TYPE 'S' DISPLAY LIKE 'E'.
LEAVE SCREEN.
elseif vbak-vdatu is INITIAL and
not vbak-erdat is INITIAL.
start_date = vbak-erdat.
leave to screen 0.
else.
start_date = vbak-vdatu.
end_date = vbak-erdat.
leave to screen 0.
ENDIF.
WHEN 'CANCEL'.
leave to SCREEN 0.
WHEN OTHERS.
ENDCASE.
Step 2:
In FM RV_SALES_DOCUMENT_VIEW_3, create an enhancement spot on ES_SAPLV05T on section RV_SALES_DOCUMENT_VIEW_3_06.
ENHANCEMENT-SECTION RV_SALES_DOCUMENT_VIEW_3_06 SPOTS ES_SAPLV05T.
This Enhancement spot will trigger right after the select statement based on selection screen parameters. All data will be stored in internal table VBAK_TAB.
Step 3:
Provide the logic in ENHANCEMENT-SECTION to invoke pop-up screen for additional seelction screen fields.
Filter the internal table VBAK_TAB with the new selection screen parameters from pop-up screen. Change the logic as per your requirement.
IF sy-tcode = 'VA05'.
data: lv_start_date like vbak-vdatu,
lv_end_date like vbak-vdatu,
lv_idx like sy-tabix.
RANGES: r_vdatu FOR vbak-vdatu.
CALL FUNCTION 'Z_VA05_POPUP'
IMPORTING
VDATU_START = lv_start_date
VDATU_END = lv_end_date.
if NOT lv_start_date IS INITIAL or
NOT lv_end_date IS INITIAL.
r_vdatu-sign = 'I'.
IF lv_end_date IS INITIAL.
r_vdatu-option = 'EQ'.
else.
r_vdatu-option = 'BT'.
ENDIF.
r_vdatu-low = lv_start_date.
r_vdatu-high = lv_end_date.
APPEND r_vdatu.
LOOP AT vbak_tab .
lv_idx = sy-tabix.
IF NOT vbak_tab-vdatu in r_vdatu.
DELETE vbak_tab INDEX lv_idx.
ENDIF.
CLEAR: vbak_tab, lv_idx.
ENDLOOP.
endif.
ENDIF.
The VA05 screen with requested Delivery date popup looks like...
Hope to get valuable suggestions from experts....
Regards
Syed Afsar