on 09-24-2008 4:23 PM
Hello friends,
Question 1,
I am Uptaing the USER attributes for Approval Limit, APPRV_LIM.
I am using the FM - BBP_UPDATE_ATTRIBUTES.
I am confused how would I pass the value and the format. I am passing 100USD, Its Updating but when I see in T-CODE, pposa_bbp, I see some diffrent value being uploaded.
Any Idea as whats the issue and how should I handle this.
Question 2,
I have updated many other attributes, Like Companu Code (BUK) usint the FM - BBP_UPDATE_ATTRIBUTES.
The issue is it Uploaded the new ones from the Text file I had, but the concern is it deleted the existing records. ANy idea as why it deleted the existing and how can I upload the new attributes without deleting the old attributes.
Any Suggestions,
Ster
Any More suggestions pls.
Ster
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Muthu.
But in this case we are using the standard Function Module BBP_UPDATE_ATTRIBUTES. this FM is deleting the old records and inserting the new records.
Do you mean to say this FM wont handle only inserting and not deleting.
Is there any other FM we could use for this purpose.
Thanks,
Ster
Please find the below code,
Thanks for all the suggestions.
and the file format.
orgunitid,companycode,sourcesystem
50000186;2350;TD6510
REPORT zs_srm_BUK.
TABLES: bbp_attributes.
DATA : BEGIN OF t_orgunit OCCURS 0,
orgunit TYPE objec-objid,
END OF t_orgunit.
DATA : l_value TYPE bbp_attributes-value,
l_orgunit TYPE objec-objid,
l_ccode TYPE bbps_om_p5502_exp-co_code,
l_logsys TYPE bbps_om_p5502_exp-backend.
.
DATA : BEGIN OF t_bbp_attributes OCCURS 0,
orgunit TYPE objec-objid,
attr_id TYPE bbp_attributes-attr_id,
logsys TYPE bbps_om_p5502_exp-backend,
value TYPE bbp_attributes-value,
END OF t_bbp_attributes.
DATA : tmp_bbp_attributes LIKE bbp_attributes OCCURS 0 WITH HEADER LINE.
DATA : gv_file TYPE string.
*----------------------------------------------------------------------*
* Parameters
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b_file WITH FRAME TITLE text-001.
PARAMETERS: filename TYPE text255 OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b_file.
SELECTION-SCREEN BEGIN OF BLOCK b_switches WITH FRAME TITLE text-002.
PARAMETERS: testmode AS CHECKBOX DEFAULT 'X'.
PARAMETERS: inheritv AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK b_switches.
***********************************************************************
* At Selection Screen On Value Request
***********************************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
* Call Function Module /SAPDMC/LSM_F4_FRONTEND_FILE
CALL FUNCTION '/SAPDMC/LSM_F4_FRONTEND_FILE'
CHANGING
pathfile = filename
EXCEPTIONS
canceled_by_user = 1
system_error = 2
OTHERS = 3.
IF sy-subrc > 0. "#EC NEEDED
ENDIF.
*=======================================================================
START-OF-SELECTION.
*=======================================================================
PERFORM read_cnt_file.
*=======================================================================
END-OF-SELECTION.
*=======================================================================
PERFORM update.
*======================================================================*
* Form read_cnt_file
*======================================================================*
FORM read_cnt_file .
DATA: lt_file TYPE TABLE OF bbptab WITH HEADER LINE.
gv_file = filename.
* Read data from file
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gv_file
has_field_separator = ';'
header_length = 0
TABLES
data_tab = lt_file
EXCEPTIONS
invalid_type = 1
no_authority = 2
access_denied = 3
bad_data_format = 4
header_not_allowed = 5
separator_not_allowed = 6
OTHERS = 7.
IF sy-subrc <> 0.
ENDIF.
LOOP AT lt_file.
CLEAR : l_orgunit, l_ccode, l_logsys, l_value.
SPLIT lt_file AT ';' INTO l_orgunit
l_ccode
l_logsys.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_ccode
IMPORTING
output = l_ccode.
t_orgunit-orgunit = l_orgunit.
APPEND t_orgunit.
t_bbp_attributes-orgunit = l_orgunit.
t_bbp_attributes-attr_id = 'BUK'.
t_bbp_attributes-logsys = l_logsys.
t_bbp_attributes-value = l_value.
APPEND t_bbp_attributes.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM t_orgunit.
ENDFORM. "read_cnt_file
*&---------------------------------------------------------------------*
*& Form UPDATE
*&---------------------------------------------------------------------*
FORM update .
LOOP AT t_orgunit.
REFRESH : tmp_bbp_attributes.
LOOP AT t_bbp_attributes
WHERE orgunit = t_orgunit-orgunit.
tmp_bbp_attributes-attr_id = t_bbp_attributes-attr_id.
tmp_bbp_attributes-value_logsys = t_bbp_attributes-logsys.
tmp_bbp_attributes-value = t_bbp_attributes-value.
APPEND tmp_bbp_attributes.
ENDLOOP.
CHECK tmp_bbp_attributes[] IS NOT INITIAL.
CLEAR : tmp_bbp_attributes.
CALL FUNCTION 'BBP_UPDATE_ATTRIBUTES'
EXPORTING
orgunit_id_p = t_orgunit-orgunit
replace_p = ' '
TABLES
it_attr_p = tmp_bbp_attributes
EXCEPTIONS
object_id_missed = 1
no_active_plvar = 2
object_not_found = 3
no_attributes = 4
times_invalid = 5
inconsistent_values = 6
update_error = 7
ambiguous_position = 8
OTHERS = 9.
IF sy-subrc = 4 OR sy-subrc = 7.
CALL FUNCTION 'BBP_UPDATE_ATTRIBUTES'
EXPORTING
orgunit_id_p = t_orgunit-orgunit
replace_p = 'X'
TABLES
it_attr_p = tmp_bbp_attributes
EXCEPTIONS
object_id_missed = 1
no_active_plvar = 2
object_not_found = 3
times_invalid = 5
inconsistent_values = 6
update_error = 7
ambiguous_position = 8
OTHERS = 9.
ENDIF.
IF sy-subrc <> 0.
MESSAGE e001(aq_ad_hoc) WITH ' ' 'BBP_UPDATE_ATTRIBUTES'.
* &1 Interner Fehler: &2
ELSE.
WRITE : / 'Records Updated'.
ENDIF.
ENDLOOP.
ENDFORM. " UPDATE
there is a small error in the previous one.
use this.
REPORT zs_srm_buk
TABLES: bbp_attributes.
DATA : BEGIN OF t_orgunit OCCURS 0,
orgunit TYPE objec-objid,
END OF t_orgunit.
DATA : l_value TYPE bbp_attributes-value,
l_orgunit TYPE objec-objid,
l_ccode TYPE bbps_om_p5502_exp-co_code,
l_logsys TYPE bbps_om_p5502_exp-backend.
.
DATA : BEGIN OF t_bbp_attributes OCCURS 0,
orgunit TYPE objec-objid,
attr_id TYPE bbp_attributes-attr_id,
logsys TYPE bbps_om_p5502_exp-backend,
value TYPE bbp_attributes-value,
END OF t_bbp_attributes.
DATA : tmp_bbp_attributes LIKE bbp_attributes OCCURS 0 WITH HEADER LINE.
DATA : gv_file TYPE string.
*----------------------------------------------------------------------*
* Parameters
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b_file WITH FRAME TITLE text-001.
PARAMETERS: filename TYPE text255 OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b_file.
SELECTION-SCREEN BEGIN OF BLOCK b_switches WITH FRAME TITLE text-002.
PARAMETERS: testmode AS CHECKBOX DEFAULT 'X'.
PARAMETERS: inheritv AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK b_switches.
***********************************************************************
* At Selection Screen On Value Request
***********************************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
* Call Function Module /SAPDMC/LSM_F4_FRONTEND_FILE
CALL FUNCTION '/SAPDMC/LSM_F4_FRONTEND_FILE'
CHANGING
pathfile = filename
EXCEPTIONS
canceled_by_user = 1
system_error = 2
OTHERS = 3.
IF sy-subrc > 0. "#EC NEEDED
ENDIF.
*=======================================================================
START-OF-SELECTION.
*=======================================================================
PERFORM read_cnt_file.
*=======================================================================
END-OF-SELECTION.
*=======================================================================
PERFORM update.
*======================================================================*
* Form read_cnt_file
*======================================================================*
FORM read_cnt_file .
DATA: lt_file TYPE TABLE OF bbptab WITH HEADER LINE.
gv_file = filename.
* Read data from file
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gv_file
has_field_separator = ';'
header_length = 0
TABLES
data_tab = lt_file
EXCEPTIONS
invalid_type = 1
no_authority = 2
access_denied = 3
bad_data_format = 4
header_not_allowed = 5
separator_not_allowed = 6
OTHERS = 7.
IF sy-subrc <> 0.
ENDIF.
LOOP AT lt_file.
CLEAR : l_orgunit, l_ccode, l_logsys, l_value.
SPLIT lt_file AT ';' INTO l_orgunit
l_ccode
l_logsys.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_ccode
IMPORTING
output = l_ccode.
t_orgunit-orgunit = l_orgunit.
APPEND t_orgunit.
* CONCATENATE l_loc l_desc l_logsys l_plant
* INTO l_value RESPECTING BLANKS.
l_value = l_ccode.
t_bbp_attributes-orgunit = l_orgunit.
t_bbp_attributes-attr_id = 'BUK'.
t_bbp_attributes-logsys = l_logsys.
t_bbp_attributes-value = l_value.
APPEND t_bbp_attributes.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM t_orgunit.
ENDFORM. "read_cnt_file
*&---------------------------------------------------------------------*
*& Form UPDATE
*&---------------------------------------------------------------------*
FORM update .
LOOP AT t_orgunit.
REFRESH : tmp_bbp_attributes.
LOOP AT t_bbp_attributes
WHERE orgunit = t_orgunit-orgunit.
tmp_bbp_attributes-attr_id = t_bbp_attributes-attr_id.
tmp_bbp_attributes-value_logsys = t_bbp_attributes-logsys.
tmp_bbp_attributes-value = t_bbp_attributes-value.
APPEND tmp_bbp_attributes.
ENDLOOP.
CHECK tmp_bbp_attributes[] IS NOT INITIAL.
CLEAR : tmp_bbp_attributes.
CALL FUNCTION 'BBP_UPDATE_ATTRIBUTES'
EXPORTING
orgunit_id_p = t_orgunit-orgunit
replace_p = ' '
TABLES
it_attr_p = tmp_bbp_attributes
EXCEPTIONS
object_id_missed = 1
no_active_plvar = 2
object_not_found = 3
no_attributes = 4
times_invalid = 5
inconsistent_values = 6
update_error = 7
ambiguous_position = 8
OTHERS = 9.
IF sy-subrc = 4 OR sy-subrc = 7.
CALL FUNCTION 'BBP_UPDATE_ATTRIBUTES'
EXPORTING
orgunit_id_p = t_orgunit-orgunit
replace_p = 'X'
TABLES
it_attr_p = tmp_bbp_attributes
EXCEPTIONS
object_id_missed = 1
no_active_plvar = 2
object_not_found = 3
times_invalid = 5
inconsistent_values = 6
update_error = 7
ambiguous_position = 8
OTHERS = 9.
ENDIF.
IF sy-subrc <> 0.
MESSAGE e001(aq_ad_hoc) WITH ' ' 'BBP_UPDATE_ATTRIBUTES'.
* &1 Interner Fehler: &2
ELSE.
WRITE : / 'Records Updated'.
ENDIF.
ENDLOOP.
ENDFORM. " UPDATE
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.