SAP data migration: Create project milestone

Source: Internet
Author: User
Tags date1

Reference: skysky

This report is used to create milestone.

Report zup4.
Data:
Begin of rtab,
Project (24 ),
WBS (24 ),
Usage (5 ),
DESC (40 ),
Fbdate (10 ),
Acdate (10 ),
Sales (1 ),
Ivper (10 ),
End of rtab.
Data: itab like standard table of rtab.
Data: temp like standard table of rtab with header line.
Data: pro_def like bapi_project_definition,
Pro_def_up like bapi_project_definition_up.
Data: med_pro like bapi_method_project occurs 0 with header line,
Mil_sto like bapi_wbs_milestone occurs 0 with header line,
Mil_sto_up like bapi_wbs_milestone_upd occurs 0 with header line.
Data: RC like bapireturn1.
Data: date1 type D, date2 type D.
Parameters: file like RLGRAP-FILENAME obligatory.
Perform upload_file.
Check not itab [] is initial.
*******
Sort itab by project WBS.
Loop at itab into rtab.
Append rtab to temp.
At end of WBS.
Loop at temp.
PRO_DEF-PROJECT_DEFINITION = RTAB-PROJECT.
PRO_DEF_UP-PROJECT_DEFINITION = 'x '.
MED_PRO-OBJECTTYPE = 'wbsmilestone '.
MED_PRO-METHOD = 'create '.
MED_PRO-REFNUMBER = '000000 '.
Append med_pro.
Clear: med_pro.
MED_PRO-METHOD = 'save '.
Append med_pro.
MIL_STO-WBS_ELEMENT = TEMP-WBS.
MIL_STO-MILESTONE_USAGE = TEMP-USAGE.
MIL_STO-DESCRIPTION = TEMP-DESC.
Clear: date1, date2.
Call function 'convert _ date_to_internal'
Exporting
Date_external = TEMP-FBDATE
Importing
Date_internal = date1
Exceptions
Date_external_is_invalid = 1
Others = 2.
The MIL_STO-FIXED_MILESTONE_DATE_BASIC = date1.
Call function 'convert _ date_to_internal'
Exporting
Date_external = TEMP-ACDATE
Importing
Date_internal = date2
Exceptions
Date_external_is_invalid = 1
Others = 2.
The MIL_STO-ACTUAL_DATE = date2.
MIL_STO-SALES_DOC_DATE_INIDICATOR = TEMP-SALES.
MIL_STO-INVOICE_PERCENTAGE = TEMP-IVPER.
Append mil_sto.
MIL_STO_UP-WBS_ELEMENT = 'x '.
MIL_STO_UP-MILESTONE_USAGE = 'x '.
MIL_STO_UP-DESCRIPTION = 'x '.
MIL_STO_UP-FIXED_MILESTONE_DATE_BASIC = 'x '.
MIL_STO_UP-ACTUAL_DATE = 'x '.
MIL_STO_UP-SALES_DOC_DATE_INIDICATOR = 'x '.
MIL_STO_UP-INVOICE_PERCENTAGE = 'x '.
Append mil_sto_up.
*******
Call function 'bapi _ project_maintain'
Exporting
I _project_definition = pro_def
I _project_definition_upd = pro_def_up
Importing
Return = RC
Tables
I _method_project = med_pro
I _wbs_milestone_table = mil_sto
I _wbs_milestone_table_update = mil_sto_up.
Clear: pro_def, RC, med_pro, med_pro [], mil_sto, mil_sto [],
Mil_sto_up, mil_sto_up [], pro_def_up.
Endloop.
Clear: temp, temp [].
Endat.
Endloop.
*&---------------------------------------------------------------------*
* & Form upload_file
*&---------------------------------------------------------------------*
* Text
*----------------------------------------------------------------------*
* --> P_dataset text
*----------------------------------------------------------------------*
Form upload_file.
Call function 'ws _ upload'
Exporting
Filename = File
Filetype = 'dat'
Tables
Data_tab = itab
Exceptions
Conversion_error = 1
File_open_error = 2
File_read_error = 3
Invalid_type = 4
No_batch = 5
Unknown_error = 6
Invalid_table_width = 7
Gui_refuse_filetransfer = 8
Customer_error = 9
Others = 10.
Endform. "upload_file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.