Need logic for this output itab format
hi guys
i need the output itab in following format
i have data in my present itab
itab-f1 itab-f2 itab-f3
AAA 10 (means null,' ')
AAA 20
BBB 10
BBB 20 A1
BBB 30
and i want output in following way output itab
itab-f1 itab-f2 itab-f3
AAA 30
BBB 60 A1
can anyone suggest me code for this
You want the sum of f2 for a group of f1's?
Is f3 going to be the same for that group?
Try this
sum = 0
sort itab by f1.
itab2 like itab.
loop itab.
sum = itab-f2 + sum.
f3var = tab-f3.
at end of f1.
move itab-f1 to itab2-f1.
move sum to itab2-f2.
move f3var to itab2-f3.
append itab2.
sum = 0.
endat.
endloop.
Edited by: Ramiro Escamilla on Feb 7, 2008 11:29 PM
Similar Messages
-
I HAVE A TABLE AND THE VALUES LIKE THIS,
CALENDAR_DATE working_day return_date
JUL 04 N JUL 04
JUL 05 N JUL 05
JUL 06 N JUL 06
JUL 06 N JUL 07
JUL 08 Y JUL 08
my requirement is how can i change all the return_date for which the working_day is 'N' to JUL 08 (working_day= 'Y')UPDATE table_name
SET return_date = 'JUL 08'
,working_day = 'Y'
WHERE working_day = 'N';
Is this what you wanted ? -
Need the Logic for this Prg issue Pls
Hi Friends,
i have an urgent requirement..
i am develop the report that is :
Based on Selction Critirea kunnr(knvv-kunnr)
i want Delete the
Internet mail (SMTP) address FROM ADR6-MTP_ADDR
AND Teletex number FROM ADR4-TTX_NUMBER..
USING TABLES ARE KNVV , ADR6 AND ADR4.
please how to Write the LOGIC For this Program .
help me.. it is an urgent.. anyone.
regards,Hi Alchermi,
thanks for your reply soon.
based on selction kunnr .. i want deete the ADR4-TTX_NUMBER..and ADR6-SMTP_ADDR From these 2 tables
for these 2 fields..
kunnr from knvv, selection field..
below fields want be DELETED..
ttx-number from adr4,
smtp_addr from adr6.
it is an urgent. help me .
regards, -
i need to know that why this code is giving the following output..what's the flow of control.......
public class ThreadPrint {
static synchronized Thread makeT(final String id,boolean d)
{Thread t=new Thread(id) {
public void run() {System.out.println(id);
// System.out.println("hi" + ":" + id);
//t.setDaemon(d) ;
t.start();return t;
public static void main(String s[])
Thread a=makeT("A",false);
Thread b=makeT("B",false);
System.out.println("End");
output:
End
A
B
liz,
Try to explain this one...
package forums;
public class ThreadPrinter {
static synchronized Thread makeThread(final String id,boolean d) {
Thread t = new Thread(id) {
public void run() {
for(int i=0; i<10; i++) {
System.out.println(id+" "+i);
t.start();
return t;
public static void main(String s[]) {
Thread a=makeThread("A",false);
Thread b=makeThread("B",false);
System.out.println("End");
}produces
Test 1
A 0
A 1
A 2
A 3
A 4
A 5
A 6
A 7
A 8
A 9
End
B 0
B 1
B 2
B 3
B 4
B 5
B 6
B 7
B 8
B 9Test 2
End
B 0
B 1
B 2
A 0
A 1
A 2
A 3
A 4
A 5
A 6
A 7
A 8
A 9
B 3
B 4
B 5
B 6
B 7
B 8
B 9Hmmm... vely intarasting :-)
Keith.
liz,
Try to explain this one...
package forums;
public class ThreadPrinter {
static synchronized Thread makeThread(final String id,boolean d) {
Thread t = new Thread(id) {
public void run() {
for(int i=0; i<10; i++) {
System.out.println(id+" "+i);
t.start();
return t;
public static void main(String s[]) {
Thread a=makeThread("A",false);
Thread b=makeThread("B",false);
System.out.println("End");
}produces
Test 1
A 0
A 1
A 2
A 3
A 4
A 5
A 6
A 7
A 8
A 9
End
B 0
B 1
B 2
B 3
B 4
B 5
B 6
B 7
B 8
B 9Test 2
End
B 0
B 1
B 2
A 0
A 1
A 2
A 3
A 4
A 5
A 6
A 7
A 8
A 9
B 3
B 4
B 5
B 6
B 7
B 8
B 9Hmmm... vely intarasting :-)
Keith.
Logic for this comparision of character type operands.
Source field name: ZDCNFG
Target Info Objects:
ZDVD59
ZDVD10
ZDVD14
ZDVD18
ZDVD25
ZDVD50
Scenario1: If ZDCNFG = 2(10). 2 is quantity and 10 in brackets is part number (DVD format). So I will have to update the quantity respective field as shown below.
ZDVD59: 0
ZDVD10: 2 -->updated 10 part
ZDVD14: 0
ZDVD18: 0
ZDVD25: 0
ZDVD50: 0
Scenario2: If ZDCNFG: 2(25)3(50)
ZDVD59: 0
ZDVD10: 0
ZDVD14: 0
ZDVD18: 0
ZDVD25: 2 --> Updated
ZDVD50: 3 --> Updated
Scenario3: If ZDCNFG: 2(5)3(9) ---This is exceptional case. If we have 5 and 9 then add and assign 5 to ZDVD59 rest all are 0.
ZDVD59: 5 Sum of DVD5 and DVD9
ZDVD10: 0
ZDVD14: 0
ZDVD18: 0
ZDVD25: 0
ZDVD50: 0
Quantity is the value which is out side the brackets. For e.g. in 10(5), 10 is the quantity.
Can any one give me a logic for this.
I was trying with CA CS etc..but no charm.
Thanks
Kiran
Kiran,
This should work
parameters: zdcnfg(50).
data: zdvd59(3),
zdvd10(3),
zdvd14(3),
zdvd18(3),
zdvd25(3),
zdvd50(3),
rcnt type i,
roff type i,
temp type i.
data: static(50).
start-of-selection.
static = zdcnfg.
replace all occurrences of '(5)' in zdcnfg with '+' replacement count rcnt.
if rcnt ge 1.
zdcnfg = static.
do rcnt times.
replace first occurrence of '(5)' in zdcnfg with '+' replacement offset roff.
temp = roff - 1.
add zdcnfg+temp(1) to zdvd59.
enddo.
endif.
zdcnfg = static.
clear: roff, rcnt, temp.
replace all occurrences of '(9)' in zdcnfg with '+' replacement count rcnt.
if rcnt ge 1.
zdcnfg = static.
do rcnt times.
replace first occurrence of '(9)' in zdcnfg with '+' replacement offset roff.
temp = roff - 1.
add zdcnfg+temp(1) to zdvd59.
enddo.
endif.
zdcnfg = static.
clear: roff, rcnt, temp.
replace all occurrences of '(10)' in zdcnfg with '+' replacement count rcnt.
if rcnt ge 1.
zdcnfg = static.
do rcnt times.
replace first occurrence of '(10)' in zdcnfg with '+' replacement offset roff.
temp = roff - 1.
add zdcnfg+temp(1) to zdvd10.
enddo.
endif.
zdcnfg = static.
clear: roff, rcnt, temp.
replace all occurrences of '(14)' in zdcnfg with '+' replacement count rcnt.
if rcnt ge 1.
zdcnfg = static.
do rcnt times.
replace first occurrence of '(14)' in zdcnfg with '+' replacement offset roff.
temp = roff - 1.
add zdcnfg+temp(1) to zdvd14.
enddo.
endif.
zdcnfg = static.
clear: roff, rcnt, temp.
replace all occurrences of '(18)' in zdcnfg with '+' replacement count rcnt.
if rcnt ge 1.
zdcnfg = static.
do rcnt times.
replace first occurrence of '(18)' in zdcnfg with '+' replacement offset roff.
temp = roff - 1.
add zdcnfg+temp(1) to zdvd18.
enddo.
endif.
zdcnfg = static.
clear: roff, rcnt, temp.
replace all occurrences of '(25)' in zdcnfg with '+' replacement count rcnt.
if rcnt ge 1.
zdcnfg = static.
do rcnt times.
replace first occurrence of '(25)' in zdcnfg with '+' replacement offset roff.
temp = roff - 1.
add zdcnfg+temp(1) to zdvd25.
enddo.
endif.
zdcnfg = static.
clear: roff, rcnt, temp.
replace all occurrences of '(50)' in zdcnfg with '+' replacement count rcnt.
if rcnt ge 1.
zdcnfg = static.
do rcnt times.
replace first occurrence of '(50)' in zdcnfg with '+' replacement offset roff.
temp = roff - 1.
add zdcnfg+temp(1) to zdvd50.
enddo.
endif.
Search Help - logic for getting output.
Hi,
I am trying to create search help for Vendor number field. And input selection has a fields from various Vendor related tables ( LFA1,ADRC,LFB1,LFBK,LFBW,LFM1,LFZA).
If user enters any of the input field values (from the above table selected fields)then need to get corresponding vendor number details from all of the above tables(selected fields from the above tables).
can any one let me know how to compose the logic for this?
1. I created search help and trying to put the logic in EXIT for the search help to get the values.
Thanks in advance.
Rajesh.
rajesh,
check tis out,
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee2b446011d189700000e8322d00/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee86446011d189700000e8322d00/content.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/cf/21ee5f446011d189700000e8322d00/content.htm
http://fuller.mit.edu/tech/search_helps.ppt#260,5,Simple
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee52446011d189700000e8322d00/frameset.htm
http://www.sapdevelopment.co.uk/dictionary/shelp/shelp_basic.htm
http://help.sap.com/saphelp_46c/helpdata/EN/cf/21ee2b446011d189700000e8322d00/content.htm
http://www.sap-img.com/abap/attach-a-search-help-to-the-screen-field.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/3d/e53642e2a3ab04e10000000a1550b0/content.htm
Need logic for invoice due date and discount due date uncear
Hi Experts.. am new to ABAP
i had an issue please need some logics for these..
Formatting of the Invoice due dates and Discount due date is unclear e.g 20101109,
Invoice due date and Discount due dates are in correct on 10 and 20 days reminders on missing credit notes for blocked invoices.
<removed by moderator>
Thanks & Regards
Edited by: Thomas Zloch on May 18, 2011 1:55 PM
Can you provide more info?
are you talking about BSID open accounts?
if yes, use function module DETERMINE_DUE_DATE.
<removed by moderator>
Edited by: Thomas Zloch on May 18, 2011 2:10 PM - please do not ask for "award"
Hi XI Gurus,
I hav to create a UDF.This is an IDOC - XI - FILE seerio. In this senerio is I have an IDOc whose 7th segment contains a field. This field can store values in between 0 - 9. On the other hand I have a file structure in my left hand side from Messge mapping prespective , which contains 9 similar sized fields.
Now the logic is if the field in the segment of the idoc has value say '3', then the file structure in the left hand side would have 3 in the field no 3 and all other fields 1, 2, 4, 5, 6, 7, 8, 9 would be zero.
Can u guys suggest some logic for this???
Thanks in advance !
Poits would be rewarded.
Arnab
Hi Mohd,
Select the Queue option for getting individual nodes
public void test(String[] a,ResultList result,Container container){
if (a<i> == 7) { //This is for selecting the node
for(i=0;i<10;i++){ //This is for collecting the correct value
ifIi==3){
write what ever u have to done
else{
write the exceptional condition
Dont to Reward points if this helps
Regards
Pragathi.
pls i need help for this simple problem of my palm os zire 72. pls share your ideas with me.... i tried to connect my palm os zire72 in my desktop computer using my usb cable but i can't see it in my computer.. my palm has no problem and it works well. the only problem is that, my desktop computer can't find my palm when i tried to connect it using usb cable. is thier any certain driver or installer needed for it so that i can view my files in my palm using the computer. where i can download its driver? is there somebody can help me for this problem? just email me pls at [email protected] i really accept any suggestions for this problem. thanks for your help...
If you are using Windows Vista go to All Programs/Palm and click on the folder and select Hot Sync Manager and then try to sync with the USB cable. If you are using the Windows XP go to Start/Programs/Palm/Hot Sync Manager and then try to sync. If you don’t have the palm folder at all on your PC you have to install it. Here is the link http://kb.palm.com/wps/portal/kb/common/article/33219_en.html that version 4.2.1 will be working for your device Zire 72.
Hi
I need a procedure 4 this logic,
Need to get 32+ inputs in procedure of same type varchar2,
If comp_id !=360
insert 32 inputs in table column-> value using custom-id
Note:
Column : brand-code,value,custom_name using custom_id
brand-code gets from comp-id from another table
i/p- from procedure comp_id and 32 inputs
This 32 inputs should use varray cocept
end if;
ex:
table 1
brand_code custom-id value editble
table 2
custom-id custom-name
Could you please share ur suggestions
Create or replace procedure cdm_cl_proc is
v_sqnum number(3);
cursor c1 is
select dcn, pp_code from d_cl_ext;
Cursor c2 is
Select t_code, s_date, area_chrg, rc_pct from d_c_p_ext;
Begin
for v1 in c1
Loop
update d_cl set pp_code = v1.pp_code
where dcn=v1.dcn;
select d_sqnum into v_sqnum from d_cl
where dcn=v1.dcn;
For v2 in c2
Loop
Update d_c_p set area_chrg= v2.area_chrg, rc_pct=v2.rc_pct
Where t_code= v2.t_code and s_date = v2.s_date
and d_sqnum = v_sqnum;
if mod(c2%rowcount,1000)=0 then
commit;
end if;
End loop;
if mod(c1%rowcount,1000)=0 then
commit;
end if;
End loop;
Commit;
End;
I amable to load the data when dcn is matched but, if the dcn is not matched no data found error is coming. can u suggest error handling for this.
Hi,
I need sequence for autogenerate of code
Table 1
id code
We need to autogenerate code for every new entity of id
ex:
id code
sbi sbi001
hsb hsb002
xyz xyz003
And
ex:
id code
sbi s001
hsb h002
xyz x003
You can use a Sequence and Trigger in combination like this
create table t
id varchar2(10)
, code varchar2(25)
create sequence t_seq;
create or replace trigger t_trig before insert on t for each row
declare
l_seq integer;
begin
select t_seq.nextval into l_seq from dual;
:new.code := :new.id || to_char(l_seq, 'fm099');
end;
insert into t (id) values ('sbi');
insert into t (id) values ('hsb');
insert into t (id) values ('xyz');
select * from t;
Hi iam trying to get the po line item latest changedby name to display in my report
can you give me the logic to get the changed by name for theline item.
i have written the code but if i change the line item 20 then in the out put the changedby name is being displayed for line itema 10 ,20, 30 i e for all line items .but i want the changeby name to be displayed only for the particular line item which was changed.
*& Report ZMR_PO_AUDIT_RPT *
*& Purpose - Report on PO release details for auditing. *
Program ID : ZMR_PO_AUDIT_RPT *
Title : Purchase Release Audit Report *
Create Date : 19.03.2007 *
Author : Marina Gosman (JH IT services) *
Tech. Spec : *
Change Req #: *
Changed by | Description of change | Date *
MarinaG | Change the report Heading to Purchase | *
| Order Action Audit Report R3DK912376 |23.03.07 *
MarinaG | Fix a select bug. R3DK912384 |23.03.07 *
MarinaG | Change report heading by removing fields |27.03.07 *
| R3DK912404 | *
MarinaG | Add exception checkbox which will only |3.04.07 *
| show the same GR, Released and Created | *
| username R3DK912444. | *
MarinaG | Add GR Value and Vendor Name FP#1919 |28.08.07 *
| R3DK912809 | *
MarinaG | Add line item no., display line items for |11.10.07 *
| GR period and GR date FP#1919 R3DK912960 | *
REPORT ZSAMPLE3 NO STANDARD PAGE HEADING LINE-SIZE 200
MESSAGE-ID zv.
Database Tables
TABLES: ekko,t16fd,cdhdr,cdpos,t000,lfa1,t024,ekbe,mkpf.
TYPE-POOLS slis.
Type Declaration
*TYPE-POOLS: kkblo.
Structures
DATA:BEGIN OF st_output,
ebeln LIKE ekko-ebeln,
batxt LIKE t161t-batxt,
banfn LIKE eban-banfn,
bukrs LIKE ekko-bukrs,
frggr LIKE ekko-frggr,
frgsx LIKE ekko-frgsx,
frgct LIKE t16fd-frgct,
udate LIKE cdhdr-udate,
utime like cdhdr-utime,
username LIKE cdhdr-username,
lifnr LIKE ekko-lifnr, " vendor
name1 LIKE lfa1-name1, " vendor name
ebelp LIKE ekpo-ebelp, " line no.
afnam LIKE ekpo-afnam, " requisitioner
netwr LIKE ekpo-netwr,
ekgrp LIKE ekko-ekgrp,
eknam LIKE t024-eknam,
ernam LIKE ekko-ernam,
grnam LIKE ekbe-ernam,
bedat LIKE ekko-bedat,
budat LIKE ekbe-budat,
belnr LIKE ekbe-belnr, "R3DK912960
dmbtr LIKE ekbe-dmbtr, "R3DK912960
Indira
cdate LIKE cdhdr-username,
Indira
END OF st_output.
Indra
DATA: l_ponum LIKE ekko-ebeln,
l_poline LIKE ekpo-ebelp.
DATA: BEGIN OF t_EKbe OCCURS 0,
ebeln LIKE EKbe-ebeln,
belnr LIKE EKbe-Belnr,
budat LIKE EKbe-Budat,
cputm LIKE EKbe-cputm,
END OF T_EKbe.
DATA: BEGIN OF T_mkpf OCCURS 0,
mblnr LIKE mkpf-mblnr,
usnam LIKE mkpf-usnam,
END OF T_mkpf.
Internal Tables
DATA: t_cdhdr LIKE cdhdr OCCURS 0 WITH HEADER LINE,
t_cdhdr1 LIKE cdhdr OCCURS 0 WITH HEADER LINE,
po_ekko LIKE ekko OCCURS 0 WITH HEADER LINE.
Indra
DATA: t_cdpos LIKE cdpos OCCURS 0 WITH HEADER LINE.
indra
DATA: BEGIN OF tbl_output OCCURS 0.
INCLUDE STRUCTURE st_output.
DATA: END OF tbl_output.
DATA: BEGIN OF tbl_ekpo OCCURS 0.
INCLUDE STRUCTURE ekpo.
DATA: END OF tbl_ekpo.
DATA: BEGIN OF tbl_ekbe OCCURS 0.
INCLUDE STRUCTURE ekbe.
DATA: END OF tbl_ekbe.
DATA: BEGIN OF t_ekko OCCURS 0,
ebeln TYPE ebeln,
ebelp TYPE ebelp, "R3DK912960
belnr TYPE MBLNR, "R3DK912960
bukrs TYPE bukrs,
bsart TYPE bsart,
bedat TYPE bedat,
budat TYPE budat,
ernam TYPE ernam,
grnam TYPE ernam,
dmbtr TYPE dmbtr, "R3DK912960
END OF t_ekko.
DATA: c_tcode(25) TYPE c.
DATA: st_fieldcat TYPE slis_fieldcat_alv.
DATA: tbl_fieldcat TYPE slis_t_fieldcat_alv.
DATA: st_event TYPE slis_alv_event.
DATA: tbl_events TYPE slis_t_event.
DATA: fieldname(30) TYPE c.
DATA: st_layout TYPE slis_layout_alv.
DATA: g_status TYPE slis_formname VALUE 'STANDARD01'.
DATA: g_user_command TYPE slis_formname VALUE 'USER_COMMAND'.
DATA: st_status TYPE slis_status.
DATA: tbl_status TYPE slis_status OCCURS 0 WITH HEADER LINE.
DATA: f_ebeln LIKE ekko-ebeln.
DATA: cursorfield LIKE ekko-ebeln.
DATA: ws_ebeln LIKE ekko-ebeln,
ws_netwr LIKE ekpo-netwr,
ws_ernam LIKE ekbe-ernam,
rs_selfield TYPE slis_selfield,
ws_dmbtr LIKE ekbe-dmbtr. "R3DK912809
RANGES: r_kunnr FOR vbak-kunnr OCCURS 0.
Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK title WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_bukrs FOR ekko-bukrs OBLIGATORY,
s_ekorg FOR ekko-ekorg OBLIGATORY,
s_ebeln FOR ekko-ebeln,
s_groups FOR ekko-ekgrp,
s_lifnr FOR ekko-lifnr,
s_bedat FOR ekko-bedat,
s_budat FOR ekbe-budat,
s_bsart FOR ekko-bsart.
SELECTION-SCREEN END OF BLOCK title .
SELECTION-SCREEN BEGIN OF BLOCK title2 WITH FRAME TITLE text-001.
PARAMETERS: p_gr AS CHECKBOX DEFAULT 'X',
p_excep AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK title2 .
*& AT SELECTION SCREEN
AT SELECTION-SCREEN.
IF NOT p_gr IS INITIAL.
IF s_budat IS INITIAL.
MESSAGE s000 WITH 'Please enter Goods Receipt Date.'.
STOP.
ENDIF.
ELSE.
IF s_bedat IS INITIAL.
MESSAGE s000 WITH 'Please enter Purch Doc Date.'.
STOP.
ENDIF.
ENDIF.
START-OF-SELECTION.
START-OF-SELECTION.
PERFORM select_data. " Select data
PERFORM sort_table.
PERFORM get_events. " Include header in display
PERFORM get_eventstatus. " Set the GUI status
PERFORM get_layout. " Define ALV Layout
PERFORM get_fieldcat. " Fill report fields
PERFORM create_report. " Write ALV format
AT LINE-SELECTION.
PERFORM user_command USING sy-ucomm
rs_selfield.
FORM user_command *
--> R_UCOMM *
--> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: l_ta TYPE sy-tcode VALUE 'SLIS_DUMMY'.
CLEAR: f_ebeln.
CASE r_ucomm.
WHEN 'CF1'.
READ TABLE tbl_output INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
f_ebeln = tbl_output-ebeln.
ENDIF.
SET PARAMETER ID 'BES' FIELD f_ebeln.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
Begin of R3DK912404
WHEN 'EXIT' OR 'CANC'.
LEAVE PROGRAM.
End of R3DK912404
WHEN 'OTHERS'.
ENDCASE.
ENDFORM. "user_command
FORM STANDARD_02 *
--> EXTAB *
FORM standard_01 USING extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD01' EXCLUDING extab .
ENDFORM. "standard_01
*& Form get_events
setup report headings
--> p1 text
<-- p2 text
FORM get_events.
CLEAR st_event.
st_event-name = 'TOP_OF_PAGE'.
st_event-form = 'PROCESS_TOP_OF_PAGE'.
APPEND st_event TO tbl_events.
ENDFORM. " get_events
FORM get_eventstatus *
FORM get_eventstatus.
CLEAR st_status.
st_status-callback_pf_status_set = 'STANDARD_01'.
APPEND st_status TO tbl_status.
ENDFORM. " get_eventstatus
*& Form get_layout
text
--> p1 text
<-- p2 text
FORM get_layout.
CLEAR st_layout.
st_layout-zebra = 'X'.
ENDFORM. " get_layout
*& Form get_fieldcat
text
--> p1 text
<-- p2 text
FORM get_fieldcat.
PERFORM write_fieldcat USING 'EBELN' 'TBL_OUTPUT' 'EKKO' 'X' 1 ' '.
PERFORM write_fieldcat USING 'BUKRS' 'TBL_OUTPUT' 'EKKO' 'X' 2 ' '.
Begin of R3DK912960
PERFORM write_fieldcat USING 'EBELP' 'TBL_OUTPUT' 'EKPO' 'X' 3 ' '.
End of R3DK912960
PERFORM write_fieldcat USING 'UDATE' 'TBL_OUTPUT' ' ' ' ' 4
'Doc. Date'.
PERFORM write_fieldcat USING 'UTIME' 'TBL_OUTPUT' ' ' ' ' 13
'Doc. Time'.
Begin of R3DK912960
PERFORM write_fieldcat USING 'BUDAT' 'TBL_OUTPUT' ' ' ' ' 5
'GR Date'.
End of R3DK912960
PERFORM write_fieldcat USING 'ERNAM' 'TBL_OUTPUT' ' ' ' ' 6
'Created By'.
PERFORM write_fieldcat USING 'USERNAME' 'TBL_OUTPUT' ' ' ' ' 7
'Released By'.
PERFORM write_fieldcat USING 'GRNAM' 'TBL_OUTPUT' ' ' ' ' 8
'Goods Receipted By'.
PERFORM write_fieldcat USING 'CDATE' 'TBL_OUTPUT' ' ' ' ' 9
'Changed By'.
PERFORM write_fieldcat USING 'NETWR' 'TBL_OUTPUT' ' ' ' ' 10
'Total Value'.
PERFORM write_fieldcat USING 'EKGRP' 'TBL_OUTPUT' 'EKKO' ' ' 11 ' '.
Begin of R3DK912809
PERFORM write_fieldcat USING 'DMBTR' 'TBL_OUTPUT' ' ' ' ' 12
'GR Value '.
PERFORM write_fieldcat USING 'NAME1' 'TBL_OUTPUT' ' ' ' ' 13
'Vendor Name'.
End of R3DK912809
ENDFORM. " get_fieldcat
FORM process_top_of_page *
FORM process_top_of_page.
SKIP.
ULINE.
FORMAT COLOR COL_HEADING INTENSIFIED OFF .
Begin of R3DK912376
WRITE:/ 'Report Name : PO Release Audit Report',
WRITE:/ 'Report Name : Purchase Order Actions Report',
End of R3DK912376
/ 'Run Date : ', sy-datum,
/ 'Run Time : ', sy-uzeit,
Begin of R3DK912404
/ 'Document Type : ', c_tcode,
End of R3DK912404
/ 'Company code : ', s_bukrs-low.
IF NOT s_bukrs-high IS INITIAL.
WRITE: 'To', s_bukrs-high.
ENDIF.
WRITE:/ 'Purch Org : ', s_ekorg-low.
IF NOT s_ekorg-high IS INITIAL.
WRITE: 'To', s_ekorg-high.
ENDIF.
Begin of R3DK912404
WRITE:/ 'Purchase Order : ', s_ebeln-low.
IF NOT s_ebeln-high IS INITIAL.
WRITE: 'To', s_ebeln-high.
ENDIF.
WRITE:/ 'Purchasing Grp : ', s_groups-low.
IF NOT s_groups-high IS INITIAL.
WRITE: 'To', s_groups-high.
ENDIF.
WRITE:/ 'Vendor : ', s_lifnr-low.
IF NOT s_lifnr-high IS INITIAL.
WRITE: 'To', s_lifnr-high.
ENDIF.
WRITE:/ 'Goods Receipt Date:', s_budat-low.
IF NOT s_budat-high IS INITIAL.
WRITE: 'To', s_budat-high.
ENDIF.
End of R3DK912404
WRITE:/ 'Purch Doc Date : ', s_bedat-low.
IF NOT s_bedat-high IS INITIAL.
WRITE: 'To', s_bedat-high.
ENDIF.
Begin of R3DK912404
WRITE:/ 'Purch Doc Type : ', s_bsart-low.
IF NOT s_bsart-high IS INITIAL.
WRITE: 'To', s_bsart-high.
ENDIF.
End of R3DK912404
ULINE.
FORMAT COLOR COL_HEADING INTENSIFIED OFF.
ENDFORM. " process_top_of_page
*& Form create_report
text
--> p1 text
<-- p2 text
FORM create_report.
SORT tbl_output BY ebeln ebelp.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_events = tbl_events
i_interface_check = ' '
i_callback_program = 'ZSAMPLE3'
i_callback_pf_status_set = g_status
i_callback_user_command = g_user_command
is_layout = st_layout
it_fieldcat = tbl_fieldcat
i_default = 'X'
i_save = 'X'
TABLES
t_outtab = tbl_output
EXCEPTIONS
program_error = 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.
ENDFORM. " create_report
*& Form select_data
select records for specified selections
--> p1 text
<-- p2 text
FORM select_data.
CLEAR: c_tcode, t_cdhdr, t_ekko, tbl_output.
REFRESH: t_cdhdr, t_ekko, tbl_output, tbl_fieldcat.
IF NOT p_gr IS INITIAL.
SELECT DISTINCT a~ebeln "R3DK912960
SELECT a~ebeln "R3DK912960
b~ebelp "R3DK912960
b~belnr
a~bukrs
a~bsart
a~bedat
b~budat
a~ernam
b~ernam
INTO TABLE t_ekko
FROM ekko AS a
INNER JOIN ekbe AS b
ON aebeln = bebeln
Begin of R3DK912384
AND b~bewtp = 'E'
AND b~bwart = '101'
End of R3DK912384
WHERE a~bukrs IN s_bukrs AND
a~ebeln IN s_ebeln AND
a~ekgrp IN s_groups AND
a~lifnr IN s_lifnr AND
a~bsart IN s_bsart AND
a~ekorg IN s_ekorg and
a~bedat IN s_bedat AND
b~budat IN s_budat AND
a~frgke = 'R'
ORDER BY aebeln bbudat DESCENDING.
Begin of R3DK912809 R3DK912960
DELETE ADJACENT DUPLICATES FROM T_EKKO COMPARING EBELN.
End of R3DK912809 R3DK912960
ELSE.
SELECT DISTINCT a~ebeln "R3DK912960
SELECT a~ebeln "R3DK912960
b~ebelp "R3DK912960
b~belnr
a~bukrs
a~bsart
a~bedat
b~budat
a~ernam
b~ernam
INTO TABLE t_ekko
FROM ekko AS a
LEFT JOIN ekbe AS b
ON aebeln = bebeln
Begin of R3DK912384
AND b~bewtp = 'E'
AND b~bwart = '101'
End of R3DK912384
WHERE a~bukrs IN s_bukrs AND
a~ebeln IN s_ebeln AND
a~ekgrp IN s_groups AND
a~lifnr IN s_lifnr AND
a~bsart IN s_bsart AND
a~ekorg IN s_ekorg AND
a~bedat IN s_bedat AND
a~frgke = 'R'
ORDER BY aebeln bbudat DESCENDING.
Begin of R3DK912809 R3DK912960
DELETE ADJACENT DUPLICATES FROM T_EKKO COMPARING EBELN.
End of R3DK912809 R3DK912960
ENDIF.
sort t_ekko by ebeln ebelp budat descending.
sivanew
delete adjacent duplicates from t_ekko comparing ebeln ebelp .
sivanew
IF sy-subrc EQ 0. "R3DK912809
IF NOT t_ekko[] IS INITIAL. "R3DK912809
PERFORM process_data.
Begin of R3DK912444
IF NOT p_excep IS INITIAL.
PERFORM get_exceptions.
ENDIF.
End of R3DK912444
ENDIF.
ENDFORM. " select_data
*& Form write_fieldcat
text
-->P_0190 field name, if the SAP name used desc will be
automatically get from SAP table
-->P_0191 Internale structure or table name
-->P_0192 SAP table for field description
-->P_0193 format
-->P_1 Position
-->P_0195 Custom Description
FORM write_fieldcat USING name tab st key pos desc.
st_fieldcat-fieldname = name.
st_fieldcat-tabname = tab.
st_fieldcat-ref_tabname = st.
st_fieldcat-key = key.
st_fieldcat-col_pos = pos.
st_fieldcat-seltext_m = desc.
IF pos = 12.
st_fieldcat-outputlen = 40.
ENDIF.
APPEND st_fieldcat TO tbl_fieldcat.
CLEAR st_fieldcat.
ENDFORM. " write_fieldcat
*& Form process_record
text
--> p1 text
<-- p2 text
FORM process_record.
DATA:l_ebeln LIKE ekko-ebeln.
LOOP AT t_cdhdr.
CLEAR: l_ebeln, ws_ebeln, ws_netwr, ws_ernam.
MOVE t_cdhdr-objectid TO l_ebeln.
CALL FUNCTION 'ME_EKKO_SINGLE_READ'
EXPORTING
pi_ebeln = l_ebeln
IMPORTING
po_ekko = po_ekko.
Begin of R3DK912809 R3DK912960
SELECT SUM( dmbtr ) INTO ws_dmbtr
FROM ekbe WHERE ebeln = l_ebeln
AND vgabe = '1'
AND bewtp = 'E'
GROUP BY ebeln.
ENDSELECT.
End of R3DK912809
SELECT SINGLE dmbtr INTO t_ekko-dmbtr
FROM ekbe WHERE ebeln = t_ekko-ebeln
AND ebelp = t_ekko-ebelp
AND belnr = t_ekko-belnr
AND vgabe = '1'
AND bewtp = 'E'.
MODIFY T_EKKO.
End of R3DK912960
SELECT SINGLE ernam INTO t_ekko-grnam
FROM ekbe WHERE ebeln = t_ekko-ebeln
AND ebelp = t_ekko-ebelp
AND ELIKZ = 'X'.
MODIFY T_EKKO.
SELECT ebeln SUM( netwr ) INTO (ws_ebeln, ws_netwr)
FROM ekpo WHERE ebeln = l_ebeln R3DK912960
FROM ekpo WHERE ebeln = t_ekko-ebeln "R3DK912960
GROUP by ebeln.
ENDSELECT.
IF sy-subrc EQ 0.
IF s_groups IS INITIAL.
PERFORM build_output.
ELSE.
IF po_ekko-ekgrp IN s_groups.
PERFORM build_output.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " process_record
*& Form get_customer
Get Customers if sales office specified
--> p1 text
<-- p2 text
*& Form build_output
text
--> p1 text
<-- p2 text
FORM build_output.
DATA: l_line LIKE ekpo-ebelp.
DATA: l_requisitioner LIKE ekpo-afnam.
IF po_ekko-frgke = 'R'.
CLEAR: tbl_output.
tbl_output-udate = t_cdhdr-udate.
tbl_output-utime = t_cdhdr-utime.
tbl_output-username = t_cdhdr-username.
tbl_output-ebeln = po_ekko-ebeln.
tbl_output-bukrs = po_ekko-bukrs.
tbl_output-lifnr = po_ekko-lifnr.
tbl_output-name1 = ' '.
tbl_output-lifnr = po_ekko-lifnr.
tbl_output-ekgrp = po_ekko-ekgrp.
tbl_output-ernam = po_ekko-ernam.
tbl_output-ernam = t_ekko-ernam.
tbl_output-budat = t_ekko-budat.
tbl_output-grnam = t_ekko-grnam.
tbl_output-bedat = t_ekko-bedat.
tbl_output-dmbtr = t_ekko-dmbtr. "R3DK912809
tbl_output-ebelp = t_ekko-ebelp.
SORT T_CDHDR1.
sivanew
read table t_cdhdr1 with key
objectid = t_cdhdr-objectid binary search.
if sy-subrc = 0.
tbl_output-cdate = t_cdhdr1-username.
endif.
read table t_cdhdr1 with key
tcode = 'ME22N' binary search.
if sy-subrc = 0.
SELECT * FROM cdpos INTO TABLE t_cdpos
WHERE objectid = t_cdhdr1-objectid AND
objectclas = 'EINKBELEG' AND
changenr = t_cdhdr1-changenr.
IF sy-subrc = 0.
l_ponum = t_cdpos-tabkey+3(10).
l_poline = t_cdpos-tabkey+13(6).
ENDIF.
ENDIF.
IF tbl_output-ebeln = l_ponum AND tbl_output-ebelp = l_poline.
READ TABLE t_cdhdr1 WITH KEY changenr = t_cdpos-changenr
tcode = 'ME22N' BINARY SEARCH.
IF sy-subrc = 0.
tbl_output-cdate = t_cdhdr1-username.
ENDIF.
ENDIF.
ENDIF.
select ebeln belnr budat cputm from ekbe into table t_ekbe
where vgabe = '1' and
ebeln = t_cdhdr-objectid.
sort t_ekbe by budat descending cputm descending.
delete adjacent duplicates from t_ekbe comparing ebeln.
loop at t_ekbe.
select mblnr usnam from mkpf into table t_mkpf
where mblnr = t_ekbe-belnr.
if sy-subrc = 0.
read table t_mkpf with key
mblnr = t_ekbe-belnr binary search.
move t_mkpf-usnam to tbl_output-grnam.
endif.
endloop.
Indra
Get the user changed the record
IF t_cdhdr-tcode = 'ME22N'.
SELECT * FROM cdpos INTO TABLE t_cdpos
WHERE objectid = t_cdhdr-objectid AND
objectclas = 'EINKBELEG' AND
changenr = t_cdhdr-changenr.
IF sy-subrc = 0.
l_ponum = t_cdpos-tabkey+3(10).
l_poline = t_cdpos-tabkey+13(6).
ENDIF.
ENDIF.
indra
Display creator or changer
IF tbl_output-ebeln = l_ponum AND tbl_output-ebelp = l_poline.
READ TABLE t_cdhdr WITH KEY changenr = t_cdpos-changenr
tcode = 'ME22N' BINARY SEARCH.
IF sy-subrc = 0.
tbl_output-cdate = t_cdhdr-username.
ENDIF.
ENDIF.
Indra
SELECT SINGLE * FROM t024
WHERE ekgrp = po_ekko-ekgrp.
IF sy-subrc EQ 0.
tbl_output-eknam = t024-eknam.
ENDIF.
tbl_output-netwr = ws_netwr.
SELECT SINGLE name1 FROM lfa1
INTO tbl_output-name1
WHERE lifnr = po_ekko-lifnr.
Get Document descriptions
SELECT SINGLE batxt FROM t161t
INTO tbl_output-batxt
WHERE spras = 'E' AND
bsart = po_ekko-bsart AND
bstyp = po_ekko-bstyp.
Get Release code descriptions
SELECT SINGLE frgct FROM t16fd
INTO tbl_output-frgct
WHERE spras = 'E' AND
frggr = po_ekko-frggr AND
frgco = po_ekko-frgsx.
APPEND tbl_output.
ENDIF.
ENDFORM. " build_output
*& Form SORT_TABLE
text
--> p1 text
<-- p2 text
FORM sort_table.
SORT tbl_output BY ebeln ebelp ascending udate utime DESCENDING.
SORT tbl_output BY ebeln ascending udate utime DESCENDING.
delete adjacent duplicates from tbl_output comparing ebeln ebelp .
ENDFORM. " SORT_TABLE
*& Form PROCESS_DATA
text
--> p1 text
<-- p2 text
FORM process_data.
LOOP AT t_ekko.
c_tcode = 'Purchase Orders'.
SELECT * FROM cdhdr UP TO 1 ROWS INTO TABLE t_cdhdr "R3DK912960
SELECT * FROM cdhdr into table t_cdhdr
WHERE objectclas = 'EINKBELEG' AND
objectid = t_ekko-ebeln AND
tcode = 'ME28'.
SORT T_CDHDR BY UDATE DESCENDING UTIME DESCENDING.
delete adjacent duplicates from t_cdhdr comparing objectid.
siva
SELECT * FROM cdhdr UP TO 1 ROWS INTO TABLE t_cdhdr1
*"R3DK912960
SELECT * FROM cdhdr INTO TABLE t_cdhdr1
WHERE objectclas = 'EINKBELEG' AND
objectid = t_ekko-ebeln AND
tcode = 'ME22N'.
SORT T_CDHDR1 BY UDATE descending UTIME DESCENDING.
delete adjacent duplicates from t_cdhdr1 comparing objectid.
sivanew
if c_tcode = 'ME22N'.
SELECT * FROM cdpos INTO TABLE t_cdpos
WHERE objectid = t_cdhdr1-objectid AND
objectclas = 'EINKBELEG' AND
changenr = t_cdhdr1-changenr.
IF sy-subrc = 0.
l_ponum = t_cdpos-tabkey+3(10).
l_poline = t_cdpos-tabkey+13(6).
ENDIF.
ENDIF.
*sivanew
IF sy-subrc = 0.
delete adjacent duplicates from t_cdhdr comparing objectid.
PERFORM process_record. " process each document
ENDIF.
ENDLOOP.
ENDFORM. " PROCESS_DATA
*& Form get_exceptions
text
--> p1 text
<-- p2 text
form get_exceptions.
Display a report which shows the same released, goods receipted and
created by user
LOOP AT tbl_output.
IF tbl_output-username <> tbl_output-ernam OR
tbl_output-ernam <> tbl_output-grnam.
DELETE tbl_output.
ENDIF.
ENDLOOP.
endform. " get_exceptions
Hi,
first of all you should read the following thread ABAP Development It is really hard to read code without proper formatting.
It looks like you use change documents to get user name for last change. For each document you use last change document and hence you have same name for every item. I am not sure if it is possible (it should be) but for each item you need to look for last change document corresponding to this item.
Cheers
I want sql query for this output
hi guys
could u tell how can i write sql query for this out put
i have one table like this
ID ACCOUTID TAX
1 1 A
2 1 B
3 2 C
4 2 D
5 3 E
7 NULL F
8 NULL G
MY OUT PUT MUST BE LIKE THIS
ID AID TAX
2 1 A
4 2 D
7 NULL F
8 NULL G
HERE IN THIS OUTPUT I SHOULD HAVE
MAXIMAM ID VALUE FOR A REPEATED AID VALUES
AND
THE ROWS AID VALUES IS NULL ALSO MUST PAPULATED IN THE OUTPUT.
I KNOW ONE SOLUTION LIKE THIS
SELECT MAX(ID),AID,TAX
FROM TABLE T
GROUP BY AID,TAX
UNION ALL
SELECT ID, AIC,TAX
FROM TABLE T
WHERE AID IS NULL;
BUT I WANT SAME RESULT WITH OUT USING LOGICAL OPERATORS.
COULD U PLZ TELL A SOL.
Will this help:
SQL> with t as
2 (
3 select 1 ID, 1 ACCOUTID, 'A' TAX from dual union all
4 select 2, 1, 'B' from dual union all
5 select 3, 2, 'C' from dual union all
6 select 4, 2, 'D' from dual union all
7 select 5, 3, 'E' from dual union all
8 select 7, NULL, 'F' from dual union all
9 select 8, NULL, 'G' from dual
10 )
11 --
12 select id, ACCOUTID AID, Tax
13 from
14 (
15 select t.*
16 ,count(1) over (partition by t.ACCOUTID) cn
17 ,row_number() over (partition by t.ACCOUTID order by id desc) rn
18 from t
19 )
20 where cn > 1
21 and (rn = 1 or ACCOUTID is null)
22 /
ID AID T
2 1 B
4 2 D
8 G
7 F
-- If I leave out the OR condition then you'll get this:
SQL> ed
Wrote file afiedt.buf
1 with t as
2 (
3 select 1 ID, 1 ACCOUTID, 'A' TAX from dual union all
4 select 2, 1, 'B' from dual union all
5 select 3, 2, 'C' from dual union all
6 select 4, 2, 'D' from dual union all
7 select 5, 3, 'E' from dual union all
8 select 7, NULL, 'F' from dual union all
9 select 8, NULL, 'G' from dual
10 )
11 --
12 select id, ACCOUTID AID, Tax
13 from
14 (
15 select t.*
16 ,count(1) over (partition by t.ACCOUTID) cn
17 ,row_number() over (partition by t.ACCOUTID order by id desc) rn
18 from t
19 )
20 where cn > 1
21* and rn = 1
SQL> /
ID AID T
2 1 B
4 2 D
8 G
--which follows the description you've given, but not the output
Need logic for calculate the balance quantity in open sales order
hi all
i need logic to calcuclate the balance quantity in open sales order ,
where i am using VBAK header and VBAP item , and VBFA for document flow tables
i need to have the balance quantity , for the open sales order
especially taking with respect to VBFA-VBTYP_N = M for invoice creation and N for canellation
any one please help me
thank you but i am clear abt it
will you please anyother way to calucaluate the logic ,
and i need to populate in bukets also for the terms of 5 years
Edited by: sridhar loganathan on Nov 25, 2008 6:43 AM
Need code for this Small validation on when-validate-item
Hi All,
I have a text item(date datatype) in forms 4.5 I need to do a small validation want to write on when-validate-item. When I enter a date in that text item (Ex 10-JUN-2005) it has to check
1) It Cannot be "blank"
2) It cannot be "Not older than today"
can you please put me code for this small validation. I am new to Forms.
Thanks in Advance,
Reddy
I always put code in the when-validate-RECORD trigger to ensure fields are entered, rather than setting the property. That way, the user can enter other fields within the record, and then gets a message that the field is required only when leaving the record.
...of course, if the date item is the only field in the block, then the when-validate triggers will not run unless the user at least types a space in the date. In that case, you need to check in the key-commit trigger.
Maybe you are looking for
-
Logic for Open Sales order qty
What should be the logic given to determine "open sales order qty" during designing a report. Note the criterias are as under: 1) Open sales order qty is the confirmed qty less the delivery qty. 2) The delivery qty should be delivery order qty (The d
-
HT1414 how do i back up my iphone?
I haven't updated my iphone 3G in about a year (my laptop at home is crappy and won't cooperate). I'm trying to do the update on a different computer. I called the apple support people but since my warranty is expired they told me to put my questio
-
Save as dialog not showing files on a AFP share in CS2
I have a user who is not able to see any files or folders on an AFP share (SFM on Windows 2003) when attempting to Save As. The files are visible in the finder, terminal, it is not a permissions issue, and I have trashed permissions. Any ideas? Are t
-
How to fill the table UD_SAPHR with data from SAP HR Connector
Hi, I`ve searched all the forrum but didn`t find how to map fields from connector form to the any field in OIM. I tryied with entity adapters but failed to reach any result. The problem is that I even cant put incoming data with connector to the tabl
-
can I connect a Mac Mini to a computer monitor using a HDMI to HDMI cable directly without using any adapter??? In terms of achieve the best HD resolution quality this is the best connection or not??