2008 Jul 10 6:19 AM
I have got a requirement where I need to extract data from certain fields from LFA1, LFB1, ADR6, ADRC
to application server in XML format. and also to schedule this job in the background.
How should I proceed...Any sample code related to this would be helpful !
Please repsond !
I have got a requirement where I need to extract data from certain fields from LFA1, LFB1, ADR6, ADRC
to application server in XML format. and also to schedule this job in the background.
How should I proceed...Any sample code related to this would be helpful !
Please repsond !
2008 Jul 10 6:25 AM
HI,
u need to use the NTF functionality for that purpose. and also use opendata set intab for output in legacy text mode.
before that check weather u have the authorisation to deposit a file in the application server. for that u need to use authority_check_ dataset FM.
reward if useful,
babu
2008 Jul 10 6:28 AM
hi,
u can write a report to extract data from ur tables and use gui_download function module to send the data to ur presentation server.
then use CG3Z transaction to upload that data into application server.
2008 Jul 10 6:32 AM
Hi,
Simply write a report and get data from tables which you want for selection.
Use Dataset commands like Open/read/Transfer dataset and transfer the data on application server.
If you need to fetch data from LFA1 and LFB1 you can use the sap standard view VF_KRED.
Hope this helps!!
Regards,
lalit
2008 Jul 10 6:39 AM
Hi Lalit,
Thanks for your precious help. But because I am new to ABAP , if could please send some sample code explaining the same.
Thanks n Regards,
Shreya
2008 Jul 10 7:04 AM
Hi shreya,
Hope this code helps you to proceed further.
This will extract data from certain fields from MARA
to application server.
TYPES: BEGIN OF tw_mara,
matnr TYPE matnr, "Material Number
mtart TYPE mtart, "Material Type
meins TYPE meins, "Base Unit of Measure
END OF tw_mara,
tt_mara TYPE STANDARD TABLE OF tw_mara.
*&---------------------------------------------------------------------*
*& DATA
*&---------------------------------------------------------------------*
DATA: lw_mara TYPE tw_mara,
lt_mara TYPE tt_mara.
DATA: gf_matnr TYPE mara-matnr.
*&---------------------------------------------------------------------*
*& SELECTION-SCREEN
*&---------------------------------------------------------------------*
* Material Info
SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : so_matnr FOR gf_matnr.
SELECTION-SCREEN END OF BLOCK bk1.
* File Details
*SELECTION-SCREEN BEGIN OF BLOCK bk2 WITH FRAME TITLE text-002.
*PARAMETERS: pa_fpath TYPE rlgrap-filename.
*SELECTION-SCREEN END OF BLOCK bk2.
*
DATA:pa_fpath TYPE string VALUE '/usr/sap/IDZ/DVEBMGS00/work/ztest.txt'.
"File name where data gets stored in the application server.
*&---------------------------------------------------------------------*
*& START-OF-SELECTION
*&---------------------------------------------------------------------*
START-OF-SELECTION.
"Fetch data from MARA table
SELECT matnr mtart meins INTO TABLE lt_mara
FROM mara
WHERE matnr IN so_matnr.
"If no data found for the given selection.
IF sy-subrc NE 0.
MESSAGE i000(00) WITH 'No data found'.
LEAVE TO LIST-PROCESSING.
ENDIF.
" Open the dataset
OPEN DATASET pa_fpath FOR APPENDING IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
LOOP AT lt_mara INTO lw_mara.
"Write the data into the file
TRANSFER lw_mara TO pa_fpath.
ENDLOOP.
ELSE.
WRITE :/ 'Error while opening the file'.
ENDIF.
"Close the dataset
CLOSE DATASET pa_fpath.
Thanks
Ramya
2008 Jul 10 7:07 AM