cancel
Showing results for 
Search instead for 
Did you mean: 

How to update info object attributes using Abap

Former Member
0 Kudos

Hi All,

I have a reqirement to update master data info object's attributes using Abap program. Currently we are in BW 7.3 version. I have tried the following options with no success.

[a] Using internal table.

I have declared an internal table with the exact fields of the info object's P table /BIC/PZ* & then poplated the vales in the internal table.

I have used the regular Abap statement. While updating the internal table I have tried OBJVERS = 'A', OBJVERS = 'M', and OBJVERS =''. as well. But no luck.

update /BIC/PZ* from table it_table.

While debggin the Abap program, post execution of the update statement, I am getting the sy-subrc = 4.

[b] Using the Function Module RSDMD_WRITE_ATTRIBUTES_TEXTS

I have created the internal table to similar to the table /BIC/PZ* & passed the internal table while calling the function module RSDMD_WRITE_ATTRIBUTES_TEXTS with no luck.

CALL FUNCTION 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
  EXPORTING
    I_IOBJNM                        = '<info object name Z*>'
    I_TABCLASS                   = 'M'
*   I_T_ATTR                        =
*  I_S_MINFO                      =
*   I_REQUNR                      =
*   I_DATAPAKID                 =
*   I_MONITORING              =
*   I_CREATE_STATISTICS          = RS_C_TRUE
* IMPORTING
*   E_T_IDOCSTATE                =
*   E_SUBRC                      =
  TABLES
    I_T_TABLE                    = it_table
EXCEPTIONS
   ATTRIBUTE_NAME_ERROR         = 1
   IOBJ_NOT_FOUND                        = 2
   GENERATE_PROGRAM_ERROR = 3
   OTHERS                                         = 4

After executing this function module the master data table is not getting updated.

[c] I have used the function module RSNDI_MD_ATTRIBUTES_UPDATE as mentioned below with no luck

CALL FUNCTION 'RSNDI_MD_ATTRIBUTES_UPDATE'
  EXPORTING
    I_IOBJNM                          = '<info object name z*>'
    I_UPDATE_ALL_ATTRIBUTES           = 'X'
*   I_CLEAR_UNMAPPED_ATTRIBUTES       = RS_C_FALSE
*   I_CHAVL_ENQUEUE                   = RS_C_TRUE
*   I_DB_COMMIT                       = RS_C_FALSE
*   I_COMMIT_WORK                     = RS_C_FALSE
*   I_PROTOCOL                        = RS_C_FALSE
*   I_NO_APPL_LOGGING                 = RS_C_FALSE
*   I_ACTIVATE_MD                     = RS_C_FALSE
* IMPORTING
*   E_SUBRC                           =
  TABLES
*   I_T_ATTRIBUTES                    =
    I_T_DATA                          = it_table
    E_T_MESSAGES                      = .

In all the three options I have mentioned above, I am not sure what is missing.

Can any one check and let me know in the above three options what I did wrong ?. Also, if there is any other funtion module, provide me the sample code.

Thanks in Advance,

Spring

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Please search in SCN, there are a lot of examples how to use the FM correctly.

Just search for  'RSDMD_WRITE_ATTRIBUTES_TEXTS'

 

Regards,

Jürgen

Former Member
0 Kudos

Hi Spring,

It looks like, there is no issue, in calling teh FM. i tried with 'RSDMD_WRITE_ATTRIBUTES_TEXTS' , it works perfectly fine.

I assume there would be soem issue with your it_table. can you paste the logic written to populate the internal table. or you first display the data for your internal table and check whether all the fields populated correctly or not.

Regards,

Sakthi

Former Member
0 Kudos

Hi Sakthi,

Thanks for the response. The internal table is having the same fields that the info object is having.

Here is the simple code to fill the internal table. All the fields in the internal table are defined exactly like the attributes of the info object & so are the local variables as well.

wa_table-employee = l_emloyee.

wa_table-ename  = l_ename.

wa_table-eaddress = l_eaddress.

append it_table from wa_table.

I tried to display the data in the internal table & all the fields are populated correctly. Also, while debugging the program, I am able to see the data being updated into the internal table correctly.

Also, can we use the below abap statement alone to update the info object attributes.

update /BIC/PZ* from table it_table.

Regards,

Spring

Former Member
0 Kudos

Hi Spring,

the update statement not working. But modify statement works fine.

Modify /BIC/PZ* from table it_table.



Regards,

Sakthi

Former Member
0 Kudos

Spring,

Is the ABAP statement updating your master data table?  if that works, then the FM also should work.

also from your post, you got some error message while debugging, so please correct your internal table data and try direct updating the table. if that works, please pass the same to the FM.

Regards,

Sakthi.

Former Member
0 Kudos

Hi Sakthi,

I have tried using the Modify instead of Update statement. However, whle debuggin, the modify statement gave sy-subrc = 0. But values are not added into the table.

Yes, it seems to be a problem with passing the internal table values into the function module. I am getting the dump while executing the function module alone. In the input parameters screen I have provided each field name (attributes starting with BIC/Z*) and its respective values in the I_T_TABLE.

Two internal table are neither compatible not convertble.

Since this is a /BIC/PZ*, I had included the fields OBJVERS, CHANGED in the internal table.

I have passed the values A & M for OBJVERS fields in internal table.

wa_table-employee = l_emloyee.

wa_table-OBJVERS = 'A'.

CHANGED =''.

wa_table-ename  = l_ename.

wa_table-eaddress = l_eaddress.

append it_table from wa_table.

Could you tell me how I should define my internal table or how I should pass values to this function module ?

Regards,

Spring

Former Member
0 Kudos

Hi Spring,

Were you able to fix this?

Plz just try this and check is this making an entry in master data table?

data: it_table type standard table of /BIC/PZEMPLOYEE with header line.

it_table-employee = '10000'.

it_table-OBJVERS = 'A'.

it_table-CHANGED = '' .

it_table-ename  = 'SPRING'.

it_table-eaddress = ''.

append it_table.



CALL FUNCTION 'RSDMD_WRITE_ATTRIBUTES_TEXTS'

   EXPORTING

     i_iobjnm                     = 'ZEMPLOYEE'

     i_tabclass                   = 'M'

*   I_T_ATTR                     =

*   I_S_MINFO                    =

*   I_REQUNR                     =

*   I_DATAPAKID                  =

*   I_MONITORING                 =

*   I_CREATE_STATISTICS          = RS_C_TRUE

* IMPORTING

*   E_T_IDOCSTATE                =

*   E_SUBRC                      =

  tables

    i_t_table                    = it_table.

Regards,

Sakthi

Former Member
0 Kudos

Hi Skthi,

The declaration of the internal asindicated by you had resolved the issue. Now, I am able to add new master data to the infoobject using the FM RSDMD_WRITE_ATTRIBUTES_TEXTS.

However if I try to modify any existing master data record using the same FM, I am able to add the modified record to the /BIC/P* table but not activate it. I have tried to call the function module

RSDDS_AGGREGATES_MAINTAIN but no luck.

Could you check what is missing here  ?

CALL FUNCTION 'RSDDS_AGGREGATES_MAINTAIN'
EXPORTING
   I_T_RANGE_CHABASNM       = 'zemployee'
*   I_T_RANGE_HIEID          =
*   I_PC_VARIANT             =
*   I_DEBUG                  = RS_C_FALSE
*   I_PROT_DETLEVEL          = '1'
*   I_TOLERANCE              = 0
*   I_AGGR_AUTO_REFILL       = RS_C_FALSE
*   I_BIA_DEACTIVATE         = RS_C_FALSE
* IMPORTING
*   E_T_MSG                  =
* EXCEPTIONS
*   INHERITED_ERROR          = 1
*   LOCKED                   = 2
*   RESTART                  = 3
*   OTHERS                   = 4      .
IF SY-SUBRC <> 0.

* Implement suitable error handling here

ENDIF.

Regards,

Spring