cancel
Showing results for 
Search instead for 
Did you mean: 

Item Level Approval..

Former Member
0 Kudos
302

Hi,

Can you please tell me <b>is there any BAdi avaliable for ITEM LEVEL SHOPPING CART APPROVAL</b>? If is kindly give me an overview about that please

Thanks,

Kannan.

View Entire Topic
Former Member
0 Kudos

Durai,

Just to let you knowto every contribution that answers your question...you should be assigning points to it.I can see that you have not assigned points to anybodyJay,Vadim,Christophe and others have been extremely helpful.

The least you can do is award them the points appropriately.

Thats the motivation-and one needs to respect their time and suggestions by assigning points to them.

Hope you understand my point.

Thanks

Priya

Former Member
0 Kudos

Hi Priya,

No, i gave points to all priya. i don't know how did you came to know i don't give. no priya. i gave.

this is very good form. as a beginner i got lot of ideas with help like you.

if you find any think wrong from my side , please let me know , i'll correct that.

if you find i don't give points for any body please friend let me know , i'll do that.

request,

please friends answer my coming questions. that will help me very lot.

thanks,

durai.

Former Member
0 Kudos

Hi Durai,

You should read what Priya has mentioned. Thanke Priya.

Ok, coming to your question, I am not sure you looked at the BADI Sample Code, Here is that, i had put my remarks in there with my name Jay where you should focus.

METHOD if_ex_bbp_wfl_approv_badi~get_remaing_approvers.

  • This a default implementation that gives idea about of how line item

  • approval should work

DATA:

ls_header TYPE bbp_pds_sc_header_d,

  • tables for different approval criteria

lv_call_crit1 TYPE bbp_wfl_app_criterion,

lv_call_value1 TYPE bbp_wfl_app_property,

  • local help variables

lv_guid TYPE crmt_object_guid,

  • item fields and structures

ls_item TYPE bbp_pds_sc_item_d,

lt_item TYPE TABLE OF bbp_pds_sc_item_d,

  • accounting structures

ls_account TYPE bbp_pds_acc,

lt_account TYPE TABLE OF bbp_pds_acc.

DATA: ls_approver TYPE bbp_wfl_approval_table_badi.

  • Business objects (local)

CONSTANTS:

c_po TYPE crmt_subobject_category_db VALUE 'BUS2201',

c_shop TYPE crmt_subobject_category_db VALUE 'BUS2121',

c_contract TYPE crmt_subobject_category_db VALUE 'BUS2000113'.

.

  • Approval Criteria and properties used (local)

CONSTANTS:

c_cost_centre TYPE bbp_wfl_app_criterion VALUE 'COST_CTR',

c_prod_categ TYPE bbp_wfl_app_criterion VALUE 'PROD_CAT'.

CASE object_type.

WHEN c_shop.

  • ----------- shopping cart ---------------------------------- *

      • get the details of the shopping cart

CALL FUNCTION 'BBP_PD_SC_GETDETAIL'

EXPORTING

i_object_id = object_id

  • I_WITH_ITEMDATA = 'X'

IMPORTING

e_header = ls_header

  • EV_IS_PD =

  • ET_ATTACH =

TABLES

e_item = lt_item

e_account = lt_account

  • E_PARTNER =

  • E_ORGDATA =

  • E_TAX =

  • E_PRIDOC =

.

  • Jay - you decide here that what approval it should start first.

First Level Approval.

In this case, they are starting with approval based on cost center in SC Line items.

Values in changing parameters will decide which item to go to which approver based the cost center the approvers are responsible for.

  • 1st approval step executed for indices 1 and 0

IF actual_approval_index LE 1.

                                              • First approval step (cost center based)

LOOP AT lt_item INTO ls_item WHERE del_ind IS INITIAL.

      • We consider only items, which are not deleted (del_ind = 'X')

      • Found out to which cost center this item belongs

READ TABLE lt_account INTO ls_account

WITH KEY p_guid = ls_item-guid.

IF sy-subrc = 4.

MOVE 'OTHERS' TO lv_call_value1.

ELSE.

MOVE ls_account-cost_ctr TO lv_call_value1.

ENDIF.

      • Call your own customers function to found the approver of this item

      • based on your own customizing table/RFC.

      • The function BBP_WFL_DIN_ITEM_APPROVAL_GET is only an example

      • for implementing this.

CALL FUNCTION 'BBP_WFL_DIN_ITEM_APPROVAL_GET'

EXPORTING

sc_guid = ls_header-guid

item_guid = ls_item-guid

approval_index = '1'

approval_description = 'Cost center approval'

      • each cost center approver should see only items he is responsible

hide_items_not_responsible = 'X'

criterion1 = c_cost_centre

value1 = lv_call_value1

  • CRITERION2 = ''

  • CRITERION3 = ''

  • VALUE2 = ''

  • VALUE3 = ''

CHANGING

approval_table = approval_table

item_approval_table = item_approval_table

item_approval_obj = item_approval_obj

.

ENDLOOP.

ENDIF.

  • Jay - you decide here that what should be second level approval.

In this case, they are following the approval based on product category in SC Line items.

Values in changing parameters will decide which item to go to which approver based on the product category the approvers are responsible for.

        • 2. approval step executed for indices 2,1 and 0

IF actual_approval_index LE 2.

IF ls_header-total_value GE 510000000.

LOOP AT lt_item INTO ls_item WHERE del_ind IS INITIAL.

      • We consider only items, which are not deleted (del_ind = 'X')

      • Set the product category

MOVE ls_item-category_id TO lv_call_value1.

      • Call your own customers function to found the approver of this item

      • based on your own customizing table/RFC.

      • The function BBP_WFL_DIN_ITEM_APPROVAL_GET is only an example

      • for implementing this.

CALL FUNCTION 'BBP_WFL_DIN_ITEM_APPROVAL_GET'

EXPORTING

sc_guid = ls_header-guid

item_guid = ls_item-guid

approval_index = '2'

approval_description = 'Product approval'

      • each product category approver should see all items

hide_items_not_responsible = ''

criterion1 = c_prod_categ

value1 = lv_call_value1

  • CRITERION2 = ''

  • CRITERION3 = ''

  • VALUE2 = ''

  • VALUE3 = ''

CHANGING

approval_table = approval_table

item_approval_table = item_approval_table

item_approval_obj = item_approval_obj

.

ENDLOOP.

ELSEIF actual_approval_index EQ 2.

      • don't process 2nd step if shopping cart value is less than 510000000

no_further_approval_needed = 'X'.

ENDIF. " value more than 510000000

ENDIF.

  • now fill the approval_table

IF actual_approval_index GE 3.

  • this BADI-implementation defines 2 steps

no_further_approval_needed = 'X'.

ELSE.

IF approval_table[] IS INITIAL.

  • if no approver found because send sc to default administrator

ls_approver-approval_index = actual_approval_index.

      • the agent is 'US' + user

ls_approver-approval_agent = 'USADMNIN1'.

ls_approver-name = 'Peter Admin'.

APPEND ls_approver TO approval_administrators.

ENDIF.

ENDIF.

ENDCASE.

ENDMETHOD.

Pls keep im mind that you will one or more or no approvers in every level. It could be parallel or sequential. SAP delivers standard workflow definition for both parallel or sequential.

In your case, you do not need first level approval. So, You do not need the codes involved for first level. Use the code involved for second level.

Again, it is sample code, pls treat this is a pseduo to drive your logic.

Good Luck.

Regards,

Jay

Former Member
0 Kudos

Hi Jay,

<b>sorry to ask, you mean i don't give points for your past great suggestions? please let me know jay, because i gave points to all, that is why.</b>

ok let us come to topic.

jay.

as your sample coding i need to go through from step 2, ok , i'll do that, but before i go through that please give me your ideas about below one.

<b>*** Call your own customers function to found the approver of this item

      • based on your own customizing table/RFC.</b>

      • The function BBP_WFL_DIN_ITEM_APPROVAL_GET is only an example

      • for implementing this.

CALL FUNCTION 'BBP_WFL_DIN_ITEM_APPROVAL_GET'

EXPORTING

sc_guid = ls_header-guid

item_guid = ls_item-guid

approval_index = '2'

approval_description = 'Product approval'

      • each product category approver should see all items

hide_items_not_responsible = ''

criterion1 = c_prod_categ

value1 = lv_call_value1

  • CRITERION2 = ''

  • CRITERION3 = ''

  • VALUE2 = ''

  • VALUE3 = ''

CHANGING

approval_table = approval_table

item_approval_table = item_approval_table

item_approval_obj = item_approval_obj

endloop.

<b>i hope you can see bold letters above, what is that mean, do i need to write coding in that block.</b>

<b>say for example i have a 'z' custom table which is having PRODUCT CATEGORY,APPROVAL ID , NAME AND ETC..

my scenario is based on the product category workitem should send for approval.

take this above scenario and explain me how should my coding please. if you need any thing please let me know i'll explain my scenario breifly.</b>

please jay,

thanks,

durai.

Former Member
0 Kudos

Hi,

sorry, This is kavin not durai. by mistake i did ,

Mr . Durai. don't take into account. sorry Durai.

Thanks,

kavin.

Former Member
0 Kudos

Hi,

hey Kavin Kumar what happened , you use my name , did you forgot your name?..

it's ok. but don't use my name please.

Friends,

please give me the soluction for my last post.

waiting for your answer.

thanks,

Durai.