2010 Feb 16 5:37 AM
i am new in abap , and i have the following issue,so plz anyone who knows how to do it
Background :
An XML file is used as the datasource for a Flex Application. From time to time this requires updating with new staff details.
i have already saved the xml file in the c drive with the name C:\AdvAC\AC1\bin-debug\assets\staff
Requirement : Write a Dialog transaction with the following text input fields.
Reference Indicator. (Char10)
Staff No (NUMC, Length 5)
Name (Char50)
Room (Numc, length 3)
Phone (Numc Length 7)
Mail (char30)
in screen 100
The transaction should also have an u201CUpdate Fileu201D button, which when pressed :
1) Loads the file C:\AdvAC\AC1\bin-debug\assets \ into an ITAB.
2) Inserts the data into the ITAB using the following XML format.
<staff>
<ref_ind> Reference Indicator.</ref_ind>
<staff_no> Staff No </staff_no>
<name> Name </name>
<room> Room </room>
<phone> Phone </phone>
<mail> Mail </mail>
</staff>
all should be inside <allstaff> </allstaff> tagsu2026.
Writes the ITAB back to the file.
thanx all
i am new in abap , and i have the following issue,so plz anyone who knows how to do it
Background :
An XML file is used as the datasource for a Flex Application. From time to time this requires updating with new staff details.
i have already saved the xml file in the c drive with the name C:\AdvAC\AC1\bin-debug\assets\staff
Requirement : Write a Dialog transaction with the following text input fields.
Reference Indicator. (Char10)
Staff No (NUMC, Length 5)
Name (Char50)
Room (Numc, length 3)
Phone (Numc Length 7)
Mail (char30)
in screen 100
The transaction should also have an u201CUpdate Fileu201D button, which when pressed :
1) Loads the file C:\AdvAC\AC1\bin-debug\assets \ into an ITAB.
2) Inserts the data into the ITAB using the following XML format.
<staff>
<ref_ind> Reference Indicator.</ref_ind>
<staff_no> Staff No </staff_no>
<name> Name </name>
<room> Room </room>
<phone> Phone </phone>
<mail> Mail </mail>
</staff>
all should be inside <allstaff> </allstaff> tagsu2026.
Writes the ITAB back to the file.
thanx all
2010 Feb 16 5:48 AM
this is what i have done but i dont know how to do the rest. i will apprecite any help from u.
Edited by: man700s on Feb 16, 2010 6:58 AM
REPORT Z_XML_FILE_UPDATE.
TYPES: BEGIN OF ts_staff,
REF_IND(10) TYPE c,
Staff_No(5) TYPE c,
Name(50) TYPE c,
Room(3) Type n,
Phone(7) Type n,
Mail(30) Type c,
END OF ts_staff.
DATA: t_staff TYPE TABLE OF ts_staff WITH HEADER LINE.
DATA: w_staff Type ts_staff.
DATA T_STRING TYPE TABLE OF STRING.
DATA W_STRING TYPE STRING.
call SCREEN 100.
PERFORM upload_xml_file.
PERFORM update_xml_tab.
*PERFORM download_xml_file.
MODULE USER_COMMAND_0100 INPUT.
W_STRING = '<allstaff>'.
APPEND w_string to t_string.
loop at t_staff into w_staff.
w_string ='<staff>'.
APPEND w_string to t_string.
if T_staff-Ref_Ind = 'X'.
CONCATENATE '<Ref_Ind>' w_staff-Ref_Ind '</Ref_Ind>' into w_string.
APPEND w_string to t_string.
ENDIF.
if T_staff-staff_no = 'X'.
CONCATENATE '<staff_no>' w_staff-staff_no '</staff_no>' into w_string.
APPEND w_string to t_string.
ENDIF.
if T_staff-name = 'X'.
CONCATENATE '<name>' w_staff-name '</name>' into w_string.
APPEND w_string to t_string.
ENDIF.
if T_staff-room = 'X'.
CONCATENATE '<room>' w_staff-room '</room>' into w_string.
APPEND w_string to t_string.
ENDIF.
if T_staff-phone = 'X'.
CONCATENATE '<phone>' w_staff-phone '</phone>' into w_string.
APPEND w_string to t_string.
ENDIF.
if T_staff-mail = 'X'.
CONCATENATE '<mail>' w_staff-mail '</mail>' into w_string.
APPEND w_string to t_string.
ENDIF.
w_string = '</staff>'.
append w_string to t_string.
ENDLOOP.
W_STRING = '</allstaff>'.
APPEND w_string to t_string.
ENDMODULE.
Edited by: man700s on Feb 16, 2010 7:01 AM
2010 Feb 16 6:07 AM
this is the to upload the xml file
FORM UPLOAD_XML_FILE .
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
EXPORTING
FILENAME = 'C:\AdvAC\AC1\bin-debug\assets\staff'
FILETYPE = 'ASC'
CHANGING
DATA_TAB = T_STRING
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
NOT_SUPPORTED_BY_GUI = 17
ERROR_NO_GUI = 18
others = 19
.
ENDFORM.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |