on 2011 Mar 09 9:47 AM
Hi all,
I have an implementation of the badi BBP_DOC_CHANGE_BADI for Shopping Cart and I want to know when the badi is trigger wich items are new items. i want to do some modifications the fist time the line is added.
The problem is that this badi is only triggered when a line is modified and the table IT_ITEM brings only the modified lines, so I can't know if the line is a new line.
I managed to do it in a way a bit ugly and I wonder if there is a better way. What I have done is create an attribute in my class to store the lines called 'GT_LINEAS' and put the following code:
READ TABLE gt_lineas INTO ls_lineas WITH KEY number_int = wa_items-number_int.
IF sy-subrc NE 0.
MOVE-CORRESPONDING wa_items TO ls_lineas.
APPEND ls_lineas TO gt_lineas. CLEAR ls_lineas.
* Check if exits in DB
SELECT SINGLE number_int INTO ls_lineas-number_int
FROM crmd_orderadm_i
WHERE guid EQ wa_items-guid
AND number_int EQ wa_items-number_int.
IF sy-subrc NE 0.
ADD 10 TO wa_items-deliv_date. "This is the modification I want to do.
MODIFY lt_items FROM wa_items INDEX d_indice.
ENDIF.
ENDIF.
Request clarification before answering.
Hi,
If it is SRM 7 then the below logic will work.
DATA: lo_item TYPE REF TO /sappssrm/if_item,
lo_factory TYPE REF TO /sappssrm/if_instance_factory.
CALL FUNCTION '/SAPPSSRM/BO_BASE_FACTORY'
IMPORTING
eo_factory = lo_factory.
lo_item ?= lo_factory->lookup_srm_guid( <xs_item>-guid ).
IF lo_item IS NOT BOUND . " if it is not bound then it is a new item in the Shopping cart.
" New item
else.
" Existing item int he shopping cart.
endif.
Regards,
Deviprasad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.