Sunteți pe pagina 1din 6

report rsaqdvp_template . ******************************************************************************** * InfoSet : /LGC/CUSTOMER_BLOCKS * Title : Customer Blocks * * Author : Julian Hundeloh / EXDE0A7C * Date : 23.04.

2012 * Responsibility: SALES / Order Management * Design Spec : CTM-EV1?.01-02_FDD_0C_002_SA Segmentation_Enhancements_Variabl e_Data *------------------------------------------------------------------------------* Description * Customer Blocks * *------------------------------------------------------------------------------* Modification Protocol * No. Date Author Change Ref. Transp.Requ. *------------------------------------------------------------------------------* 1 23.04.2012 Hundeloh / EXDE0A7C CR: 6000002182 DCGK903641 * InfoSet implemented * 2 13.12.2013 Kavindra J/EXIN056B IM-13-181706 * Performance Imporvement ******************************************************************************** * *---------------------------------------------------------------------* * declarations * (insert your declarations in this section) *---------------------------------------------------------------------* types: begin of s_but000, rltyp type bu_partnerrole. include type but000. types: end of s_but000. types: t_frg0050 type standard table of crmm_but_frg0050. types: t_frg0100 type standard table of crmm_but_frg0100. types: begin of ty_customer_blocks, guid type crmt_partner_guid, role type bu_partnerrole, sales_org type crmt_sales_org, channel type crmt_distribution_channel, division type crmt_division, ord_block_reason type crmt_bus_ord_block_reason, bil_block_reason type crmt_bus_bill_block_reason, del_block_reason type crmt_bus_del_block_reason, end of ty_customer_blocks. data: /lgc/mks_customer_blocks type /lgc/mks_customer_blocks , lt_data type standard table of /lgc/mks_customer_blocks, it_data type standard table of /lgc/mks_customer_blocks . data: lt_but000 ls_but000 lt_frg0050 ls_frg0100 lt_frg0100 type type type type type table of s_but000, s_but000, t_frg0050, line of t_frg0100, t_frg0100,

ls_frg0050 type line of t_frg0050, ls_data type /lgc/mks_customer_blocks, lt_selections type table of rsparams, ls_selection type rsparams, lv_sel_low type tztf_io_field, lv_sel_high type tztf_io_field, lt_fieldinfo type table of rsel_info, ls_fieldinfo type rsel_info, lv_repid type syrepid, ls_where type string, ls_where_block type string, lt_data_temp type standard table of ty_customer_blocks, ls_data_temp type ty_customer_blocks, lv_timestamp type timestamp. constants: l_qu(3) type c value ''''. data: ls_check type string. field-symbols: <struc> type /lgc/mks_customer_blocks field-symbols: <fs_but000> like ls_but000. field-symbols: <fs_frg0100> type line of t_frg0100. .

*-------------------------------------------------------------------* * selection screen statements *-------------------------------------------------------------------* * (define your selection-screen here) * !! the following comment MUST NOT BE CHANGED !! *<QUERY_HEAD>

*-------------------------------------------------------------------* * read data into IT_DATA *-------------------------------------------------------------------* * (select your data here into internal table IT_DATA) " Get timestamp lv_repid = sy-repid. *** read selections of query call function 'RS_REFRESH_FROM_SELECTOPTIONS' exporting curr_report = lv_repid tables selection_table = lt_selections. *** get fiedinfos for selections call function 'RS_REPORTSELECTIONS_INFO' exporting report = lv_repid tables field_info = lt_fieldinfo. clear ls_check. * Read the selection Parameters read table lt_fieldinfo into ls_fieldinfo with key dbfield = '/LGC/MKS_CUSTOMER_BLOCKS-CHANNEL'. if sy-subrc = 0. loop at lt_selections into ls_selection where selname = ls_fieldinfo-name. concatenate l_qu ls_selection-low l_qu into ls_check.

concatenate 'C~CHANNEL' ls_selection-option ls_check into ls_where separated by space. endloop. endif. clear ls_check. * Read the selection Parameters read table lt_fieldinfo into ls_fieldinfo with key dbfield = '/LGC/CUSTOMER_BLOCKS-DIVISION'. if sy-subrc = 0. loop at lt_selections into ls_selection where selname = ls_fieldinfo-name. if ls_where is not initial. concatenate ls_where 'AND' into ls_where separated by space. endif. concatenate l_qu ls_selection-low l_qu into ls_check. concatenate 'C~DIVISION' ls_selection-option ls_check into ls_where separated by space. endloop. endif. clear ls_check. * Read the selection Parameters read table lt_fieldinfo into ls_fieldinfo with key dbfield = '/LGC/MKS_CUSTOMER_BLOCKS-SALES_ORG'. if sy-subrc = 0. loop at lt_selections into ls_selection where selname = ls_fieldinfo-name. if ls_where is not initial. concatenate ls_where 'AND' into ls_where separated by space. endif. concatenate l_qu ls_selection-low l_qu into ls_check. concatenate 'C~SALES_ORG' ls_selection-option ls_check into ls_where separated by space. endloop. endif. clear ls_check. * Read the selection Parameters read table lt_fieldinfo into ls_fieldinfo with key dbfield = '/LGC/MKS_CUSTOMER_BLOCKS-ORD_BLOCK_REASON'. if sy-subrc = 0. loop at lt_selections into ls_selection where selname = ls_fieldinfo-name. if ls_where_block is not initial. concatenate ls_where_block 'AND' into ls_where separated by space. endif. concatenate l_qu ls_selection-low l_qu into ls_check. concatenate 'D~ORD_BLOCK_REASON' ls_selection-option ls_check into ls_where_block separated by space. endloop. endif. clear ls_check. * Read the selection Parameters read table lt_fieldinfo into ls_fieldinfo with key dbfield = '/LGC/MKS_CUSTOMER_BLOCKS-BIL_BLOCK_REASON'.

if sy-subrc = 0. loop at lt_selections into ls_selection where selname = ls_fieldinfo-name. if ls_where_block is not initial. concatenate ls_where_block 'AND' into ls_where separated by space. endif. concatenate l_qu ls_selection-low l_qu into ls_check. concatenate 'D~BIL_BLOCK_REASON' ls_selection-option ls_check into ls_where_block separated by space. endloop. endif. clear ls_check. * Read the selection Parameters read table lt_fieldinfo into ls_fieldinfo with key dbfield = '/LGC/MKS_CUSTOMER_BLOCKS-DEL_BLOCK_REASON'. if sy-subrc = 0. loop at lt_selections into ls_selection where selname = ls_fieldinfo-name. if ls_where_block is not initial. concatenate ls_where_block 'AND' into ls_where separated by space. endif. concatenate l_qu ls_selection-low l_qu into ls_check. concatenate 'D~DEL_BLOCK_REASON' ls_selection-option ls_check into ls_where_block separated by space. endloop. endif. *concatenate ls_where ls_where_block into ls_where separated by space. get time stamp field lv_timestamp. if ls_where is not initial. * ls_where is not initial and ls_where_block is not initial. select a~partner_guid * d~bil_block_reason * d~del_block_reason * d~ord_block_reason c~sales_org c~channel c~division b~rltyp from but000 as a inner join but100 as b on a~partner = b~partner inner join crmm_but_frg0100 as c on a~partner_guid = c~partner_guid * * inner join crmm_but_frg0050 as d on a~partner_guid = d~guid into corresponding fields of table it_data where ( b~valid_from <= lv_timestamp and b~valid_to >= lv_timestamp ) and ( b~rltyp = 'CRM000' or b~rltyp = 'CRM002' ) and (ls_where). * and (ls_where_block). " Sold-To Party OR Ship-To Party. *elseif ls_where is not initial and ls_where_block is initial. * select a~partner_guid d~bil_block_reason * d~del_block_reason d~ord_block_reason * c~sales_org c~channel c~division b~rltyp * from but000 as a

* inner join crmm_but_frg0100 as c * on a~partner_guid = c~partner_guid * inner join but100 as b * on a~partner = b~partner * inner join crmm_but_frg0050 as d * on a~partner_guid = d~guid * into corresponding fields of table it_data * where ( b~valid_from <= lv_timestamp and b~valid_to >= lv_timestamp ) * and ( b~rltyp = 'CRM000' or b~rltyp = 'CRM002' ) * and (ls_where). " Sold-To Party OR Ship-To Party. *else. * select a~partner_guid ** d~bil_block_reason ** d~del_block_reason d~ord_block_reason * c~sales_org c~channel c~division * b~rltyp *from but000 as a * inner join but100 as b *on a~partner = b~partner * inner join crmm_but_frg0100 as c * on a~partner_guid = c~partner_guid * ** inner join crmm_but_frg0050 as d ** on a~partner_guid = d~guid *into corresponding fields of table it_data *where ( b~valid_from <= lv_timestamp and b~valid_to >= lv_timestamp ) * and ( b~rltyp = 'CRM000' or b~rltyp = 'CRM002' ). ** and (ls_where_block). " Sold-To Party OR Ship-To Party. endif. clear: ls_data,ls_but000,ls_frg0050, ls_frg0100. if ls_where_block is not initial. if it_data is not initial. lt_data = it_data. select d~bil_block_reason d~del_block_reason d~ord_block_reason d~guid * a~guid from crmm_but_frg0050 as d into corresponding fields of table lt_data_temp where (ls_where_block). loop at lt_data_temp into ls_data_temp. read table it_data with key partner_guid = ls_data_temp-guid assigning <struc>. if sy-subrc = 0. <struc>-del_block_reason = ls_data_temp-del_block_reason. <struc>-ord_block_reason = ls_data_temp-ord_block_reason. <struc>-bil_block_reason = ls_data_temp-bil_block_reason. endif. endloop. else. select a~partner_guid

* *

d~bil_block_reason d~del_block_reason d~ord_block_reason c~sales_org c~channel c~division b~rltyp from but000 as a inner join but100 as b on a~partner = b~partner inner join crmm_but_frg0100 as c on a~partner_guid = c~partner_guid

inner join crmm_but_frg0050 as d on a~partner_guid = d~guid into corresponding fields of table it_data for all entries in it_data where partner_guid = it_data-partner_guid and ( b~valid_from <= lv_timestamp and b~valid_to >= lv_timestamp ) and ( b~rltyp = 'CRM000' or b~rltyp = 'CRM002' ) . endif. endif. unassign <struc>. *------------------------------------------------------------* * output of the data * (this section can be left unchanged) *------------------------------------------------------------* loop at it_data assigning <struc>. move-corresponding <struc> to /lgc/mks_customer_blocks . * !! the following comment MUST NOT BE CHANGED !! *<QUERY_BODY> endloop.

S-ar putea să vă placă și