Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to pick the file from application server in background

Former Member
0 Kudos

hi ,

im developing an interface program, my requirement is the interface file should be picked from application server in background from specific location at a certain time daily .is it possible how to do . any help will be appreciated

thanks to all

1 ACCEPTED SOLUTION

former_member156446
Active Contributor

it is possible the solution has been posted many times in Forum please SEARCH

Reported!!

18 REPLIES 18

former_member156446
Active Contributor

it is possible the solution has been posted many times in Forum please SEARCH

Reported!!

0 Kudos

thanks j@y for suggestion.

im searching for that in scn could not find the post regarding the requirement, then only i post it . please can u give me the links for this in scn i couldnt find . your kind help will be appreciated .

0 Kudos

[Search |https://forums.sdn.sap.com/click.jspa?searchID=21345195]

0 Kudos

Okay,

Would these below Search result work?

0 Kudos

Hi Amit,

your links seems more linked to my requirement .

thanks.

0 Kudos

HI,

You need to use the OPEN DATASET, READ DATASET & CLOSE DATASET to upload the data from application server to internal table and do processing as per your rquirement.

If you want to have upload the data timely..schedule the Report program as job.

Former Member
0 Kudos

Hi,

Try with the FM 'GUI_UPLOAD'.

Regards,

Aravind J M

0 Kudos

GUi_upload is for NOT for application server....

Open dataset is the key word to search..

0 Kudos

gui_upload is for front end(presentation server) i think

Former Member
0 Kudos

in one of my requirement, the functional guys has look after the scheduling the back ground job etc. stuff......so, i guess, just u need to write the prog, by using the above key words, then the functional team will schedule it, u need not worry abt it, better keep the application server path as parameter on the selection screen, and make sure that, the file shuld over write each time ión UNIX(if its a regular job).

thanq

0 Kudos

how to make sure that the file is overwritten with other one.

0 Kudos

Hi First,, start codeing form the input you got in the forum.. in the process if any thing stops you search the forum for the solution if you dont find then get back with a Question.

If you got enough info close the thread...

0 Kudos

Hi,

You can also define the aplication server path using the transaction FILE.

Kind regards

Åsa Thenstedt

p244500
Active Contributor
0 Kudos

hi

When scheduling a job in the background the appropriate statement to read in your file is OPEN DATASET, and the file must be on the file system that the SAP server can see.

At anytime, a user can switch of the Personal Computers even though the job is still running in the background. Therefore GUI_* and WS_* function modules are not designed to work in that way, as they need to access your personal computer file.

To choose the correct download method to used, you can check the value of SY-BATCH in your code,

if it is 'X' use OPEN DATASET and if it is ' ' use WS_UPLOAD.

*-- Open dataset for reading

DATA:

dsn(20) VALUE '/usr/test.dat',

rec(80).

OPEN DATASET dsn FOR INPUT IN TEXT MODE.

IF sy-subrc = 0.

DO.

READ DATASET dsn INTO rec.

IF sy-subrc <> 0.

EXIT.

ELSE.

WRITE / rec.

ENDIF.

ENDDO.

ENDIF.

CLOSE DATASET dsn.

*-- Open dataset for writing

DATA rec(80).

OPEN DATASET dsn FOR OUTPUT IN TEXT MODE.

TRANSFER rec TO '/usr/test.dat'.

CLOSE DATASET dsn.

*And*

*You need to do following this thing also*

      • Create a file in AL11 ( By using CG3Y / CF3Z Transaction ) , Then it it will create a file in AL11->Home.**

      • In your code upload this file by using OPEN DATASET etc syntaxe**

Regard

nawa

shadow
Participant
0 Kudos

Hi ,

Could u check this program , hope use full for u.

OPEN DATASET file IN TEXT MODE ENCODING DEFAULT FOR INPUT.

DO .

READ DATASET FILE INTO ITAB.

APPEND ITAB.

IF SY-SUBRC <> 0.

EXIT.

ENDIF.

LOOP AT ITAB.

REFRESH JTAB.

PERFORM SUB USING 'ZVIF' '0100'.

PERFORM SUB1 USING:'LFA1-LIFNR' ITAB-LIFNR,

'LFA1-NAME1' ITAB-NAME1,

'LFA1-LAND1' ITAB-LAND1.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'ZVIF'

TABLES

DYNPROTAB = JTAB.

ENDLOOP.

ENDDO.

CLOSE DATASET FILE.

Regard's

Shaik.

chi_chiu_wong
Explorer
0 Kudos

Hi,

Here is a sample abap program for extract data from custom table and download to a file on server for your reference.

The ZUSR02 is a view created from USR02. You can changed the code for reading different for testing.

Regards,

Billy

zbcdataset01.txt

----------------------------------------------------------------------

Sample ABAP Program:

----------------------------------------------------------------------

REPORT ZBCDATEXTRACT01.
TABLES:ZUSR02.
DATA HEADER(255).
DATA: BEGIN OF ITAB OCCURS 0,
CLIENT like ZUSR02-CLIENT,
BNAME like ZUSR02-BNAME,
USTYP like ZUSR02-USTYP,
UFLAG like ZUSR02-UFLAG,
TRDAT like ZUSR02-TRDAT,
PWDLGNDATE like ZUSR02-PWDLGNDATE,
LOCNT like ZUSR02-LOCNT,
GLTGV like ZUSR02-GLTGV,
GLTGB like ZUSR02-GLTGB,
END OF ITAB.
DATA: ZSYSID(3) type C.
DATA: ZBNAME(12) type C.
DATA: ZUSTYP(1) type C.
DATA: ZUFLAG(3) type C.
DATA: ZTRDAT(8) type C.
DATA: ZPWDLGNDATE(8) type C.
DATA: ZLOCNT(3) type C.
DATA: ZGLTGV(8) type C.
DATA: ZGLTGB(8) type C.
DATA: ZCLIENT(3) type C.

DATA: wa_itab like line of ITAB.

DATA: v_record(255) TYPE C.

PARAMETERS: OUTFILE(60) DEFAULT 'R:\usr\sap\UD2\DVEBMGS12\data\ZBCDATASET01.txt' LOWER CASE.
PARAMETERS: ZPAR2 DEFAULT ';' LOWER CASE.
CONCATENATE 'SYSTEM_ID' 'ZUSR02-CLIENT' 'ZUSR02-BNAME' 'ZUSR02-USTYP' 'ZUSR02-UFLAG' 'ZUSR02-TRDAT' 'ZUSR02-PWDLGNDATE' 'ZUSR02-LOCNT' 'ZUSR02-GLTGV' 'ZUSR02-GLTGB' INTO HEADER SEPARATED BY ZPAR2.

ZSYSID = SY-SYSID.


OPEN DATASET OUTFILE FOR OUTPUT IN TEXT MODE encoding UTF-8.
SELECT * FROM ZUSR02 INTO CORRESPONDING FIELDS OF TABLE ITAB.

TRANSFER HEADER TO OUTFILE.

LOOP AT ITAB into wa_itab.
ZUFLAG = wa_itab-UFLAG.
ZLOCNT = wa_itab-LOCNT.

CONCATENATE ZSYSID wa_itab-client wa_itab-BNAME wa_itab-USTYP ZUFLAG wa_itab-TRDAT wa_itab-PWDLGNDATE ZLOCNT wa_itab-GLTGV wa_itab-GLTGB into v_record separated by ZPAR2.
TRANSFER v_record TO OUTFILE.
ENDLOOP.


CLOSE DATASET OUTFILE.

chi_chiu_wong
Explorer
0 Kudos

Custom view structure (ZUSR02)

chi_chiu_wong
Explorer
0 Kudos

Application tables for FI

Accounts Recievables
1. BSID - Customer Open Items
2. BSAD- Customer cleared items.
Accounts Payables
1. BSIK - Vendor Open Items
2. BSAK- Vendor cleared items.

Vendor Master : LFA1, LFB1, LFBK, LFBW,ADRC, ADR6
Customer Master : KNA1, KNB1, KNBK ( KN*)
Payment : REGUP, REGUH, RAGUV ( REGU*), PAYR
Documents : BKPF, BSEG, BSIS, BSAD, BSAK