2006 Feb 14 12:27 PM
Hi All
On a selection screen I have parameter that has a search help atached in order to allow the user to select a KUNNR item from the KNA1 table. However, rather than the search help displaying all of the customer records I would like to restrict it to only those for which there is a certain type of sales item (VBAP). I have tried to do this by creating a view with a join in it and linking the matchcode for the parameter to this view. However, while this restricts the set to KNA1 records with a corresponding VBAP record, I don't seem to be able to make it 'distinct' so I end up with multiple rows for each KNA1 record.
Any help would be greatly appreciated - I'm new to ABAP so am probably missing something obvious!
Kind regards
Andy
2006 Feb 14 12:36 PM
Hi Andrew,
I hope i got ur Q right. You want to restrict the F4 help to just those kunrs that have VBAP details...
see this code if it helps
SELECT kunnr FROM vbak INTO itab-vbak
WHERE ..............
APPEND itab.
ENDSELECT.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'KUNNR'
dynpprog = w_progname
dynpnr = w_scr_num
dynprofield = 'itab-vtweg'
value_org = 'S'
display = 'F'
stepl = g_stepl
TABLES
value_tab = itab
return_tab = return_values
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE .
hide: itab-kunnr.
modify table itab transporting kunnr.
I hope it will help you.............
2006 Feb 14 12:36 PM
Hi Andrew,
I hope i got ur Q right. You want to restrict the F4 help to just those kunrs that have VBAP details...
see this code if it helps
SELECT kunnr FROM vbak INTO itab-vbak
WHERE ..............
APPEND itab.
ENDSELECT.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'KUNNR'
dynpprog = w_progname
dynpnr = w_scr_num
dynprofield = 'itab-vtweg'
value_org = 'S'
display = 'F'
stepl = g_stepl
TABLES
value_tab = itab
return_tab = return_values
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE .
hide: itab-kunnr.
modify table itab transporting kunnr.
I hope it will help you.............
2006 Feb 14 3:25 PM
Thanks Shobna
I think I am geting there with this in that I've got it to compile! However, I'm getting a runtime error of 'Type conflict when calling a function module (field length).' The error analysis suggests that what I have put under return_tab Table is the correct type but the incorrect length. I have declared an internal table:
DATA: BEGIN OF it_ret_val OCCURS 0,
kunnr TYPE vbak-kunnr,
END OF it_ret_val.
which is identical in structure to the value_tab Table. I have looked at the function module and its help but do not seem to be able to figure out why this is a problem. Do you have any ideas?
Kind regards
Andrew
2006 Feb 14 3:33 PM
Hi Andrew,
Declare the internla table field as <b>LIKE</b> not <b>TYPE</b>.
DATA: BEGIN OF it_ret_val OCCURS 0,
kunnr <b>LIKE</b> vbak-kunnr,
END OF it_ret_val.
2006 Feb 14 3:38 PM
Hi Phani
This doesn't seem to have solved it as I'm still getting the same run-time error...
Thanks anyway
Andrew
2006 Feb 14 3:50 PM
Hi Andrew,
Please go through the SDN code sample for "Enhancing a Standard Search Help " created by one of our colegue:
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/daeda0d7-0701-0010-8caa-edc983384237.">Enhancing a Standard Search Help</a>
Hope this may help you.
Lanka
2006 Feb 14 4:29 PM
Hi Lanka
Thanks for this, however, the link doesn't seem to work - I just get a standard unable to find the page type error. I've had a quick search for the title but no luck yet - is there any chance you could re-post the link please?
Kind regards
Andy
2006 Feb 14 4:32 PM
Hi Andrew,
Please view as HTML and it is opening for me.
<a href="http://72.14.207.104/search?q=cache:jsjjnGNVn98J:https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/daeda0d7-0701-0010-8caa-edc983384237++f4if_shlp_exit_example&hl=en&gl=us&ct=clnk&cd=2">Try this link</a>
Lanka
2006 Feb 14 5:02 PM
Thanks Lanka
That link works now. I've finished for the day so will check out the article when I'm back in the office next week.
Thanks again
Andrew
2006 Feb 14 5:07 PM
Hi Andrew,
Great that the links helps you. It contains very good documentation on creation of custom search help.
All the Best.
Lanka
2006 Feb 15 8:44 AM
Hi Andrew,
Here is the complete code...Sorry about the logic sent before..
REPORT Z_SC_F4_HELP .
data:begin of itab occurs 0,
kunnr like vbak-kunnr,
end of itab.
data: return_values like DDSHRETVAL occurs 0 with header line.
parameters: p_kunnr like vbak-kunnr.
at selection-screen on value-request for p_kunnr.
SELECT kunnr FROM vbak INTO itab-kunnr.
APPEND itab.
ENDSELECT.
sort itab.
delete adjacent duplicates from itab.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'P_KUNNR'
value_org = 'S'
display = 'F'
TABLES
value_tab = itab
return_tab = return_values
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE .
p_kunnr = return_values-fieldval.
ENDIF.
2006 Feb 14 1:00 PM
write ur own exit in the search help and modify the internal table record_tab to contain only those records which u wnat.
2006 Feb 14 1:13 PM
u can do it by defining ur own f4 help
by calling fn module f4if_int_table_value_request as discussed above.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |