2012 Jul 31 10:39 AM
Hello Experts,
I want to update search help programatically, i got one function module 'DD_SHLP_SET_PUT' of function group 'SDSH'. But it shows error, though search help is getting updated with new values but after that it does not change to editable mode, and shows weird behavior any suggestion ???
Regards,
Ankur Sharma.
2012 Jul 31 11:38 AM
Hello Rüdiger Plantiko and Former Member,
Actually, my requirement is, if i have a search help 'ZSEARCHHELP' which is using table 'ZDBTAB'.
Table: ZDBTAB
field1: emp_id type ZELEMENT.
Now, in search help 'ZSEARCHHELP' i want to change the DE which is used in field Emp_id from ZELEMENT to YELEMENT.
And i want to do it programatically.
Regards,
Ankur Sharma
2012 Jul 31 10:46 AM
Hi Ankur,
evey search help has a search help exit, if you want to update any search help functinality then open that search help in se11 and click on definition tab. you will see the seach help exit, there you can write your own logic.
for the code lines you can search google.
Thanks
2012 Jul 31 10:59 AM
Helly Ankur,
My recommendation:
Don't do it. Don't create a complete search help programmatically.
My alternative:
Create manually a search help which is sufficiently generic: With only one parameter (the field for which it is designed), with no selection method and with a search help exit module.
Then, add your dynamics in the form of generic programming in the search help exit module. There are many times of the F4 processing model where you can intervene with an exit. You can overwrite any F4 behaviour: The result list, the select options dialogue, the selection itself.
In my opinion, this way will save you a lot of work, of trial and error with undocumented basis code, of random-programming (i.e. randomly trying out things).
Regards,
Rüdiger
2012 Jul 31 11:38 AM
Hello Rüdiger Plantiko and Former Member,
Actually, my requirement is, if i have a search help 'ZSEARCHHELP' which is using table 'ZDBTAB'.
Table: ZDBTAB
field1: emp_id type ZELEMENT.
Now, in search help 'ZSEARCHHELP' i want to change the DE which is used in field Emp_id from ZELEMENT to YELEMENT.
And i want to do it programatically.
Regards,
Ankur Sharma
2012 Jul 31 12:19 PM
Hi Ankur,
Use combination of these FM.
You cannot directly replace the data element.
You need to delete the field first with 'ZELEMENT' and then create the same field again with 'YELEMENT'.
First get the field structure in lt_dd32p_tab_a internal table using 'DD_SHLP_GET'.
Then delete the row which has the Old data element. Save this in a temporary work area, so that you can replace the old DE with new DE.
Call 'DD_SHLP_PUT' with the new lt_dd32p_tab_a. This will delete the Search help field with 'ZELEMENT'.
Then add the new field again with 'YELEMENT' to the lt_dd32p_tab_a table.
Call 'DD_SHLP_PUT' with the new lt_dd32p_tab_a.
CALL FUNCTION 'DD_SHLP_GET'
EXPORTING
shlp_name = 'Y_ARTICLE_SEARCH_HELP'
TABLES
dd31v_tab_a = lt_dd31v_tab_a
dd31v_tab_n = lt_dd31v_tab_n
dd32p_tab_a = lt_dd32p_tab_a
dd32p_tab_n = lt_dd32p_tab_n
dd33v_tab_a = lt_dd33v_tab_a
dd33v_tab_n = lt_dd33v_tab_n
EXCEPTIONS
ILLEGAL_VALUE = 1
OP_FAILURE = 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.
ENDIF.
CALL FUNCTION 'DD_SHLP_PUT'
EXPORTING
PUT_STATE = 'A'
shlp_name = 'Y_ARTICLE_SEARCH_HELP'
TABLES
dd31v_tab = lt_dd31v_tab_a
dd32p_tab = lt_dd32p_tab_a
dd33v_tab = lt_dd33v_tab_a
EXCEPTIONS
DB_ACCESS_FAILURE = 1
ILLEGAL_VALUE = 2
OBJECT_INCONSISTENT = 3
OTHERS = 4
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks,
Shambu
2012 Jul 31 1:13 PM
Hello Shambu VS ,
Thanks for the solution, i was trying it directly that is why it was showing weird results. Between with this method, the condition is that in SEARCH HELP 'Modified' parameter should be checked, is that so or am missing something in code ?
One more doubt is, why there are two tables 'LT_DD32P_N' used 'LT_DD32P_A' is used ?
CODE:
CALL FUNCTION 'DD_SHLP_GET'
EXPORTING
* GET_STATE = 'M '
LANGU = SY-LANGU
* PRID = 0
SHLP_NAME = 'ZSEARCHHELP'
* WITHTEXT = ' '
* ADD_TYPEINFO = 'X'
* TRACELEVEL = 0
* IMPORTING
* DD30V_WA_A =
* DD30V_WA_N =
* GOT_STATE =
TABLES
DD31V_TAB_A = lt_dd31v_a
DD31V_TAB_N = lt_dd31v_n
DD32P_TAB_A = lt_dd32p_a
DD32P_TAB_N = lt_dd32p_n
DD33V_TAB_A = lt_dd33v_a
DD33V_TAB_N = lt_dd33v_n
EXCEPTIONS
ILLEGAL_VALUE = 1
OP_FAILURE = 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.
ENDIF.
LOOP AT lt_dd32p_a INTO ls_dd32p_a.
ls_dd32p_a-rollname = 'INT1'.
MODIFY lt_dd32p_a FROM ls_dd32p_a.
ENDLOOP.
CALL FUNCTION 'DD_SHLP_PUT'
EXPORTING
* CTRL_SHLP_PUT = 'XXXX'
* DD30V_WA =
PUT_STATE = 'A'
* PRID = 0
SHLP_NAME = 'ZSEARCHHELP'
TABLES
DD31V_TAB = lt_dd31v_a
DD32P_TAB = lt_dd32p_a
DD33V_TAB = lt_dd33v_a
EXCEPTIONS
DB_ACCESS_FAILURE = 1
ILLEGAL_VALUE = 2
OBJECT_INCONSISTENT = 3
OTHERS = 4
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Ankur Sharma.
2012 Jul 31 2:27 PM
Hi,
Please use this piece.
DATA: ls_dd32p_tab_a TYPE dd32p ,
lt_dd32p_tab_a TYPE TABLE OF dd32p.
CALL FUNCTION 'DD_SHLP_GET'
EXPORTING
shlp_name = 'Y_ARTICLE_SEARCH_HELP'
TABLES
dd32p_tab_a = lt_dd32p_tab_a
EXCEPTIONS
illegal_value = 1
op_failure = 2
OTHERS = 3.
LOOP AT lt_dd32p_tab_a INTO ls_dd32p_tab_a.
IF ls_dd32p_tab_a-rollname = 'EKGRP'.
ls_dd32p_tab_a-rollchange = 'X'.
ls_dd32p_tab_a-rollname = 'BKGRP'.
MODIFY lt_dd32p_tab_a FROM ls_dd32p_tab_a.
ENDIF.
ENDLOOP.
CALL FUNCTION 'DD_SHLP_PUT'
EXPORTING
put_state = 'A'
shlp_name = 'Y_ARTICLE_SEARCH_HELP'
TABLES
dd32p_tab = lt_dd32p_tab_a
EXCEPTIONS
db_access_failure = 1
illegal_value = 2
object_inconsistent = 3
OTHERS = 4.
In this example I am replacing data element EKGRP with BKGRP.
Also, 'LT_DD32P_N' will have the fields of inactive version of the search help. I dont think you will need this, as you will be replacing active Search helps.
Thanks,
Shambu
2012 Aug 01 5:33 AM
Hello Shambu,
ok, i missed rollchange = 'X'. Well thanks for the help, means a lot to me.
Regards,
Ankur Sharma