No result when I submit in background job a Z transaction
Hi,
I design a screen with the screen painters for my Z report instead of using SELECTION-SCREEN command to build my screen of selection. In the PAI process, I launch the same report in backgound with JOB_OPEN,SUBMIT, JOB_CLOSE and nothing happens. I go to SM50 and no job is found and SM37 confirm me thatt the job has been launch and terminate without error.
My report, when the background checkbox is checked, launch it-self in background to insert rows in 2 Z tables. Theses 2 tasks take time and are not possible to process in foreground and the user can't wait after the result. That is why I Submit my report in background.
I made it in another program with a selection screen built with SELECTION-SCREEN command and I never had this problem.
It is possible to do a selection screen with the screenpainters and launchable in background or it is only possible with SELECTION-SCREEN command.
JOB_OPEN,SUBMIT, JOB_CLOSE and nothing happens. I go
to SM50 and no job is found and SM37 confirm me thatt
the job has been launch and terminate without error.
In SM50 you can see the jobs only while they are running. Since there is an entry in SM37, it means that the job has been initiated, so something did happen. Check the job log for the details (I strongly advise to add some messages in your program to track the progress).
You might also want to take a look at the FM SUBST_START_REPORT_IN_BATCH. Here is a code example that I've just written recently to force the report execution in the background (a message is displayed to the user but the report runs in a backrgound job):
PARAMETERS: p_vkorg TYPE tvko-vkorg OBLIGATORY MEMORY ID vko.
DATA: rspar TYPE TABLE OF rsparams,
wa_rspar LIKE LINE OF rspar.
START-OF-SELECTION.
IF sy-batch IS INITIAL.
wa_rspar-selname = 'P_VKORG'.
wa_rspar-kind = 'P'.
wa_rspar-low = p_vkorg.
APPEND wa_rspar TO rspar.
CALL FUNCTION 'SUBST_START_REPORT_IN_BATCH'
EXPORTING
iv_repname = sy-repid
TABLES
tt_reportparam = rspar
EXCEPTIONS
variant_exist_check_failed = 1
variant_update_failed = 2
variant_update_not_authorized = 3
variant_update_no_report = 4
variant_update_no_variant = 5
variant_update_variant_locked = 6
variant_insert_failed = 7
variant_insert_not_authorized = 8
variant_insert_no_report = 9
variant_insert_variant_exists = 10
variant_insert_variant_locked = 11
variant_write_failed = 12
no_batch_service = 13
no_server_list = 14
batch_scheduling_failed = 15
OTHERS = 16
IF sy-subrc = 0.
MESSAGE Report started in background TYPE I.
ELSE.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
<do stuff here>
ENDIF.
SUBST_START_REPORT_IN_BATCH actually calls JOB_OPEN, JOB_CLOSE but I just find it easier to use one FM instead of 2-3.
Similar Messages
-
Issue in background job for call transaction
Dear All,
I am facing a strange issue with call transaction. I need to add some Purchase requisitons in the APO using Call transactionmethod. It is working fine In All screen mode and No Screen Mode. But when I schedule the program in BAckground processing it is not wokring fine. It is not creating any Purchase requisitioins. When I debug the background Job it is creating Purchase requisitions.
Please find the code below
DATA: l_wa_params TYPE ctu_params.
l_wa_params-dismode = l_c_mode.
l_wa_params-updmode = 'A'.
l_wa_params-defsize = 'X'.
l_wa_params-racommit = 'X'.
CALL TRANSACTION '/SAPAPO/RRP3' USING fp_i_bdcdata OPTIONS FROM l_wa_params
MESSAGES INTO l_i_bdcmsgcoll.Hi,
I have exactly the same problem with transaction /SAPAPO/RRP5.
Thanks in advance for your help,
Yannick CAREL -
How to create a background job for call transaction
hi gurus
can any one suggest me
how to create the background job for call transaction.
thank you
regards
kals.Hi,
Refer
https://forums.sdn.sap.com/click.jspa?searchID=10926107&messageID=889652
Regards
Kiran Sure -
Merge Excel cells when creating file for Background job
Hi Experts
I need to create an Excel document and within the excel sheet merge some cells, I can get that done via OLE.
My problem though comes in with... the Report needs to be scheduled as a background job and therefore OLE does not work!!!
Does any of you have another solution to merge cells while running in background??
Your thoughts are greatly appreciated.
VicHi Vic,
You can use the xml transformations for formatting excel. For my case I needed multiple sheets including glossary sheet to be mailed in a particular format , which was achieved by using transformations.
CALL TRANSFORMATION z_xls_xxx
SOURCE table = i_tmp_b[]
RESULT XML wa_xmlstr.
TRY.
cl_bcs_convert=>string_to_solix(
EXPORTING
iv_string = wa_xmlstr
iv_codepage = '4103' "suitable for MS Excel, leave empty
iv_add_bom = 'X' "for other doc types
IMPORTING
et_solix = l_bin
ev_size = l_size ).
CATCH cx_bcs.
MESSAGE e445(so).
ENDTRY. -
Error when running SWN_SELSEN as background job.
Hello Gurus,
I am facing a typical problem these days.
The background job for program SWN_SELSEN is scheduled in every 5 mins. It has started to fail intermittently with the error message 'An instance of the report SWN_SELSEN is still active'. But the stange thing is that the program completes its execution in approx. 12 - 15 secs then why this kind of error it is throwing.
This error message should not come as the program completes itself in 12- 15 secs and it has more than 4 mins as free time.
Please help as this kind of failure is happenning quite frequently i.e. once in nearly every three times it executes. In a day around 100 times.
Please help.
Thanks in advance.
NehaHello,
I assume you've checked in SM37 to see how often it actually runs and whether perhaps two instances have been scheduled?
Also check the log in SLG1 to see if there is any clue there.
regards
Rick Bakker
Hanabi Technology -
Scheduled background job for FBV0 transaction is not working.
Hi All,
We have impleted OSS note 971193. This is program which deletes parked documents in the system and it behaves good when we run in the foreground and doesn't work when it is scheduled in background. I debugged background job which is scheduled and program fails after call transaction. I get this following error "Error in Document Deletion. Runtime error RAISE_EXCEPTION has occurred".
Can anyone please help me if you have any info on this or if you see similar kind of problem.
Thanks in Advance.
Regards,
Many idea ?
-
How to get the Status code of rwclient when run as a background job
Hi all,
i have to get the return code(status code) of the rwclient.exe while running as a batch script. is it possible to get the return code to check whether the report generated succefully or not?
please help me if anyone has the solution.
Thanks in advance
DeenaHi Andi,
Please see my Blog : /people/dhanabal.thangavel2/blog/2009/12/16/getting-daily-failed-message-list-in-xi-and-sending-an-alert-mail-with-attachementcsv-file-of-that-list
I think it 'll help you on this.
Cheer,
Dhanabal -
How to view the emma coverage test result when running local job
Hi Guys,
When using emma in DTE, we can obtain the code coverage test result. I submit a farm job, and can get a txt or html file on coverage report. But when I run it locally, the txt / html files is unavailable. I can only see a folder named coverage with coverage.emma & metadata.emma. So my question is how can I get the coverage report from it?
If I can use some command to generate report files, then what is it and how to run it.
ThanksHello Twenz
This forum is mainly (should not be only but it is) used for supporting Oracle Application Testing Suite (OATS) products.
I guess your question is not related to this solution at all. So maybe this is not really the right forum.
Good luck
JB -
Hi,
I am scheduling a report to run in background.
In this report it is creating background jobs automatically for different company codes.
It submits the 1st background job and waits until it finishes.
Then 2nd job starts in background and continues with other jobs.
At end it finishes all the jobs and closes.
Now my problem is.
1. Whether is it possible for us to submit all the jobs at 1 time. And execute at same time. Ie., 1st, 2nd job will start at same time.
2. If possible how can we do that.
What I have written is
loop at companycode.
Create job name.
call fun 'Job_Open'.
submit xxxx user sy-uname via job job_name numer job_count
to sap-spool
spool parameters l_spool_parameter
without spool dynpro
with companycode
with ......
and return.
endloop.
Please help ASAP, urgent.hi praveen,
Job Scheduling Explained
Definition
Before any background processing can actually begin, background jobs must be defined and scheduled. The scheduled time for when a job runs is one part of the jobs definition. There are several ways to schedule jobs:
From Transaction SM36 (Define Background Job)
With the "start program in the background" option of either Transaction SA38 (ABAP: Execute Program) or Transaction SE38 (the ABAP editor)
Through the background processing systems own programming interface. (Many SAP applications use the internal programming interface to schedule long-running reports for background processing.)
Through an external interface.
Scheduling Background Jobs
Use
You can define and schedule background jobs in two ways from the Job Overview:
· Directly from Transaction SM36. This is best for users already familiar with background job scheduling.
· The Job Scheduling Wizard. This is best for users unfamiliar with SAP background job scheduling. To use the Job Wizard, start from Transaction SM36, and either select Goto ® Wizard version or simply use the Job Wizard button.
Procedure
1. Call Transaction SM36 or choose CCMS ® Jobs ® Definition.
2. Assign a job name. Decide on a name for the job you are defining and enter it in the Job Name field.
3. Set the jobs priority, or Job Class:
· High priority: Class A
· Medium priority: Class B
· Low priority: Class C
4. In the Target server field, indicate whether to use system load balancing.
· For the system to use system load balancing to automatically select the most efficient application server to use at the moment, leave this field empty.
· To use a particular application server to run the job, enter a specific target server.
5. If spool requests generated by this job are to be sent to someone as email, specify the email address. Choose the Spool list recipient button.
6. Define when the job is to start by choosing Start Condition and completing the appropriate selections. If the job is to repeat, or be periodic, check the box at the bottom of this screen.
7. Define the jobs steps by choosing Step, then specify the ABAP program, external command, or external program to be used for each step.
8. Save the fully defined job to submit it to the background processing system.
9. When you need to modify, reschedule, or otherwise manipulate a job after you've scheduled it the first time, you'll manage jobs from the Job Overview.
Note: Release the job so that it can run. No job, even those scheduled for immediate processing, can run without first being released.
Specifying Job Start Conditions
Use
When scheduling a background job (either from Transaction SM36, Define Background Job or CCMS ® Jobs ® Definition), you must specify conditions that will trigger the job to start.
Procedure
Choose the Start condition button at the top of the Define Background Job screen.
Choose the button at the top of the Start Time screen for the type of start condition you want to use (Immediate, Date/Time, After job, After event, or At operation mode) and complete the start time definition in the screen that appears.
For the job to repeat, check the Periodic job box at the bottom of the Start Time screen and choose the Period values button below it to define the frequency of repetition (hourly, daily, weekly, monthly, or another specific time-related period). Then choose the Save button in the Period values screen to accept the periodicity and return to the Start Time screen.
Once youve completed specifying the job start conditions, choose the Save button at the bottom of the Start Time screen to return to the Define Background Job screen.
No job can be started until it is released, including jobs scheduled to start immediately. Since releasing jobs can be done only by a system administrator from the job management screen (Transaction SM37) or by other users who have been granted the appropriate Authorizations for Background Processing, no unauthorized user can start a job without explicit permission
Managing Jobs from the Job Overview
Use
The Job Overview, or Job Maintenance, screen is the single, central area for completing a wide range of tasks related to monitoring and managing jobs, including defining jobs; scheduling, rescheduling, and copying existing jobs; rescheduling and editing jobs and job steps; repeating a job; debugging an active job; reviewing information about a job; canceling a job's release status; canceling and deleting jobs; comparing the specifications of several jobs; checking the status of jobs; reviewing job logs; and releasing a job so it can run.
Procedures
To display the Job Overview screen, choose CCMS ® Jobs ® Maintenance or call Transaction SM37. Before entering the Job Overview screen, the system first displays the Select Background Jobs screen. You'll need to complete this Job Selection screen to define the criteria for the jobs you want to manage. Once you've selected jobs to manage, you can choose from a wide range of management tasks:
To copy a single existing job, choose Job ® Copy.
To reschedule or edit job steps or attributes of a single job, choose Job ® Change. A job step is an independent unit of work within a background job. Each job step can execute an ABAP or external program. Other variants or authorizations may be used for each job step. The system allows you to display ABAP programs and variants. You can scan a program for syntax errors. You can also display the authorizations for an authorized user of an ABAP job step.
To repeat a single job, choose Job ® Repeat scheduling.
To debug an active job, choose Job ® Capture: active job. Only a single selection is allowed. If an active job seems to be running incorrectly (e.g., running for an excessively long time), you can interrupt and analyze it in debugging mode in a background process, and then either release it again or stop it altogether.
You will be able to capture a background job only if you are logged on to the SAP server on which the job is running. To find server information in the Job Overview, select and mark the job, then choose Job ® Job details.
To review information about a job, choose Job ® Job details. Details displayed can include:
current job status
periodicity, or the repetition interval
other jobs linked to the current job, either as previous or subsequent jobs
defined job steps
spool requests generated by the current job
To cancel a job's "Released" status, select the job or jobs from the Job Overview list and choose Job ® Release -> Scheduled.
To cancel a job from running but keep the job definition available, select the job or jobs from the Job Overview list and choose Job ® Cancel active job.
To delete a job entirely, select the job or jobs from the Job Overview list and choose Job ® Delete. Jobs with the status of Ready or Running cannot be deleted.
To compare the specifications of more than one job, select the jobs from the Job Overview list and choose Job ® Compare jobs.
To check the status of jobs, select the job or jobs from the Overview Job list and choose Job ® Check status. This allows you to either change the job status back to Planned or cancel the job altogether. This is especially useful when a job has malfunctioned.
To review job logs, select a job or jobs with the status Completed or Canceled from the Job Overview list and
regards
karthik
reward me points if helpfull -
Error in active background jobs
Hi All,
i facing problem while cosing the job
i have written the code
IF NOT p_imm IS INITIAL.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_f_jobcount
jobname = l_f_jobname
strtimmed = l_flg_start_sofort
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
COMMIT WORK .
and it is not showing any error and it should finished the job in sm37 but i am always getting the ststus active rather than finished.
please suggest what could be the reason
Thanks,
Madhuhi all,
please help me on this..
when there is no data then background job finish the job and in the job log it shows thst no valid data for selection. but if there si any data ... the job status stil active and it never get finished.... and finaly it get cancelled.
even while dubugging it never shows sy-subrc value other than 0. even when i run the background job manually for the submit sdt program it finish the job. I don't understand the reason why it is in active stage while executing id dialog.
Please mention if there is any parameter value missing ..
my code as follows..
do n times. "n muber of jobs
Start Immediately
IF NOT p_imm IS INITIAL.
l_flg_start_sofort = 'X'.
(1)Open the job
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = l_f_jobname
IMPORTING
jobcount = l_f_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE e032(sxmsf) WITH l_f_jobname.
ENDIF.
(2)Report start under job name
SUBMIT (g_c_prog_c1_lo)
WITH s_partn IN r_partn
WITH s_parro IN s_parro
WITH s_grvsy IN s_grvsy
WITH s_lgreg IN s_lgreg
WITH p_updab = p_updab
WITH p_updbi = p_updbi
WITH p_enqal = p_enqal
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
VIA JOB l_f_jobname NUMBER l_f_jobcount AND RETURN.
*(3)Job closed when starts Immediately
IF NOT p_imm IS INITIAL.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_f_jobcount
jobname = l_f_jobname
strtimmed = l_flg_start_sofort
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
COMMIT WORK .
ADD 1 TO g_cnt_job.
l_r_tbtcjob-jobcount = l_f_jobcount.
l_r_tbtcjob-jobname = l_f_jobname.
l_r_tbtcjob_previous = l_r_tbtcjob.
IF NOT l_flg_first_job IS INITIAL.
g_v_tbtcjob_first = l_r_tbtcjob.
ENDIF.
CLEAR: l_flg_first_job.
ENDDO.
thanks -
Triggering a background job of class 'A' from within the ABAP program
Dear All,
We are implementing SAP ECC 6.0 on IBM System i, i5/OS V5R4, SAP kernel 7.00, kernel patch level 173.
Is there a way to control that when a background job is triggered from within an ABAP program using the : CALL FUNCTION 'JOB_OPEN' statement, the background job is of class A ?
I know that through transaction SM37, the job class for a background job can be changed manually, but the situation is an outsource company did for us some changes in the native SAP ABAP programs related to some SAP native transactions, and those programs trigger at their end some background jobs, each job running with the name of user running the transaction.
Through SM37, I can't find a template background job, to be changed to have class 'A'
The following is an excerpt from the ABAP code, bearing the CALL FUNCTION 'JOB_OPEN' statement :
FUNCTION z_cs_technical_completion.
""Local Interface:
*" IMPORTING
*" VALUE(AUFNR) TYPE VBRP-AUFNR
DATA jobcount TYPE tbtcjob-jobcount.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = 'CS_TECH_COMPLETE'
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
JOBCLASS =
IMPORTING
jobcount = jobcount
CHANGING
RET =
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4
SUBMIT zcs_technical_completion
WITH p_aufnr EQ aufnr
AND RETURN
VIA JOB 'CS_TECH_COMPLETE'
NUMBER jobcount.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = jobcount
jobname = 'CS_TECH_COMPLETE'
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
invalid_target = 8
OTHERS = 9.
ENDFUNCTION.
Thank you in advance for your cooperation.
Best regards.
Reda KhalifaDear Darren,
Thank you very much for your cooperation and for your prompt reply.
Could you please explain to me how to find out the template background job that was first used, or in other words, how things were set up in the first place, i.e. when first the ABAP program was written and executed, there had to be at least one background job created through transaction SM36 ?
Thank you in advance for your cooperation.
Best regards.
Reda Khalifa -
FM ARCHIVE_SCHEDULE_JOB giving dump as background job?
Hello Everyone,
I am scheduling a report in SM37 which consists of FM ARCHIVE_SCHEDULE_JOB.
And based on the output of FM, some Ztables are updated and some jobs are created in sm37.
Now, when i debugged the background job, i found out that Fm is giving Dump 'NO_RUNTIME_INFO' since sy-batch is not initial.
Due to which Ztables are not updated but the jobs are created....
Can anyone please help me what should i do on this case?
Edited by: Suruchi Razdan on Jun 2, 2011 9:45 AMHi Akshay,
II have copied the Std workflow WS20000075 into a custom one and in the latest end tab, i have selected "Workitem creaton" for Refer Date/Time field and given 5 mins. I have deactivated the workflow in which i have created the containers for date and time and used "Expresion" for latest end and also commented the zmethod in delegated object. Even now also the job is getting cancelled with the same error.
Any idea why is it happening ?
regards,
Trimurty -
Hi,
In my program iam using this function call function 'LIST_TO_ASCI'
so what ever the output placed in list is transfered to end customer in the textfile format , my problem is when i set in background job, some records are missing , is there any restrictions for setting column and row size
REPORT ZDEVTESTING
NO STANDARD PAGE HEADING
LINE-SIZE 275
LINE-COUNT 80
MESSAGE-ID YMSG.
INCLUDE Y_INCLUDE_FTP_V01.
TYPE-POOLS : SLIS.
TYPE-POOLS: SLIST.
TABLES: LIKP,
LIPS,
LFA1,
VBKD,
KNA1,
ADRC,
VBAP,
KNVK,
T005T,
ZMMGRINFO,
ZSDDOITEM,
ZPASPACKLIST,
ZSDPACKINFO_V1.
DATA : BEGIN OF TEM_ITAB OCCURS 0,
VBELN LIKE LIKP-VBELN,
END OF TEM_ITAB.
DATA: V_LOTID(15) TYPE C,
V_TOT_LFIMG(30),
V_COUNTRY_TEXT(15),
TEMP_CHARG,
L_NTGEW LIKE ZSDPACKINFO_V1-NTGEW,
L_LFIMG LIKE LIPS-LFIMG.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE LIKP-VBELN, "UTAC DO NO
CUSO(30), "CUSTOMER SO
CUIN(10), "CUSTOMER PART NO
POSNR LIKE LIPS-POSNR, "ITEM NO
ARKTX LIKE LIPS-ARKTX, "ShortTextforSOITEM
LFIMG LIKE LIPS-LFIMG, "QTY
WADAT_IST LIKE LIKP-WADAT_IST, "DO DATE
VBELN1 LIKE LIKP-VBELN, "UTAC PO NO
NAME1 LIKE KNA1-NAME1, "SHIPPING NAME
NAME2 LIKE ADRC-NAME1, "Billing Name
FNAM(35), "Forwarder Name
LIFNR LIKE LFA1-LIFNR, " Forwarder
MAWB(40), "MAWB Number
HAWB(40), "HAWB Number
FLNO(70), "Flight Number
ZCUST_LOTID LIKE ZMMGRINFO-ZCUST_LOTID, "CUSTLOTID
CHARG LIKE LIPS-CHARG, "UTACLOTID
ZDATECODE LIKE ZMMGRINFO-ZDATECODE, "UTAC DATE CODE
ZU_COO LIKE ZMMGRINFO-ZU_COO, "COUNTRY OF ORIGIN
V_BTGEW(19), "GROSS WEIGHT
V_NTGEW LIKE ZSDPACKINFO_V1-NTGEW, "Net Weight
V_CTN1 LIKE ZSDPACKINFO_V1-ZU_CTN_NUM, "CARTON NUMBER
V_DIM(15), "CARTON DIMENSION
KUNAG LIKE LIKP-KUNAG, "Sold-to-Party
V_QTY1(30),
V_QTY2(30),
V_QTY3 LIKE LIPS-LFIMG,
V_QTY LIKE LIPS-LFIMG,
V_QTY4 LIKE LIPS-LFIMG,
V_QTY5(30),
ADRNR LIKE KNA1-ADRNR,
BSTKD LIKE VBKD-BSTKD, "CUST PO
MATNR LIKE LIPS-MATNR, "MATERIAL
WERKS LIKE LIPS-WERKS, "PLANT
V_CTN(4),
V_TOTCTN(4),
NTGEW LIKE ZSDPACKINFO_V1-NTGEW,
NTGEW1(30),
SHPN(35), "CUSTOMER NAME
KUNNR LIKE LIKP-KUNNR, "SHIP-TO-PARTY
END OF ITAB.
DATA : BEGIN OF ITAB1 OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA : END OF ITAB1.
DATA: BEGIN OF S_DATA OCCURS 0,
CUSO(30), "CUSTOMER SO
CUIN(10), "CUSTOMER PART NO
POSNR LIKE LIPS-POSNR, "ITEM NO
ARKTX LIKE LIPS-ARKTX, "ShortTextforSOITEM
LFIMG LIKE LIPS-LFIMG, "QTY
KUNAG LIKE LIKP-KUNAG, "Sold-to-Party
V_QTY1(30),
V_QTY2(30),
WADAT_IST LIKE LIKP-WADAT_IST, "DO DATE
VBELN LIKE LIKP-VBELN, "UTAC DO NO
VBELN1 LIKE LIKP-VBELN, "UTAC PO NO
NAME1 LIKE KNA1-NAME1, "SHIPPING NAME
NAME2 LIKE ADRC-NAME1, "Billing Name
LIFNR LIKE LFA1-LIFNR, " Forwarder
FNAM(35), "Forwarder Name
MAWB(30), "MAWB Number
HAWB(30), "HAWB Number
FLNO(70), "Flight Number
ZCUST_LOTID LIKE ZMMGRINFO-ZCUST_LOTID, "CUSTLOTID
CHARG LIKE LIPS-CHARG, "UTACLOTID
ZDATECODE LIKE ZMMGRINFO-ZDATECODE, "UTAC DATE CODE
ZU_COO LIKE ZMMGRINFO-ZU_COO, "COUNTRY OF ORIGIN
V_BTGEW(19), "GROSS WEIGHT
V_NTGEW LIKE ZSDPACKINFO_V1-NTGEW, "Net Weight
V_CTN1 LIKE ZSDPACKINFO_V1-ZU_CTN_NUM, "CARTON NUMBER
NTGEW1(30),
V_DIM(15), "CARTON DIMENSION
ADRNR LIKE KNA1-ADRNR,
BSTKD LIKE VBKD-BSTKD, "CUST PO
MATNR LIKE LIPS-MATNR, "MATERIAL
WERKS LIKE LIPS-WERKS, "PLANT
V_QTY3 LIKE LIPS-LFIMG,
V_QTY LIKE LIPS-LFIMG,
V_QTY4 LIKE LIPS-LFIMG,
V_QTY5(30),
V_CTN(4),
V_TOTCTN(4),
NTGEW LIKE ZSDPACKINFO_V1-NTGEW,
SHPN(35), "Customer Name
KUNNR LIKE LIKP-KUNNR, " Ship-to-Party
END OF S_DATA.
DATA: HOST LIKE ZFTP-HOST,
USERNAME LIKE ZFTP-USERNAME,
PWD(100) TYPE C,
PRGNAME LIKE ZFTP-PRGNAME,
RDIRLOC LIKE ZFTP-RDIRLOC,
LDIRLOC LIKE ZFTP-RDIRLOC,
HANDLE TYPE I,
FNAME(40) TYPE C,
FAILED(1) TYPE C.
DATA: L_OK(1) TYPE C,
L_ERRMSG(150) TYPE C.
DATA : T_ZMMGRINFO LIKE ZMMGRINFO OCCURS 0 WITH HEADER LINE.
DATA:T_LINE LIKE TLINE OCCURS 0 WITH HEADER LINE,
VBELN LIKE THEAD-TDNAME.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS :
S_KUNAG FOR LIKP-KUNAG DEFAULT 'BC1001'.
PARAMETERS : S_WADAT LIKE LIKP-WADAT_IST DEFAULT SY-DATUM.
PARAMETERS: S_UPLOAD AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM WRITE_DATA.
PERFORM DOWN_DATA.
*& Form GET_DETAILS
FORM GET_DATA .
SELECT LIKP~VBELN
LIPS~POSNR
LIKP~WADAT_IST
LIKP~KUNNR
LIKP~KUNAG
KNA1~NAME1
KNA1~ADRNR
VBKD~BSTKD
LIPS~MATNR
LIPS~CHARG
LIPS~LFIMG
LIPS~WERKS
LIPS~VGBEL
LIPS~ARKTX
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM LIKP
JOIN LIPS ON LIKPVBELN = LIPSVBELN
JOIN VBKD ON LIPSVGBEL = VBKDVBELN
JOIN KNA1 ON KNA1KUNNR = LIKPKUNNR
WHERE LIPS~LFIMG GT 0 AND
LIKP~KUNAG IN S_KUNAG AND
LIKP~WADAT_IST = S_WADAT
ORDER BY LIKP~WADAT_IST
LIKP~VBELN.
LOOP AT ITAB.
CALL FUNCTION 'Z_GET_CHAR_VAL'
EXPORTING
WERKS = ITAB-WERKS
MATNR = ITAB-MATNR
CHARG = ITAB-CHARG
IMPORTING
ZMMGRINFO = T_ZMMGRINFO
EXCEPTIONS
INVALID_COMBINATION = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ITAB-ZCUST_LOTID = T_ZMMGRINFO-ZCUST_LOTID.
ITAB-ZDATECODE = T_ZMMGRINFO-ZDATECODE.
ITAB-ZU_COO = T_ZMMGRINFO-ZU_COO.
VBELN = ITAB-VBELN.
*Extracting the Flight Number
PERFORM READ_TEXT USING 'Z006' 'E' VBELN 'VBBK'.
READ TABLE T_LINE INDEX 1.
MOVE T_LINE-TDLINE TO ITAB-FLNO.
Extracting the MAWB Number
PERFORM READ_TEXT USING 'Z007' 'E' VBELN 'VBBK'.
READ TABLE T_LINE INDEX 1.
MOVE T_LINE-TDLINE TO ITAB-MAWB.
Extracting the HAWB Number
PERFORM READ_TEXT USING 'Z008' 'E' VBELN 'VBBK'.
READ TABLE T_LINE INDEX 1.
MOVE T_LINE-TDLINE TO ITAB-HAWB.
Extracting the Carton Dimension
PERFORM READ_TEXT USING 'Z013' 'E' VBELN 'VBBK'.
READ TABLE T_LINE INDEX 1.
MOVE T_LINE-TDLINE TO ITAB-V_DIM.
CONCATENATE ITAB-V_DIM 'CM' INTO ITAB-V_DIM SEPARATED BY SPACE.
PERFORM READ_TEXT USING 'Z015' 'E' VBELN 'VBBK'.
DELETE T_LINE WHERE TDLINE = SPACE.
IF NOT T_LINE[] IS INITIAL.
READ TABLE T_LINE INDEX 1.
MOVE T_LINE-TDLINE TO ITAB-CUSO.
ENDIF.
Customer PartNumber
PERFORM READ_TEXT USING 'Z017' 'E' VBELN 'VBBK'.
LOOP AT T_LINE.
MOVE : T_LINE-TDLINE TO ITAB-CUIN.
ENDLOOP.
Extracting the Gross Weight
PERFORM READ_TEXT USING 'Z022' 'E' VBELN 'VBBK'.
READ TABLE T_LINE INDEX 1.
MOVE T_LINE-TDLINE TO ITAB-V_BTGEW.
*Qyantity in DO
PERFORM READ_TEXT USING 'Z015' 'E' VBELN 'VBBP'.
READ TABLE T_LINE INDEX 1.
MOVE T_LINE-TDLINE TO ITAB-V_QTY.
*UTAC PO NUMBER AND DO NUMBER
MOVE ITAB-VBELN TO ITAB-VBELN1.
*FARWORDER NAME
SELECT SINGLE LIFNR INTO ITAB-LIFNR FROM VBPA
WHERE VBELN = ITAB-VBELN AND PARVW = 'ZF'.
SELECT SINGLE NAME1 INTO ITAB-FNAM FROM LFA1
WHERE LIFNR = ITAB-LIFNR.
CONDENSE ITAB-FNAM.
SELECT SINGLE * FROM KNA1 WHERE KUNNR = ITAB-KUNAG.
IF SY-SUBRC = 0.
ITAB-KUNNR = KNA1-KUNNR.
ENDIF.
SELECT SINGLE * FROM KNA1 WHERE KUNNR = ITAB-KUNNR.
IF SY-SUBRC = 0.
SELECT SINGLE * FROM ADRC WHERE ADDRNUMBER = KNA1-ADRNR.
ITAB-SHPN = ADRC-NAME1.
ENDIF.
SELECT SINGLE * FROM T005T
WHERE LAND1 = ITAB-ZU_COO AND
SPRAS = SY-LANGU.
IF SY-SUBRC EQ 0.
V_COUNTRY_TEXT = T005T-LANDX.
ELSE.
CLEAR V_COUNTRY_TEXT.
ENDIF.
MOVE ITAB-LFIMG TO ITAB-V_QTY1.
TRANSLATE ITAB-V_QTY1 USING ','.
CONDENSE ITAB-V_QTY1 NO-GAPS.
MODIFY ITAB.
CLEAR ITAB.
ENDLOOP.
ENDFORM. " GET_DETAILS
***& Form READ_TEXT
Reading the text
FORM READ_TEXT USING P_ID LIKE THEAD-TDID
P_LAN LIKE THEAD-TDSPRAS
P_NAME LIKE THEAD-TDNAME
P_OBJ LIKE THEAD-TDOBJECT.
REFRESH T_LINE. CLEAR T_LINE.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = P_ID
LANGUAGE = P_LAN
NAME = P_NAME
OBJECT = P_OBJ
TABLES
LINES = T_LINE
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
ENDFORM. " READ_TEXT
*& Form WRITE_DATA
text
FORM WRITE_DATA.
LOOP AT ITAB.
MOVE-CORRESPONDING ITAB TO ITAB1.
AT NEW VBELN .
WRITE :/1 'ORDER'.
WRITE : 6 SY-VLINE.
WRITE : 7 ITAB1-CUSO LEFT-JUSTIFIED.
WRITE : 17 SY-VLINE.
WRITE : 18 ITAB1-CUIN LEFT-JUSTIFIED.
WRITE : 24 SY-VLINE.
WRITE : 25 ITAB1-ARKTX LEFT-JUSTIFIED.
WRITE : 43 SY-VLINE.
LOOP AT ITAB WHERE VBELN = ITAB1-VBELN.
L_LFIMG = L_LFIMG + ITAB-LFIMG.
ENDLOOP.
WRITE : 44 L_LFIMG NO-GROUPING LEFT-JUSTIFIED.
WRITE : 54 SY-VLINE.
WRITE : 55 ITAB1-WADAT_IST LEFT-JUSTIFIED.
WRITE: 65 SY-VLINE.
WRITE : 66 ITAB1-VBELN LEFT-JUSTIFIED.
WRITE: 76 SY-VLINE.
WRITE : 77 ITAB1-VBELN1 LEFT-JUSTIFIED.
WRITE : 87 SY-VLINE.
WRITE : 88 ITAB1-NAME1 LEFT-JUSTIFIED. .
WRITE : 123 SY-VLINE.
WRITE : 124 ITAB1-SHPN LEFT-JUSTIFIED.
WRITE : 159 SY-VLINE.
WRITE : 160 ITAB1-FNAM LEFT-JUSTIFIED.
WRITE : 204 SY-VLINE.
IF ITAB1-HAWB <> ''.
WRITE : 205 ITAB1-HAWB LEFT-JUSTIFIED.
ELSE.
WRITE : 205 ITAB1-MAWB LEFT-JUSTIFIED.
ENDIF.
WRITE : 245 SY-VLINE.
WRITE : 246 ITAB1-FLNO LEFT-JUSTIFIED.
WRITE : 266 SY-VLINE.
CLEAR L_LFIMG.
ENDAT.
SELECT * FROM ZSDPACKINFO_V1 WHERE VBELN = ITAB-VBELN AND
ZU_CTN_NUM NE '' AND ZU_LCHARG = ITAB-CHARG.
MOVE ZSDPACKINFO_V1-LFIMG TO ITAB-V_QTY2.
MOVE ZSDPACKINFO_V1-NTGEW TO ITAB-NTGEW.
MOVE ZSDPACKINFO_V1-NTGEW TO ITAB-NTGEW1.
MOVE ZSDPACKINFO_V1-ZU_CTN_NUM+6(4) TO ITAB-V_CTN.
TRANSLATE ITAB-V_QTY2 USING ', '.
CONDENSE ITAB-V_QTY2 NO-GAPS.
MOVE-CORRESPONDING ITAB TO S_DATA.
S_DATA-V_QTY4 = ITAB-V_QTY2.
CLEAR S_DATA-V_QTY2.
COLLECT S_DATA.
ENDSELECT.
LOOP AT S_DATA.
WRITE :/1'LOT'.
WRITE : 4 SY-VLINE.
WRITE : 5 S_DATA-CUSO LEFT-JUSTIFIED.
WRITE : 15 SY-VLINE.
WRITE : 16 S_DATA-CUIN LEFT-JUSTIFIED.
WRITE : 23 SY-VLINE.
WRITE : 24 S_DATA-ZCUST_LOTID LEFT-JUSTIFIED.
WRITE : 35 SY-VLINE.
WRITE : 36 S_DATA-CHARG LEFT-JUSTIFIED.
WRITE : 46 SY-VLINE.
WRITE : 47 S_DATA-V_QTY4 NO-GROUPING LEFT-JUSTIFIED .
WRITE : 57 SY-VLINE.
WRITE : 58 S_DATA-ZDATECODE LEFT-JUSTIFIED.
WRITE : 62 SY-VLINE.
WRITE : 63 V_COUNTRY_TEXT LEFT-JUSTIFIED.
WRITE : 75 SY-VLINE.
WRITE : 76 S_DATA-V_BTGEW LEFT-JUSTIFIED.
WRITE : 83 SY-VLINE.
L_NTGEW = S_DATA-NTGEW1.
WRITE : 84 L_NTGEW LEFT-JUSTIFIED.
WRITE : 94 SY-VLINE.
WRITE : 95 S_DATA-V_CTN LEFT-JUSTIFIED.
WRITE : 99 SY-VLINE.
WRITE : 100 S_DATA-V_DIM LEFT-JUSTIFIED.
WRITE : 115 SY-VLINE.
ENDLOOP.
REFRESH S_DATA.
ENDLOOP.
ENDFORM.
*& Form DOWN_DATA
text
--> p1 text
<-- p2 text
FORM DOWN_DATA.
DATA : P_FILE(128) TYPE C.
DATA: P_FNAME(100).
data abap_list like abaplist occurs 1.
DATA : BEGIN OF IFILE OCCURS 0,
TEXT(1023) TYPE C,
END OF IFILE.
PRGNAME = SY-CPROG.
CONCATENATE '/home/sapifc/custrept/' 'IDT_' SY-DATUM '_' '2245' '.txt' INTO P_FILE.
call function 'LIST_TO_ASCI'
exporting
list_index = sy-lsind
tables
listasci = IFILE
listobject = abap_list
exceptions
empty_list = 1
list_index_invalid = 2
others = 3.
if sy-subrc <> 0.
endif.
OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC = 0.
LOOP AT IFILE.
TRANSFER IFILE TO P_FILE.
ENDLOOP.
ENDIF.
CLOSE DATASET P_FILE.
ENDFORM.HI,
The width of spool can be of max. 255 size.
In your case, you are displaying data at 266 also (THe WRITE statement).
Try to fit all the columns within 255 width.
Best regards,
Prashant -
VL10B is terminating in background job, no deliveries are generated
VL10B is terminating when running in a background job then no deliveries get generated for STO, is there a way to make the program skip to the next record instead of terminating so some deliveries will be generate?
Hi mohan,
check in material master whether there is any saftey stock / minimum stock is there.. if so. please correct it.
Ramki -
Creating EXCEL documents and background jobs
Hi there,
I was wondering whether the method 'SAVE_DOCUMENT_TO_URL' of the interface 'i_oi_spreadsheet' will work when called in a background job with the intention to store the information somewhere on the SAP servers filepath ...
If so then I would assume that one needs to install both SAPGUI and MS EXCEL on the server to get it actual working?
Thx,
StevenYes it does seem silly that there is check like that. However have a look at the first perform in the function: Create_Spreadsheet. Right inside of that form there is another perform for get_spreadsheet_interface. The following is the very first executable line in this perform:
* don't do anything in batch, because there is no GUI...
check sy-batch is initial.
By exiting at this point, l_iref_spreadsheet will be initial and message e893(ux) will be issued. Based upon that; the if sy-batch is initial around the SAPGUI_PROGRESS_INDICATOR call can never not be true.
Maybe you are looking for
-
DDL in pl/sql block???
Hi, begin create table sample_test ( x number); end; gives an error, but begin execute immediate 'create table sample_test(x number)'; end very much works, is there any specific reason to why the first way of doing a DDL statement is restricted or av
-
Hello We are building a BC4J application. We would like to use JAAS on the client side (Swing Client), to do some authorization. I made a test, authentication a user trough JAAS on the client as follow: // Auhorization CallbackHandler handler = new I
-
Change color spectrum orientation in 3d plot
hi, I have a 3d plot: x-axis = wavelength y-axis = angle of reflection z-axis = intensity counts the 3d surface is colored like the spectrum, now i want to rotate the color orientation, that it corresponds with the wavelength, but I do not want to ch
-
PPro CS6: Source Monitor Dropping Frames
Greetings, Currently I'm working off an iMac, OSC 10.8.4, 12 GB RAM, with i7, and ATI Radeon 1GB video card. I haven't noticed it recently until today for some reason, but my source monitor keeps dropping frames like crazy after about 5 seconds of p
-
Regarding sending data throgh IDOC MBGMCR02
hi friends, iam sending data from non sap to sap through xi using idoc adapter.i am using mbgmcr02 idoc.what is the use of mbgmcr02 and how to send .pls help on this. adavnce thanks Ravi