Application Development 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: 

How to update values in domain?

Former Member

Hi All,

Is there any FM or BAPI or any other logic to update the values of domain?

For example, I have 4 values in my domain and i want to add 5th value to it. How we can do this....Please help me out.

Thanks in advance,

Srilakshmi.

9 REPLIES 9

Former Member
0 Kudos

Hi Srilakshmi,

Try these function modules.

RPY_DOMAIN_INSERT

RPY_DOMAIN_UPDATE

Best Regards,

Ram.

Former Member
0 Kudos

try to get access key and do it......

0 Kudos

Hi Srilakshmi

try using BDC.

Or use the FM DDIF_DOMA_PUT

Thanks

Pushpraj

0 Kudos

it is not a standard domain, it is a custom domain only but i am not supposed to update it directly by editing the domain.

0 Kudos

zdomain then try to update it directly dont waste ur time ...otherwise try ram kumar answer..

0 Kudos

Hi Srilakshmi,

RPY_DOMAIN_UPDATE

When you fill the tables parameter, make sure you fill it properly, so the already existing values should not get over written.

I think this should work for your scenario. Have you tried this?

Best Regards,

Ram.

Edited by: ram Kumar on Dec 19, 2008 12:31 PM

0 Kudos

Hi Ram,

I have tried the following program, but still nothing is getting updated. one value is present in domain already which i directly inserted and tried updating it by the following code, but not getting updated.

DATA dd07v_tab LIKE dd07v OCCURS 2 WITH HEADER LINE.

data doma_inf like rpy_doma.

DATA doma_values LIKE rpy_dval OCCURS 2 WITH HEADER LINE.

doma_inf-DOMANAME = 'ZTEST'.

doma_inf-language = 'E'.

doma_inf-datatype = 'CHAR'.

doma_inf-length = '1'.

doma_inf-outputlen = '1'.

doma_values-DOMANAME = 'ZTEST'.

doma_values-valpos = '0002'.

doma_values-language = 'E'.

doma_values-ddtext = 'value2'.

doma_values-domvalue_l = 'C'.

APPEND doma_values.

clear doma_values.

doma_values-DOMANAME = 'ZTEST'.

doma_values-valpos = '0003'.

doma_values-language = 'E'.

doma_values-ddtext = 'value3'.

doma_values-domvalue_l = 'D'.

APPEND doma_values.

clear doma_values.

CALL FUNCTION 'RPY_DOMAIN_UPDATE'

EXPORTING

ACTIVATION_TYPE = 'A'

doma_name = 'ZTEST'

doma_inf = doma_inf

LANGUAGE = 'E'

  • TRANSPORT_NUMBER = ' '

  • WITH_DOCU = ' '

  • DOCUTYPE = 'T'

tables

doma_values = doma_values

  • DOCU_TABLE_USER =

  • DOCU_TABLE_TECH =

EXCEPTIONS

CANCELLED = 1

NOT_EXIST = 2

PERMISSION_ERROR = 3

ILLEGAL_TYPE = 4

OTHERS = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

IF sy-subrc = 0.

COMMIT WORK.

endif.

Is there anything wrong in this code.

Thanks,

srilakshmi.

0 Kudos

it is not a standard domain, it is a custom domain only but i am not supposed to update it directly by editing the domain.

Why are you not supposed to directly edit as it is a custom domain ?

0 Kudos

Hi Srilakshmi,

I have run this code and i was able to update the domain values successfully. The parameter that you need to change would be,

DOMA_INF-VALUEEXIST = 'X'.

In the Import structure, pass this value. Also you need to pass the value for shorttext in the structure. This is the domain short text. if you dont pass this, the domain text will be blank and it will throw an error.

doma_inf-shorttext = 'Domain for testing Purpose'.

Once you pass these two you should be able to update the domain values successfully. For your reference i am ataching the code that i had modified.


DATA DD07V_TAB LIKE DD07V OCCURS 2 WITH HEADER LINE.
DATA DOMA_INF LIKE RPY_DOMA.
DATA DOMA_VALUES LIKE RPY_DVAL OCCURS 2 WITH HEADER LINE.

DOMA_INF-DOMANAME = 'ZTEST_RAM'.
DOMA_INF-LANGUAGE = 'E'.
DOMA_INF-DATATYPE = 'CHAR'.
DOMA_INF-LENGTH = '4'.
DOMA_INF-OUTPUTLEN = '4'.
DOMA_INF-VALUEEXIST = 'X'.   " This is important
DOMA_INF-SHORTTEXT = 'DOMAIN FOR TESTING PURPOSE'. " This is also important.

DOMA_VALUES-DOMANAME = 'ZTEST_RAM'.
DOMA_VALUES-VALPOS = '0001'.
DOMA_VALUES-LANGUAGE = 'E'.
DOMA_VALUES-DDTEXT = 'TEST'.
DOMA_VALUES-DOMVALUE_L = 'RAM'.
APPEND DOMA_VALUES.
CLEAR DOMA_VALUES.

DOMA_VALUES-DOMANAME = 'ZTEST_RAM'.
DOMA_VALUES-VALPOS = '0002'.
DOMA_VALUES-LANGUAGE = 'E'.
DOMA_VALUES-DDTEXT = 'TEST2'.
DOMA_VALUES-DOMVALUE_L = 'TEST'.
APPEND DOMA_VALUES.
CLEAR DOMA_VALUES.

CALL FUNCTION 'RPY_DOMAIN_UPDATE'
  EXPORTING
    ACTIVATION_TYPE        = 'A'
    DOMA_NAME              = 'ZTEST_RAM'
    DOMA_INF               = DOMA_INF
    LANGUAGE               = SY-LANGU
  TABLES
    DOMA_VALUES            = DOMA_VALUES
 EXCEPTIONS
   CANCELLED              = 1
   NOT_EXIST              = 2
   PERMISSION_ERROR       = 3
   ILLEGAL_TYPE           = 4
   OTHERS                 = 5.
IF SY-SUBRC <> 0.
  WRITE:/ SY-MSGNO.
ENDIF.

Best Regards,

Ram.