2015 Jan 16 3:12 PM
Hi gurus,
I'm trying to use the following function to update the business partners classification.
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
objectkey = wa_objectkey
objecttable = 'JGVGPKLASS'
classnum = 'CLIENTI'
classtype = '071'
* STATUS = '1'
* STANDARDCLASS =
* CHANGENUMBER =
* KEYDATE = SY-DATUM
* NO_DEFAULT_VALUES = ' '
* IMPORTING
* CLASSIF_STATUS =
TABLES
allocvaluesnumnew = gt_allocnum
allocvaluescharnew = gt_allocchar
allocvaluescurrnew = gt_alloccurr
return = gt_return.
As a result I can add a characteristic to an existing classification, but I can not change a value for a characteristic already present in that classification.
I can not even delete a characteristic for that classification.
Can you give me directions about?
Thanks in advance.
Alessio
Hi gurus,
I'm trying to use the following function to update the business partners classification.
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
objectkey = wa_objectkey
objecttable = 'JGVGPKLASS'
classnum = 'CLIENTI'
classtype = '071'
* STATUS = '1'
* STANDARDCLASS =
* CHANGENUMBER =
* KEYDATE = SY-DATUM
* NO_DEFAULT_VALUES = ' '
* IMPORTING
* CLASSIF_STATUS =
TABLES
allocvaluesnumnew = gt_allocnum
allocvaluescharnew = gt_allocchar
allocvaluescurrnew = gt_alloccurr
return = gt_return.
As a result I can add a characteristic to an existing classification, but I can not change a value for a characteristic already present in that classification.
I can not even delete a characteristic for that classification.
Can you give me directions about?
Thanks in advance.
Alessio
2015 Jan 16 3:58 PM
2015 Jan 18 11:24 PM
Hi Alessio,
You cant delete the characteristic from class but you can reset the characteristic value to initials value using change BAPI.
Regards,
Sudeesh Soni
2015 Jan 19 9:04 AM
Thanks Sudeesh Soni,
could you give me more info about reset the characteristic value to initials value using change BAPI?
Now, passing to a characteristic the initial value, do not get any change.
deleting the record of the feature to reset, I do not get the desired result.
Checking in debug the BAPI_OBJCL_CHANGE I see that the table " l_api_val_r_del" is empty.
Reagards,
Alessio
2015 Jan 19 9:18 AM
2015 Jan 19 9:27 AM
Hi Raymond,
I try
passing characteristics with the new values, if exploited.
2015 Jan 19 9:28 AM
2015 Jan 19 9:28 AM
2015 Jan 19 9:36 AM
... so for deleting I have to call BAPI_OBJCL_DELETE with the characteristics to delete?
Regards
Alessio
2015 Jan 19 9:49 AM
2015 Jan 19 10:04 AM
Thanks Raymond,
but in BAPI_OBJCL_DELETE ,how do I clear the value of a single characteristic and leave unchanged the other?
In BAPI_OBJCL_CHANGE there are the tables :
ALLOCVALUESNUMNEW
ALLOCVALUESCHARNEW
ALLOCVALUESCURRNEW
In BAPI_OBJCL_DELETE we delete all the characteristics, Is this right?
Regards,
Alessio
2015 Jan 19 11:05 AM
Hi Alessio,
Pls refer belowmentioned logic steps.
1. Get the BP class details using BAPI-BAPI_OBJCL_GETDETAIL.
2. In debug, You can check in which below mentioned tables your required characteristic field exist.
ALLOCVALUESNUMNEW
ALLOCVALUESCHARNEW
ALLOCVALUESCURRNEW
3. Read the identified internal table with key CHARACT and store the data into workarea. Also, store the table index SY-TABIX into local variable.
4. Change the Workarea required field with desired value.Further, modify the step-3 identified internal table with new workarea data using INDEX = SY-TABIX.
5. Call the BAPI-BAPI_OBJCL_CHANGE and pass all above mentioned internal tables with modified value(ALLOCVALUESNUMNEW, ALLOCVALUESCHARNEW, ALLOCVALUESCURRNEW)
Why you want to delete the characteristic? I think best option is to reset the characteristic value to initial value using above mentioned logic.
Regards,
Sudeesh Soni
2015 Jan 19 11:51 AM
Thanks Sudeesh Soni,
I'm using the logic steps that you mentioned.
I supposed to delete the characteristic because if I reset the characteristic value to initial value I do not get any change !
After the commit I see the old characteristic value.
But the logic work right changing the characteristic value with another one different from initial (' ').
Also work right adding a value to a characteristic that were initial.
Where can I go wrong?
Regards
Alessio
2015 Jan 19 11:22 AM
Thanks Sudeesh Soni,
I'm using the logic steps that you mentioned.
I supposed to delete the characteristic because if I reset the characteristic value to initial value I do not get any change !
After the commit I see the old characteristic value.
But the logic work right changing the characteristic value with another one different from initial (' ').
Also work right adding a value to a characteristic that were initial.
Where can I go wrong?
Regards
Alessio
2015 Jan 19 1:27 PM
Hi Alessio,
Can you pls copy/paste the code logic?
Regards,
Sudeesh Soni
2015 Jan 19 1:39 PM
LOOP AT gt_class.
READ TABLE char_struc INTO wa_char_struc WITH KEY name_char = gt_class-rcdin.
IF wa_char_struc-data_type = 'CURR'.
READ TABLE gt_alloccurr INTO wa_alloccurr WITH KEY charact = gt_class-rcdin.
if sy-subrc = 0.
wa_alloccurr-charact = wa_char_struc-name_char.
CLEAR lv_rinal.
WRITE gt_class-rinal TO lv_rinal DECIMALS 0.
REPLACE '.' WITH ' ' INTO lv_rinal.
REPLACE ',' WITH ' ' INTO lv_rinal.
CONDENSE gt_class-rinal NO-GAPS.
wa_alloccurr-value_from = lv_rinal.
wa_alloccurr-currency_from = 'EUR'.
wa_alloccurr-value_relation = '1'.
wa_alloccurr-currency_from_iso = 'EUR'.
* If NOT gt_class-rinal is INITIAL.
MODIFY gt_alloccurr FROM wa_alloccurr INDEX sy-tabix TRANSPORTING value_from currency_from value_relation currency_from_iso.
* else.
* DELETE gt_alloccurr WHERE charact = wa_alloccurr-charact.
* endif.
endif.
ELSEIF wa_char_struc-data_type = 'CHAR'.
READ TABLE gt_allocchar INTO wa_allocchar WITH KEY charact = gt_class-rcdin.
if sy-subrc = 0.
wa_allocchar-charact = wa_char_struc-name_char.
wa_allocchar-value_char = gt_class-rinal.
wa_allocchar-value_neutral = gt_class-rinal.
* If NOT gt_class-rinal is INITIAL.
MODIFY gt_allocchar FROM wa_allocchar INDEX sy-tabix TRANSPORTING value_char value_neutral.
* else.
* DELETE gt_allocchar WHERE charact = wa_allocchar-charact.
* endif.
endif.
ELSEIF wa_char_struc-data_type = 'NUM'.
READ TABLE gt_allocnum INTO wa_allocnum WITH KEY charact = gt_class-rcdin.
if sy-subrc = 0.
wa_allocnum-charact = wa_char_struc-name_char.
wa_allocnum-value_from = gt_class-rinal.
wa_allocnum-unit_from = 'VIS'.
wa_allocnum-value_relation = '1'.
wa_allocnum-unit_from_iso = 'ANZ'.
* If NOT gt_class-rinal is INITIAL.
MODIFY gt_allocnum FROM wa_allocnum INDEX sy-tabix TRANSPORTING value_from unit_from value_relation unit_from_iso.
* else.
* DELETE gt_allocnum WHERE charact = wa_allocnum-charact.
* endif.
endif.
ENDIF.
ENDLOOP.
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
objectkey = wa_objectkey
objecttable = 'JGVGPKLASS'
classnum = 'CLIENTI'
classtype = '071'
STATUS = '1'
* STANDARDCLASS =
* CHANGENUMBER =
* KEYDATE = SY-DATUM
* NO_DEFAULT_VALUES = ' '
* IMPORTING
* CLASSIF_STATUS =
TABLES
allocvaluesnumnew = gt_allocnum
allocvaluescharnew = gt_allocchar
allocvaluescurrnew = gt_alloccurr
return = gt_return.
2015 Jan 19 1:43 PM
this code is before the code over...
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
objectkey = wa_objectkey
objecttable = 'BUT001'
classnum = 'CLIENTI'
classtype = '071'
keydate = sy-datum
language = sy-langu
TABLES
allocvaluesnum = gt_allocnum
allocvalueschar = gt_allocchar
allocvaluescurr = gt_alloccurr
return = gt_return.
.
CALL FUNCTION 'BAPI_CLASS_GET_CHARACTERISTICS'
EXPORTING
classnum = 'CLIENTI'
classtype = '071'
* LANGU_ISO =
* LANGU_INT =
* KEY_DATE = SY-DATUM
* WITH_VALUES = 'X'
IMPORTING
return = bapi_ret
TABLES
characteristics = char_struc
char_values = char_val.
In gt_class we have all the characteristcs about the class.
You can se the line with * about the "delete" logic.
Thanks.
Alessio
2015 Jan 20 8:04 AM
Hi gurus!
Performing additional tests, I noticed that the problem is limited to the characteristics of type CHAR.
With types CURR and NUM passing the empty value, the value of the characteristic is cleaned.
Could you tell me how to deal with the characteristics of type char , to clean up the value?
Regards Alessio
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |