2008 Oct 17 3:15 PM
Hi friends,
Now, I am using this scenario step by step:
1. step: Transaction ZUPLOAD for uploading file to application server. Code for this is:
data: begin of oldrec occurs 0,
txt1(250),
txt2(250),
end of oldrec.
start-of-selection.
call function 'UPLOAD'
tables data_tab = oldrec
exceptions others = 1.
if sy-subrc ne 0.
write:****
else.
open dataset outfile for output in text mode.
if sy-subrc = 0.
loop at oldrec.
transfer oldrec to outfile.
endloop.
close dataset outfile.
if sy-subrc = 0.
write:****
else.
write:****
endif.
else.
write:*****
endif.
endif.
2. step: TR SE38 run Z program for preparing file to serve as input for RFBIBL00. (I have source code)
3. step: go to TR SM35 and proces new created session.
Final result is posted FI document that I can view using FB03.
My question is: How can I make one program that will do these 3 steps? I want to have one transaction that will do all these 3 steps and as output that will give me posted document. if you need I may send you to private mail screen shots and all codes of what I do and my scenario and what I want to have now.
Thanks a lot.
Nihad
Edited by: nihad omerbegovic on Oct 17, 2008 4:15 PM
Edited by: nihad omerbegovic on Oct 17, 2008 4:25 PM
2008 Oct 17 3:31 PM
Hi,
You can do this in one program only.
Write a program to create a file mentioned by you in STEP1.
If the file is successfully created then use Submit statement in the program to call the report 'RFBIBL00' with the file name OUTFILE you created. (STEP 2).
STEP 3 i think will be taken care by the std program you are using i.e., 'RFBIBL00', then check SM35.
With Regards,
Dwarakanath.S
2008 Oct 17 3:31 PM
2008 Oct 17 3:31 PM
Hello,
I suggest you to use the SUBMIT or CALL TRANSACTION commands.
See this for more help http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9d7535c111d1829f0000e829fbfe/frameset.htm
Regards.
2008 Oct 17 3:31 PM
Hi,
You can do this in one program only.
Write a program to create a file mentioned by you in STEP1.
If the file is successfully created then use Submit statement in the program to call the report 'RFBIBL00' with the file name OUTFILE you created. (STEP 2).
STEP 3 i think will be taken care by the std program you are using i.e., 'RFBIBL00', then check SM35.
With Regards,
Dwarakanath.S
2008 Oct 17 3:34 PM
1. Create a program with step 1 then for step 2 use SUBMIT Zprogram and for step 3 use SUBMIT RSBDCSUB
a®
2008 Oct 17 3:36 PM
Hi,
I want to have only one program that will be under one transaction.
When I run that Transaction all logic under STEP 1, STEP 2 and STEP 3 will be done so I would have posted document as final result.
I can not run SM35 separately. Session must be procesed during performing of this unique Z program.
I wait for your replies, Thanks
Nihad
2008 Oct 17 3:39 PM
In my reply i mentioned if you submit RSBDCSUB after your zprogram . you don't need to call sm35 separately
a®
2008 Oct 17 3:40 PM
As a®s said, you have to submit RSBDCSUB as well, but this will process the batch input session in a separate process and will continue after the original program finishes.
If I understand your requirements, I don't think there is a way to fulfil them.
Rob
2008 Oct 17 3:42 PM
Ok, thanks I will try and give you feedback. I don't have access to system until monday so I will send you reply. Thanks again.
Nihad
2008 Oct 17 3:45 PM
Rob, session may be processed in background, separately doesn't matter. I just want to have my document posted when I leave this new program.
Thanks.
Edited by: nihad omerbegovic on Oct 17, 2008 4:45 PM
Edited by: nihad omerbegovic on Oct 17, 2008 4:46 PM
2008 Oct 17 3:48 PM
The document will probably not be posted by the time you program finishes. RSBDCSUB justs submits the batch input session and returns. The BDC then just continues on it's own.
Rob
2008 Oct 17 3:51 PM
Yes, it is fine also. The logic is that I don't want to run 3 different program and transactions separately. I want to run one Z TR that will do this logic in 1 step, not in 3 steps as I use now.
Thanks again for help
Nihad
Edited by: nihad omerbegovic on Oct 18, 2008 5:06 PM
2008 Oct 20 8:16 AM
Hi guys,
I have done something on this. I wrote Z program for step 1
then SUBMIT Zprogram from step 2
and then SUBMIT RSBDCSUB.
I got new session but problem is that I have to manually process it. I got this:
MF20102008 NIHADOM 20.10.2008 08:59:58 NIHADOM New 3
Is there any way to proces this session in background, what should I change my code??
PARAMETERS: OUTFILE(80).
data: begin of oldrec occurs 0,
txt1(250),
txt2(250),
end of oldrec.
start-of-selection.
call function 'UPLOAD'
tables data_tab = oldrec
exceptions others = 1.
if sy-subrc ne 0.
write:/
else.
open dataset outfile for output in text mode.
if sy-subrc = 0.
loop at oldrec.
transfer oldrec to outfile.
endloop.
close dataset outfile.
if sy-subrc = 0.
write:/
else.
write:/
endif.
else.
write:/
endif.
endif.
SUBMIT Z_FI_MEDJUNARODNI_OBRACUN_FIKS.
SUBMIT RSBDCSUB.
How to do this friends??
Thanks
Nihad
2008 Oct 20 8:39 AM
Use this as follow -
SUBMIT rsbdcsub AND RETURN
WITH mappe EQ v_bdc_name. "BDC session name
Regards,
Mohaiyuddin
2008 Oct 20 8:23 AM
Hi Nihad,
write a program for
1. Uploading the file (you already have it)
2. Use SUBMIT and Return for Step 2.
3. Use SUBMIT RSBDCSUB and RETURN.. to automatically submit and process your BDC session.
4. use following logic to wait for certain time for session to be completed in foreground, else submit job for monitoring and creating output in spool.
DO 10000 times. (Count will vary how long you want to wait)
Select Qstate from APQI for BDC session submitted. Please check on created time and date to avoid referring to older sessions.
Check IF QSTATE = E OR F (Error or Finished).
If yes, EXIT, else continue.
ENDDO.
If sy-index <= 10000. (or count you have specified).
Write Logic to select data from FI tables based on information available in internal table updaloaded from file.
Output appropriate data.
else.
Tranport internal table uploaded in step 1 to memory or specify filepath so that monitoring program can upload data from file.
use OPEN_JOB (FM)
SUBMIT <monitoring program> VIA JOB AND RETURN....
CLOSE_JOB (FM)
endif.
<monitoring program> = It will contain same logic as above with addition of uploading data logic used in STEP 1.
In SUBMIT statement you may pass parameter to monitoring program to specify filepath, session name etc.
Regards,
Mohaiyuddin
Edited by: Mohaiyuddin Soniwala on Oct 20, 2008 12:58 PM
2008 Oct 21 7:48 AM
Hi guys, when I run my zprogram, upload file and process session in background I got this screen, is there a way to omit this???
Batch input: Process all sessions still to be processed 21.10.2008
Time Session Date Time Job no. Queue ID
08:36:41 MF21102008 21.10.2008 08:36:38 08364101 08102108363852285232
08:36:41 KLASIF_PM 18.09.2002 10:44:03 08364101 02091810440123320001
Submit RSDBCBTC not successfully executed (see SYSLOG)
08:36:41 IBIP09171150 17.09.2002 11:50:39 08364101 02091711503804280002
Submit RSDBCBTC not successfully executed (see SYSLOG)
08:36:41 TUMOBL080901 20.08.2008 09:01:28 08364101 08082009012878202225
08:36:41 TUMOBL080856 20.08.2008 08:56:58 08364101 08082008565825200933
08:36:41 TUMOBL080844 20.08.2008 08:44:43 08364101 08082008444325200929
Also, I would like to print out fields. How to do this.
time
date,
BSEG-BELNR,
BKPF-USNAM,
BKPF-BELNR
Lastly, when I double click on document number (BELNR) on this screen I want to go into document (like TR FB03)
How to do this??
Thanks,
Nihad
2008 Oct 21 8:00 AM
My zprogram source code is like this:
PARAMETERS: OUTFILE(80).
data: begin of oldrec occurs 0,
txt1(250),
txt2(250),
end of oldrec.
start-of-selection.
call function 'UPLOAD'
tables data_tab = oldrec
exceptions others = 1.
if sy-subrc ne 0.
write:/
else.
open dataset outfile for output in text mode.
if sy-subrc = 0.
loop at oldrec.
transfer oldrec to outfile.
endloop.
close dataset outfile.
if sy-subrc = 0.
write:/
else.
write:/
endif.
else.
write:/
endif.
endif.
SUBMIT Z_FI_MEDJUNARODNI_OBRACUN_FIKS AND RETURN.
SUBMIT RSBDCSUB AND RETURN.
How to modify code to get these fields in report output:
current time,
current date,
BSEG-BELNR,
BKPF-USNAM,
BKPF-BELNR
These fields should go each in new line if possible.
When I double click on document number (BELNR) on this screen I want to go into document. How to do this??
Thanks,
Nihad
2008 Oct 21 8:04 AM
The program should look like
- CALL TRANSACTION ZUPLOAD
- SUBMIT Zreport
- SUBMIT RSBDCSUB (or CALL TRANSACTION SM35)
Regards
2008 Oct 21 8:08 AM
Session should be procesed in background that's why I should use SUBMIT RSBDCSUB AND RETURN.
Right? What about these fields? I need them in report output.
Thanks,
Nihad
2008 Oct 21 8:24 AM
Should I put SELECT in my main zprogram or in the zprogram I call with SUBMIT??
Do you have idea?
My output should look like this:
TIME
DATE
USNAM
BELNR (for one or more vendors from the file I upload)
Double click on BELNR should open my FI document.
Thank you guys
Nihad
2008 Oct 21 2:32 PM
2008 Oct 21 8:30 PM
Ok, I closed the other thread.
Have a look at my question guys, should I put select, loop at and write in main program.
is there need to define my internal structures like it_bseg and it_bkpf and how
could I take data since I have no any condition??
after my program finishes for posted documents fieldsa like usnam, belnr, time and date should be taken
from bseg and bkpf.
I have no acess to system right now. any idea is welcomed
thanks
Nihad
2008 Oct 21 8:38 PM
You will not have access to these fields until after the batch input session finishes. That will probably not be until after this program finishes. That is what I said in my earlier post.
Rob
2008 Oct 21 8:40 PM
Thanks,I understand Rob, but what should I do? I need these fields in output. How to overcome this problem?
Nihad
2008 Oct 21 8:44 PM
Using RFBIBL00 and RSBDCSUB, you cannot.
You would have to re-write your current process using call transaction (not a simple process).
Look at alternatives . After your program and the batch input session have completed, run a report that gives the information you need.
However -
If you set the "Data transfer type" to 'C' (call transaction) on the selection screen for RFBIBL00, you may be able to get the documents. (I haven't tried this.)
And you won't have to submit RSBDCSUB.
Rob
Edited by: Rob Burbank on Oct 21, 2008 3:53 PM
2008 Oct 21 8:42 PM
And yes, after program finishes, I go to SM35 and I can see my session processed.
When I enter it I see posted documents and their numbers.
Nihad
2008 Oct 21 8:56 PM
Ok, that's valuable info Rob. how do you mean to do this? should I write it separately and call it from my main program or as part of my main code?
Nihad
2008 Oct 21 9:00 PM
2008 Oct 27 8:59 AM
After SUBMIT RSBDCSUB AND RETURN.
I would like to print some fields with values that are in tables bseg and bkpf
after posting is finished. How to do this please have a look at my selects.
REPORT Z_MOB_FAK .
tables: bkpf,bseg.
data: it_bkpf type table of bkpf with header line,
wa_bkpf type bkpf,
it_bseg type table of bseg with header line,
wa_bseg type bseg.
PARAMETERS: OUTFILE(80) default 'C:\TEMP\MFOBRACUN'.
data: begin of oldrec occurs 0,
txt1(250),
txt2(250),
end of oldrec.
start-of-selection.
call function 'UPLOAD'
tables data_tab = oldrec
exceptions others = 1.
if sy-subrc ne 0.
write:/
else.
open dataset outfile for output in text mode.
if sy-subrc = 0.
loop at oldrec.
transfer oldrec to outfile.
endloop.
close dataset outfile.
if sy-subrc = 0.
write:/
else.
write:/
endif.
else.
write:/
endif.
endif.
SUBMIT Z_FI_MEDJUNARODNI_OBRACUN_FIKS AND RETURN.
SUBMIT RSBDCSUB AND RETURN.
SELECT bukrs belnr gjahr FROM bseg
INTO TABLE it_bseg where bukrs = it_bkpf-bukrs and
belnr = it_bkpf-belnr and
gjahr = it_bkpf-gjahr.
SELECT usnam FROM bkpf
INTO TABLE it_bkpf where usnam = it_bkpf-usnam.
loop at it_bseg into wa_bseg.
loop at it_bkpf into wa_bkpf WHERE bukrs = wa_bseg-bukrs AND belnr =
wa_bseg-belnr AND gjahr = wa_bseg-gjahr.
write: wa_bseg-belnr, wa_bseg-gjahr.
endloop.
write: wa_bkpf-usnam.
endloop.
May I do select and write in this same program or I have to write report separately and later caal it
from my main program to print out these fields??
2008 Oct 27 9:09 AM
I think my condition is wrong, since I have no any conditions I should put some, could it be system time or system date (for those values of tables on specefic time when posting is finished)?? or could condition be the number od posting document??
Please have a look at selects what should I change in order to get and print
bseg-belnr, bseg-gjahr, bkpf-usnam, system time and system date?
Thanks
2008 Oct 27 10:43 AM