Skip to Content
0
Former Member
May 30, 2008 at 09:35 AM

performance issue

15 Views

Hi experts,

this is my code it have many performance issue can u make it out to remove .

----


  • Trans.Code : *

  • Program : YSDC019 - Sales Program Report *

  • Author : RAHUL SINGH *

  • Date : *

----


  • Detail Description: *

----


  • This conversion requires input from Comand system.Only open,general *

  • sales order sales programs will be converted.The special programs *

  • such as employee, accommodation,government will need to be setup manually.*

  • --------------------------------------------------------------------------*

  • Date Author Transport Description *

  • ======== ======= =========== ============================================*

REPORT ysdc019 NO STANDARD PAGE HEADING.

=====================================================================

  • Data Declaration *

=====================================================================

----


  • External declarations *

----


----


  • External tables & structure declarations *

----


TABLES: kona.

----


  • Type declarations *

----


TYPES: BEGIN OF tp_qsp1001 ,

qsp1001_record_status(01) TYPE c,

qsp1001_corp_code(02) TYPE c,

qsp1001_sales_pgm_number(06) TYPE c,

qsp1001_rec_id(02) TYPE c,

qsp1001_last_maint_date TYPE sy-datum,

qsp1001_company_code(02) TYPE c,

qsp1001_version_num(02) TYPE c,

qsp1001_approved_date TYPE kona-zz_actdat,

qsp1001_sales_office(02) TYPE c,

qsp1001_sales_pgm_desc(49) TYPE c,

qsp1001_sales_pgm_beg_date TYPE kona-datab,

qsp1001_sales_pgm_end_date TYPE kona-datbi,

qsp1001_sales_pgm_grace_date TYPE kona-datbi,

qsp1001_dlr_type_code(03) TYPE c,

filler(15) TYPE c,

qsp1001_dlr_type_flag(01) TYPE c,

qsp1001_sales_program_status TYPE kona-zz_psts,

qsp1001_warranty_code(02) TYPE c,

qsp1001_sales_pgm_type(02) TYPE c,

qsp1001_sales_pgm_bulletin(15) TYPE c,

qsp1001_prepaid_frt_ind(01) TYPE c,

qsp1001_spdemo_pgm_ind(01) TYPE c,

qsp1001_sales_pgm_term1(03) TYPE c,

qsp1001_sales_pgm_trm_frm_dat1(06) TYPE c,

qsp1001_sales_pgm_trm_to_dat1(06) TYPE c,

qsp1001_sales_pgm_term2(03) TYPE c,

qsp1001_sales_pgm_trm_frm_dat2(06) TYPE c,

qsp1001_sales_pgm_trm_to_dat2(06) TYPE c,

qsp1001_sales_pgm_term3(03) TYPE c,

qsp1001_sales_pgm_trm_frm_dat3(06) TYPE c,

qsp1001_sales_pgm_trm_to_dat3(06) TYPE c,

qsp1001_sales_pgm_term4(03) TYPE c,

qsp1001_sales_pgm_trm_frm_dat4(06) TYPE c,

qsp1001_sales_pgm_trm_to_dat4(06) TYPE c,

qsp1001_sales_pgm_term5(03) TYPE c,

qsp1001_sales_pgm_trm_frm_dat5(06) TYPE c,

qsp1001_sales_pgm_trm_to_dat5(06) TYPE c,

qsp1001_sales_pgm_term6(03) TYPE c,

qsp1001_sales_pgm_trm_frm_dat6(06) TYPE c,

qsp1001_sales_pgm_trm_to_dat6(06) TYPE c,

qsp1001_sales_pgm_term7(03) TYPE c,

qsp1001_sales_pgm_trm_frm_dat7(06) TYPE c,

qsp1001_sales_pgm_trm_to_dat7(06) TYPE c,

qsp1001_sales_pgm_term8(03) TYPE c,

qsp1001_sales_pgm_trm_frm_dat8(06) TYPE c,

qsp1001_sales_pgm_trm_to_dat8(06) TYPE c,

qsp1001_sales_pgm_term9(03) TYPE c,

qsp1001_sales_pgm_trm_frm_dat9(06) TYPE c,

qsp1001_sales_pgm_trm_to_dat9(06) TYPE c,

qsp1001_sales_pgm_term10(03) TYPE c,

qsp1001_sales_pgm_trm_frm_da10(06) TYPE c,

qsp1001_sales_pgm_trm_to_da10(06) TYPE c,

qsp1001_sales_pgm_term11(03) TYPE c,

qsp1001_sales_pgm_trm_frm_da11(06) TYPE c,

qsp1001_sales_pgm_trm_to_da11(06) TYPE c,

qsp1001_sales_pgm_term12(03) TYPE c,

qsp1001_sales_pgm_trm_frm_da12(06) TYPE c,

qsp1001_sales_pgm_trm_to_da12(06) TYPE c,

qsp1001_sales_pgm_def_term(03) TYPE c,

qsp1001_date_of_order_begin TYPE kona-datab,

qsp1001_date_of_order_end TYPE kona-datbi,

qsp1001_sales_pgm_cur_flag TYPE kona-zz_cdpf,

qsp1001_sales_pgm_as_of_date TYPE kona-zz_prsdt,

filler1(0125) TYPE c,

qsp1001_uspamfe_sls_pgm(02) TYPE c,

qsp1001_orig_order_cutoff_date TYPE kona-datbi,

qsp1001_sales_pgm_def_duoe(01) TYPE c,

qsp1001_sales_pgm_trm_duoe_ind(12) TYPE c,

qsp1001_benefit_dist1(018) TYPE c,

qsp1001_benefit_dist2(018) TYPE c,

qsp1001_benefit_dist3(018) TYPE c,

qsp1001_benefit_dist4(018) TYPE c,

qsp1001_benefit_dist5(018) TYPE c,

qsp1001_benefit_dist6(018) TYPE c,

qsp1001_benefit_app_flag(01) TYPE c,

qsp1001_report_freq_wkly(01) TYPE c,

qsp1001_report_freq_bi_mo(01) TYPE c,

qsp1001_report_freq_mthly(01) TYPE c,

qsp1001_end_of_prog_rpt_date(08) TYPE c,

qsp1001_special_pgm_rpt_date(08) TYPE c,

  • QSP1001_RETRO_PROC_DATE_GRP1(01) TYPE C,

  • QSP1001_RETRO_PROC_DATE_GRP2(01) TYPE C,

  • QSP1001_RETRO_PROC_DATE_GRP3(01) TYPE C,

  • QSP1001_RETRO_PROC_DATE_GRP4(01) TYPE C,

10_qsp1001_process_date_from1(08) TYPE c,

10_qsp1001_process_date_to1(08) TYPE c,

10_qsp1001_process_date_grace1(08) TYPE c,

10_qsp1001_process_date_from2(08) TYPE c,

10_qsp1001_process_date_to2(08) TYPE c,

10_qsp1001_process_date_grace2(08) TYPE c,

10_qsp1001_process_date_from3(08) TYPE c,

10_qsp1001_process_date_to3(08) TYPE c,

10_qsp1001_process_date_grace3(08) TYPE c,

10_qsp1001_process_date_from4(08) TYPE c,

10_qsp1001_process_date_to4(08) TYPE c,

10_qsp1001_process_date_grace4(08) TYPE c,

qsp1001_assoc_pgm_grp1(01) TYPE c,

qsp1001_assoc_pgm_grp2(01) TYPE c,

qsp1001_assoc_pgm_grp3(01) TYPE c,

qsp1001_assoc_pgm_grp4(01) TYPE c,

qsp1001_assoc_pgm_grp5(01) TYPE c,

qsp1001_assoc_pgm_grp6(01) TYPE c,

qsp1001_assoc_pgm_grp7(01) TYPE c,

qsp1001_assoc_pgm_grp8(01) TYPE c,

qsp1001_assoc_pgm_grp9(01) TYPE c,

qsp1001_assoc_pgm_grp10(01) TYPE c,

qsp1001_assoc_pgm_grp11(01) TYPE c,

qsp1001_assoc_pgm_grp12(01) TYPE c,

10_qsp1001_inc_exc_flag1(01) TYPE c,

10_qsp1001_sales_pgm_rel_num1(06) TYPE c,

qsp1001_pr_reserve_pct_sn1(01) TYPE c,

qsp1001_pr_reserve_percent1(05) TYPE c,

qsp1001_pr_bonus_pct_sn1(01) TYPE c,

qsp1001_pr_bonus_percent1(05) TYPE c,

qsp1001_pr_bonus_amount_sn1(01) TYPE c,

qsp1001_pr_bonus_amount1(08) TYPE c,

qsp1001_spec_sls_pgm(05) TYPE c,

qsp1001_co_op_pct_per_unit_sn(01) TYPE c,

qsp1001_co_op_percent_per_unit(05) TYPE c,

qsp1001_yamaha_contr_pct_sn(01) TYPE c,

qsp1001_yamaha_contr_percent(05) TYPE c,

qsp1001_prepaid_frt_min_qty(03) TYPE c,

qsp1001_duoe_pgm_ind(01) TYPE c,

qsp1001_duoe_pgm_desc_1 TYPE kona-zz_abrex,

qsp1001_duoe_pgm_desc_2(40) TYPE c,

qsp1001_ie_code(01) TYPE c,

qsp1001_sa_value1(03) TYPE c,

qsp1001_sa_value2(03) TYPE c,

qsp1001_sa_value3(03) TYPE c,

qsp1001_last_byte(01) TYPE c,

END OF tp_qsp1001.

TYPES: BEGIN OF tp_qsp1002 ,

qsp1002_record_status(01) TYPE c,

qsp1002_corp_code(02) TYPE c,

qsp1002_sales_pgm_number(06) TYPE c,

qsp1002_rec_id(02) TYPE c,

qsp1002_division_filler1(01) TYPE c,

qsp1002_product_line TYPE mara-spart,

division_filler2(01) TYPE c,

qsp1002_model_year_from(04) TYPE c,

qsp1002_modelyear_to(04) TYPE c,

qsp1002_last_maint_date(8) TYPE c,

qsp1002_company_code(02) TYPE c,

qsp1002_sales_pgm_model_flag(01) TYPE c,

qsp1002_unit_quantity_from_sn1(01) TYPE c,

10_qsp1002_unit_quantity_from1(05) TYPE p,

10_qsp1002_unit_quantity_to_s1(01) TYPE c,

10_qsp1002_unit_quantity_to1(06) TYPE p,

10_qsp1002_discount_type1(01) TYPE c,

10_qsp1002_discount_sn1(01) TYPE c,

10_qsp1002_discount1(06) TYPE p,

qsp1002_unit_quantity_from_sn2(01) TYPE c,

10_qsp1002_unit_quantity_from2(05) TYPE p,

10_qsp1002_unit_quantity_to_s2(01) TYPE c,

10_qsp1002_unit_quantity_to2(06) TYPE p,

10_qsp1002_discount_type2(01) TYPE c,

10_qsp1002_discount_sn2(01) TYPE c,

10_qsp1002_discount2(06) TYPE p,

qsp1002_unit_quantity_from_sn3(01) TYPE c,

10_qsp1002_unit_quantity_from3(05) TYPE p,

10_qsp1002_unit_quantity_to_s3(01) TYPE c,

10_qsp1002_unit_quantity_to3(06) TYPE p,

10_qsp1002_discount_type3(01) TYPE c,

10_qsp1002_discount_sn3(01) TYPE c,

10_qsp1002_discount3(06) TYPE p,

qsp1002_unit_quantity_from_sn4(01) TYPE c,

10_qsp1002_unit_quantity_from4(05) TYPE p,

10_qsp1002_unit_quantity_to_s4(01) TYPE c,

10_qsp1002_unit_quantity_to4(06) TYPE p,

10_qsp1002_discount_type4(01) TYPE c,

10_qsp1002_discount_sn4(01) TYPE c,

10_qsp1002_discount4(06) TYPE p,

qsp1002_unit_quantity_from_sn5(01) TYPE c,

10_qsp1002_unit_quantity_from5(05) TYPE p,

10_qsp1002_unit_quantity_to_s5(01) TYPE c,

10_qsp1002_unit_quantity_to5(06) TYPE p,

10_qsp1002_discount_type5(01) TYPE c,

10_qsp1002_discount_sn5(01) TYPE c,

10_qsp1002_discount5(06) TYPE p,

qsp1002_unit_quantity_from_sn6(01) TYPE c,

10_qsp1002_unit_quantity_from6(05) TYPE p,

10_qsp1002_unit_quantity_to_s6(01) TYPE c,

10_qsp1002_unit_quantity_to6(06) TYPE p,

10_qsp1002_discount_type6(01) TYPE c,

10_qsp1002_discount_sn6(01) TYPE c,

10_qsp1002_discount6(06) TYPE p,

qsp1002_unit_quantity_from_sn7(01) TYPE c,

10_qsp1002_unit_quantity_from7(05) TYPE p,

10_qsp1002_unit_quantity_to_s7(01) TYPE c,

10_qsp1002_unit_quantity_to7(06) TYPE p,

10_qsp1002_discount_type7(01) TYPE c,

10_qsp1002_discount_sn7(01) TYPE c,

10_qsp1002_discount7(06) TYPE p,

qsp1002_unit_quantity_from_sn8(01) TYPE c,

10_qsp1002_unit_quantity_from8(05) TYPE p,

10_qsp1002_unit_quantity_to_s8(01) TYPE c,

10_qsp1002_unit_quantity_to8(06) TYPE p,

10_qsp1002_discount_type8(01) TYPE c,

10_qsp1002_discount_sn8(01) TYPE c,

10_qsp1002_discount8(06) TYPE p,

qsp1002_unit_quantity_from_sn9(01) TYPE c,

10_qsp1002_unit_quantity_from9(05) TYPE p,

10_qsp1002_unit_quantity_to_s9(01) TYPE c,

10_qsp1002_unit_quantity_to9(06) TYPE p,

10_qsp1002_discount_type9(01) TYPE c,

10_qsp1002_discount_sn9(01) TYPE c,

10_qsp1002_discount9(06) TYPE p,

qsp1002_unit_quantity_from_s10(01) TYPE c,

10_qsp1002_unit_quantity_fro10(05) TYPE p,

10_qsp1002_unit_quantity_t_s10(01) TYPE c,

10_qsp1002_unit_quantity_to10(06) TYPE p,

10_qsp1002_discount_type10(01) TYPE c,

10_qsp1002_discount_sn10(01) TYPE c,

10_qsp1002_discount10(06) TYPE p,

qsp1002_unit_quantity_from_s11(01) TYPE c,

10_qsp1002_unit_quantity_fro11(05) TYPE p,

10_qsp1002_unit_quantity_t_s11(01) TYPE c,

10_qsp1002_unit_quantity_to11(06) TYPE p,

10_qsp1002_discount_type11(01) TYPE c,

10_qsp1002_discount_sn11(01) TYPE c,

10_qsp1002_discount11(06) TYPE p,

qsp1002_unit_quantity_from_s12(01) TYPE c,

10_qsp1002_unit_quantity_fro12(05) TYPE p,

10_qsp1002_unit_quantity_t_s12(01) TYPE c,

10_qsp1002_unit_quantity_to12(06) TYPE p,

10_qsp1002_discount_type12(01) TYPE c,

10_qsp1002_discount_sn12(01) TYPE c,

10_qsp1002_discount12(06) TYPE p,

qsp1002_unit_quantity_from_s13(01) TYPE c,

10_qsp1002_unit_quantity_fro13(05) TYPE p,

10_qsp1002_unit_quantity_t_s13(01) TYPE c,

10_qsp1002_unit_quantity_to13(06) TYPE p,

10_qsp1002_discount_type13(01) TYPE c,

10_qsp1002_discount_sn13(01) TYPE c,

10_qsp1002_discount13(06) TYPE p,

qsp1002_unit_quantity_from_s14(01) TYPE c,

10_qsp1002_unit_quantity_fro14(05) TYPE p,

10_qsp1002_unit_quantity_t_s14(01) TYPE c,

10_qsp1002_unit_quantity_to14(06) TYPE p,

10_qsp1002_discount_type14(01) TYPE c,

10_qsp1002_discount_sn14(01) TYPE c,

10_qsp1002_discount14(06) TYPE p,

qsp1002_unit_quantity_from_s15(01) TYPE c,

10_qsp1002_unit_quantity_fro15(05) TYPE p,

10_qsp1002_unit_quantity_t_s15(01) TYPE c,

10_qsp1002_unit_quantity_to15(06) TYPE p,

10_qsp1002_discount_type15(01) TYPE c,

10_qsp1002_discount_sn15(01) TYPE c,

10_qsp1002_discount15(06) TYPE p,

qsp1002_unit_quantity_from_s16(01) TYPE c,

10_qsp1002_unit_quantity_fro16(05) TYPE p,

10_qsp1002_unit_quantity_t_s16(01) TYPE c,

10_qsp1002_unit_quantity_to16(06) TYPE p,

10_qsp1002_discount_type16(01) TYPE c,

10_qsp1002_discount_sn16(01) TYPE c,

10_qsp1002_discount16(06) TYPE p,

qsp1002_unit_quantity_from_s17(01) TYPE c,

10_qsp1002_unit_quantity_fro17(05) TYPE p,

10_qsp1002_unit_quantity_t_s17(01) TYPE c,

10_qsp1002_unit_quantity_to17(06) TYPE p,

10_qsp1002_discount_type17(01) TYPE c,

10_qsp1002_discount_sn17(01) TYPE c,

10_qsp1002_discount17(06) TYPE p,

qsp1002_unit_quantity_from_s18(01) TYPE c,

10_qsp1002_unit_quantity_fro18(05) TYPE p,

10_qsp1002_unit_quantity_t_s18(01) TYPE c,

10_qsp1002_unit_quantity_to18(06) TYPE p,

10_qsp1002_discount_type18(01) TYPE c,

10_qsp1002_discount_sn18(01) TYPE c,

10_qsp1002_discount18(06) TYPE p,

qsp1002_unit_quantity_from_s19(01) TYPE c,

10_qsp1002_unit_quantity_fro19(05) TYPE p,

10_qsp1002_unit_quantity_t_s19(01) TYPE c,

10_qsp1002_unit_quantity_to19(06) TYPE p,

10_qsp1002_discount_type19(01) TYPE c,

10_qsp1002_discount_sn19(01) TYPE c,

10_qsp1002_discount19(06) TYPE p,

qsp1002_unit_quantity_from_s20(01) TYPE c,

10_qsp1002_unit_quantity_fro20(05) TYPE p,

10_qsp1002_unit_quantity_t_s20(01) TYPE c,

10_qsp1002_unit_quantity_to20(06) TYPE p,

10_qsp1002_discount_type20(01) TYPE c,

10_qsp1002_discount_sn20(01) TYPE c,

10_qsp1002_discount20(06) TYPE p,

qsp1002_oem_special_flag(01) TYPE c,

qsp1002_last_byte(01) TYPE c,

END OF tp_qsp1002.

TYPES: BEGIN OF tp_qsp1003 ,

qsp1003_record_status(01) TYPE c,

qsp1003_corp_code(02) TYPE c,

qsp1003_sales_pgm_number(06) TYPE c,

qsp1003_rec_id(02) TYPE c,

division_filer1(01) TYPE c,

qsp1003_product_line TYPE mara-spart,

division_filler2(01) TYPE c,

qsp1003_model_year_from(04) TYPE c,

qsp1003_model_year_to(04) TYPE c,

qsp1003_last_maint_date(08) TYPE c,

qsp1003_company_code(02) TYPE c,

10_qsp1003_inc_exc_ind1(01) TYPE c,

10_qsp1003_model_name1(12) TYPE c,

10_qsp1003_inc_exc_ind2(01) TYPE c,

10_qsp1003_model_name2(12) TYPE c,

10_qsp1003_inc_exc_ind3(01) TYPE c,

10_qsp1003_model_name3(12) TYPE c,

10_qsp1003_inc_exc_ind4(01) TYPE c,

10_qsp1003_model_name4(12) TYPE c,

10_qsp1003_inc_exc_ind5(01) TYPE c,

10_qsp1003_model_name5(12) TYPE c,

10_qsp1003_inc_exc_ind6(01) TYPE c,

10_qsp1003_model_name6(12) TYPE c,

10_qsp1003_inc_exc_ind7(01) TYPE c,

10_qsp1003_model_name7(12) TYPE c,

10_qsp1003_inc_exc_ind8(01) TYPE c,

10_qsp1003_model_name8(12) TYPE c,

10_qsp1003_inc_exc_ind9(01) TYPE c,

10_qsp1003_model_name9(12) TYPE c,

10_qsp1003_inc_exc_ind10(01) TYPE c,

10_qsp1003_model_name10(12) TYPE c,

10_qsp1003_inc_exc_ind11(01) TYPE c,

10_qsp1003_model_name11(12) TYPE c,

10_qsp1003_inc_exc_ind12(01) TYPE c,

10_qsp1003_model_name12(12) TYPE c,

10_qsp1003_inc_exc_ind13(01) TYPE c,

10_qsp1003_model_name13(12) TYPE c,

10_qsp1003_inc_exc_ind14(01) TYPE c,

10_qsp1003_model_name14(12) TYPE c,

10_qsp1003_inc_exc_ind15(01) TYPE c,

10_qsp1003_model_name15(12) TYPE c,

10_qsp1003_inc_exc_ind16(01) TYPE c,

10_qsp1003_model_name16(12) TYPE c,

10_qsp1003_inc_exc_ind17(01) TYPE c,

10_qsp1003_model_name17(12) TYPE c,

10_qsp1003_inc_exc_ind18(01) TYPE c,

10_qsp1003_model_name18(12) TYPE c,

10_qsp1003_inc_exc_ind19(01) TYPE c,

10_qsp1003_model_name19(12) TYPE c,

10_qsp1003_inc_exc_ind20(01) TYPE c,

10_qsp1003_model_name20(12) TYPE c,

10_qsp1003_inc_exc_ind21(01) TYPE c,

10_qsp1003_model_name21(12) TYPE c,

10_qsp1003_inc_exc_ind22(01) TYPE c,

10_qsp1003_model_name22(12) TYPE c,

10_qsp1003_inc_exc_ind23(01) TYPE c,

10_qsp1003_model_name23(12) TYPE c,

10_qsp1003_inc_exc_ind24(01) TYPE c,

10_qsp1003_model_name24(12) TYPE c,

10_qsp1003_inc_exc_ind25(01) TYPE c,

10_qsp1003_model_name25(12) TYPE c,

10_qsp1003_inc_exc_ind26(01) TYPE c,

10_qsp1003_model_name26(12) TYPE c,

10_qsp1003_inc_exc_ind27(01) TYPE c,

10_qsp1003_model_name27(12) TYPE c,

10_qsp1003_inc_exc_ind28(01) TYPE c,

10_qsp1003_model_name28(12) TYPE c,

10_qsp1003_inc_exc_ind29(01) TYPE c,

10_qsp1003_model_name29(12) TYPE c,

10_qsp1003_inc_exc_ind30(01) TYPE c,

10_qsp1003_model_name30(12) TYPE c,

10_qsp1003_inc_exc_ind31(01) TYPE c,

10_qsp1003_model_name31(12) TYPE c,

10_qsp1003_inc_exc_ind32(01) TYPE c,

10_qsp1003_model_name32(12) TYPE c,

10_qsp1003_inc_exc_ind33(01) TYPE c,

10_qsp1003_model_name33(12) TYPE c,

10_qsp1003_inc_exc_ind34(01) TYPE c,

10_qsp1003_model_name34(12) TYPE c,

10_qsp1003_inc_exc_ind35(01) TYPE c,

10_qsp1003_model_name35(12) TYPE c,

10_qsp1003_inc_exc_ind36(01) TYPE c,

10_qsp1003_model_name36(12) TYPE c,

qsp1003_last_byte(01) TYPE c,

flag(01) TYPE c,

END OF tp_qsp1003.

TYPES: BEGIN OF tp_bapiret2,

type TYPE bapiret2-type,

id TYPE bapiret2-id,

number TYPE bapiret2-number,

message TYPE bapiret2-message,

log_no TYPE bapiret2-log_no,

log_msg_no TYPE bapiret2-log_msg_no,

message_v1 TYPE bapiret2-message_v1,

message_v2 TYPE bapiret2-message_v2,

message_v3 TYPE bapiret2-message_v3,

message_v4 TYPE bapiret2-message_v4,

parameter TYPE bapiret2-parameter,

row TYPE bapiret2-row,

field TYPE bapiret2-field,

system TYPE bapiret2-system,

END OF tp_bapiret2.

TYPES: BEGIN OF tp_matlist,

zz_true_matnr TYPE zsd_sp_prodlist_st-zz_true_matnr,

vkorg TYPE zsd_sp_prodlist_st-vkorg,

spart TYPE zsd_sp_prodlist_st-spart,

zzmod_year TYPE zsd_sp_prodlist_st-zzmod_year,

zzstate_comp_flg TYPE zsd_sp_prodlist_st-zzstate_comp_flg,

maktx TYPE zsd_sp_prodlist_st-maktx,

zz_master_matnr TYPE zsd_sp_prodlist_st-zz_master_matnr,

END OF tp_matlist.

TYPES: BEGIN OF tp_zz_actdat,

zz_actdat TYPE kona-zz_actdat,

END OF tp_zz_actdat.

TYPES: BEGIN OF tp_vkbur,

vkbur TYPE kona-vkbur,

END OF tp_vkbur.

TYPES: BEGIN OF tp_knuma,

knuma TYPE kona-knuma,

END OF tp_knuma.

TYPES: BEGIN OF tp_zz_abrex,

zz_abrex TYPE kona-zz_abrex,

END OF tp_zz_abrex.

TYPES: BEGIN OF tp_datab,

datab TYPE kona-datab,

END OF tp_datab.

TYPES: BEGIN OF tp_datbi,

datbi TYPE kona-datbi,

END OF tp_datbi.

TYPES: BEGIN OF tp_datbi1,

datbi TYPE kona-datbi,

END OF tp_datbi1.

TYPES: BEGIN OF tp_zz_psts,

zz_psts TYPE kona-zz_psts,

END OF tp_zz_psts.

TYPES: BEGIN OF tp_dftwty,

dftwty TYPE zsd_sp_alwd_wty-dftwty,

END OF tp_dftwty.

TYPES: BEGIN OF tp_zz_sptype,

zz_sptype TYPE kona-zz_sptype,

END OF tp_zz_sptype.

TYPES: BEGIN OF tp_zterm,

zterm TYPE zsd_sp_alwd_term-zterm,

END OF tp_zterm.

TYPES: BEGIN OF tp_zz_cdpf,

zz_cdpf TYPE kona-zz_cdpf,

END OF tp_zz_cdpf.

TYPES: BEGIN OF tp_zz_prsdt,

zz_prsdt TYPE kona-zz_prsdt,

END OF tp_zz_prsdt.

TYPES: BEGIN OF tp_zz_vdf,

zz_vdf TYPE kona-zz_vdf,

END OF tp_zz_vdf.

TYPES: BEGIN OF tp_knuma1,

knuma TYPE kona-knuma,

END OF tp_knuma1.

TYPES: BEGIN OF tp_spart,

spart TYPE mara-spart,

END OF tp_spart.

TYPES: BEGIN OF tp_knuma2,

knuma TYPE kona-knuma,

END OF tp_knuma2.

TYPES: BEGIN OF tp_final,

knuma TYPE kona-knuma,

spart TYPE kona-spart,

v1 TYPE num2,

v2 TYPE num2,

END OF tp_final.

***************************************************************************

  • Internal Table Declaratiion for qsp1001 *

***************************************************************************

DATA: it_qsp1001 TYPE TABLE OF tp_qsp1001 WITH HEADER LINE.

DATA: it_zz_actdat TYPE TABLE OF tp_zz_actdat.

DATA: it_vkbur TYPE TABLE OF tp_vkbur WITH HEADER LINE.

DATA: it_knuma TYPE TABLE OF tp_knuma.

DATA: it_zz_abrex TYPE TABLE OF tp_zz_abrex.

DATA: it_datab TYPE TABLE OF tp_datab.

DATA: it_datbi TYPE TABLE OF tp_datbi.

DATA: it_datbi1 TYPE TABLE OF tp_datbi1.

DATA: it_zz_psts TYPE TABLE OF tp_zz_psts.

DATA: it_dftwty TYPE TABLE OF tp_dftwty.

DATA: it_zz_sptype TYPE TABLE OF tp_zz_sptype WITH HEADER LINE.

DATA: it_zterm TYPE TABLE OF tp_zterm.

DATA: it_zz_cdpf TYPE TABLE OF tp_zz_cdpf.

DATA: it_zz_prsdt TYPE TABLE OF tp_zz_prsdt.

DATA: it_zz_vdf TYPE TABLE OF tp_zz_vdf WITH HEADER LINE.

***************************************************************************

  • Internal Table Declaratiion for qsp1002 *

***************************************************************************

DATA: it_qsp1002 TYPE TABLE OF tp_qsp1002 WITH HEADER LINE.

DATA: it_knuma1 TYPE TABLE OF tp_knuma1.

DATA: it_spart TYPE TABLE OF tp_spart WITH HEADER LINE.

***************************************************************************

  • Internal Table Declaratiion for qsp1003 *

***************************************************************************

DATA: it_qsp1003 TYPE TABLE OF tp_qsp1003 WITH HEADER LINE.

DATA: it_knuma2 TYPE TABLE OF tp_knuma2 WITH HEADER LINE.

DATA: it_matlist TYPE TABLE OF tp_matlist.

DATA: it_bapiret2 TYPE TABLE OF tp_bapiret2.

DATA: it_final TYPE TABLE OF tp_final WITH HEADER LINE.

***************************************************************************

  • Work Area for above stated Internal Tables for qsp1001 *

***************************************************************************

DATA: wa_qsp1001 TYPE tp_qsp1001.

DATA: wa_zz_actdat TYPE tp_zz_actdat.

DATA: wa_knuma TYPE tp_knuma.

DATA: wa_zz_abrex TYPE tp_zz_abrex.

DATA: wa_datab TYPE tp_datab.

DATA: wa_datbi TYPE tp_datbi.

DATA: wa_datbi1 TYPE tp_datbi1.

DATA: wa_zz_psts TYPE tp_zz_psts.

DATA: wa_dftwty TYPE tp_dftwty.

DATA: wa_zterm TYPE tp_zterm.

DATA: wa_zz_cdpf TYPE tp_zz_cdpf.

DATA: wa_zz_prsdt TYPE tp_zz_prsdt.

***************************************************************************

  • Work Area for above stated Internal Tables for qsp1002 *

***************************************************************************

DATA: wa_qsp1002 TYPE tp_qsp1002.

DATA: wa_knuma1 TYPE tp_knuma1.

DATA: wa_spart TYPE tp_spart.

DATA: wa_matlist TYPE tp_matlist.

DATA: wa_bap1ret2 TYPE tp_bapiret2.

***************************************************************************

  • Work Area for above stated Internal Tables for qsp1003 *

***************************************************************************

DATA: wa_qsp1003 TYPE tp_qsp1003.

DATA: wa_knuma2 TYPE tp_knuma2.

DATA: wa TYPE zsd_sp_prodlist_st.

DATA: wa_final TYPE tp_final.

----


  • Misc working variables for qsp1001 *

----


DATA: z_qsp1001_code(02) TYPE c VALUE '01'.

DATA: z_qsp1001_rec_id(02) TYPE c VALUE '01'.

DATA: z_qsp1001_last_maint_date(08) TYPE c .

DATA: z_qsp1001_company_code(02) TYPE c VALUE '08'.

DATA: z_qsp1001_version_num(02) TYPE c VALUE '01'.

DATA: z_qsp1001_sales_office(02) TYPE c VALUE ' '.

DATA: z_qsp1001_dlr_type_code(03) TYPE c VALUE 'ALL'.

DATA: z_filler(15) TYPE c VALUE ' '.

DATA: z_qsp1001_dlr_type_flag(01) TYPE c VALUE 'Y'.

DATA: z_qsp1001_sales_pgm_type(02) TYPE c VALUE ' '.

DATA: z_qsp1001_sales_pgm_bulletin(15) TYPE c VALUE ' '.

DATA: z_qsp1001_spdemo_pgm_ind(01) TYPE c VALUE ' '.

DATA: filenam TYPE string VALUE 'C:\Documents and Settings\Administrator\Desktop\QSP1111.txt'.

DATA: qsp1001_pr_reserve_percent(05) TYPE p.

DATA: qsp1001_pr_reserve_percenx(05) TYPE n.

DATA: qsp1001_pr_reserve_percent1(05) TYPE c.

DATA: qsp1001_pr_bonus_percent(05) TYPE p.

DATA: qsp1001_pr_bonus_percenx(05) TYPE n.

DATA: qsp1001_pr_bonus_percent1(05) TYPE c.

DATA: qsp1001_pr_bonus_amount(08) TYPE p.

DATA: qsp1001_pr_bonus_amounx(08) TYPE n.

DATA: qsp1001_pr_bonus_amount1(08) TYPE c.

DATA: qsp1001_co_op_percent_per_uni(05) TYPE p.

DATA: qsp1001_co_op_percent_per_unix(05) TYPE n.

DATA: qsp1001_co_op_percent_per_unit(05) TYPE c.

DATA: qsp1001_yamaha_contr_percen(05) TYPE p.

DATA: qsp1001_yamaha_contr_percenx(05) TYPE n.

DATA: qsp1001_yamaha_contr_percent(05) TYPE c.

----


  • Misc working variables for qsp1002 *

----


DATA: z_qsp1002_last_maint_date(08) TYPE c .

DATA: filenam1 TYPE string VALUE 'C:\Documents and Settings\Administrator\Desktop\QSP1222.txt'.

----


  • Misc working variables for qsp1003 *

----


DATA: z_qsp1003_last_maint_date(08) TYPE c .

DATA: filenam2 TYPE string VALUE 'C:\Documents and Settings\Administrator\Desktop\QSP1333.txt'.

*DATA: v1(08) TYPE c.

*DATA: v2(08) TYPE c.

*DATA: v1 TYPE num2.

*DATA: v2 TYPE num2.

=========================================================================

  • Selection screen *

=========================================================================

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.

SELECT-OPTIONS: s_vkorg FOR kona-vkorg OBLIGATORY.

SELECT-OPTIONS: s_bosta FOR kona-bosta OBLIGATORY.

SELECT-OPTIONS: s_datab FOR wa-zzmod_year OBLIGATORY.

SELECTION-SCREEN: END OF BLOCK b1.

SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.

PARAMETERS: p_qs1001 TYPE rlgrap-filename DEFAULT 'QSPPN01.PQSP010D.QSP1001.TXT' OBLIGATORY.

PARAMETERS: p_qs1002 TYPE rlgrap-filename DEFAULT 'QSPPN02.PQSP020D.QSP1002.TXT' OBLIGATORY.

PARAMETERS: p_qs1003 TYPE rlgrap-filename DEFAULT 'QSPPN03.PQSP030D.QSP1003.TXT' OBLIGATORY.

SELECTION-SCREEN: END OF BLOCK b2.

----


*INITIALIZATION. *

----


INITIALIZATION.

z_qsp1001_last_maint_date = sy-datum.

z_qsp1002_last_maint_date = sy-datum.

z_qsp1003_last_maint_date = sy-datum.

qsp1001_pr_reserve_percenx = qsp1001_pr_reserve_percent.

qsp1001_pr_reserve_percent1 = qsp1001_pr_reserve_percenx.

qsp1001_pr_bonus_percenx = qsp1001_pr_bonus_percent.

qsp1001_pr_bonus_percent1 = qsp1001_pr_bonus_percenx.

qsp1001_pr_bonus_amounx = qsp1001_pr_bonus_amount.

qsp1001_pr_bonus_amount = qsp1001_pr_bonus_amounx.

qsp1001_co_op_percent_per_unix = qsp1001_co_op_percent_per_uni.

qsp1001_co_op_percent_per_unit = qsp1001_co_op_percent_per_unix.

qsp1001_yamaha_contr_percenx = qsp1001_yamaha_contr_percen.

qsp1001_yamaha_contr_percent = qsp1001_yamaha_contr_percenx.

----


  • At selection-screen on for files qs1001,qs1002,qs1003 *

----


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_qs1001.

PERFORM s1_ps1001_f4_help.

PERFORM s2_ps1002_f4_help.

PERFORM s3_ps1002_f4_help.

----


  • Start-of-selection- *

----


START-OF-SELECTION.

PERFORM file_qsp1001_data_retrieval.

PERFORM file_qsp1002_data_retrieval.

PERFORM file_qsp1003_data_retrieval.

END-OF-SELECTION.

PERFORM file_qsp1001_data_save_app_svr.

PERFORM file_qsp1002_data_save_app_svr.

PERFORM file_qsp1003_data_save_app_svr.

PERFORM data_download.

PERFORM data_download_qsp1002.

PERFORM data_download_qsp1003.

&----


*& Form file_qsp1001_data_retrieval

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM file_qsp1001_data_retrieval .

SELECT zz_actdat FROM kona INTO TABLE it_zz_actdat

WHERE vkorg IN s_vkorg

AND bosta IN s_bosta

AND datab IN s_datab.

LOOP AT it_zz_actdat INTO wa_zz_actdat.

wa_qsp1001-qsp1001_approved_date = wa_zz_actdat-zz_actdat.

APPEND wa_qsp1001 TO it_qsp1001.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT vkbur FROM kona INTO TABLE it_vkbur

WHERE vkorg IN s_vkorg

AND bosta IN s_bosta

AND datab IN s_datab.

READ TABLE it_vkbur INDEX sy-tabix .

CASE it_vkbur-vkbur.

WHEN 'YMTS'.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_sales_office = '10'.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_office.

CLEAR wa_qsp1001.

ENDLOOP.

WHEN 'YMRN'.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_sales_office = '20'.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_office.

CLEAR wa_qsp1001.

ENDLOOP.

WHEN 'YWTC'.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_sales_office = '30'.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_office.

CLEAR wa_qsp1001.

ENDLOOP.

ENDCASE.

SELECT knuma FROM kona INTO TABLE it_knuma

WHERE vkorg IN s_vkorg

AND bosta IN s_bosta

AND datab IN s_datab.

.

LOOP AT it_knuma INTO wa_knuma.

wa_qsp1001-qsp1001_sales_pgm_number = wa_knuma-knuma.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_number.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_corp_code = z_qsp1001_code.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_corp_code.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_rec_id = z_qsp1001_rec_id.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_rec_id.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_last_maint_date = z_qsp1001_last_maint_date.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_last_maint_date.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_company_code = z_qsp1001_company_code.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_company_code.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_version_num = z_qsp1001_version_num.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_version_num.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zz_abrex FROM kona INTO TABLE it_zz_abrex

WHERE vkorg IN s_vkorg

AND bosta IN s_bosta

AND datab IN s_datab.

.

LOOP AT it_zz_abrex INTO wa_zz_abrex.

wa_qsp1001-qsp1001_sales_pgm_desc = wa_zz_abrex-zz_abrex.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_desc.

APPEND wa_qsp1001 TO it_qsp1001.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT datab FROM kona INTO TABLE it_datab

WHERE vkorg IN s_vkorg

AND bosta IN s_bosta

AND datab IN s_datab.

LOOP AT it_datab INTO wa_datab.

wa_qsp1001-qsp1001_sales_pgm_beg_date = wa_datab-datab.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_beg_date.

APPEND wa_qsp1001 TO it_qsp1001.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT datbi FROM kona INTO TABLE it_datbi

WHERE vkorg IN s_vkorg

AND bosta IN s_bosta

AND datab IN s_datab.

LOOP AT it_datbi INTO wa_datbi.

wa_qsp1001-qsp1001_sales_pgm_end_date = wa_datbi-datbi.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_end_date.

APPEND wa_qsp1001 TO it_qsp1001.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT datbi FROM kona INTO TABLE it_datbi1

WHERE vkorg IN s_vkorg

AND bosta IN s_bosta

AND datab IN s_datab.

LOOP AT it_datbi1 INTO wa_datbi1.

wa_qsp1001-qsp1001_sales_pgm_grace_date = wa_datbi1-datbi.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_grace_date.

APPEND wa_qsp1001 TO it_qsp1001.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_dlr_type_code = z_qsp1001_dlr_type_code.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_dlr_type_code.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-filler = z_filler.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING filler.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_dlr_type_flag = z_qsp1001_dlr_type_flag.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_dlr_type_flag.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zz_psts FROM kona INTO TABLE it_zz_psts

WHERE vkorg IN s_vkorg

AND bosta IN s_bosta

AND datab IN s_datab.

LOOP AT it_zz_psts INTO wa_zz_psts.

wa_qsp1001-qsp1001_sales_program_status = wa_zz_psts-zz_psts.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_program_status.

APPEND wa_qsp1001 TO it_qsp1001.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT dftwty FROM zsd_sp_alwd_wty INTO TABLE it_dftwty.

LOOP AT it_dftwty INTO wa_dftwty.

wa_qsp1001-qsp1001_warranty_code = wa_dftwty-dftwty.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_warranty_code.

APPEND wa_qsp1001 TO it_qsp1001.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_sales_pgm_type = z_qsp1001_sales_pgm_type.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_type.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_sales_pgm_bulletin = z_qsp1001_sales_pgm_bulletin.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_bulletin.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zz_sptype FROM kona INTO TABLE it_zz_sptype

WHERE vkorg IN s_vkorg

AND bosta IN s_bosta

AND datab IN s_datab.

READ TABLE it_zz_sptype INDEX sy-tabix .

IF it_zz_sptype-zz_sptype = 'GEN'.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_prepaid_frt_ind = 'Y'.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_prepaid_frt_ind.

CLEAR wa_qsp1001.

ENDLOOP.

ELSE.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_prepaid_frt_ind = 'D'.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_prepaid_frt_ind.

CLEAR wa_qsp1001.

ENDLOOP.

ENDIF.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_spdemo_pgm_ind = z_qsp1001_spdemo_pgm_ind.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_spdemo_pgm_ind.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zterm FROM zsd_sp_alwd_term INTO TABLE it_zterm.

LOOP AT it_zterm INTO wa_zterm.

wa_qsp1001-qsp1001_sales_pgm_term1 = wa_zterm-zterm.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_term1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datab INTO wa_datab.

wa_qsp1001-qsp1001_sales_pgm_trm_frm_dat1 = wa_datab-datab.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_frm_dat1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datbi INTO wa_datbi.

wa_qsp1001-qsp1001_sales_pgm_trm_to_dat1 = wa_datbi-datbi.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_to_dat1.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zterm FROM zsd_sp_alwd_term INTO TABLE it_zterm.

LOOP AT it_zterm INTO wa_zterm.

wa_qsp1001-qsp1001_sales_pgm_term2 = wa_zterm-zterm.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_term2.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datab INTO wa_datab.

wa_qsp1001-qsp1001_sales_pgm_trm_frm_dat2 = wa_datab-datab.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_frm_dat2.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datbi INTO wa_datbi.

wa_qsp1001-qsp1001_sales_pgm_trm_to_dat2 = wa_datbi-datbi.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_to_dat2.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zterm FROM zsd_sp_alwd_term INTO TABLE it_zterm.

LOOP AT it_zterm INTO wa_zterm.

wa_qsp1001-qsp1001_sales_pgm_term3 = wa_zterm-zterm.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_term3.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datab INTO wa_datab.

wa_qsp1001-qsp1001_sales_pgm_trm_frm_dat3 = wa_datab-datab.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_frm_dat3.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datbi INTO wa_datbi.

wa_qsp1001-qsp1001_sales_pgm_trm_to_dat3 = wa_datbi-datbi.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_to_dat3.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zterm FROM zsd_sp_alwd_term INTO TABLE it_zterm.

LOOP AT it_zterm INTO wa_zterm.

wa_qsp1001-qsp1001_sales_pgm_term4 = wa_zterm-zterm.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_term4.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datab INTO wa_datab.

wa_qsp1001-qsp1001_sales_pgm_trm_frm_dat4 = wa_datab-datab.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_frm_dat4.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datbi INTO wa_datbi.

wa_qsp1001-qsp1001_sales_pgm_trm_to_dat4 = wa_datbi-datbi.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_to_dat4.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zterm FROM zsd_sp_alwd_term INTO TABLE it_zterm.

LOOP AT it_zterm INTO wa_zterm.

wa_qsp1001-qsp1001_sales_pgm_term5 = wa_zterm-zterm.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_term5.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datab INTO wa_datab.

wa_qsp1001-qsp1001_sales_pgm_trm_frm_dat5 = wa_datab-datab.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_frm_dat5.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datbi INTO wa_datbi.

wa_qsp1001-qsp1001_sales_pgm_trm_to_dat5 = wa_datbi-datbi.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_to_dat5.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zterm FROM zsd_sp_alwd_term INTO TABLE it_zterm.

LOOP AT it_zterm INTO wa_zterm.

wa_qsp1001-qsp1001_sales_pgm_term6 = wa_zterm-zterm.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_term6.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datab INTO wa_datab.

wa_qsp1001-qsp1001_sales_pgm_trm_frm_dat6 = wa_datab-datab.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_frm_dat6.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datbi INTO wa_datbi.

wa_qsp1001-qsp1001_sales_pgm_trm_to_dat6 = wa_datbi-datbi.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_to_dat6.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zterm FROM zsd_sp_alwd_term INTO TABLE it_zterm.

LOOP AT it_zterm INTO wa_zterm.

wa_qsp1001-qsp1001_sales_pgm_term7 = wa_zterm-zterm.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_term7.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datab INTO wa_datab.

wa_qsp1001-qsp1001_sales_pgm_trm_frm_dat7 = wa_datab-datab.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_frm_dat7.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datbi INTO wa_datbi.

wa_qsp1001-qsp1001_sales_pgm_trm_to_dat7 = wa_datbi-datbi.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_to_dat7.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zterm FROM zsd_sp_alwd_term INTO TABLE it_zterm.

LOOP AT it_zterm INTO wa_zterm.

wa_qsp1001-qsp1001_sales_pgm_term8 = wa_zterm-zterm.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_term8.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datab INTO wa_datab.

wa_qsp1001-qsp1001_sales_pgm_trm_frm_dat8 = wa_datab-datab.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_frm_dat8.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datbi INTO wa_datbi.

wa_qsp1001-qsp1001_sales_pgm_trm_to_dat8 = wa_datbi-datbi.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_to_dat8.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zterm FROM zsd_sp_alwd_term INTO TABLE it_zterm.

LOOP AT it_zterm INTO wa_zterm.

wa_qsp1001-qsp1001_sales_pgm_term9 = wa_zterm-zterm.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_term9.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datab INTO wa_datab.

wa_qsp1001-qsp1001_sales_pgm_trm_frm_dat9 = wa_datab-datab.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_frm_dat9.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datbi INTO wa_datbi.

wa_qsp1001-qsp1001_sales_pgm_trm_to_dat9 = wa_datbi-datbi.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_to_dat9.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zterm FROM zsd_sp_alwd_term INTO TABLE it_zterm.

LOOP AT it_zterm INTO wa_zterm.

wa_qsp1001-qsp1001_sales_pgm_term10 = wa_zterm-zterm.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_term10.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datab INTO wa_datab.

wa_qsp1001-qsp1001_sales_pgm_trm_frm_da10 = wa_datab-datab.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_frm_da10.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datbi INTO wa_datbi.

wa_qsp1001-qsp1001_sales_pgm_trm_to_da10 = wa_datbi-datbi.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_to_da10.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zterm FROM zsd_sp_alwd_term INTO TABLE it_zterm.

LOOP AT it_zterm INTO wa_zterm.

wa_qsp1001-qsp1001_sales_pgm_term11 = wa_zterm-zterm.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_term11.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datab INTO wa_datab.

wa_qsp1001-qsp1001_sales_pgm_trm_frm_da11 = wa_datab-datab.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_frm_da11.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datbi INTO wa_datbi.

wa_qsp1001-qsp1001_sales_pgm_trm_to_da11 = wa_datbi-datbi.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_to_da11.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zterm FROM zsd_sp_alwd_term INTO TABLE it_zterm.

LOOP AT it_zterm INTO wa_zterm.

wa_qsp1001-qsp1001_sales_pgm_term12 = wa_zterm-zterm.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_term12.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datab INTO wa_datab.

wa_qsp1001-qsp1001_sales_pgm_trm_frm_da12 = wa_datab-datab.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_frm_da12.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datbi INTO wa_datbi.

wa_qsp1001-qsp1001_sales_pgm_trm_to_da12 = wa_datbi-datbi.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_to_da12.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zterm FROM zsd_sp_alwd_term INTO TABLE it_zterm.

LOOP AT it_zterm INTO wa_zterm.

wa_qsp1001-qsp1001_sales_pgm_def_term = wa_zterm-zterm.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_def_term.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datab INTO wa_datab.

wa_qsp1001-qsp1001_date_of_order_begin = wa_datab-datab.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_date_of_order_begin.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datbi INTO wa_datbi.

wa_qsp1001-qsp1001_date_of_order_end = wa_datbi-datbi.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_date_of_order_end.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zz_cdpf FROM kona INTO TABLE it_zz_cdpf

WHERE vkorg IN s_vkorg

AND bosta IN s_bosta

AND datab IN s_datab.

LOOP AT it_zz_cdpf INTO wa_zz_cdpf.

wa_qsp1001-qsp1001_sales_pgm_cur_flag = wa_zz_cdpf-zz_cdpf.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_cur_flag.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zz_prsdt FROM kona INTO TABLE it_zz_prsdt

WHERE vkorg IN s_vkorg

AND bosta IN s_bosta

AND datab IN s_datab.

LOOP AT it_zz_prsdt INTO wa_zz_prsdt.

wa_qsp1001-qsp1001_sales_pgm_as_of_date = wa_zz_prsdt-zz_prsdt.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_as_of_date.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001.

wa_qsp1001-filler1 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING filler1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_uspamfe_sls_pgm = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_uspamfe_sls_pgm.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_datbi INTO wa_datbi.

wa_qsp1001-qsp1001_orig_order_cutoff_date = wa_datbi-datbi.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_orig_order_cutoff_date.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_sales_pgm_def_duoe = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_def_duoe.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_sales_pgm_trm_duoe_ind = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sales_pgm_trm_duoe_ind.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_benefit_dist1 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_benefit_dist1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_benefit_dist2 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_benefit_dist2.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_benefit_dist3 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_benefit_dist3.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_benefit_dist4 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_benefit_dist4.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_benefit_dist5 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_benefit_dist5.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_benefit_dist6 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_benefit_dist6.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_benefit_app_flag = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_benefit_app_flag.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_report_freq_wkly = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_report_freq_wkly.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_report_freq_bi_mo = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_report_freq_bi_mo.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_report_freq_mthly = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_report_freq_mthly.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_end_of_prog_rpt_date = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_end_of_prog_rpt_date.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_special_pgm_rpt_date = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_special_pgm_rpt_date.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-10_qsp1001_process_date_from1 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING 10_qsp1001_process_date_from1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-10_qsp1001_process_date_to1 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING 10_qsp1001_process_date_to1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-10_qsp1001_process_date_grace1 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING 10_qsp1001_process_date_grace1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-10_qsp1001_process_date_from2 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING 10_qsp1001_process_date_from2.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-10_qsp1001_process_date_to2 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING 10_qsp1001_process_date_to2.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-10_qsp1001_process_date_grace2 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING 10_qsp1001_process_date_grace2.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-10_qsp1001_process_date_from3 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING 10_qsp1001_process_date_from3.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-10_qsp1001_process_date_to3 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING 10_qsp1001_process_date_to3.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-10_qsp1001_process_date_grace3 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING 10_qsp1001_process_date_grace3.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-10_qsp1001_process_date_from4 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING 10_qsp1001_process_date_from4.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-10_qsp1001_process_date_to4 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING 10_qsp1001_process_date_to4.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-10_qsp1001_process_date_grace4 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING 10_qsp1001_process_date_grace4.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_assoc_pgm_grp1 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_assoc_pgm_grp1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_assoc_pgm_grp2 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_assoc_pgm_grp2.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_assoc_pgm_grp3 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_assoc_pgm_grp3.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_assoc_pgm_grp4 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_assoc_pgm_grp4.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_assoc_pgm_grp5 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_assoc_pgm_grp5.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_assoc_pgm_grp6 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_assoc_pgm_grp6.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_assoc_pgm_grp7 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_assoc_pgm_grp7.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_assoc_pgm_grp8 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_assoc_pgm_grp8.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_assoc_pgm_grp9 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_assoc_pgm_grp9.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_assoc_pgm_grp10 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_assoc_pgm_grp10.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_assoc_pgm_grp11 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_assoc_pgm_grp11.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_assoc_pgm_grp12 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_assoc_pgm_grp12.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-10_qsp1001_inc_exc_flag1 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING 10_qsp1001_inc_exc_flag1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-10_qsp1001_sales_pgm_rel_num1 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING 10_qsp1001_sales_pgm_rel_num1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_pr_reserve_pct_sn1 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_pr_reserve_pct_sn1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_pr_reserve_percent1 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_pr_reserve_percent1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_pr_bonus_pct_sn1 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_pr_bonus_pct_sn1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_pr_bonus_percent1 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_pr_bonus_percent1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_pr_bonus_amount_sn1 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_pr_bonus_amount_sn1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_pr_bonus_amount1 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_pr_bonus_amount1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_spec_sls_pgm = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_spec_sls_pgm.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_co_op_pct_per_unit_sn = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_co_op_pct_per_unit_sn.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_co_op_percent_per_unit = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_co_op_percent_per_unit.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_yamaha_contr_pct_sn = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_yamaha_contr_pct_sn.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_yamaha_contr_percent = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_yamaha_contr_percent.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_prepaid_frt_min_qty = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_prepaid_frt_min_qty.

CLEAR wa_qsp1001.

ENDLOOP.

SELECT zz_vdf FROM kona INTO TABLE it_zz_vdf

WHERE vkorg IN s_vkorg

AND bosta IN s_bosta

AND datab IN s_datab.

.

READ TABLE it_zz_vdf INDEX sy-tabix .

IF it_zz_vdf-zz_vdf = ''.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_duoe_pgm_ind = 'N'.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_duoe_pgm_ind.

CLEAR wa_qsp1001.

ENDLOOP.

ELSE.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_duoe_pgm_ind = 'Y'.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_duoe_pgm_ind.

CLEAR wa_qsp1001.

ENDLOOP.

ENDIF.

LOOP AT it_zz_abrex INTO wa_zz_abrex.

wa_qsp1001-qsp1001_duoe_pgm_desc_1 = wa_zz_abrex-zz_abrex.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_duoe_pgm_desc_1.

APPEND wa_qsp1001 TO it_qsp1001.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_duoe_pgm_desc_2 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_duoe_pgm_desc_2.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_ie_code = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_ie_code.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_sa_value1 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sa_value1.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_sa_value2 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sa_value2.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_sa_value3 = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_sa_value3.

CLEAR wa_qsp1001.

ENDLOOP.

LOOP AT it_qsp1001 INTO wa_qsp1001 .

wa_qsp1001-qsp1001_last_byte = ' '.

MODIFY it_qsp1001 FROM wa_qsp1001 INDEX sy-tabix TRANSPORTING qsp1001_last_byte.

CLEAR wa_qsp1001.

ENDLOOP.

ENDFORM. " file_qsp1001_data_retrieval

&----


*& Form data_download

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM data_download .

  • CALL FUNCTION 'GUI_DOWNLOAD'

  • EXPORTING

  • BIN_FILESIZE =

  • filename = filenam

    • FILETYPE = 'ASC'

    • APPEND = ' '

    • WRITE_FIELD_SEPARATOR = ' '

    • HEADER = '00'

    • TRUNC_TRAILING_BLANKS = ' '

    • WRITE_LF = 'X'

    • COL_SELECT = ' '

    • COL_SELECT_MASK = ' '

    • DAT_MODE = ' '

    • CONFIRM_OVERWRITE = ' '

    • NO_AUTH_CHECK = ' '

    • CODEPAGE = ' '

    • IGNORE_CERR = ABAP_TRUE

    • REPLACEMENT = '#'

    • WRITE_BOM = ' '

    • TRUNC_TRAILING_BLANKS_EOL = 'X'

    • WK1_N_FORMAT = ' '

    • WK1_N_SIZE = ' '

    • WK1_T_FORMAT = ' '

    • WK1_T_SIZE = ' '

    • WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE

    • SHOW_TRANSFER_STATUS = ABAP_TRUE

    • IMPORTING

    • FILELENGTH =

  • TABLES

  • data_tab = it_qsp1001

    • FIELDNAMES =

    • EXCEPTIONS

    • FILE_WRITE_ERROR = 1

    • NO_BATCH = 2

    • GUI_REFUSE_FILETRANSFER = 3

    • INVALID_TYPE = 4

    • NO_AUTHORITY = 5

    • UNKNOWN_ERROR = 6

    • HEADER_NOT_ALLOWED = 7

    • SEPARATOR_NOT_ALLOWED = 8

    • FILESIZE_NOT_ALLOWED = 9

    • HEADER_TOO_LONG = 10

    • DP_ERROR_CREATE = 11

    • DP_ERROR_SEND = 12

    • DP_ERROR_WRITE = 13

    • UNKNOWN_DP_ERROR = 14

    • ACCESS_DENIED = 15

    • DP_OUT_OF_MEMORY = 16

    • DISK_FULL = 17

    • DP_TIMEOUT = 18

    • FILE_NOT_FOUND = 19

    • DATAPROVIDER_EXCEPTION = 20

    • CONTROL_FLUSH_ERROR = 21

    • OTHERS = 22

  • .

  • IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

  • *

    ENDFORM. " data_download

    &----


    *& Form file_qsp1002_data_retrieval

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM file_qsp1002_data_retrieval .

    SELECT knuma FROM kona INTO TABLE it_knuma1

    WHERE vkorg IN s_vkorg

    AND bosta IN s_bosta

    AND datab IN s_datab.

    LOOP AT it_knuma1 INTO wa_knuma1.

    wa_qsp1002-qsp1002_sales_pgm_number = wa_knuma1-knuma.

    APPEND wa_qsp1002 TO it_qsp1002.

    CLEAR wa_qsp1002.

    ENDLOOP.

    LOOP AT it_qsp1002 INTO wa_qsp1002 .

    wa_qsp1002-qsp1002_record_status = ' '.

    MODIFY it_qsp1002 FROM wa_qsp1002 INDEX sy-tabix TRANSPORTING qsp1002_record_status.

    CLEAR wa_qsp1002.

    ENDLOOP.

    LOOP AT it_qsp1002 INTO wa_qsp1002 .

    wa_qsp1002-qsp1002_corp_code = '01'.

    MODIFY it_qsp1002 FROM wa_qsp1002 INDEX sy-tabix TRANSPORTING qsp1002_corp_code.

    CLEAR wa_qsp1002.

    ENDLOOP.

    LOOP AT it_qsp1002 INTO wa_qsp1002 .

    wa_qsp1002-qsp1002_rec_id = '02'.

    MODIFY it_qsp1002 FROM wa_qsp1002 INDEX sy-tabix TRANSPORTING qsp1002_corp_code.

    CLEAR wa_qsp1002.

    ENDLOOP.

    LOOP AT it_qsp1002 INTO wa_qsp1002 .

    wa_qsp1002-qsp1002_rec_id = '1'.

    MODIFY it_qsp1002 FROM wa_qsp1002 INDEX sy-tabix TRANSPORTING qsp1002_corp_code.

    CLEAR wa_qsp1002.

    ENDLOOP.

    SELECT spart FROM mara INTO TABLE it_spart

    WHERE datab IN s_datab.

    LOOP AT it_spart INTO wa_spart.

    wa_qsp1002-qsp1002_product_line = wa_spart-spart.

    MODIFY it_qsp1002 FROM wa_qsp1002 INDEX sy-tabix TRANSPORTING qsp1002_product_line.

    CLEAR wa_qsp1002.

    ENDLOOP.

    LOOP AT it_qsp1002 INTO wa_qsp1002 .

    wa_qsp1002-division_filler2 = '0'.

    MODIFY it_qsp1002 FROM wa_qsp1002 INDEX sy-tabix TRANSPORTING division_filler2.

    CLEAR wa_qsp1002.

    ENDLOOP.

    LOOP AT it_qsp1002 INTO wa_qsp1002 .

    wa_qsp1002-qsp1002_last_maint_date = z_qsp1002_last_maint_date .

    MODIFY it_qsp1002 FROM wa_qsp1002 INDEX sy-tabix TRANSPORTING qsp1002_last_maint_date.

    CLEAR wa_qsp1002.

    ENDLOOP.

    LOOP AT it_qsp1002 INTO wa_qsp1002 .

    wa_qsp1002-qsp1002_company_code = '08' .

    MODIFY it_qsp1002 FROM wa_qsp1002 INDEX sy-tabix TRANSPORTING qsp1002_company_code.

    CLEAR wa_qsp1002.

    ENDLOOP.

    LOOP AT it_qsp1002 INTO wa_qsp1002 .

    wa_qsp1002-qsp1002_sales_pgm_model_flag = 'N'.

    MODIFY it_qsp1002 FROM wa_qsp1002 INDEX sy-tabix TRANSPORTING qsp1002_sales_pgm_model_flag.

    CLEAR wa_qsp1002.

    ENDLOOP.

    LOOP AT it_qsp1002 INTO wa_qsp1002 .

    wa_qsp1002-qsp1002_oem_special_flag = 'N'.

    MODIFY it_qsp1002 FROM wa_qsp1002 INDEX sy-tabix TRANSPORTING qsp1002_oem_special_flag.

    CLEAR wa_qsp1002.

    ENDLOOP.

    LOOP AT it_qsp1002 INTO wa_qsp1002 .

    wa_qsp1002-qsp1002_last_byte = 'X'.

    MODIFY it_qsp1002 FROM wa_qsp1002 INDEX sy-tabix TRANSPORTING qsp1002_last_byte.

    CLEAR wa_qsp1002.

    ENDLOOP.

    ENDFORM. " file_qsp1002_data_retrieval

    &----


    *& Form data_download_qsp1002

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM data_download_qsp1002 .

    *CALL FUNCTION 'GUI_DOWNLOAD'

    • EXPORTING

    • BIN_FILESIZE =

  • filename = filenam1

    • FILETYPE = 'ASC'

    • APPEND = ' '

    • WRITE_FIELD_SEPARATOR = ' '

    • HEADER = '00'

    • TRUNC_TRAILING_BLANKS = ' '

    • WRITE_LF = 'X'

    • COL_SELECT = ' '

    • COL_SELECT_MASK = ' '

    • DAT_MODE = ' '

    • CONFIRM_OVERWRITE = ' '

    • NO_AUTH_CHECK = ' '

    • CODEPAGE = ' '

    • IGNORE_CERR = ABAP_TRUE

    • REPLACEMENT = '#'

    • WRITE_BOM = ' '

    • TRUNC_TRAILING_BLANKS_EOL = 'X'

    • WK1_N_FORMAT = ' '

    • WK1_N_SIZE = ' '

    • WK1_T_FORMAT = ' '

    • WK1_T_SIZE = ' '

    • WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE

    • SHOW_TRANSFER_STATUS = ABAP_TRUE

    • IMPORTING

    • FILELENGTH =

  • tables

  • data_tab = it_qsp1002

    • FIELDNAMES =

    • EXCEPTIONS

    • FILE_WRITE_ERROR = 1

    • NO_BATCH = 2

    • GUI_REFUSE_FILETRANSFER = 3

    • INVALID_TYPE = 4

    • NO_AUTHORITY = 5

    • UNKNOWN_ERROR = 6

    • HEADER_NOT_ALLOWED = 7

    • SEPARATOR_NOT_ALLOWED = 8

    • FILESIZE_NOT_ALLOWED = 9

    • HEADER_TOO_LONG = 10

    • DP_ERROR_CREATE = 11

    • DP_ERROR_SEND = 12

    • DP_ERROR_WRITE = 13

    • UNKNOWN_DP_ERROR = 14

    • ACCESS_DENIED = 15

    • DP_OUT_OF_MEMORY = 16

    • DISK_FULL = 17

    • DP_TIMEOUT = 18

    • FILE_NOT_FOUND = 19

    • DATAPROVIDER_EXCEPTION = 20

    • CONTROL_FLUSH_ERROR = 21

    • OTHERS = 22

  • .

  • *IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    *ENDIF.

    ENDFORM. " data_download_qsp1002

    &----


    *& Form file_qsp1003_data_retrieval

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM file_qsp1003_data_retrieval .

    SELECT knuma FROM kona INTO TABLE it_knuma2

    WHERE vkorg IN s_vkorg

    AND bosta IN s_bosta

    AND datab IN s_datab.

    LOOP AT it_knuma2 INTO wa_knuma2.

    wa_qsp1003-qsp1003_sales_pgm_number = wa_knuma2-knuma.

    APPEND wa_qsp1003 TO it_qsp1003.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-qsp1003_record_status = ' ' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING qsp1003_record_status.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-qsp1003_corp_code = '01' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING qsp1003_corp_code.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-qsp1003_rec_id = '02' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING qsp1003_rec_id.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-division_filer1 = '1' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING division_filer1.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_spart INTO wa_spart.

    wa_qsp1003-qsp1003_product_line = wa_spart-spart.

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING qsp1003_product_line.

    CLEAR wa_qsp1002.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-division_filler2 = '0' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING division_filler2.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-qsp1003_last_maint_date = z_qsp1003_last_maint_date .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING qsp1003_last_maint_date.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-qsp1003_company_code = '08' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING qsp1003_company_code.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind1 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind1.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind2 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind2.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind3 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind3.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind4 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind4.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind5 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind5.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind6 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind6.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind7 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind7.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind8 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind8.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind9 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind9.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind10 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind1.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind1 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind10.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind11 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind11.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind12 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind12.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind13 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind13.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind14 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind14.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind15 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind15.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind16 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind16.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind17 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind17.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind18 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind18.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind19 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind19.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind20 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind21.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind22 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind22.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind23 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind23.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind24 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind24.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind25 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind25.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind26 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind26.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind27 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind27.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind28 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind28.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind29 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind29.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind30 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind30.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind31 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind31.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind32 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind32.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind33 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind33.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind34 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind34.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind35 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind35.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-10_qsp1003_inc_exc_ind36 = 'I' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING 10_qsp1003_inc_exc_ind36.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_qsp1003 INTO wa_qsp1003 .

    wa_qsp1003-qsp1003_last_byte = 'X' .

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING qsp1003_last_byte.

    CLEAR wa_qsp1003.

    ENDLOOP.

    ***************************************************************************************************************************************************************

    select knuma spart datab datbi from kona into corresponding fields of table it_final.

    • where vkorg in s_vkorg

    • and bosta in s_bosta

    • and datab in s_datab.

    • LOOP AT it_knuma INTO wa_knuma.

    • wa_final-knuma = wa_knuma-knuma.

    • MODIFY it_final FROM wa_final INDEX sy-tabix TRANSPORTING knuma.

    • CLEAR wa_final.

    • ENDLOOP.

    *

    • LOOP AT it_spart INTO wa_spart.

    • wa_final-spart = wa_spart-spart.

    • MODIFY it_final FROM wa_final INDEX sy-tabix TRANSPORTING spart.

    • CLEAR wa_final.

    • ENDLOOP.

    *

    *

    • LOOP AT it_datab INTO wa_datab.

    • wa_final-v1 = wa_datab-datab.

    • MODIFY it_final FROM wa_final INDEX sy-tabix TRANSPORTING v1.

    • CLEAR wa_final.

    • ENDLOOP.

    *

    • LOOP AT it_datbi INTO wa_datbi.

    • wa_final-v2 = wa_datbi-datbi.

    • MODIFY it_final FROM wa_final INDEX sy-tabix TRANSPORTING v2.

    • CLEAR wa_final.

    • ENDLOOP.

    LOOP AT it_final INTO wa_final.

    CALL FUNCTION 'ZSD_SP_GET_MATERIAL_LIST'

    EXPORTING

    sales_program = wa_final-knuma

    division = wa_final-spart

    models_from_last_x_yrs = wa_final-v1

    models_to_next_x_yrs = wa_final-v2

    IMPORTING

    material_list = it_matlist

    TABLES

    return = it_bapiret2.

    IF sy-subrc = 0.

    ENDIF.

    ENDLOOP.

    LOOP AT it_matlist INTO wa_matlist .

    wa_qsp1003-qsp1003_model_year_from = wa_matlist-zzmod_year .

    IF wa_qsp1003-qsp1003_model_year_from <> 0.

    wa_qsp1003-flag = 'I'.

    ELSE.

    wa_qsp1003-flag = ''.

    ENDIF.

    MODIFY it_qsp1003 FROM wa_qsp1003 INDEX sy-tabix TRANSPORTING qsp1003_model_year_from flag.

    CLEAR wa_qsp1003.

    ENDLOOP.

    LOOP AT it_matlist INTO wa_matlist.

    WRITE : / wa_matlist-zzmod_year.

    ENDLOOP.

    ENDFORM. " file_qsp1003_data_retrieval

    &----


    *& Form data_download_qsp1003

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM data_download_qsp1003 .

    • CALL FUNCTION 'GUI_DOWNLOAD'

    • EXPORTING

    • BIN_FILESIZE =

  • filename = filenam2

    • FILETYPE = 'ASC'

    • APPEND = ' '

    • WRITE_FIELD_SEPARATOR = ' '

    • HEADER = '00'

    • TRUNC_TRAILING_BLANKS = ' '

    • WRITE_LF = 'X'

    • COL_SELECT = ' '

    • COL_SELECT_MASK = ' '

    • DAT_MODE = ' '

    • CONFIRM_OVERWRITE = ' '

    • NO_AUTH_CHECK = ' '

    • CODEPAGE = ' '

    • IGNORE_CERR = ABAP_TRUE

    • REPLACEMENT = '#'

    • WRITE_BOM = ' '

    • TRUNC_TRAILING_BLANKS_EOL = 'X'

    • WK1_N_FORMAT = ' '

    • WK1_N_SIZE = ' '

    • WK1_T_FORMAT = ' '

    • WK1_T_SIZE = ' '

    • WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE

    • SHOW_TRANSFER_STATUS = ABAP_TRUE

    • IMPORTING

    • FILELENGTH =

  • TABLES

  • data_tab = it_qsp1003

    • FIELDNAMES =

    • EXCEPTIONS

    • FILE_WRITE_ERROR = 1

    • NO_BATCH = 2

    • GUI_REFUSE_FILETRANSFER = 3

    • INVALID_TYPE = 4

    • NO_AUTHORITY = 5

    • UNKNOWN_ERROR = 6

    • HEADER_NOT_ALLOWED = 7

    • SEPARATOR_NOT_ALLOWED = 8

    • FILESIZE_NOT_ALLOWED = 9

    • HEADER_TOO_LONG = 10

    • DP_ERROR_CREATE = 11

    • DP_ERROR_SEND = 12

    • DP_ERROR_WRITE = 13

    • UNKNOWN_DP_ERROR = 14

    • ACCESS_DENIED = 15

    • DP_OUT_OF_MEMORY = 16

    • DISK_FULL = 17

    • DP_TIMEOUT = 18

    • FILE_NOT_FOUND = 19

    • DATAPROVIDER_EXCEPTION = 20

    • CONTROL_FLUSH_ERROR = 21

    • OTHERS = 22

  • .

  • IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

  • ENDFORM. " data_download_qsp1003

    &----


    *& Form s1_ps1001_f4_help

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM s1_ps1001_f4_help .

    CALL FUNCTION 'NAVIGATION_FILENAME_HELP'

    EXPORTING

    default_path = '.'

    • MODE = 'O'

    • WITH_ENCODING =

    IMPORTING

    • RETURNCODE =

    selected_filename = p_qs1001

    • CHANGING

    • FILE_ENCODING =

    .

    IF p_qs1001 <> ''.

    filenam = p_qs1001.

    ENDIF.

    ENDFORM. " s1_ps1001_f4_help

    &----


    *& Form s2_ps1002_f4_help

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM s2_ps1002_f4_help .

    CALL FUNCTION 'NAVIGATION_FILENAME_HELP'

    EXPORTING

    default_path = '.'

    • MODE = 'O'

    • WITH_ENCODING =

    IMPORTING

    • RETURNCODE =

    selected_filename = p_qs1002

    • CHANGING

    • FILE_ENCODING =

    .

    IF p_qs1002 <> ''.

    filenam1 = p_qs1002.

    ENDIF.

    ENDFORM. " s2_ps1002_f4_help

    &----


    *& Form s3_ps1002_f4_help

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM s3_ps1002_f4_help .

    CALL FUNCTION 'NAVIGATION_FILENAME_HELP'

    EXPORTING

    default_path = '.'

    • MODE = 'O'

    • WITH_ENCODING =

    IMPORTING

    • RETURNCODE =

    selected_filename = p_qs1003

    • CHANGING

    • FILE_ENCODING =

    .

    IF p_qs1003 <> ''.

    filenam2 = p_qs1003.

    ENDIF.

    ENDFORM. " s3_ps1002_f4_help

    &----


    *& Form file_qsp1001_data_save_app_svr

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM file_qsp1001_data_save_app_svr .

    OPEN DATASET 'FILENAM' FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

    LOOP AT it_qsp1001.

    TRANSFER it_qsp1001 TO 'FILENAM'.

    ENDLOOP.

    CLOSE DATASET 'FILENAM'.

    ENDFORM. " file_qsp1001_data_save_app_svr

    &----


    *& Form file_qsp1002_data_save_app_svr

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM file_qsp1002_data_save_app_svr .

    • OPEN DATASET 'FILENAM1' FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

    • LOOP AT it_qsp1002.

    • TRANSFER it_qsp1002 TO 'FILENAM1'.

    • ENDLOOP.

    • CLOSE DATASET 'FILENAM1'.

    ENDFORM. " file_qsp1002_data_save_app_svr

    &----


    *& Form file_qsp1003_data_save_app_svr

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM file_qsp1003_data_save_app_svr .

    • OPEN DATASET 'FILENAM2' FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

    • LOOP AT it_qsp1003.

    • TRANSFER it_qsp1003 TO 'FILENAM2'.

    • ENDLOOP.

    • CLOSE DATASET 'FILENAM2'.

    ENDFORM. " file_qsp1003_data_save_app_svr

    thanks

    rahul