Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Update domain's append

Former Member
0 Likes
1,774

hello,

my issue is related with domain's fixed value append. My client does not have rights to update Domain's values manually, so i've created transaction which allows such action, but i have a problem when users try to use that value, system prompt to change it because this value is illegal (doesn't exit, but DD07T tables has it). i 've tryed different update combinations:

1) Only domain's update;

2) Only append's update;

3) Domain's and append's update, but without success. even changed the sequence;


...
move p_dom to lv_domain.
.
  call function 'SVRS_GET_VERSION_DOMD_40'
    exporting
      object_name = lv_domain
      versno      = lv_versno
    tables
      dd01v_tab   = gt_dd01v
*     dd07v_tab   = lt_dd07v
      dd07tv_tab  = lt_dd07tv
    exceptions
      no_version  = 01.

  loop at lt_dd07tv reference into lp_dd07tv.
    move-corresponding lp_dd07tv->* to ls_doma.
    append ls_doma to gt_doma.
    clear ls_doma.
  endloop.

....
"this part of code is executed when user presses save button

read table gt_dd01v into ls_dd01v index 1.

loop at gt_doma reference into lp_doma.
    ls_dd07v-domname = p_dom.
    ls_dd07v-valpos = sy-tabix.
    ls_dd07v-ddlanguage = 'X'.
    ls_dd07v-domvalue_l = lp_doma->domvalue_l.
    ls_dd07v-domvalue_h = lp_doma->domvalue_h.
    ls_dd07v-ddtext     = lp_doma->ddtext.
    ls_dd07v-appval     = 'X'.
    append ls_dd07v to lt_dd07v.
    clear ls_dd07v.
  endloop.

  call function 'DD_DOMA_PUT'
    exporting
      dd01v_wa            = ls_dd01v
      domain_name         = p_dom
      prid                = 0
      ctrl_doma_put       = 'A'
    tables
      dd07v_tab           = lt_dd07v
    exceptions
      illegal_value       = 1
      op_failure          = 2
      object_inconsistent = 3
      others              = 4.

  if sy-subrc is initial.
    call function 'DB_COMMIT' .
    message s043.
  else.
    message e044.
  endif.

i had tryed other Function modules, but i got the same result.

Thank you for any help.

dez_

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,175

Hi

You can SE11 Transaction code to append the values to domain.

http://wiki.sdn.sap.com/wiki/display/ABAP/FixedValueAppendForstandard+Domains

Shiva

hello,

my issue is related with domain's fixed value append. My client does not have rights to update Domain's values manually, so i've created transaction which allows such action, but i have a problem when users try to use that value, system prompt to change it because this value is illegal (doesn't exit, but DD07T tables has it). i 've tryed different update combinations:

1) Only domain's update;

2) Only append's update;

3) Domain's and append's update, but without success. even changed the sequence;


...
move p_dom to lv_domain.
.
  call function 'SVRS_GET_VERSION_DOMD_40'
    exporting
      object_name = lv_domain
      versno      = lv_versno
    tables
      dd01v_tab   = gt_dd01v
*     dd07v_tab   = lt_dd07v
      dd07tv_tab  = lt_dd07tv
    exceptions
      no_version  = 01.

  loop at lt_dd07tv reference into lp_dd07tv.
    move-corresponding lp_dd07tv->* to ls_doma.
    append ls_doma to gt_doma.
    clear ls_doma.
  endloop.

....
"this part of code is executed when user presses save button

read table gt_dd01v into ls_dd01v index 1.

loop at gt_doma reference into lp_doma.
    ls_dd07v-domname = p_dom.
    ls_dd07v-valpos = sy-tabix.
    ls_dd07v-ddlanguage = 'X'.
    ls_dd07v-domvalue_l = lp_doma->domvalue_l.
    ls_dd07v-domvalue_h = lp_doma->domvalue_h.
    ls_dd07v-ddtext     = lp_doma->ddtext.
    ls_dd07v-appval     = 'X'.
    append ls_dd07v to lt_dd07v.
    clear ls_dd07v.
  endloop.

  call function 'DD_DOMA_PUT'
    exporting
      dd01v_wa            = ls_dd01v
      domain_name         = p_dom
      prid                = 0
      ctrl_doma_put       = 'A'
    tables
      dd07v_tab           = lt_dd07v
    exceptions
      illegal_value       = 1
      op_failure          = 2
      object_inconsistent = 3
      others              = 4.

  if sy-subrc is initial.
    call function 'DB_COMMIT' .
    message s043.
  else.
    message e044.
  endif.

i had tryed other Function modules, but i got the same result.

Thank you for any help.

dez_

4 REPLIES 4
Read only

Former Member
0 Likes
1,175

These values are often determined by configuration settings development. Why aren't these updates being done that way?

Read only

Former Member
0 Likes
1,176

Hi

You can SE11 Transaction code to append the values to domain.

http://wiki.sdn.sap.com/wiki/display/ABAP/FixedValueAppendForstandard+Domains

Shiva

Read only

0 Likes
1,175

Client doesn't have rights to use SE11. i wrote that before and i need function module or other variant which allows to maintain append's values and does not require user with development key . Any suggestions?

br,

dez_

Read only

0 Likes
1,175

Hi

With your code also, the values are getting updated but the domain is not adjusted and reactivated. Check the version management, there you can see a new TR under your name.

When you use FM 'DDIF_DOMA_PUT' the system will add the entries, but the domain will not get adjusted. So you need to use another FM 'DDIF_DOMA_ACTIVATE' to get the values.

Please have a look into the below code and adjust accordingly your code.



data :wa_dd01v type dd01v.

select
single *
  into wa_dd01v
  from dd01v
 where DOMNAME = 'TEST'
   and DDLANGUAGE = sy-langu.

DATA DD07V_TAB LIKE DD07V OCCURS 2 WITH HEADER LINE.
DD07V_TAB-DOMNAME = 'TEST'.
DD07V_TAB-VALPOS = '1'.
DD07V_TAB-DDLANGUAGE = 'E'.
DD07V_TAB-DOMVALUE_L = 'X'.
DD07V_TAB-DDTEXT = 'Fixed value text A'.

APPEND DD07V_TAB.

DD07V_TAB-DOMNAME = 'TEST'.
DD07V_TAB-VALPOS = '2'.
DD07V_TAB-DDLANGUAGE = 'E'.
DD07V_TAB-DOMVALUE_L = 'Y'.
DD07V_TAB-DDTEXT = 'Fixed value text B'.

APPEND DD07V_TAB.



*COMMIT WORK.

CALL FUNCTION 'DDIF_DOMA_PUT'
EXPORTING
NAME = 'TEST'
dd01v_wa = wa_dd01v
TABLES
DD07V_TAB = DD07V_TAB
EXCEPTIONS
PUT_FAILURE  = 01
OTHERS       = 02.
IF SY-SUBRC = 1.
ROLLBACK WORK.
ENDIF.


IF SY-SUBRC = 0.
CALL FUNCTION 'DDIF_DOMA_ACTIVATE'
  EXPORTING
    name              = wa_dd01v-DOMNAME
*   AUTH_CHK          = 'X'
*   PRID              = -1
* IMPORTING
*   RC                =
* EXCEPTIONS
*   NOT_FOUND         = 1
*   PUT_FAILURE       = 2
*   OTHERS            = 3
          .
if sy-subrc = 0.
COMMIT WORK.
endif.

WRITE / 'Domain TEST is now revised with two fixed values.'.
WRITE / 'The active version is unchanged.'.
ELSE.
WRITE / 'Domain TEST is still active in the old state.'.
endif.

Shiva