‎2008 Nov 17 12:39 PM
Moderator message: Please use a more meaningful subject in future
Hi all,
I am new in sap/abap,
i do the upload program for project definition. i use this FM: BAPI_BUS2001_CREATE
i dont know how to create program. any one help me.
here my creation of program.
note: read the file records and upload the data to t code cj01 using that FM.
Thanks,
Amudha
Edited by: Matt on Nov 17, 2008 1:59 PM
‎2008 Nov 17 1:02 PM
Search on this forum/wiki for tutorials about how to ABAP.
Transaction to create a abap is SE38.
regards,
Hans
‎2008 Nov 17 2:36 PM
Go to SE38 tcode and create the program
crate your internal as your file strcture.
&----
*& SELECTION SCREEN
&----
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: pa_sep(1) TYPE c , "Field Separator
p_file1 TYPE rlgrap-filename MODIF ID sc1,
p_file2 TYPE rlgrap-filename MODIF ID sc2,
p_local RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND rad,
p_server RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b1.
F4 Help for Presentation Server
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = p_file1.
F4 Help for Application Server
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file2.
SUBMIT rs_get_f4_dir_from_applserv AND RETURN.
IMPORT path_name TO path_name FROM MEMORY ID 'PATH_NAME_SDL'.
p_file2 = path_name.
&----
*& START-OF-SELECTION
&----
START-OF-SELECTION.
IF NOT p_file1 IS INITIAL.
gv_file = p_file1.
ELSEIF NOT p_file2 IS INITIAL.
gv_file = p_file2.
ENDIF.
*If the Presentation Server is selected on the selection screen
IF p_local EQ gc_x.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gv_file
filetype = gc_filetype
TABLES
data_tab = gt_dependency_file
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*If the Application Server is selected on the selection screen
ELSEIF p_server EQ gc_x.
Read the data from Application Server
OPEN DATASET gv_file FOR INPUT IN TEXT MODE ENCODING DEFAULT
WITH SMART LINEFEED.
ENDIF.
*If the Presentation Server is selected on the selection screen
IF p_local EQ gc_x.
LOOP AT gt_dependency_file INTO gwa_dependency_file.
SPLIT gwa_dependency_file AT pa_sep INTO gv_str
wa_bom-appl_obj_type
wa_bom-ippe_obj_type
wa_bom-assembly_group_name
wa_bom-assembly_group_text .
APPEND wa_bom TO gt_bom .
CLEAR wa_bom.
ENDLOOP.
If the Application Server is selected on the selection screen
ELSEIF p_server EQ gc_x.
DO.
READ DATASET gv_file INTO gv_str.
IF sy-subrc = 0.
SPLIT gv_str AT pa_sep INTO gv_str
wa_bom-appl_obj_type
wa_bom-ippe_obj_type
wa_bom-assembly_group_name
wa_bom-assembly_group_text .
APPEND wa_bom TO gt_bom .
CLEAR wa_bom.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET gv_file.
ENDIF.
after this you can pass your function module
‎2008 Nov 18 3:08 AM
Hi Chenna,
This program s very helpful for me,
but it shows some errors like gv_file, path_name, gc_x and gc_filetype not declared, i declared this as variable TYPE c. and i dont know how i declare for "gt_dependency_file".
and some variable also.
as you said at the end i call the FM 'bapi_bus2001_create'.
EXPORTING
I_PROJECT_DEFINITION = ls_proj_def
TABLES
ET_RETURN = lt_ret
and
Initially i declared like this
data: ls_proj_def type BAPI_BUS2001_NEW.
DATA: lt_ret type table of BAPIRET2,
DATA: path_name TYPE C,
gv_file TYPE C,
gc_x TYPE C,
gc_filetype TYPE C.
declaration part also am not get successful, so please can you help me.
Thanks for advance help.
Amudha.
‎2008 Nov 18 9:55 AM
Perhaps it is a good idea to do a training course in ABAP programming before you do this?
Cheers,
Julius
‎2008 Nov 18 1:35 PM