Hello everyone,
I'm new to the ABAP language and I'm having some trouble with updating and inserting data in my tables. The problem goes like this :
1) To modify an existing line in my table, I need only to update a text data. So I specify 'T' as tab class in the RSDMD_WRITE_ATTRIBUTES_TEXTS function. The update works fine.
2) To add a new line to my table, I have to deal with both master data and text data. So I have another RSDMD_WRITE_ATTRIBUTES_TEXTS function this time with 'M' as tab class. I have put this function before the one with 'T' as tab class.
My problem is that the add a new line doesn't work. I'd be very grateful if anyone could give me some hint. Thank you very much for your help.
Best Regards,
Dimple
Here's my code :
**********************************************************
**********************************************************
**********************************************************
clear : t_wa_tproginv, t_wa_mproginv, l_wa_mproginv, l_wa_mproginv.
l_form_fields-id = 'ZPROGINV'.
read table gt_form_fields from l_form_fields into l_form_fields.
l_wa_tproginv-/BIC/ZCPROGINV = l_form_fields-frm_val.
l_wa_mproginv-/BIC/ZCPROGINV = l_form_fields-frm_val.
l_form_fields-id = 'ZEXAUTO'.
read table gt_form_fields from l_form_fields into l_form_fields.
l_wa_tproginv-APPR_YEAR = l_form_fields-frm_val.
l_wa_mproginv-APPR_YEAR = l_form_fields-frm_val.
l_wa_mproginv-OBJVERS = 'A'.
l_form_fields-id = 'ZLANGU'.
read table gt_form_fields from l_form_fields into l_form_fields.
l_wa_tproginv-LANGU = l_form_fields-frm_val.
l_form_fields-id = 'ZPROGINV_TC'.
read table gt_form_fields from l_form_fields into l_form_fields.
l_wa_tproginv-TXTSH = l_form_fields-frm_val.
l_form_fields-id = 'ZPROGINV_TL'.
read table gt_form_fields from l_form_fields into l_form_fields.
l_wa_tproginv-TXTLG = l_form_fields-frm_val.
append l_wa_tproginv to t_wa_tproginv.
append l_wa_mproginv to t_wa_mproginv.
call function 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
exporting
i_iobjnm = 'ZCPROGINV'
i_tabclass = 'M'
tables
i_t_table = t_wa_mproginv
exceptions
attribute_name_error = 1
iobj_not_found = 2
generate_program_error = 3
others = 4.
if sy-subrc <> 0.
lt_err_msg-condition = 'rsdmdmzproginv'. read table gt_err_msgs from lt_err_msg into lt_err_msg.
concatenate sy-msgid '/' sy-msgty '/' sy-msgno '/' sy-msgv1 '/' sy-msgv2 '/' sy-msgv2 '/' sy-msgv3 '/' sy-msgv4 into lt_err_msg-message.
page->messages->add_message(
condition = lt_err_msg-condition
message = lt_err_msg-message
severity = lt_err_msg-severity ).
endif.
call function 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
exporting
i_iobjnm = 'ZCPROGINV'
i_tabclass = 'T'
tables
i_t_table = t_wa_tproginv
exceptions
attribute_name_error = 1
iobj_not_found = 2
generate_program_error = 3
others = 4.
if sy-subrc <> 0.
lt_err_msg-condition = 'rsdmdmzproginv'. read table gt_err_msgs from lt_err_msg into lt_err_msg.
concatenate sy-msgid '/' sy-msgty '/' sy-msgno '/' sy-msgv1 '/' sy-msgv2 '/' sy-msgv2 '/' sy-msgv3 '/' sy-msgv4 into lt_err_msg-message.
page->messages->add_message(
condition = lt_err_msg-condition
message = lt_err_msg-message
severity = lt_err_msg-severity ).
endif.
call function 'RSDMD_MD_ACTIVATE'
exporting
i_chabasnm = 'ZCPROGINV'.
call function 'RSDDS_AGGREGATES_MAINTAIN'
exporting
i_protnumber = 'ZCPROGINV'.
if sy-subrc <> 0.
lt_err_msg-condition = 'rsdmdtzproginvchgrun'. read table gt_err_msgs from lt_err_msg into lt_err_msg.
concatenate sy-msgid '/' sy-msgty '/' sy-msgno '/' sy-msgv1 '/' sy-msgv2 '/' sy-msgv2 '/' sy-msgv3 '/' sy-msgv4 into lt_err_msg-message.
page->messages->add_message(
condition = lt_err_msg-condition
message = lt_err_msg-message
severity = lt_err_msg-severity ).
endif.