Output at 1 millisecon​d intervals
Hi,
I'm trying to create a VI in LabVIEW to drive a NI USB 9263 running on windows 7. I need the output from the DACs to update at 1 millisecond intervals, however even when running a very simple program in a while loop with no delays, I can only get the output to update approximately every 2 milliseconds. I had tried something similar in a timed loop set to 10ms which seemed to be OK, but I am not able to get it below about 2 ms. Does anyone know if it is even possible to achieve this kind of speed with LabVIEW (or even windows)?
Thanks,
Peter
Thanks,
I have set up a daqmx task and created a task constant ("Measurement I/O"-->"NI-DAQmx"-->"Task Const"), selected my task and generated example code for it. The example code (attached) just steps through 10 different voltage levels at 1 millisecond intervals. So it seems like the only thing I have to do now is replace the example code's data generation subVI with my own data. But it seems like it needs to be in a 1D array of waveforms, which coming from a C background doesn't make a great deal of sense to me, but I'm just starting to look into the waveform datatype now. Then I'll need to take my array of doubles and presumably turn that into a single waveform?
I'll post back here if I can't figure it out. Thanks again for your help.
Attachments:
example code.jpg 52 KB
Similar Messages
-
Delete after output- su01 settings
Dear experts,
We are facing an issue with user settings.
we enabled the option 'Delete after output' in Default Tab, in thought of decrease spool requests in SAP and to regulate my database increase.
User is creating large amount spools and spools are not deleting after print.
Please suggest
Regards,
SivaWhart type of output are the spool requests that are not being deleted?
If they are forms (e.g. Purchase orders, sales orders, invoices etc.) then the print definitions are defined by the outout conditions in the application rather than the user-specific settings. In this case you need to update your output conditions to delete after output. Speak to the business about updating these if this is acceptable.
Or is the output generated via periodic background jobs? Updating the user settings will not affect jobs already setup. If you see similar output being generated at regular intervals is probably being generated from a background job. In which case find and update the background job responsible. I have often see jobs that run every 5 minutes generating large numbers of unneccesary spool requests.
I am assuming that the output is completed? As spool requests will only be deleted if they have been printed (and that the output has had no errors, as the output will not be deleted if it has an error). -
Hi Gurus,
I am using oracle 11.2.0.1 Enterprise Edition. And I tried writing query different ways but unable to get going. Your help is greatly appreciated.
The Query should give output as I explained below.
This query is identify the gaps in interval reads.
Here is my create script.
create table rtype (
rid number,
rdesc varchar2(30));
insert into rtype values (1, '5-deviceinterval');
insert into rtype values (2, '15-deviceinterval');
create table readings (
device_id number,
rid number,
qstartid number,
qfinishid number,
readvalue number,
readtimestamp date);
insert into readings values (123, 1, null,null, .951, to_date('05/01/2012 00:00:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .51, to_date('05/01/2012 00:05:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .51, to_date('05/01/2012 00:10:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .51, to_date('05/01/2012 00:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .51, to_date('05/01/2012 00:20:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .51, to_date('05/01/2012 01:00:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .61, to_date('05/01/2012 01:05:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .41, to_date('05/01/2012 01:10:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .31, to_date('05/01/2012 01:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .23, to_date('05/01/2012 01:20:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .69, to_date('05/01/2012 01:25:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .85, to_date('05/01/2012 01:30:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .51, to_date('05/01/2012 02:10:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .61, to_date('05/01/2012 02:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .41, to_date('05/01/2012 02:20:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, 1, null, .31, to_date('05/01/2012 02:25:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1,null,1, .23, to_date('05/01/2012 03:20:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1,null,null, 2.23, to_date('05/01/2012 03:25:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1,null,null, .23, to_date('05/01/2012 03:30:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 16.71, to_date('05/01/2012 01:00:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 17.81, to_date('05/01/2012 01:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 191.11, to_date('05/01/2012 01:30:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 221.11, to_date('05/01/2012 01:45:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 61.71, to_date('05/01/2012 02:00:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 71.81, to_date('05/01/2012 03:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 911.11, to_date('05/01/2012 03:30:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 121.11, to_date('05/01/2012 04:45:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 61.71, to_date('05/01/2012 05:00:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 72.81, to_date('05/01/2012 05:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 941.11, to_date('05/01/2012 05:30:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 6.71, to_date('05/01/2012 01:00:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 7.81, to_date('05/01/2012 01:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 91.11, to_date('05/01/2012 01:30:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 121.11, to_date('05/01/2012 01:45:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 6.71, to_date('05/01/2012 02:00:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 7.81, to_date('05/01/2012 03:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,1,null, 91.11, to_date('05/01/2012 03:30:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,1, 121.11, to_date('05/01/2012 04:45:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 6.71, to_date('05/01/2012 05:00:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 7.81, to_date('05/01/2012 05:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 91.11, to_date('05/01/2012 05:30:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 121.11, to_date('05/01/2012 06:45:00','mm/dd/yyyy HH24:MI:SS'));
I would like to get output as below. I have billions of records in readings table, so would like to have good performance.
As you can see rtype 1 is 5 minutes reading interval and rtype 2 is 15 minutes reading time interval.
Expected output
device_id rtype missing_interval_date_time qty
123 1 05/01/2012 00:30:00
123 1 05/01/2012 00:35:00
123 1 05/01/2012 00:40:00
123 1 05/01/2012 00:45:00
123 1 05/01/2012 00:55:00
123 1 05/01/2012 01:35:00
123 1 05/01/2012 01:40:00
123 1 05/01/2012 01:45:00
123 1 05/01/2012 02:05:00
123 1 05/01/2012 02:30:00 1 - Since quality data start with qstartid
123 1 05/01/2012 02:35:00 1
123 1 05/01/2012 02:40:00 1
123 1 05/01/2012 02:45:00 1
123 1 05/01/2012 03:15:00 1 - end quality data with qendid
123 1 05/01/2012 03:35:00
123 1 05/01/2012 03:40:00
123 1 05/01/2012 23:55:00
123 2 05/01/2012 00:00:00 --(Similarly for same device_id another rtype with 15 min interval)
123 2 05/01/2012 00:15:00
123 2 05/01/2012 00:30:00
123 2 05/01/2012 00:45:00
123 2 05/01/2012 02:15:00
123 2 05/01/2012 02:30:00
123 2 05/01/2012 02:45:00
123 2 05/01/2012 03:00:00
123 2 05/01/2012 03:45:00
123 2 05/01/2012 04:00:00
123 2 05/01/2012 04:15:00
123 2 05/01/2012 04:30:00
123 2 05/01/2012 05:45:00
123 2 05/01/2012 05:50:00
123 2 05/01/2012 23:30:00
123 2 05/01/2012 23:45:00
456 ....
Edited by: MDK999 on Oct 17, 2012 5:30 PMHello
Yes, I have edited other information also such as -
"This query is identify the gaps in interval reads" and I explained that the way output should report the missing intervals. Actually expected output explains the data how it should look like. This output is created based on sample data I have provided.
basically there are two rtypes, one has 5 minutes interval and other one has 15 minutes.
so as you can see that missing intervals between below two reads '05/01/2012 00:25:00' and '05/01/2012 01:00:00' should be as below since its 5 minutes interval data based on rtype=1
123 1 05/01/2012 00:30:00
123 1 05/01/2012 00:35:00
123 1 05/01/2012 00:40:00
123 1 05/01/2012 00:45:00
123 1 05/01/2012 00:55:00
Similarly readings between two reads '05/01/2012 02:00:00' and '05/01/2012 03:15:00' should be as below since its 15 minutes interval data based on rtype = 2
123 2 05/01/2012 02:15:00
123 2 05/01/2012 02:30:00
123 2 05/01/2012 02:45:00
123 2 05/01/2012 03:00:00
And
when qstartid 1 , means there is missing interval data because there is some quality. So we just need to report that this missing interval data due to quality flag observed. there is qstartid=1 means quality reading start qfinishid=1, end of quality data.
insert into readings values (123, 1, 1, null, .31, to_date('05/01/2012 02:25:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1,null,1, .23, to_date('05/01/2012 03:20:00','mm/dd/yyyy HH24:MI:SS'));
So missing interval output should be
123 1 05/01/2012 02:30:00 1 - Since quality data start with qstartid
123 1 05/01/2012 02:35:00 1
123 1 05/01/2012 02:40:00 1
123 1 05/01/2012 02:45:00 1
123 1 05/01/2012 03:15:00 1 - end quality data with qfinishid
Thanks -
PROGRAM SLOWS DOWN WHEN IT ENTERS A CASE STRUCTURE
OK so here is the problem i am making this pid controller the output range is 0-100 in this program i am just trying to get it to work so i did a compair function whereby when the controller output is 0 and the constant is 0 i start a case loop which will turn the output on for one second and off for one second . when i enter the case structure the rest of my program slows down
i have no idea why , i have tried to make a while loop and a case structure outside my main loop but i cannot get my signal from my compair statement to enter the second loop where i get my output to cycle in 1second intervals
below is the VI please help
i am still learning how to use labview by the way
thank you
gary
GR
Solved!
Go to Solution.
Attachments:
TMP36working!vi.vi 225 KBgary,
The next thing you need to learn about LabVIEW is dataflow. This is the fundamental paradigm of LV and will explain your slow down issues.
The basic dataflow concept is that any node (node = function, subVI, structure) can begin to execute when data is present on all its inputs and that no data will be present at its outputs until the node comopletes execution.
How does this affect your VI? The true case has a 1000 ms Wait (actually two, one in each case of the inner case structure = redundant code). The case structure will not complete execution until the wait completes. And, the while loop does not complete its iteration until the case structure completes. The result: When the PID.vi output = 0, the loop will run at 1 second per iteration.
What is the fix? Continue running the loop at 100 ms intervals. Keep a count in the case structure (true case) and another shift register of how many 100 ms intervals have passed. When the count reaches ten, toggle the output line. Do not use the 1000 ms Wait.
All the code in your inner case structure is unnecessary. Wire the Remainder output directly to the Arduino Digital Write VI.
Be careful with the comparison to zero with floating point data. If the calculation which produces the data has round off errors you might get a value like 0.573E-15, but that is not equal to zero. It is better to compare to a small range of values above and below zero.
Right to left wiring is much easier to follow when trying to understand what a program does. Using the Clean Up tool occasionally will help (although it will eventually frustrate you also).
Lynn
Attachments:
TMP36working.2.vi 214 KB -
I have one script i want to run this daily at night time
how can i do that. Any ideaHi...
Oracle provides a package that allows users to schedule and run stored procedures. They may be run once, or at regular intervals. The package is DBMS_JOB. There is a summary of the functions and procedures for the package in Oracle's documentation at...
Oracle8i Supplied PL/SQL Packages Reference/DBMS_JOB, 2 of 2
otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/server.817/a76956/jobq.htm#5727 Note: You may have to edit out the '<br>'s put in by the Forum code to get the URL to work. Also you may have append some of the URL which may be truncated, usually the bookmark(#nnnn).
A complete description of the package and how to manage the job queue may be found at....
Oracle8i Administrator's Guide/The DBMS_JOB Package
otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/appdev.817/a76936/dbms_jo2.htm Note: You may have to edit out the '<br>'s put in by the Forum code to get the URL to work. Also you may have append some of the URL which may be truncated, usually the bookmark(#nnnn).
The simplest way of submitting a job as a stored procedure to run would be to use the SUBMIT procedure of the DBMS_JOB package. Below is the description of this procedure and an example of invoking it to schedule a job to rum at 11 p.m., and subsequently every 24 hours.
PROCEDURE SUBMIT
Argument Name Type In/Out Default?
JOB BINARY_INTEGER OUT
WHAT VARCHAR2 IN
NEXT_DATE DATE IN DEFAULT
INTERVAL VARCHAR2 IN DEFAULT
NO_PARSE BOOLEAN IN DEFAULT
INSTANCE BINARY_INTEGER IN DEFAULT
FORCE BOOLEAN IN DEFAULT
VARIABLE jobnum NUMBER;
BEGIN
DBMS_JOB.SUBMIT
( :jobnum
, 'stored_procedure_name;'
, TO_DATE( TRUNC(SYSDATE) + 23/24 )
, 'SYSDATE + 1'
COMMIT;
END;
PRINT jobnumSome things to note: The jobnum is a unique means of identifying this job. You will need this if you query the USER_JOBS and DBA_JOBS_RUNNING views to find out what's happening with your scheduled job. There can be no print buffer (DBMS_OUTPUT) output from the job. You should review the documentation so you understand how Oracle handles failures, error output and rescheduling based on intervals.
Hope this helps. Good Luck. -
Counting peaks within one minute intervals and outputting with time stamp
I'm currently working on my senior design project for biomedical engineering. We are creating a piezoelectric sensor in order to measure respiration on a bed non-invasively. The sensor lays on bed under subject and records movement due to respiration. We currently have figured out how to detect peaks. However, now we want to count number of peaks detected within a 1 min time period and output that result with a 'timestamp'. We would like the output to be into excel as two columns, rate(number peaks in 1 min) and time. Time in minutes and not actual time is fine. Sampling rate was 500Hz.
My current VI has peak detection criteria and can output total number of peaks and their locations.
Any help would be greatly appreciated as this is our last step before verification and have been stuck on it for awhile.
It won't allow me to attach a tdms file in which our data is stored as, so I can't upload the data currently.
Also attached is our current VI for peak detection labeled 3.26.Resp.PeakDetect.
Thanks for any and all help!!
Attachments:
3.26.Resp.PeakDetect.vi 146 KBI see no need for a case structure. Or did you set up a state machine that I missed?
I recommend making a VI that does nothing but read your 30,000 samples and process it (counting the peaks and what not). From there, you create the array for the number of peaks and the time (in minutes). Then you can call that VI inside of a loop to build up the array of data points.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Usb 6009 continuous analog output
Hi
I'm pretty new to Labview, so you may have to bear with me. I have a USB-6009 and I want to generate a continuos analog output voltage. I've got the example you have posted 'Gen Mult Volt Updates-SW Timed_LV7.1 (0 to 4).vi' working and it outputs a continuous sine wave.
In a similar manner I need to generate:
1. Ramp up voltage (and ramp down voltage): starting with a continuos constant voltage, which after a period of time linearly increases to another constant voltage, and which allows me to specify the 3 time intervals and the rate of increase.
2. Pulsations: whereby I can specify the amplitude and time interval of each pulsation
This is so that I can control voltage to a valve which regulates my pipe flow. In the example I have (one stated above), I do not understand specifically:
i. Why I need both a 'Software Loop Time (ms)' as well as 'Timeout'
ii. The 'Sinusoidal Pattern' input which seems to generate data for a sine wave- I can't get a description of that and there are no similar VIs for other waveforms; and what is the function of the two numbers it has?
iv. How do I change amplitude and time period for the wave?
iii. What does 'Index Array' do?
thank youHi there,
I'm guessing the VI you are using is the one from this KB:
http://digital.ni.com/public.nsf/allkb/6F2C2B49A89D685C8625711D007BDD64
i. The software timed loop control is to control the rate at which you change the voltage output. The timeout on the DAQmx Write VI is the maximum time in seconds the VI will wait to output a sample (eg. if the write buffer is full, the Write VI will wait for it to become available for 'timeout' seconds before outputting an error).
ii. The sine pattern is just an array constant of doubles that make up the sine wave voltage values, and the for loop adds an offset (of two volts) to every single one of those values. You might want to replace that entire array constant and for loop with a Simulate Signal Express VI (just search for Simulate Sig or look in the Functions >> Input palette) and convert the dynamic data output to an array of doubles. You can configure the type of waveform, amplitude, and time period from that express VI as well.
iii. Refer to previous answer.
iv. Index array returns an element of an array based on the index input. You can turn on the context help and move your mouse over functions to get more help on them.
I hope that helps!
Way S.
NI UK Applications Engineer -
Adding Field to the output of the Report
Hello experts
I have a program like following, I would like to add a field (Customer purchase order from order header)vbkd-bstkd to the output, I tried to add some code(check the highlightened portion) but it doesnt work(no values) can anyone help in correcting the code so that i can execute directly,
Iam not full time ABAPer so could you please highlight the code you corrected(added),
Thanks
SP
Global structure of list
TYPE-POOLS: slis.
TABLES: likp,
lips,
vbfa,
kssk,
klah,
ausp,
cabn,
vbak,
mara,
vbrk,
ser01,
vbpa,
vbrp,
nast,
zseri,
ltap,
pa0001,
kna1,
objk,
viqmel,
viqmma.
TYPES: BEGIN OF i_delivery,
vbeln LIKE likp-vbeln,
posnr LIKE lips-posnr,
kunnr LIKE likp-kunnr,
kunag LIKE likp-kunag,
vkorg LIKE vbak-vkorg,
matnr LIKE lips-matnr,
lfart LIKE likp-lfart,
arktx LIKE vbap-arktx,
vgbel LIKE lips-vgbel,
vgpos LIKE lips-vgpos,
pstyv LIKE lips-pstyv,
wadat TYPE likp-wadat_ist,
lfdat TYPE likp-lfdat,
prodh TYPE lips-prodh,
lfimg TYPE lips-lfimg,
vkbur TYPE lips-vkbur,
werks TYPE lips-werks,
vkgrp TYPE lips-vkgrp,
mvgr1 TYPE lips-mvgr1,
sernr LIKE equi-sernr,
sernp LIKE equi-sernr,
equnr LIKE equi-equnr,
kttxt LIKE qpct-kurztext,
fkimg LIKE vbrp-fkimg,
bstnk LIKE vbak-bstnk,
vbelv LIKE lips-vgbel,
posnv LIKE lips-posnv,
uecha LIKE lips-uecha,
ernam LIKE vbak-ernam,
erdat LIKE vbak-erdat,
serail LIKE lips-serail,
anzsn LIKE lips-anzsn,
auart LIKE vbak-auart ,
netwr LIKE vbap-netwr,
fstno LIKE vbpa-pernr,
fstnm LIKE pa0001-ename,
ename LIKE pa0001-ename,
qname LIKE ltap-qname,
name1 LIKE kna1-name1,
name3 LIKE kna1-name2,
pernr LIKE vbpa-pernr,
aufnr LIKE viqmel-aufnr,
qmnum LIKE viqmel-qmnum,
mngrp LIKE viqmma-mngrp,
qmcod LIKE viqmel-qmcod,
qmcol LIKE viqmma-mncod,
cotxt(20),
invvalue LIKE vbrp-netwr,
posnn LIKE vbfa-posnn,
bstkd LIKE vbkd-bstkd,
END OF i_delivery.
Global structure of list
*/ Selection and Input Parameters
SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-003.
SELECT-OPTIONS: s_vkorg FOR likp-vkorg NO INTERVALS.
SELECT-OPTIONS: s_vbeln FOR likp-vbeln,
s_lfart FOR likp-lfart,
s_kunnr FOR likp-kunnr,
s_erdat FOR likp-erdat,
s_wadat FOR likp-wadat_ist,
s_werks FOR lips-werks,
s_matnr FOR lips-matnr,
s_prodh FOR lips-prodh,
s_qmnum FOR viqmel-qmnum.
SELECTION-SCREEN END OF BLOCK block2.
SELECTION-SCREEN BEGIN OF BLOCK block4 WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_vbelv FOR vbak-vbeln,
s_auart FOR vbak-auart.
SELECTION-SCREEN END OF BLOCK block4.
PARAMETERS: p_vari LIKE disvariant-variant.
RANGES: r_vbeln FOR likp-vbeln.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: gt_outtab TYPE i_delivery OCCURS 0 WITH HEADER LINE,
rt_outtab1 TYPE i_delivery OCCURS 0 WITH HEADER LINE,
i_nast TYPE nast OCCURS 0 WITH HEADER LINE,
gt_list_top_of_page TYPE slis_t_listheader,
gt_events TYPE slis_t_event,
gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
DATA: g_repid LIKE sy-repid,
g_count LIKE sy-tabix.
DATA: BEGIN OF i_serial OCCURS 0,
obknr TYPE ser01-obknr,
lief_nr TYPE ser01-lief_nr,
posnr TYPE ser01-posnr,
anzsn TYPE ser01-anzsn,
END OF i_serial.
DATA: BEGIN OF i_object_numbers OCCURS 0,
obknr TYPE objk-obknr,
obzae TYPE objk-obzae,
sernr TYPE objk-sernr,
equnr TYPE objk-equnr,
matnr TYPE objk-matnr,
taser TYPE objk-taser,
END OF i_object_numbers.
DATA: g_save(1) TYPE c,
g_default(1) TYPE c,
g_exit(1) TYPE c,
gx_variant LIKE disvariant,
g_variant LIKE disvariant.
DATA: g_mnkat LIKE viqmma-mnkat,
g_mngrp LIKE viqmma-mngrp,
g_atinn LIKE ausp-atinn.
DATA: gt_vbkd TYPE TABLE OF vbkd WITH HEADER LINE.
Initialization fieldcatalog
INITIALIZATION.
g_repid = sy-repid.
PERFORM fieldcat_init USING gt_fieldcat[].
MOVE: 'I' TO s_vkorg-sign,
'EQ' TO s_vkorg-option,
'5090' TO s_vkorg-low.
APPEND s_vkorg.
MOVE: 'I' TO s_lfart-sign,
'EQ' TO s_lfart-option,
'LF' TO s_lfart-low.
APPEND s_lfart.
g_save = 'A'.
PERFORM variant_init.
Get default variant
gx_variant = g_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_vari = gx_variant-variant.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
PERFORM f4_for_variant.
AT SELECTION-SCREEN.
PERFORM pai_of_selection_screen.
Start of Selection
START-OF-SELECTION.
PERFORM e03_eventtab_build USING gt_events[].
PERFORM select_data TABLES gt_outtab.
Display list
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_background_id = 'ALV_BACKGROUND'
i_callback_user_command = 'USER_COMMAND'
is_variant = g_variant
i_save = g_save
i_callback_program = g_repid
it_fieldcat = gt_fieldcat[]
TABLES
t_outtab = gt_outtab.
Forms
Initialization fieldcatalog
FORM fieldcat_init
USING rt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
DATA: pos TYPE i VALUE 1.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'VBELN'.
ls_fieldcat-seltext_s = 'Delivery'.
ls_fieldcat-seltext_m = 'Delivery'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'BSTKD'.
ls_fieldcat-seltext_s = 'PO Number'.
ls_fieldcat-seltext_m = 'PO Number'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'POSNR'.
ls_fieldcat-key = 'X'.
ls_fieldcat-seltext_s = 'Item'.
ls_fieldcat-seltext_m = 'Item'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'LFART'.
ls_fieldcat-seltext_s = 'Del Type'.
ls_fieldcat-seltext_m = 'Delivery Type'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'VGBEL'.
ls_fieldcat-seltext_s = 'Source Doc'.
ls_fieldcat-seltext_m = 'Source Doc'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'AUART'.
ls_fieldcat-seltext_s = 'Type'.
ls_fieldcat-seltext_m = 'Type'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'KUNNR'.
ls_fieldcat-seltext_s = 'Customer'.
ls_fieldcat-seltext_m = 'Customer'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'NAME1'.
ls_fieldcat-seltext_s = 'Name'.
ls_fieldcat-seltext_m = 'Name1'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'WERKS'.
ls_fieldcat-seltext_s = 'Plant'.
ls_fieldcat-seltext_m = 'Plant'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-seltext_s = 'Material'.
ls_fieldcat-seltext_m = 'Material'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'MVGR1'.
ls_fieldcat-seltext_s = 'Speciality'.
ls_fieldcat-seltext_m = 'Speciality'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'PRODH'.
ls_fieldcat-seltext_s = 'Hierarchy'.
ls_fieldcat-seltext_m = 'Prod Hierarchy'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'ARKTX'.
ls_fieldcat-seltext_s = 'Description'.
ls_fieldcat-seltext_m = 'Description'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'ERNAM'.
ls_fieldcat-seltext_s = 'Created By'.
ls_fieldcat-seltext_m = 'Created By'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'ERDAT'.
ls_fieldcat-seltext_s = 'Created On'.
ls_fieldcat-seltext_m = 'Created On'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'WADAT_IST'.
ls_fieldcat-seltext_s = 'GoodsMvt.Date'.
ls_fieldcat-seltext_m = 'Goods Mvt Date'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'SERNR'.
ls_fieldcat-seltext_s = 'Serial Shipped'.
ls_fieldcat-seltext_m = 'Serial Shipped'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'SERNP'.
ls_fieldcat-seltext_s = 'Old Serial'.
ls_fieldcat-seltext_m = 'Old Serial'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'VBELV'.
ls_fieldcat-seltext_s = 'Invoice'.
ls_fieldcat-seltext_m = 'Invoice'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'INVVALUE'.
ls_fieldcat-seltext_s = 'Invoice Amt'.
ls_fieldcat-seltext_m = 'Invoice Value'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'QMNUM'.
ls_fieldcat-seltext_s = 'Notification'.
ls_fieldcat-seltext_m = 'Notification'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'QMCOD'.
ls_fieldcat-seltext_s = 'Rep LevKST'.
ls_fieldcat-seltext_m = 'Repair Level KST'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'COTXT'.
ls_fieldcat-seltext_s = 'CdTXT KST'.
ls_fieldcat-seltext_m = 'Repair Level Text KST'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'QMCOL'.
ls_fieldcat-seltext_s = 'Rep LevKSE'.
ls_fieldcat-seltext_m = 'Repair Level KSE'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'KTTXT'.
ls_fieldcat-seltext_s = 'CdTXT KSE'.
ls_fieldcat-seltext_m = 'Repair Level Text KSE'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ENDFORM. "fieldcat_init
Data selection
FORM select_data TABLES rt_outtab LIKE gt_outtab[].
CLEAR: r_vbeln[].
Read all Invoices for the Selection
SELECT DISTINCT h~vbeln h~kunnr h~kunag
d~posnr d~matnr d~anzsn
d~serail d~vgbel d~vgpos
d~posnv d~lfimg d~arktx
d~uecha h~lfart h~erdat
h~ernam h~lfdat d~prodh
h~vkorg d~vkbur d~vkgrp
d~mvgr1 h~wadat_ist d~pstyv
d~werks
INTO (rt_outtab-vbeln, rt_outtab-kunnr,
rt_outtab-kunag, rt_outtab-posnr,
rt_outtab-matnr, rt_outtab-anzsn,
rt_outtab-serail, rt_outtab-vgbel,
rt_outtab-vgpos, rt_outtab-posnv,
rt_outtab-lfimg, rt_outtab-arktx,
rt_outtab-uecha, rt_outtab-lfart,
rt_outtab-erdat, rt_outtab-ernam,
rt_outtab-lfdat, rt_outtab-prodh,
rt_outtab-vkorg, rt_outtab-vkbur,
rt_outtab-vkgrp, rt_outtab-mvgr1,
rt_outtab-wadat, rt_outtab-pstyv,
rt_outtab-werks)
FROM likp AS h INNER JOIN lips AS d
ON h~vbeln = d~vbeln
WHERE h~vbeln IN s_vbeln
AND h~vkorg IN s_vkorg
AND h~lfart IN s_lfart
AND h~kunnr IN s_kunnr
AND h~wadat IN s_wadat
AND d~matnr IN s_matnr
AND d~werks IN s_werks
AND d~prodh IN s_prodh
AND d~vgbel IN s_vbelv
AND d~matnr LIKE 'S%'.
SELECT SINGLE * FROM vbak WHERE vbeln = rt_outtab-vgbel.
IF: sy-subrc EQ 0.
MOVE vbak-vbeln TO rt_outtab-vgbel.
MOVE vbak-auart TO rt_outtab-auart.
ENDIF.
SELECT SINGLE * FROM mara WHERE matnr = rt_outtab-matnr
AND mtart EQ 'FERT'.
CHECK sy-subrc EQ 0.
IF NOT rt_outtab-posnv IS INITIAL.
rt_outtab-vgpos = rt_outtab-posnv.
ENDIF.
CLEAR: vbfa.
SELECT SINGLE vbeln posnn rfwrt INTO
(rt_outtab-vbelv, rt_outtab-posnn, rt_outtab-netwr)
FROM vbfa WHERE vbelv EQ rt_outtab-vbeln
AND posnv EQ rt_outtab-posnr
AND vbtyp_n EQ 'M'.
CLEAR : rt_outtab-invvalue.
SELECT SINGLE * FROM vbrp WHERE vbeln = rt_outtab-vbelv
AND posnr = rt_outtab-posnn.
rt_outtab-fkimg = vbrp-fkimg.
IF rt_outtab-fkimg NE 0.
rt_outtab-invvalue = rt_outtab-netwr / rt_outtab-fkimg.
ENDIF.
APPEND rt_outtab.
IF NOT r_vbeln-low IS INITIAL.
IF r_vbeln-low GT rt_outtab-vbeln.
r_vbeln-low = rt_outtab-vbeln.
ENDIF.
IF r_vbeln-high LT rt_outtab-vbeln.
r_vbeln-high = rt_outtab-vbeln.
ENDIF.
ELSE.
r_vbeln-low = rt_outtab-vbeln.
r_vbeln-high = rt_outtab-vbeln.
ENDIF.
CLEAR: rt_outtab.
ENDSELECT.
IF NOT rt_outtab[] IS INITIAL.
SELECT vbeln posnr bstkd INTO CORRESPONDING FIELDS OF TABLE gt_vbkd
FROM vbkd
FOR ALL ENTRIES IN rt_outtab
WHERE vbeln = rt_outtab-vgbel
AND posnr = rt_outtab-vgpos.
IF NOT gt_vbkd[] IS INITIAL.
SORT gt_vbkd BY vbeln posnr.
LOOP AT rt_outtab.
READ TABLE gt_vbkd WITH KEY vbeln = rt_outtab-vgbel
posnr = rt_outtab-vgpos
BINARY SEARCH.
IF sy-subrc = 0.
rt_outtab-bstkd = gt_vbkd-bstkd.
MODIFY rt_outtab.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
*select bstkd INTO CORRESPONDING FIELDS OF TABLE gt_vbkd
from vbkd where vbeln = gt_outtab-vbeln
and posnr = '000000'.
rt_outtab-bstkd = vbkd-bstkd .
<i><b> select single bstkd into gt_vbkd
from vbkd where vbeln = rt_outtab-vbeln
and posnr = '000000'.
rt_outtab-bstkd = gt_vbkd-bstkd.
APPEND rt_outtab .</b></i>
IF NOT r_vbeln IS INITIAL.
MOVE: 'I' TO r_vbeln-sign,
'BT' TO r_vbeln-option.
APPEND r_vbeln.
SELECT * INTO CORRESPONDING FIELDS OF TABLE i_serial
FROM ser01 WHERE lief_nr IN r_vbeln.
ENDIF.
SORT i_serial.
IF NOT i_serial[] IS INITIAL.
SELECT * INTO CORRESPONDING FIELDS OF TABLE i_object_numbers
FROM objk
FOR ALL ENTRIES IN i_serial
WHERE obknr EQ i_serial-obknr
AND taser EQ 'SER01'.
ENDIF.
SORT i_object_numbers BY obknr obzae.
LOOP AT rt_outtab.
CLEAR: rt_outtab-name1, rt_outtab-sernr, rt_outtab-lfimg,
rt_outtab-sernp, rt_outtab-kttxt.
Read the Sold To Name
SELECT SINGLE name1 INTO rt_outtab-name1
FROM kna1 WHERE kunnr EQ rt_outtab-kunnr.
Read Ship-to Customer
CLEAR: objk.
IF NOT rt_outtab-serail IS INITIAL.
READ TABLE i_serial WITH KEY lief_nr = rt_outtab-vbeln
posnr = rt_outtab-posnr.
IF sy-subrc EQ 0.
DO i_serial-anzsn TIMES.
CLEAR: rt_outtab-sernr, rt_outtab-sernp.
READ TABLE i_object_numbers WITH KEY obknr = i_serial-obknr
matnr = rt_outtab-matnr
BINARY SEARCH.
IF sy-subrc EQ 0.
rt_outtab-sernr = i_object_numbers-sernr.
DELETE i_object_numbers INDEX sy-tabix.
MOVE '1' TO rt_outtab-lfimg.
CLEAR: rt_outtab-aufnr, rt_outtab-qmnum,
rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat.
SELECT SINGLE aufnr qmnum equnr qmcod qmgrp qmkat
INTO (rt_outtab-aufnr, rt_outtab-qmnum,
rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat)
FROM viqmel WHERE matnr = rt_outtab-matnr
AND serialnr = rt_outtab-sernr
AND qmart EQ 'S4'
AND qmnum IN s_qmnum.
CLEAR: rt_outtab-cotxt.
SELECT SINGLE kurztext INTO rt_outtab-cotxt
FROM qpct WHERE katalogart EQ g_mnkat
AND codegruppe EQ g_mngrp
AND code EQ rt_outtab-qmcod
AND sprache EQ sy-langu.
Read Serial Number from Name Plate Data.
CLEAR: klah, kssk, ausp, cabn, g_atinn.
SELECT SINGLE atinn INTO (g_atinn) FROM cabn
WHERE atnam = 'SBANK_SERIAL_NUMBER'.
SELECT SINGLE atwrt
INTO (rt_outtab-sernp)
FROM ( klah AS a INNER JOIN kssk AS k
ON aclint = kclint )
JOIN ausp AS p
ON kobjek = pobjek
AND p~atinn = g_atinn
AND pklart = aklart
WHERE a~klart = '002'
AND a~class = 'KSE_SN_ENDOSCOPES'
AND k~objek = rt_outtab-equnr.
*KSE Repair level (activity code text from KSE-SM07 code group)
CLEAR: rt_outtab-qmcol, g_mngrp, g_mnkat.
CLEAR: rt_outtab-qmcol.
CLEAR: g_mnkat, g_mngrp.
SELECT SINGLE mnkat mngrp mncod INTO
(g_mnkat, g_mngrp, rt_outtab-qmcol)
FROM viqmma WHERE qmnum = rt_outtab-qmnum
AND mngrp EQ 'KSE-SM07'
AND kzloesch EQ space.
CLEAR: rt_outtab-kttxt.
SELECT SINGLE kurztext INTO rt_outtab-kttxt
FROM qpct WHERE katalogart EQ g_mnkat
AND codegruppe EQ g_mngrp
AND code EQ rt_outtab-qmcol
AND sprache EQ sy-langu.
rt_outtab1 = rt_outtab.
APPEND rt_outtab1.
ENDIF.
ENDDO.
ENDIF.
ENDIF.
ENDLOOP.
CLEAR: rt_outtab[].
rt_outtab[] = rt_outtab1[].
SORT rt_outtab BY vbeln posnr.
ENDFORM.
FORM get_repname *
--> P_VBELN *
--> P_POSNR *
--> P_PERNR *
--> P_ENAME *
FORM get_repname USING p_vbeln
p_posnr
CHANGING p_pernr
p_ename. "
DATA: i_vbpa LIKE vbpa OCCURS 0 WITH HEADER LINE.
CLEAR: i_vbpa[].
CALL FUNCTION 'Z_DETERMINE_ACTIVE_SALES_REP'
EXPORTING
g_salesdocument = p_vbeln
g_sales_item = p_posnr
TABLES
st_vbpa = i_vbpa.
READ TABLE i_vbpa INDEX 1.
IF sy-subrc = 0.
p_pernr = i_vbpa-pernr.
SELECT SINGLE ename INTO p_ename
FROM pa0001
WHERE pernr = i_vbpa-pernr.
ENDIF.
ENDFORM. " get_repname
FORM E03_EVENTTAB_BUILD *
--> E03_LT_EVENTS *
FORM e03_eventtab_build USING e03_lt_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = e03_lt_events.
READ TABLE e03_lt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE gc_formname_top_of_page TO ls_event-form.
APPEND ls_event TO e03_lt_events.
ENDIF.
ENDFORM.
FORM TOP_OF_PAGE *
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_list_top_of_page.
ENDFORM.
*& Form USER_COMMAND
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
PERFORM display_delivery USING r_ucomm
rs_selfield.
ENDCASE.
ENDFORM.
*& Form display_delivery
FORM display_delivery
USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE rs_selfield-sel_tab_field.
WHEN '1-VBELN'.
SET PARAMETER ID 'VL' FIELD rs_selfield-value.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
WHEN '1-VBELV'.
SET PARAMETER ID 'VF' FIELD rs_selfield-value.
CALL TRANSACTION 'VF03N' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM.
*& Form VARIANT_INIT
text
--> p1 text
<-- p2 text
FORM variant_init.
CLEAR g_variant.
g_variant-report = g_repid.
ENDFORM. " VARIANT_INIT
*& Form F4_FOR_VARIANT
text
--> p1 text
<-- p2 text
FORM f4_for_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = g_variant
i_save = g_save
it_default_fieldcat =
IMPORTING
e_exit = g_exit
es_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF g_exit = space.
p_vari = gx_variant-variant.
ENDIF.
ENDIF.
ENDFORM.
*& Form PAI_OF_SELECTION_SCREEN
text
FORM pai_of_selection_screen.
IF NOT p_vari IS INITIAL.
MOVE g_variant TO gx_variant.
MOVE p_vari TO gx_variant-variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant.
g_variant = gx_variant.
ELSE.
PERFORM variant_init.
ENDIF.
ENDFORM.naren this is the program
Global structure of list
TYPE-POOLS: slis.
TABLES: likp,
lips,
vbfa,
kssk,
klah,
ausp,
cabn,
vbak,
mara,
vbrk,
ser01,
vbpa,
vbrp,
nast,
zseri,
ltap,
pa0001,
kna1,
objk,
viqmel,
viqmma.
TYPES: BEGIN OF i_delivery,
vbeln LIKE likp-vbeln,
posnr LIKE lips-posnr,
kunnr LIKE likp-kunnr,
kunag LIKE likp-kunag,
vkorg LIKE vbak-vkorg,
matnr LIKE lips-matnr,
lfart LIKE likp-lfart,
arktx LIKE vbap-arktx,
vgbel LIKE lips-vgbel,
vgpos LIKE lips-vgpos,
pstyv LIKE lips-pstyv,
wadat TYPE likp-wadat_ist,
lfdat TYPE likp-lfdat,
prodh TYPE lips-prodh,
lfimg TYPE lips-lfimg,
vkbur TYPE lips-vkbur,
werks TYPE lips-werks,
vkgrp TYPE lips-vkgrp,
mvgr1 TYPE lips-mvgr1,
sernr LIKE equi-sernr,
sernp LIKE equi-sernr,
equnr LIKE equi-equnr,
kttxt LIKE qpct-kurztext,
fkimg LIKE vbrp-fkimg,
bstnk LIKE vbak-bstnk,
vbelv LIKE lips-vgbel,
posnv LIKE lips-posnv,
uecha LIKE lips-uecha,
ernam LIKE vbak-ernam,
erdat LIKE vbak-erdat,
serail LIKE lips-serail,
anzsn LIKE lips-anzsn,
auart LIKE vbak-auart ,
netwr LIKE vbap-netwr,
fstno LIKE vbpa-pernr,
fstnm LIKE pa0001-ename,
ename LIKE pa0001-ename,
qname LIKE ltap-qname,
name1 LIKE kna1-name1,
name3 LIKE kna1-name2,
pernr LIKE vbpa-pernr,
aufnr LIKE viqmel-aufnr,
qmnum LIKE viqmel-qmnum,
mngrp LIKE viqmma-mngrp,
qmcod LIKE viqmel-qmcod,
qmcol LIKE viqmma-mncod,
cotxt(20),
invvalue LIKE vbrp-netwr,
posnn LIKE vbfa-posnn,
bstkd LIKE vbkd-bstkd,
END OF i_delivery.
Global structure of list
*/ Selection and Input Parameters
SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-003.
SELECT-OPTIONS: s_vkorg FOR likp-vkorg NO INTERVALS.
SELECT-OPTIONS: s_vbeln FOR likp-vbeln,
s_lfart FOR likp-lfart,
s_kunnr FOR likp-kunnr,
s_erdat FOR likp-erdat,
s_wadat FOR likp-wadat_ist,
s_werks FOR lips-werks,
s_matnr FOR lips-matnr,
s_prodh FOR lips-prodh,
s_qmnum FOR viqmel-qmnum.
SELECTION-SCREEN END OF BLOCK block2.
SELECTION-SCREEN BEGIN OF BLOCK block4 WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_vbelv FOR vbak-vbeln,
s_auart FOR vbak-auart.
SELECTION-SCREEN END OF BLOCK block4.
PARAMETERS: p_vari LIKE disvariant-variant.
RANGES: r_vbeln FOR likp-vbeln.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: gt_outtab TYPE i_delivery OCCURS 0 WITH HEADER LINE,
rt_outtab1 TYPE i_delivery OCCURS 0 WITH HEADER LINE,
i_nast TYPE nast OCCURS 0 WITH HEADER LINE,
gt_list_top_of_page TYPE slis_t_listheader,
gt_events TYPE slis_t_event,
gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
DATA: g_repid LIKE sy-repid,
g_count LIKE sy-tabix.
DATA: BEGIN OF i_serial OCCURS 0,
obknr TYPE ser01-obknr,
lief_nr TYPE ser01-lief_nr,
posnr TYPE ser01-posnr,
anzsn TYPE ser01-anzsn,
END OF i_serial.
DATA: BEGIN OF i_object_numbers OCCURS 0,
obknr TYPE objk-obknr,
obzae TYPE objk-obzae,
sernr TYPE objk-sernr,
equnr TYPE objk-equnr,
matnr TYPE objk-matnr,
taser TYPE objk-taser,
END OF i_object_numbers.
DATA: g_save(1) TYPE c,
g_default(1) TYPE c,
g_exit(1) TYPE c,
gx_variant LIKE disvariant,
g_variant LIKE disvariant.
DATA: g_mnkat LIKE viqmma-mnkat,
g_mngrp LIKE viqmma-mngrp,
g_atinn LIKE ausp-atinn.
DATA: gt_vbkd TYPE TABLE OF vbkd WITH HEADER LINE.
Initialization fieldcatalog
INITIALIZATION.
g_repid = sy-repid.
PERFORM fieldcat_init USING gt_fieldcat[].
MOVE: 'I' TO s_vkorg-sign,
'EQ' TO s_vkorg-option,
'5090' TO s_vkorg-low.
APPEND s_vkorg.
MOVE: 'I' TO s_lfart-sign,
'EQ' TO s_lfart-option,
'LF' TO s_lfart-low.
APPEND s_lfart.
g_save = 'A'.
PERFORM variant_init.
Get default variant
gx_variant = g_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_vari = gx_variant-variant.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
PERFORM f4_for_variant.
AT SELECTION-SCREEN.
PERFORM pai_of_selection_screen.
Start of Selection
START-OF-SELECTION.
PERFORM e03_eventtab_build USING gt_events[].
PERFORM select_data TABLES gt_outtab.
Display list
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_background_id = 'ALV_BACKGROUND'
i_callback_user_command = 'USER_COMMAND'
is_variant = g_variant
i_save = g_save
i_callback_program = g_repid
it_fieldcat = gt_fieldcat[]
TABLES
t_outtab = gt_outtab.
Forms
Initialization fieldcatalog
FORM fieldcat_init
USING rt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
DATA: pos TYPE i VALUE 1.
CLEAR ls_fieldcat.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'VBELN'.
ls_fieldcat-seltext_s = 'Delivery'.
ls_fieldcat-seltext_m = 'Delivery'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'BSTKD'.
ls_fieldcat-seltext_s = 'PO Number'.
ls_fieldcat-seltext_m = 'PO Number'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'POSNR'.
ls_fieldcat-key = 'X'.
ls_fieldcat-seltext_s = 'Item'.
ls_fieldcat-seltext_m = 'Item'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'LFART'.
ls_fieldcat-seltext_s = 'Del Type'.
ls_fieldcat-seltext_m = 'Delivery Type'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'VGBEL'.
ls_fieldcat-seltext_s = 'Source Doc'.
ls_fieldcat-seltext_m = 'Source Doc'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'AUART'.
ls_fieldcat-seltext_s = 'Type'.
ls_fieldcat-seltext_m = 'Type'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'KUNNR'.
ls_fieldcat-seltext_s = 'Customer'.
ls_fieldcat-seltext_m = 'Customer'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'NAME1'.
ls_fieldcat-seltext_s = 'Name'.
ls_fieldcat-seltext_m = 'Name1'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'WERKS'.
ls_fieldcat-seltext_s = 'Plant'.
ls_fieldcat-seltext_m = 'Plant'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-seltext_s = 'Material'.
ls_fieldcat-seltext_m = 'Material'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'MVGR1'.
ls_fieldcat-seltext_s = 'Speciality'.
ls_fieldcat-seltext_m = 'Speciality'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'PRODH'.
ls_fieldcat-seltext_s = 'Hierarchy'.
ls_fieldcat-seltext_m = 'Prod Hierarchy'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'ARKTX'.
ls_fieldcat-seltext_s = 'Description'.
ls_fieldcat-seltext_m = 'Description'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'ERNAM'.
ls_fieldcat-seltext_s = 'Created By'.
ls_fieldcat-seltext_m = 'Created By'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'ERDAT'.
ls_fieldcat-seltext_s = 'Created On'.
ls_fieldcat-seltext_m = 'Created On'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'WADAT_IST'.
ls_fieldcat-seltext_s = 'GoodsMvt.Date'.
ls_fieldcat-seltext_m = 'Goods Mvt Date'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'SERNR'.
ls_fieldcat-seltext_s = 'Serial Shipped'.
ls_fieldcat-seltext_m = 'Serial Shipped'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'SERNP'.
ls_fieldcat-seltext_s = 'Old Serial'.
ls_fieldcat-seltext_m = 'Old Serial'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'VBELV'.
ls_fieldcat-seltext_s = 'Invoice'.
ls_fieldcat-seltext_m = 'Invoice'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'INVVALUE'.
ls_fieldcat-seltext_s = 'Invoice Amt'.
ls_fieldcat-seltext_m = 'Invoice Value'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'QMNUM'.
ls_fieldcat-seltext_s = 'Notification'.
ls_fieldcat-seltext_m = 'Notification'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'QMCOD'.
ls_fieldcat-seltext_s = 'Rep LevKST'.
ls_fieldcat-seltext_m = 'Repair Level KST'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'COTXT'.
ls_fieldcat-seltext_s = 'CdTXT KST'.
ls_fieldcat-seltext_m = 'Repair Level Text KST'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'QMCOL'.
ls_fieldcat-seltext_s = 'Rep LevKSE'.
ls_fieldcat-seltext_m = 'Repair Level KSE'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'KTTXT'.
ls_fieldcat-seltext_s = 'CdTXT KSE'.
ls_fieldcat-seltext_m = 'Repair Level Text KSE'.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
ENDFORM. "fieldcat_init
Data selection
FORM select_data TABLES rt_outtab LIKE gt_outtab[].
CLEAR: r_vbeln[].
Read all Invoices for the Selection
SELECT DISTINCT h~vbeln h~kunnr h~kunag
d~posnr d~matnr d~anzsn
d~serail d~vgbel d~vgpos
d~posnv d~lfimg d~arktx
d~uecha h~lfart h~erdat
h~ernam h~lfdat d~prodh
h~vkorg d~vkbur d~vkgrp
d~mvgr1 h~wadat_ist d~pstyv
d~werks
INTO (rt_outtab-vbeln, rt_outtab-kunnr,
rt_outtab-kunag, rt_outtab-posnr,
rt_outtab-matnr, rt_outtab-anzsn,
rt_outtab-serail, rt_outtab-vgbel,
rt_outtab-vgpos, rt_outtab-posnv,
rt_outtab-lfimg, rt_outtab-arktx,
rt_outtab-uecha, rt_outtab-lfart,
rt_outtab-erdat, rt_outtab-ernam,
rt_outtab-lfdat, rt_outtab-prodh,
rt_outtab-vkorg, rt_outtab-vkbur,
rt_outtab-vkgrp, rt_outtab-mvgr1,
rt_outtab-wadat, rt_outtab-pstyv,
rt_outtab-werks)
FROM likp AS h INNER JOIN lips AS d
ON h~vbeln = d~vbeln
WHERE h~vbeln IN s_vbeln
AND h~vkorg IN s_vkorg
AND h~lfart IN s_lfart
AND h~kunnr IN s_kunnr
AND h~wadat IN s_wadat
AND d~matnr IN s_matnr
AND d~werks IN s_werks
AND d~prodh IN s_prodh
AND d~vgbel IN s_vbelv
AND d~matnr LIKE 'S%'.
SELECT SINGLE * FROM vbak WHERE vbeln = rt_outtab-vgbel.
IF: sy-subrc EQ 0.
MOVE vbak-vbeln TO rt_outtab-vgbel.
MOVE vbak-auart TO rt_outtab-auart.
ENDIF.
SELECT SINGLE * FROM mara WHERE matnr = rt_outtab-matnr
AND mtart EQ 'FERT'.
CHECK sy-subrc EQ 0.
IF NOT rt_outtab-posnv IS INITIAL.
rt_outtab-vgpos = rt_outtab-posnv.
ENDIF.
CLEAR: vbfa.
SELECT SINGLE vbeln posnn rfwrt INTO
(rt_outtab-vbelv, rt_outtab-posnn, rt_outtab-netwr)
FROM vbfa WHERE vbelv EQ rt_outtab-vbeln
AND posnv EQ rt_outtab-posnr
AND vbtyp_n EQ 'M'.
CLEAR : rt_outtab-invvalue.
SELECT SINGLE * FROM vbrp WHERE vbeln = rt_outtab-vbelv
AND posnr = rt_outtab-posnn.
rt_outtab-fkimg = vbrp-fkimg.
IF rt_outtab-fkimg NE 0.
rt_outtab-invvalue = rt_outtab-netwr / rt_outtab-fkimg.
ENDIF.
APPEND rt_outtab.
IF NOT r_vbeln-low IS INITIAL.
IF r_vbeln-low GT rt_outtab-vbeln.
r_vbeln-low = rt_outtab-vbeln.
ENDIF.
IF r_vbeln-high LT rt_outtab-vbeln.
r_vbeln-high = rt_outtab-vbeln.
ENDIF.
ELSE.
r_vbeln-low = rt_outtab-vbeln.
r_vbeln-high = rt_outtab-vbeln.
ENDIF.
CLEAR: rt_outtab.
ENDSELECT.
IF NOT rt_outtab[] IS INITIAL.
SELECT vbeln posnr bstkd INTO CORRESPONDING FIELDS OF TABLE gt_vbkd
FROM vbkd
FOR ALL ENTRIES IN rt_outtab
WHERE vbeln = rt_outtab-vgbel
AND posnr = rt_outtab-vgpos.
IF NOT gt_vbkd[] IS INITIAL.
SORT gt_vbkd BY vbeln posnr.
LOOP AT rt_outtab.
READ TABLE gt_vbkd WITH KEY vbeln = rt_outtab-vgbel
posnr = rt_outtab-vgpos
BINARY SEARCH.
IF sy-subrc = 0.
rt_outtab-bstkd = gt_vbkd-bstkd.
MODIFY rt_outtab.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
*select bstkd INTO CORRESPONDING FIELDS OF TABLE gt_vbkd
from vbkd where vbeln = gt_outtab-vbeln
and posnr = '000000'.
rt_outtab-bstkd = vbkd-bstkd .
SELECT single bstkd INTO CORRESPONDING FIELDS OF gt_vbkd
FROM vbkd WHERE vbeln = gt_vbkd-vbeln
AND posnr = '000000'.
rt_outtab-bstkd = gt_vbkd-bstkd.
APPEND rt_outtab.
IF NOT r_vbeln IS INITIAL.
MOVE: 'I' TO r_vbeln-sign,
'BT' TO r_vbeln-option.
APPEND r_vbeln.
SELECT * INTO CORRESPONDING FIELDS OF TABLE i_serial
FROM ser01 WHERE lief_nr IN r_vbeln.
ENDIF.
SORT i_serial.
IF NOT i_serial[] IS INITIAL.
SELECT * INTO CORRESPONDING FIELDS OF TABLE i_object_numbers
FROM objk
FOR ALL ENTRIES IN i_serial
WHERE obknr EQ i_serial-obknr
AND taser EQ 'SER01'.
ENDIF.
SORT i_object_numbers BY obknr obzae.
LOOP AT rt_outtab.
CLEAR: rt_outtab-name1, rt_outtab-sernr, rt_outtab-lfimg,
rt_outtab-sernp, rt_outtab-kttxt.
Read the Sold To Name
SELECT SINGLE name1 INTO rt_outtab-name1
FROM kna1 WHERE kunnr EQ rt_outtab-kunnr.
Read Ship-to Customer
CLEAR: objk.
IF NOT rt_outtab-serail IS INITIAL.
READ TABLE i_serial WITH KEY lief_nr = rt_outtab-vbeln
posnr = rt_outtab-posnr.
IF sy-subrc EQ 0.
DO i_serial-anzsn TIMES.
CLEAR: rt_outtab-sernr, rt_outtab-sernp.
READ TABLE i_object_numbers WITH KEY obknr = i_serial-obknr
matnr = rt_outtab-matnr
BINARY SEARCH.
IF sy-subrc EQ 0.
rt_outtab-sernr = i_object_numbers-sernr.
DELETE i_object_numbers INDEX sy-tabix.
MOVE '1' TO rt_outtab-lfimg.
CLEAR: rt_outtab-aufnr, rt_outtab-qmnum,
rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat.
SELECT SINGLE aufnr qmnum equnr qmcod qmgrp qmkat
INTO (rt_outtab-aufnr, rt_outtab-qmnum,
rt_outtab-equnr, rt_outtab-qmcod, g_mngrp, g_mnkat)
FROM viqmel WHERE matnr = rt_outtab-matnr
AND serialnr = rt_outtab-sernr
AND qmart EQ 'S4'
AND qmnum IN s_qmnum.
CLEAR: rt_outtab-cotxt.
SELECT SINGLE kurztext INTO rt_outtab-cotxt
FROM qpct WHERE katalogart EQ g_mnkat
AND codegruppe EQ g_mngrp
AND code EQ rt_outtab-qmcod
AND sprache EQ sy-langu.
Read Serial Number from Name Plate Data.
CLEAR: klah, kssk, ausp, cabn, g_atinn.
SELECT SINGLE atinn INTO (g_atinn) FROM cabn
WHERE atnam = 'SBANK_SERIAL_NUMBER'.
SELECT SINGLE atwrt
INTO (rt_outtab-sernp)
FROM ( klah AS a INNER JOIN kssk AS k
ON aclint = kclint )
JOIN ausp AS p
ON kobjek = pobjek
AND p~atinn = g_atinn
AND pklart = aklart
WHERE a~klart = '002'
AND a~class = 'KSE_SN_ENDOSCOPES'
AND k~objek = rt_outtab-equnr.
*KSE Repair level (activity code text from KSE-SM07 code group)
CLEAR: rt_outtab-qmcol, g_mngrp, g_mnkat.
CLEAR: rt_outtab-qmcol.
CLEAR: g_mnkat, g_mngrp.
SELECT SINGLE mnkat mngrp mncod INTO
(g_mnkat, g_mngrp, rt_outtab-qmcol)
FROM viqmma WHERE qmnum = rt_outtab-qmnum
AND mngrp EQ 'KSE-SM07'
AND kzloesch EQ space.
CLEAR: rt_outtab-kttxt.
SELECT SINGLE kurztext INTO rt_outtab-kttxt
FROM qpct WHERE katalogart EQ g_mnkat
AND codegruppe EQ g_mngrp
AND code EQ rt_outtab-qmcol
AND sprache EQ sy-langu.
rt_outtab1 = rt_outtab.
APPEND rt_outtab1.
ENDIF.
ENDDO.
ENDIF.
ENDIF.
ENDLOOP.
CLEAR: rt_outtab[].
rt_outtab[] = rt_outtab1[].
SORT rt_outtab BY vbeln posnr.
ENDFORM.
FORM get_repname *
--> P_VBELN *
--> P_POSNR *
--> P_PERNR *
--> P_ENAME *
FORM get_repname USING p_vbeln
p_posnr
CHANGING p_pernr
p_ename. "
DATA: i_vbpa LIKE vbpa OCCURS 0 WITH HEADER LINE.
CLEAR: i_vbpa[].
CALL FUNCTION 'Z_DETERMINE_ACTIVE_SALES_REP'
EXPORTING
g_salesdocument = p_vbeln
g_sales_item = p_posnr
TABLES
st_vbpa = i_vbpa.
READ TABLE i_vbpa INDEX 1.
IF sy-subrc = 0.
p_pernr = i_vbpa-pernr.
SELECT SINGLE ename INTO p_ename
FROM pa0001
WHERE pernr = i_vbpa-pernr.
ENDIF.
ENDFORM. " get_repname
FORM E03_EVENTTAB_BUILD *
--> E03_LT_EVENTS *
FORM e03_eventtab_build USING e03_lt_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = e03_lt_events.
READ TABLE e03_lt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE gc_formname_top_of_page TO ls_event-form.
APPEND ls_event TO e03_lt_events.
ENDIF.
ENDFORM.
FORM TOP_OF_PAGE *
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_list_top_of_page.
ENDFORM.
*& Form USER_COMMAND
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
PERFORM display_delivery USING r_ucomm
rs_selfield.
ENDCASE.
ENDFORM.
*& Form display_delivery
FORM display_delivery
USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE rs_selfield-sel_tab_field.
WHEN '1-VBELN'.
SET PARAMETER ID 'VL' FIELD rs_selfield-value.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
WHEN '1-VBELV'.
SET PARAMETER ID 'VF' FIELD rs_selfield-value.
CALL TRANSACTION 'VF03N' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM.
*& Form VARIANT_INIT
text
--> p1 text
<-- p2 text
FORM variant_init.
CLEAR g_variant.
g_variant-report = g_repid.
ENDFORM. " VARIANT_INIT
*& Form F4_FOR_VARIANT
text
--> p1 text
<-- p2 text
FORM f4_for_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = g_variant
i_save = g_save
it_default_fieldcat =
IMPORTING
e_exit = g_exit
es_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF g_exit = space.
p_vari = gx_variant-variant.
ENDIF.
ENDIF.
ENDFORM.
*& Form PAI_OF_SELECTION_SCREEN
text
FORM pai_of_selection_screen.
IF NOT p_vari IS INITIAL.
MOVE g_variant TO gx_variant.
MOVE p_vari TO gx_variant-variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant.
g_variant = gx_variant.
ELSE.
PERFORM variant_init.
ENDIF.
ENDFORM. -
Down Loading ALV Output to Excel Sheet
Hi All,
I am working on Vendor Line Items Report which have both Header details as well as line item details.
So i developed Heirarical ALV to display the output and it is working fine.But my problem is Downloading output to Excel sheet functionality is not working.
In output screen LIST->EXPORT->SPREADSHEET functionality is not working.
Please give me suggestions regarding the same or is there any another way to do the same by using ALV List Display.
Points will be rewarded
Thanks and Regards,
Siva.hi ,
this is a working example check this...
REPORT zvenkattest0.
TABLES:pa0002,pa0008.
TYPE-POOLS:slis.
CONSTANTS:c VALUE 'X'.
DATA:BEGIN OF it_pa0008 OCCURS 0,
pernr LIKE pa0008-pernr,
begda LIKE pa0008-begda,
endda LIKE pa0008-endda,
preas LIKE pa0008-preas,
ansal LIKE pa0008-ansal,
lga01 LIKE pa0008-lga01,
expand TYPE xfeld,
END OF it_pa0008.
DATA:BEGIN OF it_pa0002 OCCURS 0,
pernr LIKE pa0002-pernr,
vorna LIKE pa0002-vorna,
nachn LIKE pa0002-nachn,
gbdat LIKE pa0002-gbdat,
gblnd LIKE pa0002-gblnd,
sprsl LIKE pa0002-sprsl,
perid LIKE pa0002-perid,
END OF it_pa0002.
DATA: wa_field_cat TYPE slis_fieldcat_alv,
it_field_cat TYPE slis_t_fieldcat_alv,
wa_keyinfo TYPE slis_keyinfo_alv,
it_layout TYPE slis_layout_alv.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:s_pernr FOR pa0002-pernr NO INTERVALS.
SELECTION-SCREEN: SKIP.
PARAMETERS:p_expand AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM select_data.
PERFORM build_field_cat.
PERFORM disply_data.
*& Form SELECT_DATA
text
--> p1 text
<-- p2 text
FORM select_data .
SELECT pernr
begda
endda
preas
ansal
lga01
FROM pa0008
INTO CORRESPONDING FIELDS OF TABLE it_pa0008
UP TO 10 ROWS.
IF NOT it_pa0008[] IS INITIAL.
SELECT pernr
vorna
nachn
gbdat
gblnd
sprsl
perid
FROM pa0002
INTO CORRESPONDING FIELDS OF TABLE it_pa0002
FOR ALL ENTRIES IN it_pa0008
WHERE pernr = it_pa0008-pernr.
ENDIF.
SORT it_pa0008 BY pernr.
ENDFORM. " SELECT_DATA
*& Form BUILD_FIELD_CAT
text
--> p1 text
<-- p2 text
FORM build_field_cat .
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'PERNR'.
wa_field_cat-seltext_l = 'personnelno'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'BEGDA'.
wa_field_cat-seltext_l = 'begindate'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'ENDDA'.
wa_field_cat-seltext_l = 'enddate'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'PREAS'.
wa_field_cat-seltext_l = 'reason'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'ANSAL'.
wa_field_cat-seltext_l = 'annualsalary'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0008'.
wa_field_cat-fieldname = 'LGA01'.
wa_field_cat-seltext_l = 'wagetype'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'VORNA'.
wa_field_cat-seltext_l = 'firstname'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'NACHN'.
wa_field_cat-seltext_l = 'lastname'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'GBDAT'.
wa_field_cat-seltext_l = 'birhtdate'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'GBLND'.
wa_field_cat-seltext_l = 'birthcountry'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'SPRSL'.
wa_field_cat-seltext_l = 'languageused'.
APPEND wa_field_cat TO it_field_cat.
wa_field_cat-tabname = 'PA0002'.
wa_field_cat-fieldname = 'PERID'.
wa_field_cat-seltext_l = 'personnelid'.
APPEND wa_field_cat TO it_field_cat.
ENDFORM. " BUILD_FIELD_CAT
*& Form DISPLY_DATA
text
--> p1 text
<-- p2 text
FORM disply_data .
it_layout-group_change_edit = c.
it_layout-colwidth_optimize = c.
it_layout-zebra = c.
it_layout-detail_popup = c.
it_layout-get_selinfos = c.
IF p_expand = c.
it_layout-expand_fieldname = 'EXPAND'.
ENDIF.
wa_keyinfo-header01 = 'PERNR'.
wa_keyinfo-item01 = 'PERNR'.
wa_keyinfo-item02 = 'SUBTY'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
is_layout = it_layout
it_fieldcat = it_field_cat
i_tabname_header = 'PA0008'
i_tabname_item = 'PA0002'
is_keyinfo = wa_keyinfo
TABLES
t_outtab_header = it_pa0008
t_outtab_item = it_pa0002.
ENDFORM. " DISPLY_DATA
regards,
venkat. -
Not able to display flat file's error line in output
The below Source Code is BDC for XD01 (update Customer Master Record) in CALL TRANSACTION method. This program is written in call transaction method cause as per users requirement, user wants error log to be printed as soon as the BDC process finished in the background mode.
When you execute this below program it will show a selection screen from where you can select your flat file from system.
After executing this code show output like below as soon as it finished processing the FLAT file.
1. Customer Update Summary
2. Successful record with customer number and name.
3. Error Records with 'record number' and 'reason for error'
(For testing you just have to copy-paste-save-active the source code)
And I have encountered an issue over here in 3rd section-Record Number of Error Records.
The Record Number is for display the line number of that flat file line which in which error has occurred.
The Record Number Entries showing only 0 instead of showing line number of error entry .
I have used Function Module FORMAT_MESSAGE to capture the errors. But not able to display line number of that flat file which is containing error.
So please suggest me what changes I should make in below source code to get proper output.
Flat file for your R&D
1000 1000 10 10 0001 Company Chobey & Group1N Choubey Amit Choubey New Alipore Road Habijabi Apartment Rastar Dhra 777777 kolkata 777777 kolikata howrah 777777 IN WB 1111111111 2222222222 3333333333 4444444444 5555555555 6666666666 0700 EAST 02 01 1060003 A1 Z1 ZZ13 CALS 1 A 10 1
1000 1000 10 10 0001 Company Chobey & Group2N Choubey Amit Choubey New Alipore Road Habijabi Apartment Rastar Dhra 777777 kolkata 777777 kolikata howrah 777777 IN WB 1111111111 2222222222 3333333333 4444444444 5555555555 6666666666 0700 EAST 02 01 1060003 A1 Z1 ZZ13 CALS 1 A 10 1
1000 1000 10 10 0001 Company Chobey & Group3N Choubey Amit Choubey New Alipore Road Habijabi Apartment Rastar Dhra 777777 kolkata 777777 kolikata howrah 777777 IN WB 1111111111 2222222222 3333333333 4444444444 5555555555 6666666666 0700 EAST 02 01 1060003 A1 Z1 ZZ13 CALS . A 10 1
1000 1000 10 10 0001 Company Chobey & Group4N Choubey Amit Choubey New Alipore Road Habijabi Apartment Rastar Dhra 777777 kolkata 777777 kolikata howrah 777777 IN WB 1111111111 2222222222 3333333333 4444444444 5555555555 6666666666 0700 EAST 02 01 1060003 A1 Z1 ZZ13 CALS 1 A .. 1
1000 1000 10 10 0001 Company Chobey & Group5N Choubey Amit Choubey New Alipore Road Habijabi Apartment Rastar Dhra 777777 kolkata 777777 kolikata howrah 777777 IN WB 1111111111 2222222222 3333333333 4444444444 5555555555 6666666666 0700 EAST 02 01 1060003 A1 Z1 ZZ13 CALS 1 A 10 1
And Source Code
*& Report Z_TEST_SAI *
REPORT Z_TEST_SAI no standard page heading line-size 255.
TYPES: BEGIN OF t_cust,
bukrs like rf02d-bukrs,
vkorg like rf02d-vkorg,
vtweg like rf02d-vtweg,
spart like rf02d-spart,
ktokd like rf02d-ktokd,
anred like kna1-anred,
name1 like kna1-name1,
sortl like kna1-sortl,
name2 like kna1-name2,
name3 like kna1-name3,
name4 like kna1-name4,
stras like kna1-stras,
pfach like kna1-pfach,
ort01 like kna1-ort01,
pstlz like kna1-pstlz,
ort02 like kna1-ort02,
pfort like kna1-pfort,
pstl2 like kna1-pstl2,
land1 like kna1-land1,
regio like kna1-regio,
telx1 like kna1-telx1,
telf1 like kna1-telf1,
telfx like kna1-telfx,
telf2 like kna1-telf2,
teltx like kna1-teltx,
stceg like kna1-stceg,
cityc like kna1-cityc,
lzone like kna1-lzone,
niels like kna1-niels,
kukla like kna1-kukla,
akont like knb1-akont,
fdgrv like knb1-fdgrv,
vzskz like knb1-vzskz,
zterm like knb1-zterm,
vkbur like knvv-vkbur,
versg like knvv-versg,
vsbed like knvv-vsbed,
ktgrd like knvv-ktgrd,
taxkd like knvi-taxkd,
END OF t_cust.
TYPES: BEGIN OF t_sucrec,
cnum TYPE kna1-kunnr, "Customer Number
cnam TYPE kna1-name1, "Customer Name
END OF t_sucrec.
TYPES: BEGIN OF t_errrec,
* lineno TYPE i, "Line Number
lineno TYPE string,
message TYPE string, "Error Message
END OF t_errrec.
DATA: v_file TYPE string, "Variable for storing flat file
it_cust TYPE STANDARD TABLE OF t_cust, "Internal table of Customer
wa_cust LIKE LINE OF it_cust, "Workarea of Internal table it_cust
it_sucrec TYPE STANDARD TABLE OF t_sucrec, "Internal table of Success records
wa_sucrec LIKE LINE OF it_sucrec, "Workarea of Internal table it_sucrec
it_errrec TYPE STANDARD TABLE OF t_errrec,
wa_errrec LIKE LINE OF it_errrec,
it_bdctab LIKE bdcdata OCCURS 0 WITH HEADER LINE, "Internal table structure of BDCDATA
it_messagetab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE, "Tracing Error Messages
v_date LIKE sy-datum, "Controlling of session date
v_index LIKE sy-index, "Index Number
v_totrec TYPE i, "Total Records
v_errrec TYPE i, "Error Records
v_sucrec TYPE i, "Success Records
v_sesschk TYPE c. "Session maintenance
*& SELECTION-SCREEN
SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001 NO INTERVALS.
PARAMETERS: p_file TYPE rlgrap-filename. "rlgrap-filename is a predefined structure
SELECTION-SCREEN: END OF BLOCK blk1.
SELECTION-SCREEN: BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002 NO INTERVALS.
PARAMETERS: p_mode LIKE ctu_params-dismode DEFAULT 'N',
p_update LIKE ctu_params-updmode DEFAULT 'A'.
SELECTION-SCREEN END OF BLOCK blk2.
*& INITIALIZATION
INITIALIZATION.
v_date = sy-datum - 1.
*& AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
FIELD_NAME = ' '
IMPORTING
file_name = p_file.
*& START-OF-SELECTION
START-OF-SELECTION.
v_file = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = it_cust
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
OTHERS = 17.
IF sy-subrc = 0.
*MESSAGE ID sy-msgid
*TYPE sy-msgty
*NUMBER sy-msgno
*WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*& END-OF-SELECTION
END-OF-SELECTION.
v_index = sy-index.
LOOP AT it_cust INTO wa_cust.
perform bdc_dynpro using 'SAPMF02D' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02D-KTOKD'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02D-BUKRS'
wa_cust-bukrs.
perform bdc_field using 'RF02D-VKORG'
wa_cust-vkorg.
perform bdc_field using 'RF02D-VTWEG'
wa_cust-vtweg.
perform bdc_field using 'RF02D-SPART'
wa_cust-spart.
perform bdc_field using 'RF02D-KTOKD'
wa_cust-ktokd.
perform bdc_dynpro using 'SAPMF02D' '0110'.
perform bdc_field using 'BDC_CURSOR'
'KNA1-TELTX'.
perform bdc_field using 'BDC_OKCODE'
'=VW'.
perform bdc_field using 'KNA1-ANRED'
wa_cust-anred.
perform bdc_field using 'KNA1-NAME1'
wa_cust-name1.
perform bdc_field using 'KNA1-SORTL'
wa_cust-sortl.
perform bdc_field using 'KNA1-NAME2'
wa_cust-name2.
perform bdc_field using 'KNA1-NAME3'
wa_cust-name3.
perform bdc_field using 'KNA1-NAME4'
wa_cust-name4.
perform bdc_field using 'KNA1-STRAS'
wa_cust-stras.
perform bdc_field using 'KNA1-PFACH'
wa_cust-pfach.
perform bdc_field using 'KNA1-ORT01'
wa_cust-ort01.
perform bdc_field using 'KNA1-PSTLZ'
wa_cust-pstlz.
perform bdc_field using 'KNA1-ORT02'
wa_cust-ort02.
perform bdc_field using 'KNA1-PFORT'
wa_cust-pfort.
perform bdc_field using 'KNA1-PSTL2'
wa_cust-pstl2.
perform bdc_field using 'KNA1-LAND1'
wa_cust-land1.
perform bdc_field using 'KNA1-REGIO'
wa_cust-regio.
perform bdc_field using 'KNA1-SPRAS'
'EN'.
perform bdc_field using 'KNA1-TELX1'
wa_cust-telx1.
perform bdc_field using 'KNA1-TELF1'
wa_cust-telf1.
perform bdc_field using 'KNA1-TELFX'
wa_cust-telfx.
perform bdc_field using 'KNA1-TELF2'
wa_cust-telf2.
perform bdc_field using 'KNA1-TELTX'
wa_cust-teltx.
perform bdc_dynpro using 'SAPMF02D' '0120'.
perform bdc_field using 'BDC_CURSOR'
'KNA1-CITYC'.
perform bdc_field using 'BDC_OKCODE'
'=VW'.
perform bdc_field using 'KNA1-STCEG'
wa_cust-stceg.
perform bdc_field using 'KNA1-CITYC'
wa_cust-cityc.
perform bdc_field using 'KNA1-LZONE'
wa_cust-lzone.
perform bdc_dynpro using 'SAPMF02D' '0125'.
perform bdc_field using 'BDC_CURSOR'
'KNA1-KUKLA'.
perform bdc_field using 'BDC_OKCODE'
'=VW'.
perform bdc_field using 'KNA1-NIELS'
wa_cust-niels.
perform bdc_field using 'KNA1-KUKLA'
wa_cust-kukla.
perform bdc_dynpro using 'SAPMF02D' '0130'.
perform bdc_field using 'BDC_CURSOR'
'KNBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=VW'.
perform bdc_dynpro using 'SAPMF02D' '0340'.
perform bdc_field using 'BDC_CURSOR'
'RF02D-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'=VW'.
perform bdc_dynpro using 'SAPMF02D' '0360'.
perform bdc_field using 'BDC_CURSOR'
'KNVK-NAMEV(01)'.
perform bdc_field using 'BDC_OKCODE'
'=VW'.
perform bdc_dynpro using 'SAPMF02D' '0210'.
perform bdc_field using 'BDC_CURSOR'
'KNB1-VZSKZ'.
perform bdc_field using 'BDC_OKCODE'
'=VW'.
perform bdc_field using 'KNB1-AKONT'
wa_cust-akont.
perform bdc_field using 'KNB1-FDGRV'
wa_cust-fdgrv.
perform bdc_field using 'KNB1-VZSKZ'
wa_cust-vzskz.
perform bdc_dynpro using 'SAPMF02D' '0215'.
perform bdc_field using 'BDC_CURSOR'
'KNB1-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'=VW'.
perform bdc_field using 'KNB1-ZTERM'
wa_cust-zterm.
perform bdc_dynpro using 'SAPMF02D' '0220'.
perform bdc_field using 'BDC_CURSOR'
'KNB5-MAHNA'.
perform bdc_field using 'BDC_OKCODE'
'=VW'.
perform bdc_dynpro using 'SAPMF02D' '0230'.
perform bdc_field using 'BDC_CURSOR'
'KNB1-VRSNR'.
perform bdc_field using 'BDC_OKCODE'
'=VW'.
perform bdc_dynpro using 'SAPMF02D' '0610'.
perform bdc_field using 'BDC_OKCODE'
'=VW'.
perform bdc_field using 'BDC_CURSOR'
'RF02D-KUNNR'.
perform bdc_dynpro using 'SAPMF02D' '0310'.
perform bdc_field using 'BDC_CURSOR'
'KNVV-VERSG'.
perform bdc_field using 'BDC_OKCODE'
'=VW'.
perform bdc_field using 'KNVV-AWAHR'
'100'.
perform bdc_field using 'KNVV-VKBUR'
wa_cust-vkbur.
perform bdc_field using 'KNVV-WAERS'
'INR'.
perform bdc_field using 'KNVV-KALKS'
'1'.
perform bdc_field using 'KNVV-VERSG'
wa_cust-versg.
perform bdc_dynpro using 'SAPMF02D' '0315'.
perform bdc_field using 'BDC_CURSOR'
'KNVV-VSBED'.
perform bdc_field using 'BDC_OKCODE'
'=VW'.
perform bdc_field using 'KNVV-LPRIO'
perform bdc_field using 'KNVV-KZAZU'
'X'.
perform bdc_field using 'KNVV-VSBED'
wa_cust-vsbed.
perform bdc_field using 'KNVV-ANTLF'
'9'.
perform bdc_dynpro using 'SAPMF02D' '0320'.
perform bdc_field using 'BDC_CURSOR'
'KNVV-KTGRD'.
perform bdc_field using 'BDC_OKCODE'
'=VW'.
perform bdc_field using 'KNVV-BOKRE'
'X'.
perform bdc_field using 'KNVV-KTGRD'
wa_cust-ktgrd.
perform bdc_dynpro using 'SAPMF02D' '1350'.
perform bdc_field using 'BDC_CURSOR'
'KNVI-TAXKD(01)'.
perform bdc_field using 'BDC_OKCODE'
'=VW'.
perform bdc_field using 'KNVI-TAXKD(01)'
wa_cust-taxkd.
perform bdc_dynpro using 'SAPMF02D' '0324'.
perform bdc_field using 'BDC_CURSOR'
'KNVP-PARVW(01)'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
CALL TRANSACTION 'XD01' USING it_bdctab
MODE p_mode
UPDATE p_update
MESSAGES INTO it_messagetab.
IF sy-subrc = 0.
*& reading success records to corresponding internal table
READ TABLE it_messagetab WITH KEY msgtyp = 'S'.
IF sy-subrc = 0.
wa_sucrec-cnum = it_messagetab-msgv1.
wa_sucrec-cnam = wa_cust-name1.
APPEND wa_sucrec TO it_sucrec.
CLEAR wa_sucrec.
ENDIF.
ELSE.
*& reading error records to corresponding internal table
READ TABLE it_messagetab WITH KEY msgtyp = 'E'.
IF sy-subrc = 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = sy-msgid
no = it_messagetab-msgnr
v1 = it_messagetab-msgv1
v2 = it_messagetab-msgv2
v3 = it_messagetab-msgv3
v4 = it_messagetab-msgv4
IMPORTING
msg = wa_errrec-message.
wa_errrec-lineno = v_index.
*******wa_errrec-lineno = v_index.
*******wa_errrec-message = it_messagetab-msgv1.
APPEND wa_errrec TO it_errrec.
CLEAR wa_errrec.
ENDIF.
ENDIF.
CLEAR : it_bdctab, it_messagetab.
REFRESH: it_bdctab, it_messagetab.
ENDLOOP.
DESCRIBE TABLE it_cust LINES v_totrec.
DESCRIBE TABLE it_errrec LINES v_errrec.
DESCRIBE TABLE it_sucrec LINES v_sucrec.
PERFORM disp_data.
SKIP 2.
IF v_sucrec > 0.
PERFORM disp_success_data.
ENDIF.
SKIP 2.
IF v_errrec > 0.
PERFORM disp_error_data.
ENDIF.
*& Form bdc_dynpro
*# text
*# -->P_0104 text
*# -->P_0105 text
FORM bdc_dynpro USING program
dynpro.
CLEAR it_bdctab.
it_bdctab-program = program.
it_bdctab-dynpro = dynpro.
it_bdctab-dynbegin = 'X'.
APPEND it_bdctab.
ENDFORM. " bdc_dynpro
*& Form bdc_field
*# text
*# -->P_0109 text
*# -->P_IT_cust_LIFNR text
FORM bdc_field USING fnam
fval.
CLEAR it_bdctab.
it_bdctab-fnam = fnam.
it_bdctab-fval = fval.
APPEND it_bdctab.
ENDFORM. " bdc_field
*& Form disp_data
*# text
*# --> p1 text
*# <-- p2 text
FORM disp_data .
ULINE (45).
WRITE : / sy-vline,
12 'FAMD CUSTOMER UPDATE SUMMARY'(004) COLOR 1,
45 sy-vline.
ULINE /(45).
WRITE : / sy-vline,
'Total Records Processed'(007),
28 '=',
30 v_totrec,
45 sy-vline,
/ sy-vline,
'Error Records'(005),
28 '=',
30 v_errrec,
45 sy-vline,
/ sy-vline,
'Successful Records'(006),
28 '=',
30 v_sucrec,
45 sy-vline.
ULINE /(45).
ENDFORM. " disp_data
*& Form disp_success_data
*# text
*# --> p1 text
*# <-- p2 text
FORM disp_success_data .
ULINE (45).
WRITE : / sy-vline,
14 'Successful Records'(012) COLOR 1,
45 sy-vline.
ULINE /(45).
WRITE : / sy-vline ,
'Customer Number'(010) COLOR 2,
17 sy-vline,
25 'Customer Name'(011) COLOR 2,
45 sy-vline.
ULINE /(45).
LOOP AT it_sucrec INTO wa_sucrec.
WRITE: / sy-vline ,
wa_sucrec-cnum,
17 sy-vline,
19 wa_sucrec-cnam,
45 sy-vline.
ENDLOOP.
ULINE /(45).
ENDFORM. " disp_success_data
*& Form disp_error_data
*# text
*# --> p1 text
*# <-- p2 text
FORM disp_error_data .
ULINE (85).
WRITE : / sy-vline,
35 'Error Records'(013) COLOR 1,
85 sy-vline.
ULINE /(85).
WRITE : / sy-vline,
'Record Number'(008) COLOR 2,
sy-vline,
37 'Reason for error'(009) COLOR 2,
85 sy-vline.
ULINE /(85).
LOOP AT it_errrec INTO wa_errrec.
WRITE : / sy-vline,
wa_errrec-lineno,
17 sy-vline,
wa_errrec-message,
85 sy-vline.
ENDLOOP.
ULINE /(85).
ENDFORM. " disp_error_dataWorked out n found the solution
-
Decimal upto 3 places in ALV report output
Hi Experts
My requirement is that User wants to have 3 decimal places in report output.I have used type P decimal 3,also have used field catalog Decimals_o = '3' .In the report output Lets say Previously it was 123 now after the changes its coming 123.000 but its only virtual when i try to edit that it takes only upto 4 characters like 123.???I think because the datatype defined is NUMC and its limited to 4 characters only so it is not allowing to enter more than 4 characters??Please suggest me a way?sud I change the NUMC to 6 characters as it is standard??sud I make changes in it??
Thanks & Regards
ShankarHi
i have tried that but still it takes 4 characters in output.pasting the code
1)The declaration part
DATA : gv_gjahr TYPE gjahr,
gv_plant TYPE cciht_ial-iaplant.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-003.
SELECT-OPTIONS: s_plant FOR gv_plant NO INTERVALS NO-EXTENSION OBLIGATORY,
s_gjahr FOR gv_gjahr NO INTERVALS NO-EXTENSION OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
CONSTANTS : c_x TYPE c VALUE 'X',
c_celltab(7) TYPE c VALUE 'CELLTAB',
c_gjahr(5) TYPE c VALUE 'GJAHR',
c_april(5) TYPE c VALUE 'APRIL',
c_may(3) TYPE c VALUE 'MAY',
c_june(4) TYPE c VALUE 'JUNE',
c_july(4) TYPE c VALUE 'JULY',
c_augus(5) TYPE c VALUE 'AUGUS',
c_septe(5) TYPE c VALUE 'SEPTE',
c_octob(5) TYPE c VALUE 'OCTOB',
c_novem(5) TYPE c VALUE 'NOVEM',
c_decem(5) TYPE c VALUE 'DECEM',
c_janua(5) TYPE c VALUE 'JANUA',
c_febru(5) TYPE c VALUE 'FEBRU',
c_march(5) TYPE c VALUE 'MARCH',
c_rw(2) TYPE c VALUE 'RW',
c_ro(2) TYPE c VALUE 'RO'.
TYPES : BEGIN OF ty_envtran,
envno TYPE numc3,
envlx TYPE zehenvlx,
plant TYPE ccihe_iaplant,
gjahr TYPE gjahr,
april TYPE numc4,
may TYPE numc4,
june TYPE numc4,
july TYPE numc4,
augus TYPE numc4,
septe TYPE numc4,
octob TYPE numc4,
novem TYPE numc4,
decem TYPE numc4,
janua TYPE numc4,
febru TYPE numc4,
march TYPE numc4,
END OF ty_envtran.
DATA: gt_envtran TYPE TABLE OF ty_envtran,
gs_envtran TYPE ty_envtran,
gt_envmast TYPE TABLE OF zehs_envmast,
gs_envmast TYPE zehs_envmast.
DATA: save_ok LIKE sy-ucomm,
g_container TYPE scrfname VALUE 'ZEHS_ENVIRONMENTS_CC1',
g_grid TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container,
gt_fieldcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo,
g_success TYPE c,
gv_success TYPE c,
gt_envtran3 TYPE TABLE OF ty_envtran,
gs_envtran3 TYPE ty_envtran, "#EC NEEDED
gt_envtran2 TYPE TABLE OF zehs_envtran,
gs_envtran2 TYPE zehs_envtran.
DATA: BEGIN OF gt_outtab OCCURS 0. "with header line
DATA: envlx TYPE zehenvlx,
gjahr TYPE gjahr,
april TYPE numc4,
may TYPE numc4,
june TYPE numc4,
july TYPE numc4,
augus TYPE numc4,
septe TYPE numc4,
octob TYPE numc4,
novem TYPE numc4,
decem TYPE numc4,
janua TYPE numc4,
febru TYPE numc4,
march TYPE numc4,
plant TYPE ccihe_iaplant,
envno TYPE numc3.
DATA: celltab TYPE lvc_t_styl.
DATA: END OF gt_outtab.
DATA: gs_outtab LIKE LINE OF gt_outtab.
2)The Field catalog part
LOOP AT pt_fieldcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN c_APRIL.
ls_fcat-scrtext_l = 'April'(c01).
ls_fcat-scrtext_m = 'Apr'(c13).
ls_fcat-scrtext_s = text-c13.
WHEN c_MAY.
ls_fcat-scrtext_l = 'May'(c02).
ls_fcat-scrtext_m = 'May'(c14).
ls_fcat-scrtext_s = text-c14.
WHEN c_JUNE.
ls_fcat-scrtext_l = 'June'(c03).
ls_fcat-scrtext_m = 'Jun'(c15).
ls_fcat-scrtext_s = text-c15.
WHEN c_JULY.
ls_fcat-scrtext_l = 'July'(c04).
ls_fcat-scrtext_m = 'Jul'(c16).
ls_fcat-scrtext_s = text-c16.
WHEN c_AUGUS.
ls_fcat-scrtext_l = 'August'(c05).
ls_fcat-scrtext_m = 'Aug'(c17).
ls_fcat-scrtext_s = text-c17.
WHEN c_SEPTE.
ls_fcat-scrtext_l = 'September'(c06).
ls_fcat-scrtext_m = 'Sep'(c18).
ls_fcat-scrtext_s = text-c18.
WHEN c_OCTOB.
ls_fcat-scrtext_l = 'October'(c07).
ls_fcat-scrtext_m = 'Oct'(c19).
ls_fcat-scrtext_s = text-c19.
WHEN c_NOVEM.
ls_fcat-scrtext_l = 'November'(c08).
ls_fcat-scrtext_m = 'Nov'(c20).
WHEN c_DECEM.
ls_fcat-scrtext_l = 'December'(c09).
ls_fcat-scrtext_m = 'Dec'(c21).
WHEN c_JANUA.
ls_fcat-scrtext_l = 'January'(c10).
ls_fcat-scrtext_m = 'Jan'(c22).
ls_fcat-scrtext_s = text-c22.
WHEN c_FEBRU.
ls_fcat-scrtext_l = 'February'(c11).
ls_fcat-scrtext_m = 'Feb'(c23).
ls_fcat-scrtext_s = text-c23.
WHEN c_MARCH.
ls_fcat-scrtext_l = 'March'(c12).
ls_fcat-scrtext_m = 'Mar'(c24).
ls_fcat-scrtext_s = text-c24.
Note: I have already tried giving DECIMALS_O,OUTPUTLEN,DATATYPE,FIELDCAT-REF_FIELD ,FIELDCAT-REF_TABLE BUT but still it takes upto 4 characters in output. -
How can I use the Diadem FFT Analysis GUI to give me multiple outputs given multiple inputs?
I have a few hundred channels I would like to perform FFT analysis on. They are mostly of different lengths, but I know I will have groups of 7 that will have the same number of data points. The default GUI will accept those 7 sets since they are the same size, but it will only give me one output as a combination of the sets. Is there a way to get Diadem to give me an FFT output for each set without having to select each data set individually?
The way it worked with the default channels, I had to make sure I wasn't going crazy because the way you demonstrated worked very well for me. That being said, for some reason what I am doing does not work. I've recently found that it is in changing the details in the GUI that makes my output different than yours. The differences are as follows:
1) I do not use a time channel. That is always left blank.
2) in the 'Window Functions' tab, I change the window type to Hanning
3) In the 'FFT Functions' tab, only amplitude is checked with the properties 'Peak amplitude', No Third/Octave, and Average amplitude is changed to arithmatic.
4) In the 'Time Intervals' tab 'Length/Start/Overlap' is checked, Interval length is changed to 1024, and overlap (%) is changed to 50.
I've also found that changing any number of these details from the default will cause my proplem to crop up. I am fairly sure that most of those options are just as feasibly done to one channel as they are to multiple. Is this a bug, or am I misunderstanding a property of FFT that has gone over my head? Please try changing a few of those properties since it seems like it should work just as well for all the channels as it does for just one, but that doesn't seem to be the case.
Another point of confusion is that while the window previewing the inputs in the GUI will show all the inputs I have selected, the window previewing outputs only appears to preview a single unknown output. That is just a side note though. -
How to input/output a digital signal and acquire an analog signal at the same time?
Dasylab, version: 8.0.04
Acquirement Card: PCI1002L
When I use DasyLab to acquire the analog signals is no problem without digital inputs and outputs,
and when I use DasyLab to input or output a digital signal is no problem also, but when I do that at the
same time, DasyLab tell me the rate is too high and stop.
so, I searched the manual book1 (user guide) for that, it showed me :
To internally equalize measurement time and system time in the analog input, digital input and counter
hardware modules, use the following settings:
Synchronization: PC Clock
Sampling rate: <= 5Hz
Block size: =1
the problem is, if I set the Sampling rate to 5Hz, the speed of the acquirement datas is not enough for my
application.
so, how to improve it? who can give me a example programm for me. thanks!
by the way, I come from China, my English isn't good, I'm sorry.
Allen, China.Hi,
Have things changed over the years?
I need to syncronise a digital output (Modul NI9474) and an analoge input (AI-Modul NI9203) module. I need to measure time intervals from a flank in signal A to a flank in signal B. I would like accuracies of the order of 1 ms. Currently, the signals are not synchronised, with errors of the order of 2 times the block length (block size x sample rate), sometimes much higher. The best I got so far was a block size of around 20 with a sample rate of 1 kHz.
If I use the master and slave settings on the RTSL settings, my program doesn't run properly.
If I use digital signals for input and output, I can syncronise them with RTSL settings and everything is good, but I can't always do that.
Also, if I do anything in the GUI (such as scrollowing something or going to another window), my output gets screwed up properly.
1. What can be done to synchronise AI with DO?
2. Is there something that can be done to avoid messing up the output when something happens in the user interface? (I know that I am messing up the outputs as they make some valves switch and that is loud).
Thanks in advance! -
Apple TV worked until today. Message says unsupported signal check your output device. I have checked hdmi cable with another device and it's fine. Put on a different tv and same message. Went out yesterday and bought a new Apple TV and same problem.
Which TV do you have.
You may wish to try the following:
Press and hold the menu and the up button simultaneously on the remote for six seconds, the Apple TV should then begin to cycle through the various resolutions available to it at 20 second intervals.. If you see a picture appear up on your screen, use the remote to scroll down to the OK option and select it. -
How to display the Output messages on LabVIEW
Hi,
I'm building a simple user interface on LabVIEW and I have the following question:
- TestStand has an Output Tab where I display some messages using Engine.OutputMessage; How can I do the same thing on my UI?
I've attached a printscreen of my TestStand sequence as an example of what I want do do on LabVIEW.
I apreciate all the help.
Thanks in advance.
Regards,
Daniel Coelho
Daniel Coelho
VISToolkit - http://www.vistoolkit.com - Your Real Virtual Instrument Solution
Controlar - Electronica Industrial e Sistemas, Lda
Attachments:
TS PrintScreen.JPG 137 KBSorry, from your post in the LabVIEW board I did not understand that it was the Output message that you were looking for.
I thought you wanted the results from your test steps displayed on the user interface.
It is the “Output Panel” in the sequence editor that displays your output message, but I do not know if there is default Output panel activeX indicator for user interface that the TestStand engine would update automatically like it does the execution view.
Maybe someone else knows
As also pointed out, the UI messages is your other option.
The Output Message event number is 40
http://zone.ni.com/devzone/cda/epd/p/id/3879
UIMsg_OutputMessages–(Value: 40) TestStand sends this message at periodic intervals when it holds references to output messages that calls to the OutputMessage.Post method queue. TestStand transfers the queued messages to an OutputMessages collection attached to the UIMessage.ActiveXData property for this event. An application that processes output messages should copy the output message references from the collection in UIMessage.ActiveXData to its own private OutputMessages collection by passing its private collection to the OutputMessages.CopyMessagesToCollection method. An application calls the Engine.NewOutputMessages method to create a private OutputMessage collection. TestStand generates this event only if the Engine.OutputMessagesEnabled property is True. Because there can be more than one handler for this event, the application should not modify the OutputMessages collection the UIMessage.ActiveXData property holds.
Omar
Message Edited by OmarGator on 10-09-2008 10:12 AM
Maybe you are looking for
-
Performance of jdbc mapping lookup vs BPM Process
Hello fellow consultants, I have project on AEX upcoming and now I`m deciding the strategy. I have to implement few processes for which I will use BPM. But inside these processes I have few jdbc calls for logging to the oracle db. Regarding the perfo
-
How do I export addresses from a sent email to a group vcard?
I sent many of my existing contacts an email and now want to group those contacts in a vcard. They are all already in my address book but as there are several hundred contacts that I want to group together, I don't want to do this one by one. Does
-
How to setup peer to peer network with Vista machine.
Hello, I just got my very first Apple computer last week and I'd like to copy some files from my Dell PC with Vista Premium installed. I don't have a wireless network setup yet (hopefully soon), but I'd like to copy some files from my PC to my Mini.
-
In FCP I have imported some high quality digital pics to make a montage. On some of them I use the keyframing to move them around the screen, but they all get funky movement on fine lines or patterns. It's not a de-interlacing problem because I filte
-
Can't enter unit price in Goods Receipt PO form
Priority: High Hello Experts, In GRPO >> form settings, I have checked both the boxes VISIBLE AND ACTIVE. It displays the field on form but does not allow me to modify it. Help Required... tha