<br><font size=2 face="sans-serif">Hi Arghadip,</font>
<br>
<br><font size=2 face="sans-serif">it's been a while I've dealt with the
SRM BADI workflows but two hints:</font>
<br>
<br><font size=2 face="sans-serif">1) </font>
<br>
<br><font size=2 face="sans-serif">Upgrade to the latest support package,
the SRM BADI workflows have been pretty buggy in the beginning...</font>
<br>
<br><font size=2 face="sans-serif">2)</font>
<br>
<br><font size=2 face="sans-serif">I've forgotten the actual notes, but
search OSS for the workflow numbers and the wfl_approve_badi, there are
several notes that give a detailed explanation on the usage of the BADI
in different scenarios.</font>
<br><font size=2 face="sans-serif">The ACTUAL_APPROVAL_INDEX holds the
current index of the approval hierarchy, it is filled automatically by
the system. The APPROVAL_INDEX field in the BADI tables represent the approval
hierarchy. How to fill them depends on your scenario - it might be sufficient
to statically insert 1 - Manager A, 2 - Manager B etc. In other scenarios
you'll have to count them up everytime - so 1,2,3 becomes 4,5,6 and so
on.</font>
<br><font size=2 face="sans-serif">Look up the OSS Notes and start with
a simple solution based on the examples in the notes. It is a good idea
to start with a fixed hard coded hierarchy until you get familiar with
how it works, and then insert your actual approval determination step by
step, this way you can rule out errors caused by a faulty coding to determine
the approvers.</font>
<br>
<br>
<br><font size=2 face="sans-serif">kind regards,</font>
<br><font size=2 face="sans-serif">Veit </font>
<br>
<br>
<br><font size=2 face="sans-serif"><br>
</font><font size=2 color=#0080ff face="Arial"><br>
-- </font><font size=2 color=#b2b2b2 face="Arial"><br>
Dipl. WiInf. Veit Unger <br>
- </font><font size=2 color=blue face="Arial"><u><br>
</u></font><a href=mailto:veit.unger@de.ibm.com><font size=2 color=#0080ff face="Arial"><u>veit.unger@de.ibm.com
</u></font></a><font size=2 color=#b2b2b2 face="Arial"><br>
Telefon: +(49) 170 914 7650 <br>
- </font>
<table width=100%>
<tr>
<td width=100%><a href=http://www.sercon.de/><font size=2 color=#0080ff face="Arial"><u>SerCon
GmbH</u></font></a><font size=3> </font><font size=2 color=#b2b2b2 face="Arial"><br>
Nahmitzer Damm 12 - 12277 Berlin . Germany <br>
c/o IBM Deutschland GmbH <br>
IBM Global Business Services </font></table>
<br>
<br><font size=1 color=#b2b2b2 face="Arial">SerCon Service-Konzepte für
Informations-Systeme GmbH<br>
Geschäftsführung: Jörg Schimetzek, Bernhard Settele<br>
Sitz der Gesellschaft: Ehningen<br>
Registergericht: Amtsgericht Stuttgart, HRB 243109<br>
<br>
</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>arghadip kar &lt;arghadipkar@yahoo.com&gt;</b>
</font>
<br><font size=1 face="sans-serif">Sent by: sap-wug-bounces@mit.edu</font>
<p><font size=1 face="sans-serif">19.04.2007 15:18</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
&quot;SAP Workflow Users' Group&quot; &lt;sap-wug@mit.edu&gt;</font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">sap-wug@mit.edu</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">SRM Workflow WS14500015 not working
properly</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=3>Hi All</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; &nbsp;I am having an issue with WS14500015
SRM Workflow. The Badi has been implemented but it is retrieving only the
First level for a particular Line item of a Shopping Cart. In other words
it is not taking care of the Next approval level. The Workflow is getting
completed though it requires further approval. Can you please tell me how
this parameter ACTUAL_APPROVAL_INDEX should be taken care of. Is this parmeter
used to pass the Approval Index of the Workflow for a particular Line Item.
Can you explain me this thing with what value the parameter &nbsp;ACTUAL_APPROVAL_INDEX
&nbsp;needs to be filled. I am attaching my code. If possible please review.</font>
<br><font size=3>************************************************************************<br>
* PROGRAM ID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : IF_EX_BBP_WFL_APPROV_BADI~GET_REMAING_APPROVERS<br>
* PROGRAM TITLE &nbsp; &nbsp; &nbsp; &nbsp;: Method : GET_RENAMING_APPROVERS
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br>
* AUTHOR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Dharmendra
Kumar &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; *<br>
* SUPPLIER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : IBM &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br>
* DATE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 17/06/2007
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br>
* PHASE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:<br>
* DEVELOPMENT ID &nbsp; &nbsp; &nbsp; : DHAK &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br>
* CHANGE REQUEST (CTS) : &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br>
* DESCRIPTION &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: THIS METHOD PERFOMS THE
ACTION OF FINDING THE*<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;NUMBER OF APPROVAL LEVELS REQUIRED FOR AN &nbsp; &nbsp;*<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;LINE ITEM IN A SC AND ITS CORROSPONDING &nbsp; &nbsp; &nbsp;*<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;APPROVERS.<br>
*-----------------------------------------------------------------------<br>
METHOD if_ex_bbp_wfl_approv_badi~get_remaing_approvers .<br>
* --------------------------------------------------------------------
*<br>
* Interface parameters:<br>
* --------------------------------------------------------------------
*<br>
* OBJECT_ID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TYPE
&nbsp;CRMT_OBJECT_ID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;Import<br>
* OBJECT_TYPE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TYPE
&nbsp;CRMT_SUBOBJECT_CATEGORY &nbsp; &nbsp; &nbsp; &quot;Import<br>
* GUID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; TYPE &nbsp;BBP_GUID_32 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &quot;Import<br>
* ACTUAL_APPROVAL_INDEX &nbsp; &nbsp; &nbsp;TYPE &nbsp;SWH_NUMC10 &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;Import<br>
* APPROVAL_HISTORY_TABLE &nbsp; &nbsp; TYPE &nbsp;BBP_WFL_APPROVAL_HISTORY_BADI
&quot;Import<br>
* ITEM_APPROVAL_HISTORY_TABLE TYPE BBPT_WFL_ITEM_APPROVAL_BADI &nbsp; &quot;Import<br>
* APPROVAL_TABLE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TYPE &nbsp;BBPT_WFL_APPROVAL_TABLE_BADI
&nbsp;&quot;Export<br>
* ITEM_APPROVAL_TABLE &nbsp; &nbsp; &nbsp; &nbsp;TYPE &nbsp;BBPT_WFL_ITEM_APPROVAL_BADI
&nbsp; &quot;Export<br>
* NO_FURTHER_APPROVAL_NEEDED TYPE &nbsp;BOOLEAN &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Export<br>
* ITEM_APPROVAL_OBJ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TYPE &nbsp;BBPT_WFL_ITEM_APPROVAL_OBJ
&nbsp;&quot;Changing<br>
* --------------------------------------------------------------------
*</font>
<br><font size=3>* This a default implementation that gives idea about
of how line item<br>
* approval should work as well to find the number of approval required<br>
* and to find the approvers.</font>
<br><font size=3>* Global data---------------------------------------------------------*<br>
* TYPES---------------------------------------------------------------*<br>
 &nbsp;TYPES : BEGIN OF ty_account.<br>
 &nbsp;INCLUDE TYPE bbp_pds_acc.<br>
 &nbsp;TYPES: &nbsp;app_crit_name &nbsp;TYPE bbp_wfl_app_criterion,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;app_crit_value TYPE char32.<br>
 &nbsp;TYPES: &nbsp;END OF ty_account.</font>
<br><font size=3>&nbsp; TYPES :<br>
 &nbsp; &nbsp; &nbsp;BEGIN OF ty_item_copy,<br>
 &nbsp; &nbsp; &nbsp; app_crit_value1 TYPE bbp_wfl_app_property,<br>
 &nbsp; &nbsp; &nbsp;END OF ty_item_copy.</font>
<br><font size=3>&nbsp; TYPES : ty_item_info &nbsp; &nbsp;TYPE STANDARD
TABLE OF zrp2p0bgst001,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ty_account_copy TYPE STANDARD TABLE
OF ty_account.</font>
<br><font size=3>* FIELD-SYMBOLS-------------------------------------------------------*<br>
 &nbsp;FIELD-SYMBOLS :<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;l_fs_account&gt; &nbsp; &nbsp;TYPE
ty_account.</font>
<br><font size=3>* DATA----------------------------------------------------------------*<br>
 &nbsp;DATA : it_item_info TYPE ty_item_info,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; wa_item_info TYPE zrp2p0bgst001.</font>
<br><font size=3>&nbsp; DATA : v_tabix &nbsp; &nbsp; &nbsp; &nbsp; TYPE
sytabix,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; v_num_apprv &nbsp; &nbsp; TYPE swh_numc10
VALUE '0',<br>
 &nbsp; &nbsp; &nbsp; &nbsp; v_value_per_con TYPE bbp_value &nbsp;VALUE
'0',<br>
 &nbsp; &nbsp; &nbsp; &nbsp; v_value_per &nbsp; &nbsp; TYPE bbp_value.<br>
 &nbsp;DATA : v_temp_value TYPE bbp_value &nbsp; VALUE '0',<br>
 &nbsp; &nbsp; &nbsp; &nbsp; v_temp_level TYPE swh_numc10 &nbsp;VALUE '0'.<br>
 &nbsp;DATA: &nbsp;v_call_crit1 &nbsp; &nbsp; TYPE bbp_wfl_app_criterion,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; v_call_value1 &nbsp; &nbsp;TYPE bbp_wfl_app_property,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; v_co_code &nbsp; &nbsp; &nbsp; &nbsp;TYPE
bbp_wfl_app_property,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; v_plant_value &nbsp; &nbsp;TYPE bbp_wfl_app_property,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; v_account_type &nbsp; TYPE bbp_wfl_app_criterion
,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; v_comp_code &nbsp; &nbsp; &nbsp;TYPE bbp_wfl_app_criterion
,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; v_plant &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TYPE
bbp_wfl_app_criterion ,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; v_acc_desc &nbsp; &nbsp; &nbsp; TYPE bbp_step_description
.</font>
<br><font size=3>&nbsp; DATA: &nbsp; v_guid &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; TYPE crmt_object_guid.</font>
<br><font size=3>* WORKAREA------------------------------------------------------------*<br>
 &nbsp;DATA: &nbsp;wa_header &nbsp; &nbsp; &nbsp; &nbsp; TYPE bbp_pds_sc_header_d,<br>
* tables and work area.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; it_item &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
TYPE TABLE OF bbp_pds_sc_item_d,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; wa_item &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
TYPE bbp_pds_sc_item_d,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; it_item_copy &nbsp; &nbsp; &nbsp;TYPE TABLE
OF bbp_pds_sc_item_d,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; wa_item_copy &nbsp; &nbsp; &nbsp;TYPE bbp_pds_sc_item_d,<br>
* accounting structures<br>
 &nbsp; &nbsp; &nbsp; &nbsp; it_account &nbsp; &nbsp; &nbsp; &nbsp;TYPE
TABLE OF bbp_pds_acc,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; wa_account &nbsp; &nbsp; &nbsp; &nbsp;TYPE
bbp_pds_acc,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; wa_account_copy &nbsp; TYPE ty_account,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; wa_approver &nbsp; &nbsp; &nbsp; TYPE bbp_wfl_approval_table_badi.</font>
<br><font size=3>* CONSTANTS-----------------------------------------------------------*<br>
* Business objects<br>
 &nbsp;CONSTANTS:<br>
 &nbsp; c_po &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TYPE crmt_subobject_category_db
VALUE 'BUS2201',<br>
 &nbsp; c_shop &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TYPE crmt_subobject_category_db
VALUE 'BUS2121',<br>
 &nbsp; c_contract &nbsp; &nbsp; &nbsp;TYPE crmt_subobject_category_db
VALUE 'BUS2000113'.</font>
<br><font size=3>* Approval Criteria and properties used<br>
 &nbsp;CONSTANTS:<br>
 &nbsp; &nbsp;c_cost_centre &nbsp;TYPE bbp_wfl_app_criterion &nbsp;VALUE
'COST_CTR',<br>
 &nbsp; &nbsp;c_prod_categ &nbsp; TYPE bbp_wfl_app_criterion &nbsp;VALUE
'PROD_CAT'.</font>
<br><font size=3>* Case when the object type bus212...---------------------------------*</font>
<br><font size=3>&nbsp; CASE object_type.</font>
<br><font size=3>&nbsp; &nbsp; WHEN c_shop.<br>
* ----------- &nbsp; shopping cart ---------------------------------------
*<br>
* &nbsp; &nbsp; Get the details of the shopping cart<br>
 &nbsp; &nbsp; &nbsp;CALL FUNCTION 'BBP_PD_SC_GETDETAIL'<br>
 &nbsp; &nbsp; &nbsp; &nbsp;EXPORTING<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;i_object_id = object_id<br>
 &nbsp; &nbsp; &nbsp; &nbsp;IMPORTING<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e_header &nbsp; &nbsp;= wa_header<br>
 &nbsp; &nbsp; &nbsp; &nbsp;TABLES<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e_item &nbsp; &nbsp; &nbsp;= it_item<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e_account &nbsp; = it_account.</font>
<br><font size=3>* &nbsp; &nbsp; Proceed if it_item is not initial.<br>
 &nbsp; &nbsp; &nbsp;IF NOT it_item IS INITIAL.<br>
* &nbsp; &nbsp; &nbsp; Keep the copy the it_item into it_item_copy<br>
* &nbsp; &nbsp; &nbsp; and keep the unique be_plant.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;it_item_copy[] = it_item[].<br>
 &nbsp; &nbsp; &nbsp; &nbsp;SORT it_item_copy BY be_plant.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;DELETE ADJACENT DUPLICATES FROM it_item_copy<br>
 &nbsp; &nbsp; &nbsp; &nbsp;COMPARING be_plant.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; &nbsp; SELECT &nbsp;mandt<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zplant<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zcost_ctr<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zorder_no<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zasset_no<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zlevel<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zvalue<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zapprover<br>
 &nbsp; &nbsp; &nbsp; &nbsp;FROM zrp2p0bgst001<br>
 &nbsp; &nbsp; &nbsp; &nbsp;INTO TABLE it_item_info<br>
 &nbsp; &nbsp; &nbsp; &nbsp;FOR ALL ENTRIES IN it_item<br>
 &nbsp; &nbsp; &nbsp; &nbsp;WHERE<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zplant = it_item-be_plant.<br>
* &nbsp; &nbsp; &nbsp; No sy-subrc check is required as this method is
called only<br>
* &nbsp; &nbsp; &nbsp; if the table contains some value such checks done
before this.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;SORT it_item_info BY zplant zcost_ctr<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zorder_no zasset_no zlevel
zvalue.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; &nbsp; SORT it_item BY guid.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;SORT it_account BY p_guid.</font>
<br><font size=3>* &nbsp; &nbsp; &nbsp; looping at it_item is done to fetch
the approver for every<br>
* &nbsp; &nbsp; &nbsp; line item<br>
 &nbsp; &nbsp; &nbsp; &nbsp;LOOP AT it_item INTO wa_item WHERE del_ind
IS INITIAL.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;READ TABLE it_account INTO wa_account<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WITH KEY p_guid = wa_item-guid.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IF sy-subrc = 0.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_tabix = sy-tabix.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; looping is done at every account so that
every approver is<br>
* &nbsp; &nbsp; &nbsp; &nbsp; found for every acc corresponding to each
line item.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LOOP AT it_account &nbsp;INTO
wa_account FROM v_tabix.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IF wa_account-p_guid &lt;&gt;
wa_item-guid.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;EXIT.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ELSE.<br>
* Comments for process -----------------------------------------------*<br>
* &nbsp;CALCULATING THE VALUE PER COST CENTER /INTERNAL ORDER OR ASSET.<br>
* &nbsp;ALONG WITH ,CALCULATING THE VALUE THE AMT NEED TO BE CONVERTED<br>
* &nbsp;IN USD AS THE VALUES ARE MAINTAINED IN USD.<br>
* &nbsp;SO FUNCTION MODULE IS CALLED TO CONVERT THE WA_ITEM-CURRENCY<br>
* &nbsp;INTO USD USING CONVERT_TO_LOCAL_CURRENCY.<br>
*---------------------------------------------------------------------*<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_value_per_con = wa_account-distr_perc
* wa_item-value / 100.</font>
<br><font size=3>* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CALL
FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;EXPORTING<br>
** &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CLIENT &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= SY-MANDT<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;date
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
sy-datum<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;foreign_amount
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= v_value_per_con<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;foreign_currency
&nbsp; &nbsp; &nbsp; &nbsp;= wa_item-currency<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local_currency
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 'USD'<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; type_of_rate
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 'M'<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; read_tcurr
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 'X'<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IMPORTING<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; local_amount
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= v_value_per<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EXCEPTIONS<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; no_rate_found
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 1<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; overflow
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 2<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; no_factors_found
&nbsp; &nbsp; &nbsp; &nbsp;= 3<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; no_spread_found
&nbsp; &nbsp; &nbsp; &nbsp; = 4<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; derived_2_times
&nbsp; &nbsp; &nbsp; &nbsp; = 5<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OTHERS
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 6<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp;.<br>
** if error occurs system generated message is displayed.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IF sy-subrc &lt;&gt;
0.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MESSAGE
ID sy-msgid TYPE sy-msgty NUMBER sy-msgno<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp;WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ENDIF.<br>
*--------------------------------------------------------------------*<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_value_per = v_value_per_con.<br>
*--------------------------------------------------------------------*</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
READ TABLE it_item_info INTO wa_item_info WITH KEY<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; zplant &nbsp; &nbsp;= wa_item-be_plant<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; zcost_ctr = wa_account-cost_ctr<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; zorder_no = wa_account-order_no<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; zasset_no = wa_account-asset_no.</font>
<br><font size=3>* Comment on logic----------------------------------------------------*<br>
* AS THE TABLE ZRP2P0BGST001, ONLY ONE OUT OF COST CENTER,<br>
* INTERNAL ORDER AND ASSET NUMBER<br>
* WILL BE FILLED AND REST WILL BE EMPTY, CORRSOPONDING TO COMPANY CODE,<br>
* SO ABOVE WILL FETCH FIRST RECORD AS THE it_ITEM_INFO IS SORTED.<br>
* FIRST RECORD WITH THE REQUIRED VALUE IS READ.<br>
*---------------------------------------------------------------------*<br>
*--------------------------------------------------------------------*<br>
* begin of modification.--<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IF sy-subrc =
0.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_temp_value
= wa_item_info-zvalue.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_temp_level
= wa_item_info-zlevel.<br>
*<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IF v_value_per
&lt; v_temp_value.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_num_apprv
= -1. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot; NO APPROVER REQUIRED.<br>
*<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ELSE.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LOOP
AT it_item_info INTO wa_item_info<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;WHERE<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zplant &nbsp; &nbsp;= wa_item-be_plant
&nbsp; &nbsp; &nbsp;AND<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zcost_ctr = wa_account-cost_ctr &nbsp;
AND<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zorder_no = wa_account-order_no &nbsp;
AND<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zasset_no = wa_account-asset_no .<br>
*<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;IF wa_item_info-zvalue &nbsp;GE v_value_per<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;AND v_value_per GT v_temp_value &nbsp;.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;v_num_apprv &nbsp;= &nbsp;v_temp_level.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;EXIT.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;ELSE.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;v_temp_value = wa_item_info-zvalue.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;v_temp_level = wa_item_info-zlevel.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;ENDIF.<br>
*<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ENDLOOP.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ENDIF.<br>
*<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IF v_num_apprv
IS INITIAL.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_num_apprv
= v_temp_level.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ENDIF.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ELSE.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CLEAR:
&nbsp;v_temp_value,v_temp_level.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ENDIF.<br>
* end of modification.--<br>
*--------------------------------------------------------------------*<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; As the v_num_apprv is
assigned some value other than 0.<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and for all values v_num_apprv
&lt;&gt; -1 it shud proceed.<br>
*-begin of modification ++-------------------------------------------*<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_num_apprv = actual_approval_index
.<br>
*-end of modification ++-------------------------------------------*</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
IF v_num_apprv &lt;&gt; -1.<br>
* Comment on logic----------------------------------------------------*<br>
* NOW THE NUMBER OF APPROVER IS KNOWN SO THE APPROVER IS<br>
* FOUND USING THE RFC AND THE CUSTOM TABLE ZRP2P0BGST001 IS UPDATED<br>
* WITH LATEST APPROVERS.<br>
*---------------------------------------------------------------------*<br>
* To Find out Account id of what type ie cost center/IO/Asset.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; IF NOT wa_account-cost_ctr IS INITIAL.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_call_value1
= wa_account-cost_ctr.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_account_type
= 'COST_CTR'.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_acc_desc
&nbsp;= 'Cost center approval'.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ENDIF.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IF NOT wa_account-order_no
IS INITIAL.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_call_value1
= wa_account-order_no.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_account_type
= 'ORDER_NO'.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_acc_desc
&nbsp;= 'Internal Order approval'.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ENDIF.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IF NOT wa_account-asset_no
IS INITIAL.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_call_value1
= wa_account-asset_no.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_account_type
= 'ASSET_NO'.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_acc_desc
&nbsp;= 'Asset Number approval'.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_comp_code
= 'COMPANY_CODE'.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_co_code
&nbsp; = wa_item-be_co_code.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ENDIF.</font>
<br><font size=3>* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
Defining the PLANT and plant value.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_plant
= 'PLANT'.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;v_plant_value
= wa_item-be_plant.</font>
<br><font size=3>* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
Calling the Custom function to find the approvers.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CALL FUNCTION
'ZBBP_WFL_DIN_ITEM_APPROVAL_GET'<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;EXPORTING<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;sc_guid &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;= wa_header-guid<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;item_guid &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;= wa_item-guid<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;approval_description &nbsp; &nbsp; &nbsp; = v_acc_desc<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;hide_items_not_responsible = 'X'<br>
* each cost center approver should see only items he is responsible<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;criterion1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
= v_account_type<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;criterion2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
= v_comp_code<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;criterion3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
= v_plant<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;value1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; = v_call_value1<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;value2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; = v_co_code<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;value3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; = v_plant_value<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;approval_index &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = v_num_apprv<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CHANGING<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;approval_table &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = approval_table<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;item_approval_table &nbsp; &nbsp; &nbsp; &nbsp;= item_approval_table<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;item_approval_obj &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= item_approval_obj.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
ENDIF.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ENDIF.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CLEAR wa_account.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ENDLOOP.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ENDIF.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;ENDLOOP.<br>
* &nbsp; &nbsp; &nbsp; Once done clear the wa_approver<br>
 &nbsp; &nbsp; &nbsp; &nbsp;CLEAR: wa_approver , wa_account,wa_item, wa_item_info.<br>
 &nbsp; &nbsp; &nbsp;ENDIF.<br>
 &nbsp;ENDCASE.<br>
*--------------------------------------------------------------------*<br>
* temporary change adding &nbsp;one more line to apprv table.<br>
 &nbsp;IF approval_table IS INITIAL.<br>
 &nbsp; &nbsp;no_further_approval_needed = 'X'.<br>
 &nbsp;ENDIF.</font>
<br><font size=3>* &nbsp;DATA:<br>
* &nbsp; &nbsp; &nbsp;l_wa_approval_table &nbsp; &nbsp; &nbsp;TYPE bbp_wfl_approval_table_badi.<br>
*<br>
* &nbsp;READ TABLE approval_table INTO l_wa_approval_table INDEX &nbsp;1.<br>
* &nbsp;l_wa_approval_table-approval_agent = 'USARGK'.<br>
* &nbsp;l_wa_approval_table-approval_index = '0000000003'.<br>
* &nbsp;APPEND l_wa_approval_table TO approval_table.<br>
*--------------------------------------------------------------------*</font>
<br><font size=3>ENDMETHOD.</font>
<br><font size=3>&nbsp;</font>
<br><font size=3>&nbsp;</font>
<br><font size=3>&nbsp;</font>
<br><font size=3>&nbsp;</font>
<br><font size=3>&nbsp;</font>
<br><font size=3>&nbsp;</font>
<br><font size=3>***********************************************************************<br>
* PROGRAM ID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : ZBBP_WFL_DIN_ITEM_APPROVAL_GET
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br>
* PROGRAM TITLE &nbsp; &nbsp; &nbsp; &nbsp;: Fucntion module to find the
approvers &nbsp; &nbsp; &nbsp; &nbsp;*<br>
* AUTHOR &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Dharmendra
Kumar &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; *<br>
* SUPPLIER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : IBM &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br>
* DATE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 16/04/2007
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br>
* PHASE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: BGS<br>
* DEVELOPMENT ID &nbsp; &nbsp; &nbsp; : DHAK &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br>
* CHANGE REQUEST (CTS) : &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br>
* DESCRIPTION &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: THE PURPOSE OF THIS FUNCTION
IS TO FIND THE &nbsp;*<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;APPROVERS RESPECTIVE ACCOUTNS FOR THE SC LINE*<br>
* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;ITEMS. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
*<br>
*-----------------------------------------------------------------------<br>
FUNCTION zbbp_wfl_din_item_approval_get.<br>
*&quot;----------------------------------------------------------------------<br>
*&quot;*&quot;Local Interface:<br>
*&quot; &nbsp;IMPORTING<br>
*&quot; &nbsp; &nbsp; VALUE(SC_GUID) TYPE &nbsp;BBP_GUID<br>
*&quot; &nbsp; &nbsp; VALUE(ITEM_GUID) TYPE &nbsp;BBP_GUID<br>
*&quot; &nbsp; &nbsp; VALUE(APPROVAL_DESCRIPTION) TYPE &nbsp;BBP_STEP_DESCRIPTION
OPTIONAL<br>
*&quot; &nbsp; &nbsp; VALUE(HIDE_ITEMS_NOT_RESPONSIBLE) TYPE &nbsp;BOOLEAN
OPTIONAL<br>
*&quot; &nbsp; &nbsp; VALUE(CRITERION1) TYPE &nbsp;BBP_WFL_APP_CRITERION<br>
*&quot; &nbsp; &nbsp; VALUE(CRITERION2) TYPE &nbsp;BBP_WFL_APP_CRITERION
DEFAULT ''<br>
*&quot; &nbsp; &nbsp; VALUE(CRITERION3) TYPE &nbsp;BBP_WFL_APP_CRITERION
DEFAULT ''<br>
*&quot; &nbsp; &nbsp; VALUE(VALUE1) TYPE &nbsp;BBP_WFL_APP_PROPERTY DEFAULT
''<br>
*&quot; &nbsp; &nbsp; VALUE(VALUE2) TYPE &nbsp;BBP_WFL_APP_PROPERTY DEFAULT
''<br>
*&quot; &nbsp; &nbsp; VALUE(VALUE3) TYPE &nbsp;BBP_WFL_APP_PROPERTY DEFAULT
''<br>
*&quot; &nbsp; &nbsp; VALUE(APPROVAL_INDEX) TYPE &nbsp;SWH_NUMC10<br>
*&quot; &nbsp;CHANGING<br>
*&quot; &nbsp; &nbsp; REFERENCE(APPROVAL_TABLE) TYPE &nbsp;BBPT_WFL_APPROVAL_TABLE_BADI<br>
*&quot; &nbsp; &nbsp; REFERENCE(ITEM_APPROVAL_TABLE) TYPE &nbsp;BBPT_WFL_ITEM_APPROVAL_BADI<br>
*&quot; &nbsp; &nbsp; REFERENCE(ITEM_APPROVAL_OBJ) TYPE &nbsp;BBPT_WFL_ITEM_APPROVAL_OBJ<br>
*&quot; &nbsp; &nbsp; &nbsp; OPTIONAL<br>
*&quot;----------------------------------------------------------------------<br>
* Local data-----------------------------------------------------------*</font>
<br><font size=3>&nbsp; TYPES: ty_option TYPE STANDARD TABLE OF rfc_db_opt,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; ty_fields TYPE STANDARD TABLE OF rfc_db_fld,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; ty_data &nbsp; TYPE STANDARD TABLE OF tab512.</font>
<br><font size=3>&nbsp; DATA:<br>
 &nbsp; &nbsp;l_wa_approval_table &nbsp; &nbsp; &nbsp;TYPE bbp_wfl_approval_table_badi,<br>
 &nbsp; &nbsp;l_wa_item_approval_table TYPE bbps_wfl_item_approval,<br>
 &nbsp; &nbsp;l_wa_approval_def &nbsp; &nbsp; &nbsp; &nbsp;TYPE zrp2p0bgst001.</font>
<br><font size=3>&nbsp; DATA:<br>
 &nbsp; &nbsp;l_v_app_obj_guid &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TYPE
bbp_guid_32,<br>
 &nbsp; &nbsp;l_v_is_new_approval_object TYPE boolean.</font>
<br><font size=3>&nbsp; DATA : l_it_update_tab &nbsp; TYPE STANDARD TABLE
OF zrp2p0bgst001,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; l_it_approval_def TYPE STANDARD TABLE OF zrp2p0bgst001,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; l_wa_update_tab &nbsp; TYPE zrp2p0bgst001.</font>
<br><font size=3>&nbsp; DATA : l_it_actor_tab &nbsp; &nbsp;TYPE STANDARD
TABLE OF swhactor,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; l_wa_actor_tab &nbsp; &nbsp;TYPE swhactor,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; l_it_ac_container TYPE STANDARD TABLE OF swcont,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; l_wa_ac_container TYPE swcont.</font>
<br><font size=3>&nbsp; DATA : l_it_options TYPE ty_option,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; l_it_fields &nbsp;TYPE ty_fields,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; l_it_data &nbsp; &nbsp;TYPE ty_data.</font>
<br><font size=3>&nbsp; DATA : l_wa_options TYPE &nbsp;rfc_db_opt,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; l_wa_fields &nbsp;TYPE &nbsp;rfc_db_fld,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; l_wa_data &nbsp; &nbsp;TYPE &nbsp;tab512.</font>
<br><font size=3>&nbsp; DATA : l_v_apprv_asset TYPE usnam,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; l_v_apprv_cc &nbsp; &nbsp;TYPE verak.</font>
<br><font size=3>&nbsp; DATA : l_v_cost_ctr TYPE &nbsp;bbp_wfl_app_property
VALUE '',<br>
 &nbsp; &nbsp; &nbsp; &nbsp; l_v_order_no TYPE &nbsp;bbp_wfl_app_property
VALUE '',<br>
 &nbsp; &nbsp; &nbsp; &nbsp; l_v_asset_no TYPE &nbsp;bbp_wfl_app_property
VALUE ''.</font>
<br><font size=3>&nbsp; DATA : l_v_query_table TYPE dd02l-tabname.<br>
 &nbsp;DATA : l_apprv_count &nbsp; TYPE char1 VALUE '0'.</font>
<br><font size=3>* Constants-----------------------------------------------------------*<br>
 &nbsp;CONSTANTS:<br>
 &nbsp; &nbsp;l_c_agent_is_user TYPE otype VALUE 'US'.</font>
<br><font size=3>* Comment on login ---------------------------------------------------*<br>
* First find the right approval object the item belongs to.<br>
* All items of an approval object are approved together in<br>
* this approval step, and therefore only one workitem is<br>
* created for this items.<br>
*---------------------------------------------------------------------*<br>
 &nbsp;CALL FUNCTION 'BBP_WFL_DIN_APP_OBJ_GET'<br>
 &nbsp; &nbsp;EXPORTING<br>
 &nbsp; &nbsp; &nbsp;sc_guid &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; = sc_guid<br>
 &nbsp; &nbsp; &nbsp;criterion1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;= criterion1<br>
* &nbsp; CRITERION2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= ''<br>
* &nbsp; CRITERION3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= ''<br>
 &nbsp; &nbsp; &nbsp;value1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;= value1<br>
* &nbsp; VALUE2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;= ''<br>
* &nbsp; VALUE3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;= ''<br>
 &nbsp; IMPORTING<br>
* &nbsp;If 2 items of the same shopping cart have the same<br>
* &nbsp;values for the criterias, this function returns the<br>
* &nbsp;same (!!!) approval object guid<br>
 &nbsp; &nbsp; approval_obj_guid &nbsp; &nbsp; &nbsp; = l_v_app_obj_guid<br>
 &nbsp; &nbsp;TABLES<br>
 &nbsp; &nbsp; item_app_obj &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
item_approval_obj<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<br>
* Check what type of account is ie Order no/Internal order/ASSET.<br>
 &nbsp;IF criterion1 = 'ORDER_NO'.<br>
 &nbsp; &nbsp;l_v_order_no = value1.<br>
 &nbsp; &nbsp;CONCATENATE 'AUFNR' '=' value1 INTO l_wa_options-text<br>
 &nbsp; &nbsp;SEPARATED BY space.<br>
 &nbsp; &nbsp;APPEND l_wa_options TO l_it_options.</font>
<br><font size=3>&nbsp; &nbsp; l_wa_fields-fieldname = 'AUFNR'.<br>
 &nbsp; &nbsp;l_wa_fields-length &nbsp; &nbsp;= '000012'.<br>
 &nbsp; &nbsp;l_wa_fields-offset &nbsp; &nbsp;= '000000'.<br>
 &nbsp; &nbsp;l_wa_fields-type &nbsp; &nbsp; &nbsp;= 'C'.<br>
 &nbsp; &nbsp;APPEND l_wa_fields TO l_it_fields.</font>
<br><font size=3>&nbsp; &nbsp; l_wa_fields-fieldname = 'KOSTV'.<br>
 &nbsp; &nbsp;l_wa_fields-length &nbsp; &nbsp;= '000010'.<br>
 &nbsp; &nbsp;l_wa_fields-offset &nbsp; &nbsp;= '000000'.<br>
 &nbsp; &nbsp;l_wa_fields-type &nbsp; &nbsp; &nbsp;= 'C'.<br>
 &nbsp; &nbsp;APPEND l_wa_fields TO l_it_fields.</font>
<br><font size=3>&nbsp; &nbsp; CALL FUNCTION 'RFC_READ_TABLE' DESTINATION
'E10CLNT121'<br>
 &nbsp; &nbsp; &nbsp;EXPORTING<br>
 &nbsp; &nbsp; &nbsp; &nbsp;query_table &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
'COAS'<br>
 &nbsp; &nbsp; &nbsp; &nbsp;delimiter &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;= '|'<br>
 &nbsp; &nbsp; &nbsp;TABLES<br>
 &nbsp; &nbsp; &nbsp; &nbsp;OPTIONS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;= l_it_options<br>
 &nbsp; &nbsp; &nbsp; &nbsp;fields &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; = l_it_fields<br>
 &nbsp; &nbsp; &nbsp; &nbsp;data &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; = l_it_data<br>
 &nbsp; &nbsp; &nbsp;EXCEPTIONS<br>
 &nbsp; &nbsp; &nbsp; &nbsp;table_not_available &nbsp;= 1<br>
 &nbsp; &nbsp; &nbsp; &nbsp;table_without_data &nbsp; = 2<br>
 &nbsp; &nbsp; &nbsp; &nbsp;option_not_valid &nbsp; &nbsp; = 3<br>
 &nbsp; &nbsp; &nbsp; &nbsp;field_not_valid &nbsp; &nbsp; &nbsp;= 4<br>
 &nbsp; &nbsp; &nbsp; &nbsp;not_authorized &nbsp; &nbsp; &nbsp; = 5<br>
 &nbsp; &nbsp; &nbsp; &nbsp;data_buffer_exceeded = 6<br>
 &nbsp; &nbsp; &nbsp; &nbsp;OTHERS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; = 7.</font>
<br><font size=3>&nbsp; &nbsp; IF sy-subrc = 0.</font>
<br><font size=3>* &nbsp; &nbsp; as l_it_data table contains only one record<br>
* &nbsp; &nbsp; so no sorting required.<br>
 &nbsp; &nbsp; &nbsp;READ TABLE l_it_data INTO l_wa_data INDEX 1.<br>
 &nbsp; &nbsp; &nbsp;value1 = l_wa_data-wa+12(10).</font>
<br><font size=3>&nbsp; &nbsp; ENDIF.<br>
* &nbsp; at the end of this if internal order is passed its responsible<br>
* &nbsp; cost obtained and is placed in value1 field.</font>
<br><font size=3>&nbsp; &nbsp; CLEAR : l_wa_data , l_wa_options , l_wa_fields
,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;l_it_data , l_it_options , l_it_fields
.<br>
 &nbsp;ENDIF.</font>
<br><font size=3>* RFC to read table for finding the person responsible
for the<br>
* cost center / asset ie approver.<br>
 &nbsp;CASE criterion1 .</font>
<br><font size=3>&nbsp; &nbsp; WHEN 'COST_CTR' OR 'ORDER_NO'.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; IF criterion1 = 'COST_CTR'.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;l_v_cost_ctr = value1.<br>
 &nbsp; &nbsp; &nbsp;ENDIF.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; CONCATENATE 'KOSTL' '=' value1 INTO
l_wa_options-text<br>
 &nbsp; &nbsp; &nbsp;SEPARATED BY space.<br>
 &nbsp; &nbsp; &nbsp;APPEND l_wa_options TO l_it_options.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; l_wa_fields-fieldname = 'VERAK'.<br>
 &nbsp; &nbsp; &nbsp;l_wa_fields-length &nbsp; &nbsp;= '000020'.<br>
 &nbsp; &nbsp; &nbsp;l_wa_fields-offset &nbsp; &nbsp;= '000000'.<br>
 &nbsp; &nbsp; &nbsp;l_wa_fields-type &nbsp; &nbsp; &nbsp;= 'C'.<br>
 &nbsp; &nbsp; &nbsp;APPEND l_wa_fields TO l_it_fields.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; l_wa_fields-fieldname = 'KOSTL'.<br>
 &nbsp; &nbsp; &nbsp;l_wa_fields-length &nbsp; &nbsp;= '000010'.<br>
 &nbsp; &nbsp; &nbsp;l_wa_fields-offset &nbsp; &nbsp;= '000000'.<br>
 &nbsp; &nbsp; &nbsp;l_wa_fields-type &nbsp; &nbsp; &nbsp;= 'C'.<br>
 &nbsp; &nbsp; &nbsp;APPEND l_wa_fields TO l_it_fields.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; l_v_query_table = 'CSKS'.</font>
<br><font size=3>&nbsp; &nbsp; WHEN 'ASSET_NO' &nbsp; &nbsp; &nbsp;.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; l_v_asset_no = value1.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; CONCATENATE 'ANLN1' '=' value1 'AND'
'BUKRS' '=' value2 INTO<br>
 &nbsp; &nbsp; &nbsp;l_wa_options-text SEPARATED BY space.<br>
 &nbsp; &nbsp; &nbsp;APPEND l_wa_options TO l_it_options.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; l_wa_fields-fieldname = 'XV0NM'.<br>
 &nbsp; &nbsp; &nbsp;l_wa_fields-length &nbsp; &nbsp;= '000012'.<br>
 &nbsp; &nbsp; &nbsp;l_wa_fields-offset &nbsp; &nbsp;= '000000'.<br>
 &nbsp; &nbsp; &nbsp;l_wa_fields-type &nbsp; &nbsp; &nbsp;= 'C'.<br>
 &nbsp; &nbsp; &nbsp;APPEND l_wa_fields TO l_it_fields.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; l_wa_fields-fieldname = 'ANLN1'.<br>
 &nbsp; &nbsp; &nbsp;l_wa_fields-length &nbsp; &nbsp;= '000012'.<br>
 &nbsp; &nbsp; &nbsp;l_wa_fields-offset &nbsp; &nbsp;= '000000'.<br>
 &nbsp; &nbsp; &nbsp;l_wa_fields-type &nbsp; &nbsp; &nbsp;= 'C'.<br>
 &nbsp; &nbsp; &nbsp;APPEND l_wa_fields TO l_it_fields.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; l_wa_fields-fieldname = 'BUKRS'.<br>
 &nbsp; &nbsp; &nbsp;l_wa_fields-length &nbsp; &nbsp;= '000004'.<br>
 &nbsp; &nbsp; &nbsp;l_wa_fields-offset &nbsp; &nbsp;= '000000'.<br>
 &nbsp; &nbsp; &nbsp;l_wa_fields-type &nbsp; &nbsp; &nbsp;= 'C'.<br>
 &nbsp; &nbsp; &nbsp;APPEND l_wa_fields TO l_it_fields.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; l_v_query_table = 'ANLX'.</font>
<br><font size=3>&nbsp; ENDCASE.</font>
<br><font size=3>* select all the record friom zrp2p0bgst001...<br>
* based on above plant and cost_ctr/io/asset.<br>
 &nbsp;SELECT * FROM zrp2p0bgst001<br>
 &nbsp;INTO TABLE l_it_update_tab<br>
 &nbsp;WHERE<br>
 &nbsp; &nbsp; &nbsp;zplant = value3 &nbsp; &nbsp;AND<br>
 &nbsp; &nbsp; &nbsp;zcost_ctr = l_v_cost_ctr AND<br>
 &nbsp; &nbsp; &nbsp;zorder_no = l_v_order_no AND<br>
 &nbsp; &nbsp; &nbsp;zasset_no = l_v_asset_no.</font>
<br><font size=3>&nbsp; IF sy-subrc = 0.<br>
 &nbsp; &nbsp;SORT l_it_update_tab BY zplant zcost_ctr<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zorder_no zasset_no zlevel zvalue.</font>
<br><font size=3>* &nbsp; now prepare the workarea for updating the table
zrp2p0bgst001.<br>
 &nbsp; &nbsp;READ TABLE l_it_update_tab INTO l_wa_approval_def WITH<br>
 &nbsp; &nbsp;KEY zplant &nbsp; &nbsp;= value3<br>
 &nbsp; &nbsp; &nbsp; &nbsp;zcost_ctr = l_v_cost_ctr<br>
 &nbsp; &nbsp; &nbsp; &nbsp;zorder_no = l_v_order_no<br>
 &nbsp; &nbsp; &nbsp; &nbsp;zasset_no = l_v_asset_no<br>
 &nbsp; &nbsp; &nbsp; &nbsp;zlevel &nbsp; &nbsp;= 1 &nbsp;.<br>
* &nbsp; sy-subrc check not required as the function module is caled<br>
* &nbsp; only when the table contains the value and as such abvoe<br>
* &nbsp; sy-subrc is true so below will fetch atleast one record.</font>
<br><font size=3>&nbsp; ENDIF.</font>
<br><font size=3>&nbsp; CALL FUNCTION 'RFC_READ_TABLE' DESTINATION 'E10CLNT121'<br>
 &nbsp; &nbsp;EXPORTING<br>
 &nbsp; &nbsp; &nbsp;query_table &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= l_v_query_table<br>
 &nbsp; &nbsp; &nbsp;delimiter &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
'|'<br>
 &nbsp; &nbsp;TABLES<br>
 &nbsp; &nbsp; &nbsp;OPTIONS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;= l_it_options<br>
 &nbsp; &nbsp; &nbsp;fields &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
= l_it_fields<br>
 &nbsp; &nbsp; &nbsp;data &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; = l_it_data<br>
 &nbsp; &nbsp;EXCEPTIONS<br>
 &nbsp; &nbsp; &nbsp;table_not_available &nbsp;= 1<br>
 &nbsp; &nbsp; &nbsp;table_without_data &nbsp; = 2<br>
 &nbsp; &nbsp; &nbsp;option_not_valid &nbsp; &nbsp; = 3<br>
 &nbsp; &nbsp; &nbsp;field_not_valid &nbsp; &nbsp; &nbsp;= 4<br>
 &nbsp; &nbsp; &nbsp;not_authorized &nbsp; &nbsp; &nbsp; = 5<br>
 &nbsp; &nbsp; &nbsp;data_buffer_exceeded = 6<br>
 &nbsp; &nbsp; &nbsp;OTHERS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
= 7.</font>
<br><font size=3>&nbsp; IF sy-subrc = 0.<br>
 &nbsp; &nbsp;READ TABLE l_it_data INTO l_wa_data INDEX 1.<br>
 &nbsp; &nbsp;IF l_v_query_table = 'CSKS'.<br>
 &nbsp; &nbsp; &nbsp;l_v_apprv_cc = l_wa_data-wa+0(20).<br>
 &nbsp; &nbsp; &nbsp;l_wa_approval_def-zapprover = l_v_apprv_cc.<br>
 &nbsp; &nbsp;ENDIF.<br>
 &nbsp; &nbsp;IF l_v_query_table = 'ANLX'.<br>
 &nbsp; &nbsp; &nbsp;l_v_apprv_asset = l_wa_data-wa+0(12).<br>
 &nbsp; &nbsp; &nbsp;l_wa_approval_def-zapprover = l_v_apprv_asset.<br>
 &nbsp; &nbsp;ENDIF.<br>
 &nbsp;ENDIF.<br>
**********************************************************************<br>
*--BEGING OF CHANGE MAJOR ONE.------------------------------------*<br>
**********************************************************************<br>
* &nbsp;IF ( approval_index = 0 or approval_index = 1. ).</font>
<br><font size=3>* this will pick max three records as per the requirement<br>
 &nbsp;DO 3 TIMES. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;&quot; begin of do.<br>
 &nbsp; &nbsp;l_apprv_count = l_apprv_count + 1.<br>
 &nbsp; &nbsp;l_wa_approval_def-zlevel &nbsp; &nbsp;= l_apprv_count .<br>
* &nbsp; if the count is more than one then next level of approver<br>
* &nbsp; is found using the rfc call swx_get_manager and stored as per.<br>
 &nbsp; &nbsp;IF l_apprv_count &gt; 1.<br>
 &nbsp; &nbsp; &nbsp;l_apprv_count = l_apprv_count - 1.<br>
 &nbsp; &nbsp; &nbsp;READ TABLE l_it_update_tab INTO l_wa_update_tab<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WITH KEY zlevel = l_apprv_count .<br>
 &nbsp; &nbsp; &nbsp;IF sy-subrc = 0 .<br>
* Comment &nbsp;on login ------------------------------------------------*<br>
* NOW FOR FINDING THE SECOND LEVEL OF APPROVER<br>
* 1ST LEVEL OF APPROVER IS FOUND USING ABOVE READ.<br>
* THE FIRST LEVEL OF APPROVER IS USED TO FIND THE SECOND<br>
* LEVEL OF APPROVER USING THE SWX_GET_MANAGER.<br>
* PREPARE THE TABLES FOR SWX_GET_MANAGER<br>
*-------------------------------------------------------------------*<br>
 &nbsp; &nbsp; &nbsp; &nbsp;REFRESH : l_it_ac_container.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;l_wa_ac_container-element = 'ORG_OBJECT'.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;l_wa_ac_container-tab_index = '000001'.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;l_wa_ac_container-elemlength = '006'.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;l_wa_ac_container-type &nbsp; &nbsp; &nbsp;
= 'C'.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;CONCATENATE l_c_agent_is_user l_wa_update_tab-zapprover<br>
 &nbsp; &nbsp; &nbsp; &nbsp;INTO l_wa_ac_container-value .<br>
 &nbsp; &nbsp; &nbsp; &nbsp;APPEND l_wa_ac_container TO l_it_ac_container.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; &nbsp; CALL FUNCTION 'SWX_GET_MANAGER'
DESTINATION 'E10CLNT121'<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TABLES<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;actor_tab &nbsp; &nbsp;= l_it_actor_tab<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ac_container = l_it_ac_container<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;EXCEPTIONS<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nobody_found = 1<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OTHERS &nbsp; &nbsp; &nbsp; =
2.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;IF sy-subrc = 0.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;READ TABLE l_it_actor_tab INTO l_wa_actor_tab
WITH KEY<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; otype = l_c_agent_is_user.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;l_wa_approval_def-zapprover = l_wa_actor_tab-objid.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;ENDIF.<br>
 &nbsp; &nbsp; &nbsp;ENDIF.<br>
 &nbsp; &nbsp; &nbsp;l_apprv_count = l_apprv_count + 1.<br>
 &nbsp; &nbsp;ENDIF.<br>
* &nbsp; before updating populate the table l_it_approval_def<br>
* &nbsp; l_it_update_tab is read based on next l_apprv_count and<br>
* &nbsp; updates the approver and its value.<br>
 &nbsp; &nbsp;READ TABLE l_it_update_tab INTO l_wa_update_tab<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WITH KEY zlevel = l_apprv_count .<br>
 &nbsp; &nbsp;IF sy-subrc = 0.<br>
 &nbsp; &nbsp; &nbsp;l_wa_approval_def-zplant = l_wa_update_tab-zplant.<br>
 &nbsp; &nbsp; &nbsp;l_wa_approval_def-zcost_ctr = l_wa_update_tab-zcost_ctr.<br>
 &nbsp; &nbsp; &nbsp;l_wa_approval_def-zorder_no = l_wa_update_tab-zorder_no.<br>
 &nbsp; &nbsp; &nbsp;l_wa_approval_def-zasset_no = l_wa_update_tab-zorder_no.<br>
 &nbsp; &nbsp; &nbsp;l_wa_approval_def-zvalue = l_wa_update_tab-zvalue.<br>
 &nbsp; &nbsp; &nbsp;APPEND l_wa_approval_def TO l_it_approval_def.<br>
 &nbsp; &nbsp;ENDIF.</font>
<br><font size=3>* &nbsp; modify the table l_it_update_tab so that along
with the custom<br>
* &nbsp; database table the table in use in this function module ie<br>
* &nbsp; l_it_update_tab also remain updated.<br>
* &nbsp; benefit is that if the modify to dtab fails. the process works
fine.<br>
 &nbsp; &nbsp;MODIFY l_it_update_tab FROM l_wa_approval_def<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TRANSPORTING zapprover<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WHERE zlevel = l_wa_approval_def-zlevel
AND<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zvalue
= l_wa_approval_def-zvalue.</font>
<br><font size=3>* &nbsp; now enqueue the table for modification.<br>
 &nbsp; &nbsp;CALL FUNCTION 'ENQUEUE_E_TABLE'<br>
 &nbsp; &nbsp; &nbsp;EXPORTING<br>
 &nbsp; &nbsp; &nbsp; &nbsp;tabname &nbsp; &nbsp; &nbsp; &nbsp;= 'ZRP2P0BGST001'<br>
 &nbsp; &nbsp; &nbsp;EXCEPTIONS<br>
 &nbsp; &nbsp; &nbsp; &nbsp;foreign_lock &nbsp; = 1<br>
 &nbsp; &nbsp; &nbsp; &nbsp;system_failure = 2<br>
 &nbsp; &nbsp; &nbsp; &nbsp;OTHERS &nbsp; &nbsp; &nbsp; &nbsp; = 3.<br>
* &nbsp; now modify the table, for updation of approver.<br>
 &nbsp; &nbsp;IF sy-subrc = 0.<br>
 &nbsp; &nbsp; &nbsp;MODIFY zrp2p0bgst001 FROM l_wa_approval_def.<br>
* &nbsp; &nbsp; if sy-subrc goes 0 commit work is called.<br>
* &nbsp; &nbsp; also the l_it_update_tab need to be updated.<br>
 &nbsp; &nbsp; &nbsp;IF sy-subrc = 0.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;COMMIT WORK.</font>
<br><font size=3>&nbsp; &nbsp; &nbsp; ENDIF.<br>
 &nbsp; &nbsp;ENDIF.<br>
* &nbsp; now dequeue the table after the updation.<br>
 &nbsp; &nbsp;CALL FUNCTION 'DEQUEUE_E_TABLE'<br>
 &nbsp; &nbsp; &nbsp;EXPORTING<br>
 &nbsp; &nbsp; &nbsp; &nbsp;tabname = 'ZRP2P0BGST001'.<br>
* &nbsp; once all done clear the work areas.<br>
 &nbsp; &nbsp;CLEAR : l_wa_approval_def-zlevel , l_wa_approval_def-zapprover.<br>
 &nbsp;ENDDO. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot; END OF DO STATEMENT.</font>
<br><font size=3>* sort l_it_approval_def table.<br>
 &nbsp;SORT l_it_approval_def BY zlevel ASCENDING.</font>
<br><font size=3>&nbsp; IF approval_index = 2 .<br>
 &nbsp; &nbsp;DELETE l_it_approval_def INDEX 1.<br>
 &nbsp;ENDIF.<br>
 &nbsp;IF approval_index = 3.<br>
 &nbsp; &nbsp;DELETE l_it_approval_def INDEX 1.<br>
 &nbsp; &nbsp;DELETE l_it_approval_def INDEX 1.<br>
 &nbsp;ENDIF.<br>
 &nbsp;IF approval_index &gt; 3.<br>
 &nbsp; &nbsp;REFRESH : l_it_approval_def .<br>
 &nbsp;ENDIF.<br>
*ENDIF.<br>
**********************************************************************<br>
*--end of major change.---------------------------------------------*<br>
**********************************************************************<br>
* &nbsp; fill approval table (who is responsible for which approval<br>
* &nbsp; object in which approval step)<br>
 &nbsp;SORT l_it_approval_def BY zplant zcost_ctr zorder_no zasset_no<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp;zlevel zvalue.<br>
 &nbsp;LOOP AT l_it_approval_def INTO l_wa_approval_def.<br>
 &nbsp; &nbsp;l_wa_approval_table-approval_index &nbsp; &nbsp; &nbsp; =
l_wa_approval_def-zlevel.<br>
 &nbsp; &nbsp;CONCATENATE l_c_agent_is_user l_wa_approval_def-zapprover<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;INTO l_wa_approval_table-approval_agent.</font>
<br><font size=3>&nbsp; &nbsp; l_wa_approval_table-approval_description
= approval_description.</font>
<br><font size=3>&nbsp; &nbsp; l_wa_approval_table-approval_object_guid
= l_v_app_obj_guid.</font>
<br><font size=3>&nbsp; &nbsp; l_wa_approval_table-hide_items_not_responsible
=<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;hide_items_not_responsible.</font>
<br><font size=3>&nbsp; &nbsp; APPEND l_wa_approval_table TO approval_table.<br>
 &nbsp;ENDLOOP.<br>
* fill item table (which items belongs to which approval object)<br>
 &nbsp;l_wa_item_approval_table-approval_object_guid = l_v_app_obj_guid.<br>
 &nbsp;l_wa_item_approval_table-approval_item_guid &nbsp; = item_guid.<br>
 &nbsp;APPEND l_wa_item_approval_table TO item_approval_table.</font>
<br><font size=3>ENDFUNCTION.</font>
<br><font size=3>&nbsp;</font>
<br><font size=3>&nbsp;</font>
<br><font size=3>&nbsp;</font>
<br><font size=3>Thanks </font>
<br><font size=3>Arghadip Kar</font>
<br><font size=3>&nbsp;</font>
<p><font size=3>&nbsp;</font>
<hr><font size=3>Ahhh...imagining that irresistible &quot;new car&quot;
smell?<br>
Check out </font><a href="http://us.rd.yahoo.com/evt=48245/*http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE1YW1jcXJ2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDbmV3LWNhcnM-"><font size=3 color=blue><u>new
cars at Yahoo! Autos.</u></font></a><font size=3> </font><tt><font size=2>_______________________________________________<br>
SAP-WUG mailing list<br>
SAP-WUG@mit.edu<br>
http://mailman.mit.edu/mailman/listinfo/sap-wug<br>
</font></tt>
<p>