ZPR MM Create Material

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 28

*&---------------------------------------------------------------------*

*& Report ZPR_MM_CREATE_MATERIAL


*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
***********************************************************************
* Report : ZPR_MM_CREATE_MATERIAL *
* Description : Material Master Upload *
* Module : ZMM *
* Trans. code : ZMM01 *
* Created Date : 05.03.2019 *
* Author : Bhushan Mali *
* Consultant : Mikhilesh Tamboli
*
* Request # : S4DK900158
* Tested By : *
* Remarks : *
***********************************************************************
* Change History : *
***********************************************************************
* Description | Date | Author |Change *
* | | |Request No *
*---------------------------------------------------------------------*
* | | | *
*---------------------------------------------------------------------*
REPORT zpr_mm_create_material.

* Structure Declarations
TYPES : BEGIN OF ty_upload,
matnr TYPE String40,
mbrsh TYPE string,
mtart TYPE string,
plant TYPE string,
stge_loc TYPE string,
bwtar TYPE string,
sales_org TYPE string,
distr_chan TYPE string,
maktx TYPE string,
grun(500),
best(500),
sales(500),
* Basic Data
base_uom TYPE string , " Base Unit of Measure
matl_group TYPE string , " Material Group
extmatlgrp TYPE string , " External Material Group
old_mat_no TYPE string , " Old material number
dsn_office TYPE string , " Laboratory/design
office
document TYPE string , " Document number
(without document management system)
doc_type TYPE string , " Document type (without
Document Management system)
doc_vers TYPE string , " Document version
(without Document Management system)
doc_format TYPE string , " Page format of document
(without Document Management sys
doc_chg_no TYPE string , " Document change number
(without document management syst
page_no TYPE string , " Page number of document
(without Document Management sys
no_sheets TYPE string , " Number of sheets (BTCI)
basic_matl TYPE string , " Basic material (basic
constituent of a material) - obsol
std_descr TYPE string , " Industry Standard
Description (such as ANSI or ISO)
prod_memo TYPE string , " Production/inspection
memo
pageformat TYPE string , " Page Format of
Production Memo
gross_wt TYPE string , " Gross weight (BTCI)
net_weight TYPE string , " Net weight
unit_of_wt TYPE string , " stringWeight Unit
allwd_vol TYPE string , " stringVolume
pack_vo_un TYPE string , " stringVolume unit
size_dim TYPE string , " stringSize/dimensions
division TYPE string , " stringDivision
gen_item_cat TYPE string , " stringGeneral item
category group
numerator TYPE string , " stringNumerator for
Conversion to Base Units of Measure
denominatr TYPE string , " stringDenominator for
conversion to base units of measure
alt_unit TYPE string , " Alternative Unit of
Measure for Stockkeeping Unit
*SALES VIEW
sales_unit TYPE string , "
sal_status TYPE string , "
valid_from TYPE string , "
delyg_plnt TYPE string , "
cash_disc TYPE string , "
matl_stats TYPE string , "
item_cat TYPE string , "
mat_pr_grp TYPE string , "
acct_assgt TYPE string , "
tax_type_1 TYPE string , "
taxclass_1 TYPE string , "
tax_type_2 TYPE string , "
taxclass_2 TYPE string , "
tax_type_3 TYPE string , "
taxclass_3 TYPE string , "
tax_type_4 TYPE string , "
taxclass_4 TYPE string , "
tax_type_5 TYPE string , "
taxclass_5 TYPE string , "
tax_type_6 TYPE string , "
taxclass_6 TYPE string , "
tax_type_7 TYPE string , "
taxclass_7 TYPE string , "
tax_type_8 TYPE string , "
taxclass_8 TYPE string , "
tax_type_9 TYPE string , "
taxclass_9 TYPE string , "
matl_grp_1 TYPE string , "
matl_grp_2 TYPE string , "
matl_grp_3 TYPE string , "
matl_grp_4 TYPE string , "
matl_grp_5 TYPE string , "
* Sales : General/Plant
trans_grp TYPE string,
loadinggrp TYPE string,
availcheck TYPE string,
ctrl_code TYPE string,
* Purchasing View string ,
po_unit TYPE string,
pur_valkey TYPE string,
pur_group TYPE string,
po_gr_pr_time TYPE string,
sourcelist TYPE string,
pur_status TYPE string,
manu_mat TYPE string,
* MRP View
mrp_type TYPE string,
mrp_group TYPE string,
mrp_ctrler TYPE string,
lotsizekey TYPE string,
reorder_pt TYPE string,
fixed_lot TYPE string,
minlotsize TYPE string,
maxlotsize TYPE string,
round_val TYPE string,
max_stock TYPE string,
ord_costs TYPE string,
stor_costs TYPE string,
abc_id TYPE string,
* MRP2 View
proc_type TYPE string,
spproctype TYPE string,
sm_key TYPE string,
safety_stk TYPE string,
plnd_delry TYPE string,
inhseprodt TYPE string,
sloc_exprc TYPE string,
iss_st_loc TYPE string,
backflush TYPE string,
* MRP3
plan_strgp TYPE string,
mrp_availcheck TYPE string,
consummode TYPE string,
bwd_cons TYPE string,
fwd_cons TYPE string,
mixed_mrp TYPE string,
* MRP4
dep_req_id TYPE string,
rep_manuf TYPE string,
repmanprof TYPE string,
mrp_relevancy_dep_requirements TYPE string,
grp_reqmts TYPE string,
* Work Scheduling
alt_bom_id TYPE string,
production_scheduler TYPE string,
wrk_issue_unit TYPE string,
prod_unit TYPE string,
wrk_iss_st_loc TYPE string,
replentime TYPE string,
over_tol TYPE string,
unlimited TYPE string,
under_tol TYPE string,
serno_prof TYPE string,
serialization_level TYPE string,
prodprof TYPE string,

* Plantdata/Stor1 string ,
stge_bin TYPE string,
temp_conds TYPE string,
stor_conds TYPE string,
batch_mgmt TYPE string,
minremlife TYPE string,
shelf_life TYPE string,
plnt_issue_unit TYPE string,
profit_ctr TYPE string,
* Quality View
qm_procmnt TYPE string,
ctrl_key TYPE string,
* Accounting View
val_cat TYPE string,
price_ctrl TYPE string,
moving_pr TYPE string,
std_price TYPE string,
price_unit TYPE string,
val_class TYPE string,
* Costing View
orig_group TYPE string,
lot_size TYPE string,
specprocty TYPE string,
no_costing TYPE string,
overhead_grp TYPE string,
qty_struct TYPE string,
variance_key TYPE string,
orig_mat TYPE string,

basic_view TYPE char1,


purchase_view TYPE char1,
mrp_view TYPE char1,
work_sched_view TYPE char1,
costing_view TYPE char1,
accounting_view TYPE char1,
sales_view TYPE char1,
storage_view TYPE char1,
quality_view TYPE char1,
END OF ty_upload,

BEGIN OF ty_errors,
recno TYPE i,
matnr TYPE matnr,
type TYPE bapi_mtype,
id TYPE symsgid,
number TYPE symsgno,
message TYPE bapi_msg,
END OF ty_errors,

BEGIN OF ty_success,
status TYPE char10,
recno TYPE i,
matnr TYPE matnr,
type TYPE bapi_mtype,
id TYPE symsgid,
number TYPE symsgno,
message TYPE bapi_msg,
END OF ty_success.
************ Internal Table Declarations
DATA :
##NEEDED it_upload TYPE STANDARD TABLE OF ty_upload,
##NEEDED wa_upload TYPE ty_upload,
##NEEDED it_err TYPE STANDARD TABLE OF ty_upload,
##NEEDED wa_err TYPE ty_upload,
##NEEDED it_errors TYPE STANDARD TABLE OF ty_errors,
##NEEDED wa_errors TYPE ty_errors,
##NEEDED it_success TYPE STANDARD TABLE OF ty_success,
##NEEDED wa_success TYPE ty_success.
##NEEDED CONSTANTS : c_x TYPE c VALUE 'X'.
************ Bapi Declarations
DATA :
##NEEDED wa_headdata TYPE bapimathead,
##NEEDED wa_clientdata TYPE bapi_mara,
##NEEDED wa_clientdatax TYPE bapi_marax,
##NEEDED wa_plantdata TYPE bapi_marc,
##NEEDED wa_plantdatax TYPE bapi_marcx,
##NEEDED wa_storagelocationdata TYPE bapi_mard,
##NEEDED wa_storagelocationdatax TYPE bapi_mardx,
##NEEDED wa_valuationdata TYPE bapi_mbew,
##NEEDED wa_valuationdatax TYPE bapi_mbewx,
##NEEDED wa_salesdata TYPE bapi_mvke,
##NEEDED wa_salesdatax TYPE bapi_mvkex,
lt_extensionin TYPE STANDARD TABLE OF bapiparex,
wa_extensionin LIKE LINE OF lt_extensionin,
lt_extensioninx TYPE STANDARD TABLE OF bapiparexx,
wa_extensioninx LIKE LINE OF lt_extensioninx,

##NEEDED wa_return TYPE bapiret2,


##NEEDED it_return TYPE TABLE OF bapi_matreturn2,
##NEEDED ls_return TYPE bapi_matreturn2,
##NEEDED it_bapi_makt TYPE TABLE OF bapi_makt,
##NEEDED wa_bapi_makt TYPE bapi_makt,
##NEEDED it_bapi_marm TYPE TABLE OF bapi_marm,
##NEEDED wa_bapi_marm TYPE bapi_marm,
##NEEDED it_bapi_marmx TYPE TABLE OF bapi_marmx,
##NEEDED wa_bapi_marmx TYPE bapi_marmx,
##NEEDED it_bapi_mltx TYPE TABLE OF bapi_mltx,
##NEEDED wa_bapi_mltx TYPE bapi_mltx,
##NEEDED it_bapi_mlan TYPE TABLE OF bapi_mlan,
##NEEDED wa_bapi_mlan TYPE bapi_mlan,
##NEEDED it_extensionin TYPE STANDARD TABLE OF bapiparex,
##NEEDED it_extensioninx TYPE STANDARD TABLE OF bapiparexx,
##NEEDED t_fcat TYPE slis_t_fieldcat_alv,
##NEEDED w_fcat TYPE slis_fieldcat_alv,
##NEEDED s_layo TYPE slis_layout_alv.
************ Application Log Declarations
DATA:
##NEEDED ls_log TYPE bal_s_log.
DATA:
##NEEDED lv_log_handle TYPE balloghndl,
##NEEDED ls_msg TYPE bal_s_msg,
##NEEDED lt_log_handle TYPE bal_t_logh.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.


PARAMETERS : p_file TYPE rlgrap-filename OBLIGATORY.
PARAMETERS: p_head(8) OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
PARAMETERS : p_test AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN OUTPUT .
LOOP AT SCREEN .
IF screen-group1 = 'A' .
screen-input = '0' .
MODIFY SCREEN .
ENDIF .
ENDLOOP .

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.


PERFORM validate_file USING p_file.

START-OF-SELECTION.
PERFORM read_input_file_data.
PERFORM upload_data.
PERFORM display_errors.
PERFORM display_alv.
*&---------------------------------------------------------------------*
*& Form VALIDATE_FILE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_P_FILE text
*----------------------------------------------------------------------*
FORM validate_file USING f_file TYPE rlgrap-filename.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
file_name = f_file
EXCEPTIONS
mask_too_long = 1
OTHERS = 2.

IF sy-subrc <> 0.
*--- Display message if error occurs in getting file
##NO_TEXT MESSAGE 'Error in getting the Filename' TYPE 'I' .
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form READ_INPUT_FILE_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM read_input_file_data .

* DATA: DATA LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.


* DATA: DATA1 LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
DATA: t_raw TYPE truxs_t_text_data.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'


EXPORTING
i_tab_raw_data = t_raw
i_filename = p_file
TABLES
i_tab_converted_data = it_upload.
IF sy-subrc <> 0 ##FM_SUBRC_OK .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

**** Deleting Header texts from flat file structure


DELETE it_upload FROM 1 TO p_head.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form UPLOAD_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM upload_data .
LOOP AT it_upload INTO wa_upload.

* REFRESH IT_ERRORS1.
TRANSLATE wa_upload-matnr TO UPPER CASE.

wa_headdata-material_long = wa_upload-matnr.
wa_headdata-material = wa_upload-matnr.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'


EXPORTING
input = wa_headdata-material
IMPORTING
output = wa_headdata-material.
*
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = wa_headdata-material_long
IMPORTING
output = wa_headdata-material_long.

wa_headdata-ind_sector = wa_upload-mbrsh.
wa_headdata-matl_type = wa_upload-mtart.
IF wa_upload-plant IS NOT INITIAL.
wa_plantdata-plant = wa_upload-plant.
wa_plantdatax-plant = wa_upload-plant.
ENDIF.
IF wa_upload-stge_loc IS NOT INITIAL.
wa_storagelocationdata-plant = wa_upload-plant.
wa_storagelocationdatax-plant = wa_upload-plant.
wa_storagelocationdata-stge_loc = wa_upload-stge_loc.
wa_storagelocationdatax-stge_loc = wa_upload-stge_loc.
ENDIF.
* Basic Data
PERFORM fill_basic_view.
* Mrp View
PERFORM fill_mrp_view.
* WorkScheduling View
PERFORM fill_workscheduling_view.
* Sales View
PERFORM fill_sales_view.
* Purchase View
PERFORM fill_purchase_view.
* Plant/Stor Loc1
PERFORM fill_plant_storloc_view.
* Quality View
PERFORM fill_quality_view.
* Accounting View
PERFORM fill_accounting_view.
* Costing View
PERFORM fill_costing_view.
* Sales Org1 Tax Data
PERFORM fill_salesorg1_taxdata.
*
IF wa_upload-maktx IS NOT INITIAL.
wa_bapi_makt-langu = sy-langu.
wa_bapi_makt-langu_iso = sy-langu.
wa_bapi_makt-matl_desc = wa_upload-maktx.
APPEND wa_bapi_makt TO it_bapi_makt.
CLEAR wa_bapi_makt.
ENDIF.

IF wa_upload-alt_unit IS NOT INITIAL.


CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
EXPORTING
input = wa_upload-alt_unit
language = sy-langu
IMPORTING
output = wa_upload-alt_unit
EXCEPTIONS ##FM_SUBRC_OK
unit_not_found = 1
OTHERS = 2.
ENDIF.
IF wa_upload-unit_of_wt IS NOT INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
EXPORTING
input = wa_upload-unit_of_wt
language = sy-langu
IMPORTING
output = wa_upload-unit_of_wt
EXCEPTIONS ##FM_SUBRC_OK
unit_not_found = 1
OTHERS = 2.
ENDIF.

IF wa_upload-alt_unit IS NOT INITIAL.


wa_bapi_marm-alt_unit = wa_upload-alt_unit.
wa_bapi_marm-alt_unit_iso = wa_upload-alt_unit.
wa_bapi_marm-numerator = wa_upload-numerator.
wa_bapi_marm-denominatr = wa_upload-denominatr.
wa_bapi_marm-gross_wt = wa_upload-gross_wt.
wa_bapi_marm-unit_of_wt = wa_upload-unit_of_wt.
wa_bapi_marm-unit_of_wt_iso = wa_upload-unit_of_wt.

APPEND wa_bapi_marm TO it_bapi_marm.


CLEAR wa_bapi_marm.
*
wa_bapi_marmx-alt_unit = wa_upload-alt_unit.
wa_bapi_marmx-alt_unit_iso = wa_upload-alt_unit.
wa_bapi_marmx-numerator = c_x.
wa_bapi_marmx-denominatr = c_x.
wa_bapi_marmx-gross_wt = c_x.
wa_bapi_marmx-unit_of_wt = c_x.
wa_bapi_marmx-unit_of_wt_iso = c_x.

APPEND wa_bapi_marmx TO it_bapi_marmx.


CLEAR wa_bapi_marmx.
ENDIF.
PERFORM fill_longtexts.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'


EXPORTING
headdata = wa_headdata
clientdata = wa_clientdata
clientdatax = wa_clientdatax
plantdata = wa_plantdata
plantdatax = wa_plantdatax
storagelocationdata = wa_storagelocationdata
storagelocationdatax = wa_storagelocationdatax
valuationdata = wa_valuationdata
valuationdatax = wa_valuationdatax
salesdata = wa_salesdata
salesdatax = wa_salesdatax
IMPORTING
return = wa_return
TABLES
materialdescription = it_bapi_makt
unitsofmeasure = it_bapi_marm
unitsofmeasurex = it_bapi_marmx
materiallongtext = it_bapi_mltx
taxclassifications = it_bapi_mlan
returnmessages = it_return
extensionin = it_extensionin
extensioninx = it_extensioninx.
IF wa_return-type = 'E'.
LOOP AT it_return INTO ls_return WHERE type = 'E' ##INTO_OK .
wa_errors-matnr = wa_upload-matnr.
wa_errors-type = ls_return-type.
wa_errors-id = ls_return-id.
wa_errors-number = ls_return-number.
wa_errors-message = ls_return-message.
APPEND wa_errors TO it_errors.
CLEAR wa_errors.
ENDLOOP.
MOVE-CORRESPONDING wa_upload TO wa_err.
APPEND wa_err TO it_err.
CLEAR wa_err.
ELSE.
IF p_test = 'X'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK' .
* IMPORTING
* RETURN = .
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
* IMPORTING
* RETURN =

wa_success-status = icon_green_light.
wa_success-matnr = wa_upload-matnr.
wa_success-type = wa_return-type.
wa_success-id = wa_return-id.
wa_success-number = wa_return-number.
wa_success-message = wa_return-message.
APPEND wa_success TO it_success.
CLEAR wa_success.
ENDIF.
ENDIF.

CLEAR :
wa_return,wa_headdata,wa_clientdata,wa_clientdatax,wa_plantdata,wa_plantdatax,wa_st
oragelocationdata,wa_storagelocationdatax,wa_valuationdata,

wa_valuationdatax,wa_salesdata,wa_salesdatax,wa_bapi_makt,wa_bapi_marm,wa_bapi_marm
x,ls_return.
REFRESH :
it_bapi_makt[],it_bapi_marm[],it_bapi_marmx[],it_bapi_mlan[],it_extensionin[],it_ex
tensioninx[],it_return[],it_bapi_mltx[].
ENDLOOP.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form DISPLAY_ERRORS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display_errors .
DATA : lv_path TYPE string,
lv_path1 TYPE string.
IF it_errors IS INITIAL.
IF p_test = 'X'.
##NO_TEXT MESSAGE 'Test Run Done Successfully' TYPE 'S'.
ELSE.
##NO_TEXT MESSAGE 'Data Uploaded Successfully' TYPE 'S'.
ENDIF.
ELSE.
CONCATENATE 'C:\ERROR\ERROR_EXPLAIN' sy-datum sy-uzeit '.XLS' INTO lv_path
SEPARATED BY '_'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = lv_path
write_field_separator = 'X'
TABLES
data_tab = it_errors
EXCEPTIONS ##FM_SUBRC_OK
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 it_err[] IS NOT INITIAL.


CONCATENATE 'C:\ERROR\ERROR_RECORDS' sy-datum sy-uzeit '.XLS' INTO lv_path1
SEPARATED BY '_'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = lv_path1
write_field_separator = 'X'
TABLES
data_tab = it_err
EXCEPTIONS ##FM_SUBRC_OK
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.
ENDIF.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FILL_BASIC_VIEW
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_basic_view .
TRANSLATE wa_upload-basic_view TO UPPER CASE.
wa_headdata-basic_view = wa_upload-basic_view.
CHECK wa_headdata-basic_view = c_x.

* Basic Data1

wa_clientdata-matl_group = wa_upload-matl_group.
wa_clientdatax-matl_group = c_x.
wa_clientdata-extmatlgrp = wa_upload-extmatlgrp.
wa_clientdatax-extmatlgrp = c_x.

IF wa_upload-base_uom IS NOT INITIAL.


CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
EXPORTING
input = wa_upload-base_uom
language = sy-langu
IMPORTING
output = wa_upload-base_uom
EXCEPTIONS ##FM_SUBRC_OK
unit_not_found = 1
OTHERS = 2.

ENDIF.

wa_clientdata-base_uom = wa_upload-base_uom.
wa_clientdatax-base_uom = c_x.
wa_clientdata-base_uom_iso = wa_upload-base_uom.
wa_clientdatax-base_uom_iso = c_x.

IF wa_upload-division IS NOT INITIAL.


wa_clientdata-division = wa_upload-division.
wa_clientdatax-division = c_x.
ENDIF.

wa_clientdata-old_mat_no = wa_upload-old_mat_no.
wa_clientdatax-old_mat_no = c_x.

wa_clientdata-old_mat_no_long = wa_upload-old_mat_no.
wa_clientdatax-old_mat_no_long = c_x.

wa_clientdata-inv_mat_no_long = wa_upload-old_mat_no.
wa_clientdatax-inv_mat_no_long = c_x.

IF wa_upload-gen_item_cat IS NOT INITIAL.


wa_clientdata-item_cat = wa_upload-gen_item_cat.
wa_clientdatax-item_cat = c_x.
ENDIF.

wa_clientdata-net_weight = wa_upload-net_weight.
wa_clientdatax-net_weight = c_x.
wa_clientdata-dsn_office = wa_upload-dsn_office.
wa_clientdatax-dsn_office = c_x.

wa_clientdata-document = wa_upload-document.
wa_clientdatax-document = c_x.

wa_clientdata-doc_type = wa_upload-doc_type.
wa_clientdatax-doc_type = c_x.

wa_clientdata-doc_vers = wa_upload-doc_vers.
wa_clientdatax-doc_vers = c_x.

wa_clientdata-doc_format = wa_upload-doc_format.
wa_clientdatax-doc_format = c_x.

wa_clientdata-doc_chg_no = wa_upload-doc_chg_no.
wa_clientdatax-doc_chg_no = c_x.

wa_clientdata-page_no = wa_upload-page_no.
wa_clientdatax-page_no = c_x.

wa_clientdata-no_sheets = wa_upload-no_sheets.
wa_clientdatax-no_sheets = c_x.

wa_clientdata-basic_matl = wa_upload-basic_matl.
wa_clientdatax-basic_matl = c_x.

wa_clientdata-std_descr = wa_upload-std_descr.
wa_clientdatax-std_descr = c_x.

wa_clientdata-prod_memo = wa_upload-prod_memo.
wa_clientdatax-prod_memo = c_x.

wa_clientdata-pageformat = wa_upload-pageformat.
wa_clientdatax-pageformat = c_x.

wa_clientdata-allwd_vol = wa_upload-allwd_vol.
wa_clientdatax-allwd_vol = c_x.

wa_clientdata-pageformat = wa_upload-pageformat.
wa_clientdatax-pageformat = c_x.

wa_clientdata-pack_vo_un = wa_upload-pack_vo_un.
wa_clientdatax-pack_vo_un = c_x.

wa_clientdata-size_dim = wa_upload-size_dim.
wa_clientdatax-size_dim = c_x.

wa_clientdata-size_dim = wa_upload-size_dim.
wa_clientdatax-size_dim = c_x.

wa_clientdata-size_dim = wa_upload-size_dim.
wa_clientdatax-size_dim = c_x.

wa_clientdata-size_dim = wa_upload-size_dim.
wa_clientdatax-size_dim = c_x.
wa_clientdata-size_dim = wa_upload-size_dim.
wa_clientdatax-size_dim = c_x.

wa_clientdata-size_dim = wa_upload-size_dim.
wa_clientdatax-size_dim = c_x.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FILL_MRP_VIEW
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_mrp_view .
TRANSLATE wa_upload-mrp_view TO UPPER CASE.
wa_headdata-mrp_view = wa_upload-mrp_view.
CHECK wa_headdata-mrp_view = c_x.
* MRP1

wa_plantdata-mrp_group = wa_upload-mrp_group.
wa_plantdatax-mrp_group = c_x.

wa_plantdata-mrp_type = wa_upload-mrp_type.
wa_plantdatax-mrp_type = c_x.

wa_plantdata-reorder_pt = wa_upload-reorder_pt.
wa_plantdatax-reorder_pt = c_x.

wa_plantdata-mrp_ctrler = wa_upload-mrp_ctrler.
wa_plantdatax-mrp_ctrler = c_x.

wa_plantdata-lotsizekey = wa_upload-lotsizekey.
wa_plantdatax-lotsizekey = c_x.

wa_plantdata-minlotsize = wa_upload-minlotsize.
wa_plantdatax-minlotsize = c_x.

wa_plantdata-maxlotsize = wa_upload-maxlotsize.
wa_plantdatax-maxlotsize = c_x.

wa_plantdata-round_val = wa_upload-round_val.
wa_plantdatax-round_val = c_x.

wa_plantdata-ord_costs = wa_upload-ord_costs.
wa_plantdatax-ord_costs = c_x.
wa_plantdata-stor_costs = wa_upload-stor_costs.
wa_plantdatax-stor_costs = c_x.
wa_plantdata-fixed_lot = wa_upload-fixed_lot.
wa_plantdatax-fixed_lot = c_x.

wa_plantdata-max_stock = wa_upload-max_stock.
wa_plantdatax-max_stock = c_x.

wa_plantdata-abc_id = wa_upload-abc_id.
wa_plantdatax-abc_id = c_x.

* MRP2

wa_plantdata-proc_type = wa_upload-proc_type.
wa_plantdatax-proc_type = c_x.

wa_plantdata-iss_st_loc = wa_upload-iss_st_loc.
wa_plantdatax-iss_st_loc = c_x.

wa_plantdata-plnd_delry = wa_upload-plnd_delry.
wa_plantdatax-plnd_delry = c_x.
IF wa_upload-po_gr_pr_time IS NOT INITIAL.
wa_plantdata-gr_pr_time = wa_upload-po_gr_pr_time.
wa_plantdatax-gr_pr_time = c_x.
ENDIF.

wa_plantdata-spproctype = wa_upload-spproctype.
wa_plantdatax-spproctype = c_x.
wa_plantdata-inhseprodt = wa_upload-inhseprodt.
wa_plantdatax-inhseprodt = c_x.
wa_plantdata-sloc_exprc = wa_upload-sloc_exprc.
wa_plantdatax-sloc_exprc = c_x.
wa_plantdata-iss_st_loc = wa_upload-iss_st_loc.
wa_plantdatax-iss_st_loc = c_x.

wa_plantdata-sm_key = wa_upload-sm_key.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_plantdata-sm_key
IMPORTING
output = wa_plantdata-sm_key.
wa_plantdatax-sm_key = c_x.

wa_plantdata-backflush = wa_upload-backflush .
wa_plantdatax-backflush = c_x.

wa_plantdata-safety_stk = wa_upload-safety_stk.
wa_plantdatax-safety_stk = c_x.

* MRP3

wa_plantdata-plan_strgp = wa_upload-plan_strgp.
wa_plantdatax-plan_strgp = c_x.
wa_plantdata-availcheck = wa_upload-mrp_availcheck.
wa_plantdatax-availcheck = c_x.

wa_plantdata-consummode = wa_upload-consummode.
wa_plantdatax-consummode = c_x.
wa_plantdata-bwd_cons = wa_upload-bwd_cons.
wa_plantdatax-bwd_cons = c_x.
wa_plantdata-fwd_cons = wa_upload-fwd_cons.
wa_plantdatax-fwd_cons = c_x.
wa_plantdata-mixed_mrp = wa_upload-mixed_mrp.
wa_plantdatax-mixed_mrp = c_x.

* MRP4

wa_plantdata-dep_req_id = wa_upload-dep_req_id.
wa_plantdatax-dep_req_id = c_x.

wa_plantdata-rep_manuf = wa_upload-rep_manuf.
wa_plantdatax-rep_manuf = c_x.
wa_plantdata-repmanprof = wa_upload-repmanprof.
wa_plantdatax-repmanprof = c_x.
wa_plantdata-mrp_relevancy_dep_requirements = wa_upload-
mrp_relevancy_dep_requirements.
wa_plantdatax-mrp_relevancy_dep_requirements = c_x.
wa_plantdata-grp_reqmts = wa_upload-grp_reqmts.
wa_plantdatax-grp_reqmts = c_x.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FILL_WORKSCHEDULING_VIEW
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_workscheduling_view .
TRANSLATE wa_upload-work_sched_view TO UPPER CASE.
wa_headdata-work_sched_view = wa_upload-work_sched_view.
CHECK wa_headdata-work_sched_view = c_x.

IF wa_upload-production_scheduler IS NOT INITIAL.


wa_plantdata-production_scheduler = wa_upload-production_scheduler.
wa_plantdatax-production_scheduler = c_x.
ENDIF.

IF wa_upload-prodprof IS NOT INITIAL.


wa_plantdata-prodprof = wa_upload-prodprof.
wa_plantdatax-prodprof = c_x.
ENDIF.
IF wa_upload-serno_prof IS NOT INITIAL.
wa_plantdata-serno_prof = wa_upload-serno_prof.
wa_plantdatax-serno_prof = c_x.
ENDIF.
IF wa_upload-serialization_level IS NOT INITIAL.
wa_clientdata-serialization_level = wa_upload-serialization_level.
wa_clientdatax-serialization_level = c_x.
ENDIF.
IF wa_upload-batch_mgmt IS NOT INITIAL.
wa_plantdata-batch_mgmt = wa_upload-batch_mgmt.
wa_plantdatax-batch_mgmt = c_x.
ENDIF.

wa_plantdata-alt_bom_id = wa_upload-alt_bom_id.
wa_plantdatax-alt_bom_id = c_x.

wa_plantdata-issue_unit = wa_upload-wrk_issue_unit.
wa_plantdatax-issue_unit = c_x.

wa_plantdata-issue_unit_iso = wa_upload-wrk_issue_unit.
wa_plantdatax-issue_unit_iso = c_x.

wa_plantdata-iss_st_loc = wa_upload-wrk_iss_st_loc.
wa_plantdatax-iss_st_loc = c_x.

wa_plantdata-prod_unit = wa_upload-prod_unit.
wa_plantdatax-prod_unit = c_x.
wa_plantdata-prod_unit_iso = wa_upload-prod_unit.
wa_plantdatax-prod_unit_iso = c_x.

wa_plantdata-replentime = wa_upload-replentime.
wa_plantdatax-replentime = c_x.

wa_plantdata-over_tol = wa_upload-over_tol.
wa_plantdatax-over_tol = c_x.

wa_plantdata-unlimited = wa_upload-unlimited.
wa_plantdatax-unlimited = c_x.

wa_plantdata-under_tol = wa_upload-under_tol.
wa_plantdatax-under_tol = c_x.

ENDFORM.
*---------------------------------------------------------------------*
*& Form FILL_SALES_VIEW
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_sales_view .
TRANSLATE wa_upload-sales_view TO UPPER CASE.
wa_headdata-sales_view = wa_upload-sales_view.
CHECK wa_headdata-sales_view = c_x.

wa_salesdata-sales_org = wa_upload-sales_org.
wa_salesdatax-sales_org = wa_upload-sales_org.

wa_salesdata-distr_chan = wa_upload-distr_chan.
wa_salesdatax-distr_chan = wa_upload-distr_chan.
IF wa_upload-sales_unit IS NOT INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
EXPORTING
input = wa_upload-sales_unit
language = sy-langu
IMPORTING
output = wa_upload-sales_unit
EXCEPTIONS ##FM_SUBRC_OK
unit_not_found = 1
OTHERS = 2.

ENDIF.
wa_salesdata-sales_unit = wa_upload-sales_unit.
wa_salesdatax-sales_unit = c_x.

wa_salesdata-sales_unit_iso = wa_upload-sales_unit.
wa_salesdatax-sales_unit_iso = c_x.

wa_salesdata-delyg_plnt = wa_upload-delyg_plnt.
wa_salesdatax-delyg_plnt = c_x.

wa_salesdata-cash_disc = wa_upload-cash_disc.
wa_salesdatax-cash_disc = c_x.

wa_salesdata-matl_stats = wa_upload-matl_stats.
wa_salesdatax-matl_stats = c_x.

wa_salesdata-mat_pr_grp = wa_upload-mat_pr_grp.
wa_salesdatax-mat_pr_grp = c_x.

wa_salesdata-acct_assgt = wa_upload-acct_assgt.
wa_salesdatax-acct_assgt = c_x.

wa_salesdata-item_cat = wa_upload-item_cat.
wa_salesdatax-item_cat = c_x.

* added by pallavi

wa_salesdata-sal_status = wa_upload-sal_status.
wa_salesdatax-sal_status = c_x.

wa_salesdata-valid_from = wa_upload-valid_from.
wa_salesdatax-valid_from = c_x.

wa_salesdata-matl_grp_1 = wa_upload-matl_grp_1.
wa_salesdatax-matl_grp_1 = c_x.

wa_salesdata-matl_grp_2 = wa_upload-matl_grp_2.
wa_salesdatax-matl_grp_2 = c_x.

wa_salesdata-matl_grp_3 = wa_upload-matl_grp_3.
wa_salesdatax-matl_grp_3 = c_x.
wa_salesdata-matl_grp_4 = wa_upload-matl_grp_4.
wa_salesdatax-matl_grp_4 = c_x.

wa_salesdata-matl_grp_5 = wa_upload-matl_grp_5.
wa_salesdatax-matl_grp_5 = c_x.

* Sales Gen/Plant

wa_plantdata-loadinggrp = wa_upload-loadinggrp.
wa_plantdatax-loadinggrp = c_x.

IF wa_upload-availcheck IS NOT INITIAL.


wa_plantdata-availcheck = wa_upload-availcheck.
wa_plantdatax-availcheck = c_x.
ENDIF.

wa_clientdata-trans_grp = wa_upload-trans_grp.
wa_clientdatax-trans_grp = c_x.

wa_plantdata-ctrl_code = wa_upload-ctrl_code.
wa_plantdata-ctrl_code = c_x.

IF wa_upload-profit_ctr IS NOT INITIAL.


CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_upload-profit_ctr
IMPORTING
output = wa_upload-profit_ctr.
ENDIF.
IF wa_upload-profit_ctr IS NOT INITIAL.

wa_plantdata-profit_ctr = wa_upload-profit_ctr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_plantdata-profit_ctr
IMPORTING
output = wa_plantdata-profit_ctr.
wa_plantdatax-profit_ctr = c_x.
ENDIF.
IF wa_upload-batch_mgmt IS NOT INITIAL.
wa_plantdata-batch_mgmt = wa_upload-batch_mgmt.
wa_plantdatax-batch_mgmt = c_x.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FILL_PURCHASE_VIEW
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_purchase_view .
TRANSLATE wa_upload-purchase_view TO UPPER CASE.
wa_headdata-purchase_view = wa_upload-purchase_view.
CHECK wa_headdata-purchase_view = c_x.
IF wa_upload-base_uom = wa_upload-po_unit.
wa_upload-po_unit = ' '.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
EXPORTING
input = wa_upload-po_unit
language = sy-langu
IMPORTING
output = wa_upload-po_unit
EXCEPTIONS ##FM_SUBRC_OK
unit_not_found = 1
OTHERS = 2.

IF wa_upload-po_unit IS NOT INITIAL.


wa_clientdata-po_unit = wa_upload-po_unit.
wa_clientdata-po_unit_iso = wa_upload-po_unit.
wa_clientdatax-po_unit = c_x.
wa_clientdatax-po_unit_iso = c_x.
ENDIF.
wa_plantdata-pur_group = wa_upload-pur_group.
wa_plantdatax-pur_group = c_x.

IF wa_upload-batch_mgmt IS NOT INITIAL.


wa_clientdata-batch_mgmt = wa_upload-batch_mgmt.
wa_clientdatax-batch_mgmt = c_x.
ENDIF.

wa_clientdata-pur_valkey = wa_upload-pur_valkey.
wa_clientdatax-pur_valkey = c_x.

wa_plantdata-sourcelist = wa_upload-sourcelist.
wa_plantdatax-sourcelist = c_x.

wa_plantdata-sourcelist = wa_upload-sourcelist.
wa_plantdatax-sourcelist = c_x.

IF wa_upload-po_gr_pr_time IS NOT INITIAL.


wa_plantdata-gr_pr_time = wa_upload-po_gr_pr_time.
wa_plantdatax-gr_pr_time = c_x.
ENDIF.
wa_clientdata-manu_mat = wa_upload-manu_mat.
wa_clientdatax-manu_mat = c_x.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FILL_PLANT_STORLOC_VIEW
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_plant_storloc_view .

TRANSLATE wa_upload-storage_view TO UPPER CASE.


wa_headdata-storage_view = wa_upload-storage_view.
CHECK wa_headdata-storage_view = c_x.

wa_plantdata-issue_unit = wa_upload-plnt_issue_unit.
wa_plantdata-issue_unit_iso = wa_upload-plnt_issue_unit.
wa_plantdatax-issue_unit = c_x.
wa_plantdatax-issue_unit_iso = c_x.
IF wa_upload-batch_mgmt IS NOT INITIAL.
wa_plantdata-batch_mgmt = wa_upload-batch_mgmt.
wa_plantdatax-batch_mgmt = c_x.
ENDIF.
IF wa_upload-profit_ctr IS NOT INITIAL.
wa_plantdata-profit_ctr = wa_upload-profit_ctr.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'


EXPORTING
input = wa_plantdata-profit_ctr
IMPORTING
output = wa_plantdata-profit_ctr.

wa_plantdatax-profit_ctr = c_x.
ENDIF.

wa_storagelocationdata-stge_bin = wa_upload-stge_bin.
wa_storagelocationdatax-stge_bin = c_x.

IF wa_upload-serno_prof IS NOT INITIAL.


wa_plantdata-serno_prof = wa_upload-serno_prof.
wa_plantdatax-serno_prof = c_x.
ENDIF.
IF wa_upload-serialization_level IS NOT INITIAL.
wa_clientdata-serialization_level = wa_upload-serialization_level.
wa_clientdatax-serialization_level = c_x.
ENDIF.

wa_clientdata-temp_conds = wa_upload-temp_conds.
wa_clientdatax-temp_conds = c_x.
wa_clientdata-stor_conds = wa_upload-stor_conds.
wa_clientdatax-stor_conds = c_x.
wa_clientdata-minremlife = wa_upload-minremlife.
wa_clientdatax-minremlife = c_x.
wa_clientdata-shelf_life = wa_upload-shelf_life.
wa_clientdatax-shelf_life = c_x.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FILL_QUALITY_VIEW
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_quality_view .
TRANSLATE wa_upload-quality_view TO UPPER CASE.
wa_headdata-quality_view = wa_upload-quality_view.
CHECK wa_headdata-quality_view = c_x.

wa_clientdata-qm_procmnt = wa_upload-qm_procmnt.
wa_clientdatax-qm_procmnt = c_x.

wa_plantdata-ctrl_key = wa_upload-ctrl_key.
wa_plantdatax-ctrl_key = c_x.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FILL_ACCOUNTING_VIEW
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_accounting_view .
DATA: lv_num TYPE p.

TRANSLATE wa_upload-accounting_view TO UPPER CASE.


wa_headdata-account_view = wa_upload-accounting_view.
CHECK wa_headdata-account_view = c_x.

wa_valuationdata-val_area = wa_upload-plant.
wa_valuationdatax-val_area = wa_upload-plant.

wa_valuationdata-val_type = wa_upload-bwtar.
wa_valuationdatax-val_type = wa_upload-bwtar.

wa_valuationdata-val_cat = wa_upload-val_cat.
wa_valuationdatax-val_cat = c_x.

wa_valuationdata-val_class = wa_upload-val_class.
wa_valuationdatax-val_class = c_x.

wa_valuationdata-price_ctrl = wa_upload-price_ctrl.
wa_valuationdatax-price_ctrl = c_x.
IF wa_upload-price_unit IS NOT INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
EXPORTING
input = wa_upload-price_unit
language = sy-langu
IMPORTING
output = wa_upload-price_unit
EXCEPTIONS ##FM_SUBRC_OK
unit_not_found = 1
OTHERS = 2.

ENDIF.

CALL FUNCTION 'MOVE_CHAR_TO_NUM'


EXPORTING
chr = wa_upload-price_unit
IMPORTING
num = wa_valuationdata-price_unit
EXCEPTIONS ##FM_SUBRC_OK
convt_no_number = 1
convt_overflow = 2
OTHERS = 3.
wa_valuationdatax-price_unit = c_x.

CALL FUNCTION 'HRCM_STRING_TO_AMOUNT_CONVERT'


EXPORTING
string = wa_upload-std_price
* DECIMAL_SEPARATOR =
* THOUSANDS_SEPARATOR =
* WAERS = ' '
IMPORTING
betrg = wa_valuationdata-std_price
EXCEPTIONS
convert_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
wa_valuationdatax-std_price = c_x.

CALL FUNCTION 'HRCM_STRING_TO_AMOUNT_CONVERT'


EXPORTING
string = wa_upload-moving_pr
* DECIMAL_SEPARATOR =
* THOUSANDS_SEPARATOR =
* WAERS = ' '
IMPORTING
betrg = wa_valuationdata-moving_pr
EXCEPTIONS
convert_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
wa_valuationdatax-moving_pr = c_x.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FILL_COSTING_VIEW
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_costing_view .
TRANSLATE wa_upload-costing_view TO UPPER CASE.
wa_headdata-cost_view = wa_upload-costing_view.
CHECK wa_headdata-cost_view = c_x.

wa_valuationdata-qty_struct = wa_upload-qty_struct.
wa_valuationdatax-qty_struct = c_x.

IF wa_upload-orig_mat IS NOT INITIAL.


wa_valuationdata-orig_mat = wa_upload-orig_mat.
wa_valuationdatax-orig_mat = c_x.
ENDIF.

wa_valuationdata-overhead_grp = wa_upload-overhead_grp.
wa_valuationdatax-overhead_grp = c_x.
wa_plantdata-variance_key = wa_upload-variance_key.
wa_plantdatax-variance_key = c_x.

IF wa_upload-profit_ctr IS NOT INITIAL.


wa_plantdata-profit_ctr = wa_upload-profit_ctr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_plantdata-profit_ctr
IMPORTING
output = wa_plantdata-profit_ctr.
wa_plantdatax-profit_ctr = c_x.
ENDIF.

wa_plantdata-lot_size = wa_upload-lot_size.
wa_plantdatax-lot_size = c_x.

wa_valuationdata-orig_group = wa_upload-orig_group.
wa_valuationdatax-orig_group = c_x.

wa_plantdata-specprocty = wa_upload-specprocty.
wa_plantdatax-specprocty = c_x.

wa_plantdata-no_costing = wa_upload-no_costing.
wa_plantdatax-no_costing = c_x.

wa_plantdata-no_costing = wa_upload-no_costing.
wa_plantdatax-no_costing = c_x.

ENDFORM.
*&---------------------------------------------------------------------*
*& Form FILL_SALESORG1_TAXDATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_salesorg1_taxdata .
CHECK wa_headdata-sales_view = c_x.
wa_bapi_mlan-depcountry = 'IN'.
wa_bapi_mlan-depcountry_iso = 'IN'.

* added by pallavi
wa_bapi_mlan-tax_type_1 = wa_upload-tax_type_1.
wa_bapi_mlan-taxclass_1 = wa_upload-taxclass_1.
wa_bapi_mlan-tax_type_2 = wa_upload-tax_type_2.
wa_bapi_mlan-taxclass_2 = wa_upload-taxclass_2.
wa_bapi_mlan-tax_type_3 = wa_upload-tax_type_3.
wa_bapi_mlan-taxclass_3 = wa_upload-taxclass_3.
wa_bapi_mlan-tax_type_4 = wa_upload-tax_type_4.
wa_bapi_mlan-taxclass_4 = wa_upload-taxclass_4.
wa_bapi_mlan-tax_type_5 = wa_upload-tax_type_5.
wa_bapi_mlan-taxclass_5 = wa_upload-taxclass_5.
wa_bapi_mlan-tax_type_6 = wa_upload-tax_type_6.
wa_bapi_mlan-taxclass_6 = wa_upload-taxclass_6.
wa_bapi_mlan-tax_type_7 = wa_upload-tax_type_7.
wa_bapi_mlan-taxclass_7 = wa_upload-taxclass_7.
wa_bapi_mlan-tax_type_8 = wa_upload-tax_type_8.
wa_bapi_mlan-taxclass_8 = wa_upload-taxclass_8.
wa_bapi_mlan-tax_type_9 = wa_upload-tax_type_9.
wa_bapi_mlan-taxclass_9 = wa_upload-taxclass_9.

APPEND wa_bapi_mlan TO it_bapi_mlan.


CLEAR wa_bapi_mlan.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FILL_LONGTEXTS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_longtexts .
DATA: l_text1 TYPE tdobname.

CLEAR: l_text1.
l_text1 = wa_headdata-material. "WA_UPLOAD-MATNR.
l_text1+40(4) = wa_upload-sales_org.
l_text1+44(2) = wa_upload-distr_chan.
IF wa_upload-grun IS NOT INITIAL.
wa_bapi_mltx-applobject = 'MATERIAL'.
wa_bapi_mltx-text_name = wa_headdata-material_long."WA_UPLOAD-MATNR.
wa_bapi_mltx-text_id = 'GRUN'.
wa_bapi_mltx-langu = 'E'.
wa_bapi_mltx-langu_iso = 'EN'.
wa_bapi_mltx-text_line = wa_upload-grun+0(132).
APPEND wa_bapi_mltx TO it_bapi_mltx.
CLEAR wa_bapi_mltx.
IF strlen( wa_upload-grun ) > 132.
wa_bapi_mltx-applobject = 'MATERIAL'.
wa_bapi_mltx-text_name = wa_headdata-material_long."WA_UPLOAD-MATNR.
wa_bapi_mltx-text_id = 'GRUN'.
wa_bapi_mltx-langu = 'E'.
wa_bapi_mltx-format_col = ' '.
wa_bapi_mltx-langu_iso = 'EN'.
wa_bapi_mltx-text_line = wa_upload-grun+132(132).
APPEND wa_bapi_mltx TO it_bapi_mltx.
CLEAR wa_bapi_mltx.
IF strlen( wa_upload-grun ) > 264.
wa_bapi_mltx-applobject = 'MATERIAL'.
wa_bapi_mltx-text_name = wa_headdata-material_long."WA_UPLOAD-MATNR.
wa_bapi_mltx-text_id = 'GRUN'.
wa_bapi_mltx-langu = 'E'.
wa_bapi_mltx-langu_iso = 'EN'.
wa_bapi_mltx-format_col = ' '.
wa_bapi_mltx-text_line = wa_upload-grun+264(132).
APPEND wa_bapi_mltx TO it_bapi_mltx.
CLEAR wa_bapi_mltx.
IF strlen( wa_upload-grun ) > 396.
wa_bapi_mltx-applobject = 'MATERIAL'.
wa_bapi_mltx-text_name = wa_headdata-material_long."WA_UPLOAD-MATNR.
wa_bapi_mltx-text_id = 'GRUN'.
wa_bapi_mltx-format_col = ' '.
wa_bapi_mltx-langu = 'E'.
wa_bapi_mltx-langu_iso = 'EN'.
wa_bapi_mltx-text_line = wa_upload-grun+396(104).
APPEND wa_bapi_mltx TO it_bapi_mltx.
CLEAR wa_bapi_mltx.
ENDIF.
ENDIF.
ENDIF.
ENDIF.

IF wa_upload-best IS NOT INITIAL.


wa_bapi_mltx-applobject = 'MATERIAL'.
wa_bapi_mltx-text_name = wa_headdata-material_long."WA_UPLOAD-MATNR.
wa_bapi_mltx-text_id = 'BEST'.
wa_bapi_mltx-langu = 'E'.
wa_bapi_mltx-langu_iso = 'EN'.
wa_bapi_mltx-text_line = wa_upload-best+0(132).
APPEND wa_bapi_mltx TO it_bapi_mltx.
CLEAR wa_bapi_mltx.
IF strlen( wa_upload-best ) > 132.
wa_bapi_mltx-applobject = 'MATERIAL'.
wa_bapi_mltx-text_name = wa_headdata-material_long."WA_UPLOAD-MATNR.
wa_bapi_mltx-text_id = 'BEST'.
wa_bapi_mltx-langu = 'E'.
wa_bapi_mltx-format_col = ''.
wa_bapi_mltx-langu_iso = 'EN'.
wa_bapi_mltx-text_line = wa_upload-best+132(132).
APPEND wa_bapi_mltx TO it_bapi_mltx.
CLEAR wa_bapi_mltx.
IF strlen( wa_upload-best ) > 264.
wa_bapi_mltx-applobject = 'MATERIAL'.
wa_bapi_mltx-text_name = wa_headdata-material_long."WA_UPLOAD-MATNR.
wa_bapi_mltx-text_id = 'BEST'.
wa_bapi_mltx-langu = 'E'.
wa_bapi_mltx-langu_iso = 'EN'.
wa_bapi_mltx-format_col = ''.
wa_bapi_mltx-text_line = wa_upload-best+264(132).
APPEND wa_bapi_mltx TO it_bapi_mltx.
CLEAR wa_bapi_mltx.
IF strlen( wa_upload-best ) > 396.
wa_bapi_mltx-applobject = 'MATERIAL'.
wa_bapi_mltx-text_name = wa_headdata-material_long."WA_UPLOAD-MATNR.
wa_bapi_mltx-text_id = 'BEST'.
wa_bapi_mltx-langu = 'E'.
wa_bapi_mltx-format_col = ''.
wa_bapi_mltx-langu_iso = 'EN'.
wa_bapi_mltx-text_line = wa_upload-best+396(104).
APPEND wa_bapi_mltx TO it_bapi_mltx.
CLEAR wa_bapi_mltx.
ENDIF.
ENDIF.
ENDIF.
ENDIF.

IF wa_upload-sales IS NOT INITIAL.


wa_bapi_mltx-applobject = 'MVKE'.
wa_bapi_mltx-text_name = l_text1.
wa_bapi_mltx-text_id = '0001'.
wa_bapi_mltx-langu = 'E'.
wa_bapi_mltx-langu_iso = 'EN'.
wa_bapi_mltx-text_line = wa_upload-sales+0(132).
APPEND wa_bapi_mltx TO it_bapi_mltx.
CLEAR wa_bapi_mltx.
IF strlen( wa_upload-sales ) > 132.
wa_bapi_mltx-applobject = 'MVKE'.
wa_bapi_mltx-text_name = l_text1.
wa_bapi_mltx-text_id = '0001'.
wa_bapi_mltx-langu = 'E'.
wa_bapi_mltx-format_col = ''.
wa_bapi_mltx-langu_iso = 'EN'.
wa_bapi_mltx-text_line = wa_upload-sales+132(132).
APPEND wa_bapi_mltx TO it_bapi_mltx.
CLEAR wa_bapi_mltx.
IF strlen( wa_upload-sales ) > 264.
wa_bapi_mltx-applobject = 'MVKE'.
wa_bapi_mltx-text_name = l_text1.
wa_bapi_mltx-text_id = '0001'.
wa_bapi_mltx-langu = 'E'.
wa_bapi_mltx-format_col = ''.
wa_bapi_mltx-langu_iso = 'EN'.
wa_bapi_mltx-text_line = wa_upload-sales+264(132).
APPEND wa_bapi_mltx TO it_bapi_mltx.
CLEAR wa_bapi_mltx.
IF strlen( wa_upload-sales ) > 396.
wa_bapi_mltx-applobject = 'MVKE'.
wa_bapi_mltx-text_name = l_text1.
wa_bapi_mltx-text_id = '0001'.
wa_bapi_mltx-langu = 'E'.
wa_bapi_mltx-format_col = ''.
wa_bapi_mltx-langu_iso = 'EN'.
wa_bapi_mltx-text_line = wa_upload-sales+396(104).
APPEND wa_bapi_mltx TO it_bapi_mltx.
CLEAR wa_bapi_mltx.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM.

*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display_alv .

IF it_success IS NOT INITIAL AND p_test IS INITIAL.


w_fcat-col_pos = '1'.
##NO_TEXT w_fcat-fieldname = 'STATUS'.
##NO_TEXT w_fcat-seltext_l = 'Status'.
APPEND w_fcat TO t_fcat.
CLEAR w_fcat.

w_fcat-col_pos = '2'.
##NO_TEXT w_fcat-fieldname = 'RECNO'.
##NO_TEXT w_fcat-seltext_l = 'Record No'.
APPEND w_fcat TO t_fcat.
CLEAR w_fcat.

w_fcat-col_pos = '3'.
##NO_TEXT w_fcat-fieldname = 'MATNR'.
##NO_TEXT w_fcat-seltext_l = 'Material'.
APPEND w_fcat TO t_fcat.
CLEAR w_fcat.

w_fcat-col_pos = '4'.
##NO_TEXT w_fcat-fieldname = 'TYPE'.
##NO_TEXT w_fcat-seltext_l = 'Type'.
APPEND w_fcat TO t_fcat.
CLEAR w_fcat.

w_fcat-col_pos = '5'.
##NO_TEXT w_fcat-fieldname = 'ID'.
##NO_TEXT w_fcat-seltext_l = 'Id'.
APPEND w_fcat TO t_fcat.
CLEAR w_fcat.

w_fcat-col_pos = '6'.
##NO_TEXT w_fcat-fieldname = 'NUMBER'.
##NO_TEXT w_fcat-seltext_l = 'Number'.
APPEND w_fcat TO t_fcat.
CLEAR w_fcat.
w_fcat-col_pos = '7'.
##NO_TEXT w_fcat-fieldname = 'MESSAGE'.
##NO_TEXT w_fcat-seltext_l = 'Message'.
APPEND w_fcat TO t_fcat.
CLEAR w_fcat.
s_layo-colwidth_optimize = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'


EXPORTING
i_callback_program = sy-repid
is_layout = s_layo
it_fieldcat = t_fcat
TABLES
t_outtab = it_success.
IF sy-subrc <> 0 ##FM_SUBRC_OK .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFORM.

You might also like