Please! help me with this wrong code, where is mistake
please! help me with this wrong code, where is mistake?
import java.util.Stack;
public class KnightsTour {
Vars locs[];
private int size, max=1, d=0, board[][];
public KnightsTour(int x,int y, int newSize)
size=newSize;
locs=new Vars[size*size+1];
for(int n=1;n<=size*size;n++)
locs[n]=new Vars();
board=new int[size+1][size+1];
for(int n=1;n<=size;n++)
for(int n2=1;n2<=size;n2++)
board[n][n2]=0;
locs[max].x=x;
locs[max].y=y;
locs[max].d=1;
board[x][y]=max;
max++;
class Vars{
int x;
int y;
int d;
public void GO()
int n=0;
while(max<=size*size)
n++;
d++;
if(d>8)
max--;
board[locs[max].x][locs[max].y]=0;
d=locs[max].d+1;
move();
printBoard();
public void move()
int x=locs[max-1].x, y=locs[max-1].y;
switch(d)
case 1:x--;y-=2;break;
case 2:x++;y-=2;break;
case 3:x+=2;y--;break;
case 4:x+=2;y++;break;
case 5:x++;y+=2;break;
case 6:x--;y+=2;break;
case 7:x-=2;y++;break;
case 8:x-=2;y--;break;
//System.out.println(" X: "+x+" Y: "+y+" |"+max);
if((x<1)||(x>size)||(y<1)||(y>size)){}
else if(board[x][y]!=0){}
else
locs[max].x=x;
locs[max].y=y;
locs[max].d=d;
board[x][y]=max;
max++;
d=0;
//printBoard();
public void printBoard()
for(int n=1;n<=size;n++)
for(int n2=1;n2<=size;n2++)
if(board[n2][n]<10)
System.out.print(board[n2][n]+" ");
else
System.out.print(board[n2][n]+" ");
System.out.println();
//System.out.println();
System.out.println();
public static void main (String[]args){
KnightsTour k = new KnightsTour(1,1,8);
}
public class KnightsTour {
Vars locs[];
private int size, max = 1, d = 0, board[][];
public static void main (String[] args) {
KnightsTour k = new KnightsTour (1, 1, 8);
k.GO ();
public KnightsTour (int x, int y, int newSize) {
size = newSize;
locs = new Vars[size * size + 1];
for (int n = 1; n <= size * size; n++) {
locs[n] = new Vars ();
board = new int[size + 1][size + 1];
for (int n = 1; n <= size; n++) {
for (int n2 = 1; n2 <= size; n2++) {
board[n][n2] = 0;
locs[max].x = x;
locs[max].y = y;
locs[max].d = 1;
board[x][y] = max;
max++;
class Vars {
int x;
int y;
int d;
public void GO () {
int n = 0;
while (max <= size * size) {
n++;
d++;
if (d > 8) {
max--;
board[locs[max].x][locs[max].y] = 0;
d = locs[max].d + 1;
move ();
printBoard ();
public void move () {
int x = locs[max - 1].x, y = locs[max - 1].y;
switch (d) {
case 1:
x--;
y -= 2;
break;
case 2:
x++;
y -= 2;
break;
case 3:
x += 2;
y--;
break;
case 4:
x += 2;
y++;
break;
case 5:
x++;
y += 2;
break;
case 6:
x--;
y += 2;
break;
case 7:
x -= 2;
y++;
break;
case 8:
x -= 2;
y--;
break;
//System.out.println(" X: "x" Y: "y" |"+max);
if ((x < 1) || (x > size) || (y < 1) || (y > size)) {
} else if (board[x][y] != 0) {
} else {
locs[max].x = x;
locs[max].y = y;
locs[max].d = d;
board[x][y] = max;
max++;
d = 0;
//printBoard();
public void printBoard () {
for (int n = 1; n <= size; n++) {
for (int n2 = 1; n2 <= size; n2++) {
if (board[n2][n] < 10) {
System.out.print (board[n2][n] + " ");
} else {
System.out.print (board[n2][n] + " ");
System.out.println ();
//System.out.println();
System.out.println ();
}formatting ftw.
If you call GO () you get in an infinite loop. max gets decreased, and it loops while max is smaller then or equal to size * size. Is your looping logic correct ?
Similar Messages
-
Please help me with this ABAP code!
Here is my code:
===
REPORT ZCFICO6010
line-count 65
line-size 132
no standard page heading.
tables: zsopshist, zsops.
data: old_prezsops like zsops_prev. "PJCHG10854
data: new_prezsops like zsops_prev. "PJCHG10854
data: old_zzsops like zsops. "PJCHG10854
data: new_zzsops like zsops. "PJCHG10854
data: long_rec(900) type c. "PJCHG10854
data: old_lzsops like long_rec. "PJCHG10854
data: new_lzsops like long_rec. "PJCHG10854
data: curr_zsops like zsops,
prev_zsops like zsops_prev.
data: begin of i_key,
kostl(5),
aedat(8),
cputm(6).
data: end of i_key.
DATA: HEADER like zsops-oprcd,
header1(92) type c.
header1 like header.
data: v_field(18) type c,
v_old(20) type c,
v_new(20) type c,
user like zsops-uname,
date like zsops-aedtm.
data: begin of table occurs 0,
text(20) type c,
oprcd like zsops-oprcd,
field(15) type c,
user like zsops-uname,
date like zsops-aedtm,
v_old(20) ,
v_new(20) ,
end of table.
data: text(30) type c.
data: begin of itab occurs 0,
srtfd like zsopshist-srtfd,
end of itab.
*data: ihist like old_zsops occurs 0 with header line,
nhist like new_zsops occurs 0 with header line.
data: ihist like zsops occurs 0 with header line,
nhist like zsops occurs 0 with header line.
*& Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK one WITH FRAME TITLE TEXT-200.
parameters: s_oprcd like zsops-oprcd obligatory,
s_oprcdh like zsops-oprcd .
s_cputm for sy-uzeit.
SELECTION-SCREEN END OF BLOCK one.
SELECTION-SCREEN BEGIN OF BLOCK three WITH FRAME TITLE TEXT-300.
parameters:s_aedtm like zsops-aedtm obligatory,
s_aedtmh like zsops-aedtm obligatory.
SELECTION-SCREEN END OF BLOCK three.
SELECTION-SCREEN BEGIN OF BLOCK TWO WITH FRAME TITLE TEXT-100.
PARAMETERS: P_REGSRT RADIOBUTTON GROUP RADI,
P_ACCSRT RADIOBUTTON GROUP RADI.
SELECTION-SCREEN END OF BLOCK TWO.
parameters: new_date like sy-datum obligatory default '20051214'.
*& Top-Of-Page
top-of-page.
BEGIN OF BLOCK INSERTED FOR "JJMM20040330
DATA: CC_LOW LIKE ZSOPS-OPRCD,
CC_HIGH LIKE ZSOPS-OPRCD,
FROM_DATE(10) TYPE C,
TO_DATE(10) TYPE C.
WRITE: S_OPRCD TO CC_LOW NO-ZERO,
S_AEDTM TO FROM_DATE USING EDIT MASK '__/__/____',
S_AEDTMH TO TO_DATE USING EDIT MASK '__/__/____'.
IF S_OPRCDH = S_OPRCD.
CONCATENATE: 'Cost Center'(T02) CC_LOW 'Changed On'(T04) FROM_DATE
'To'(T03) TO_DATE 'Sort By'(T05) text INTO HEADER1
separated by space.
ELSE.
WRITE: S_OPRCDH TO CC_HIGH NO-ZERO.
CONCATENATE: 'Cost Center'(T02) CC_LOW 'To'(T03) CC_HIGH
'Changed On'(T04) FROM_DATE 'To'(T03) TO_DATE
'Sort By'(T05) text INTO HEADER1 separated by space.
ENDIF.
END OF BLOCK INSERTED FOR "JJMM20040330
PERFORM DISPLAY_PAGE_HEADER(ZCLT0001) USING
header1 "JJMM20040330
HEADER
TEXT-T01
header1. "JJMM20040330
Write:/ 'Field Changed'(C01), 25 'Old Values'(C02),
55 'New Values'(C03), 85 'Cost Center'(C04),
105 'Changed By'(C05), 120 'Changed On'(C06).
uline.
start-of-selection.
data: time(6),
v_subrc like sy-subrc,
prev_format(1),
srtfd like zsopshist-srtfd,
srtfdh like zsopshist-srtfd.
srtfd0(5) = s_oprcd5(5).
srtfd+5(8) = s_aedtm.
srtfd+13(6) = '000000'.
if s_oprcdh is initial.
s_oprcdh = s_oprcd.
endif.
srtfdh0(5) = s_oprcdh5(5).
srtfdh+5(8) = s_aedtmh.
srtfdh+13(6) = '999999'.
select srtfd from zsopshist into table itab
WHERE SRTFD >= SRTFD
AND SRTFD <= SRTFDH.
sort itab by srtfd.
loop at itab.
IF ITAB+5(8) GE S_AEDTM AND "IJHM00001
ITAB+5(8) LE S_AEDTMH. "IJHM00001
move: itab+0(5) to i_key-kostl,
itab+5(8) to i_key-aedat,
itab+13(6) to i_key-cputm.
clear: v_subrc, prev_format.
if itab+5(8) lt new_date.
prev_format = 'X'.
perform import_record_prev changing v_subrc. "PJCHG10854
else.
perform import_record changing v_subrc. "PJCHG10854
endif.
if v_subrc = 0. "PJCHG10854
perform get_final_table.
endif.
ENDIF. "IJHM00001
endloop.
if p_regsrt = 'X'.
sort table by oprcd field date descending.
text = 'Cost Center'(C04).
else.
sort table by field oprcd date descending.
text = 'Field Changed'(C01).
endif.
perform write_report.
FORM get_final_table *
form get_final_table.
move old_zsops to ihist. "PJCHG10854
move new_zsops to nhist. "PJCHG10854
if prev_format eq 'X'. "PJCHG10854
move old_prezsops to ihist. "PJCHG10854
move new_prezsops to nhist. "PJCHG10854
else. "PJCHG10854
move old_zzsops to ihist. "PJCHG10854
move new_zzsops to nhist. "PJCHG10854
endif. "PJCHG10854
if ihist-ivcrg ne nhist-ivcrg.
table-text = 'Invst Charge Base'(F01).
table-field = 'IVCRG'.
table-v_old = ihist-ivcrg.
table-v_new = nhist-ivcrg.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
if ihist-mgtfp ne nhist-mgtfp.
table-field = 'MGTFP'.
table-text = 'Mgt Fee %'(F02).
table-v_old(12) = ihist-mgtfp.
table-v_new(12) = nhist-mgtfp.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
if ihist-discd ne nhist-discd.
table-field = 'DISCD'.
table-text = 'Cash Disc. Passback'(F03).
table-v_old = ihist-discd.
table-v_new = nhist-discd.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
if ihist-consc ne nhist-consc.
table-field = 'CONSC'.
table-text = 'Subsidy Calc'(F04).
table-v_old = ihist-consc.
table-v_new = nhist-consc.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
if ihist-payfart ne nhist-payfart.
table-field = 'PAYFART'.
table-text = 'Payroll Fringe'(F05).
table-v_old(12) = ihist-payfart.
table-v_new(12) = nhist-payfart.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
if ihist-frbpb ne nhist-frbpb.
table-field = 'FRBPB'.
table-text = 'Rebate Pass Back'(F06).
table-v_old(12) = ihist-frbpb.
table-v_new(12) = nhist-frbpb.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
if ihist-exlca ne nhist-exlca.
table-field = 'EXLCA'.
table-text = 'Excl Source27'(F07).
table-v_old = ihist-exlca.
table-v_new = nhist-exlca.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
perform write_report.
append table.
endif.
if ihist-exlcb ne nhist-exlcb.
table-field = 'EXLCB'.
table-text = 'Excl Source11'(F08).
table-v_old = ihist-exlcb.
table-v_new = nhist-exlcb.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
perform write_report.
append table.
endif.
if ihist-trnrate ne nhist-trnrate.
table-field = 'TRNRATE'.
table-text = 'Payroll Training'(F09).
table-v_old(12) = ihist-trnrate.
table-v_new(12) = nhist-trnrate.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
if ihist-mgffa ne nhist-mgffa.
table-field = 'MGFFA'.
table-text = 'Mgt Fee Amt'(F10).
table-v_old(12) = ihist-mgffa.
table-v_new(12) = nhist-mgffa.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
perform write_report.
append table.
endif.
if ihist-mgtfi ne nhist-mgtfi.
table-field = 'MGTFI'.
table-text = 'Mgt Fees Indicator'(F11).
table-v_old = ihist-mgtfi.
table-v_new = nhist-mgtfi.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
perform write_report.
append table.
endif.
if ihist-eqres ne nhist-eqres.
table-field = 'EQRES'.
table-text = 'Eqip Res Accrual'(F12).
table-v_old = ihist-eqres. "JJMM20040331
table-v_new = nhist-eqres. "JJMM20040331
table-v_old(12) = ihist-eqres. "JJMM20040331
table-v_new(12) = nhist-eqres. "JJMM20040331
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
if ihist-ovrhd ne nhist-ovrhd.
table-field = 'OVRHD'.
table-text = 'OverHead Amt'(F13).
table-v_old(12) = ihist-ovrhd.
table-v_new(12) = nhist-ovrhd.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
if ihist-xaccural ne nhist-xaccural.
table-field = 'XACCUARAL'.
table-text = 'Exclude Accrual'(F14).
table-v_old(12) = ihist-xaccural.
table-v_new(12) = nhist-xaccural.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
if ihist-ovrrt ne nhist-ovrrt.
table-field = 'OVRRT'.
table-text = 'OverHead Rate'(F15).
table-v_old(12) = ihist-ovrrt.
table-v_new(12) = nhist-ovrrt.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
if ihist-ztbd01 ne nhist-ztbd01.
table-field = 'ZTBD01'.
table-text = 'Char1'. "JJMM20040330
table-text = 'Meal Allowance'(F16). "JJMM20040330
table-v_old = ihist-ztbd01.
table-v_new = nhist-ztbd01.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
BEGIN OF BLOCK INSERTED FOR "JJMM20040330
if ihist-earlybil ne nhist-earlybil.
table-field = 'EARLYBIL'.
table-text = 'Early Billing'(F17).
table-v_old = ihist-earlybil.
table-v_new = nhist-earlybil.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
if ihist-combined ne nhist-combined.
table-field = 'COMBINED'.
table-text = 'Combined Billing'(F18).
table-v_old = ihist-COMBINED.
table-v_new = nhist-COMBINED.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
END OF BLOCK INSERTED FOR "JJMM20040330
if ihist-rate1 ne nhist-rate1.
table-field = 'RATE1'.
table-text = 'Rate 1'(F19).
table-v_old(12) = ihist-rate1.
table-v_new(12) = nhist-rate1.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
*if ihist-rate1 ne nhist-rate2. "JJMM20040330
table-field = 'RATE1'. "JJMM20040330
if ihist-rate2 ne nhist-rate2. "JJMM20040330
table-field = 'RATE2'. "JJMM20040330
table-text = 'Rate 2'(F20).
table-v_old(12) = ihist-rate2.
table-v_new(12) = nhist-rate2.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
*if ihist-rate1 ne nhist-rate3. "JJMM20040330
if ihist-rate3 ne nhist-rate3. "JJMM20040330
table-field = 'RATE3'.
table-text = 'Rate 3'(F21).
table-v_old(12) = ihist-rate3.
table-v_new(12) = nhist-rate3.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
*if ihist-rate1 ne nhist-rate4. "JJMM20040330
if ihist-rate4 ne nhist-rate4. "JJMM20040330
table-field = 'RATE4'.
table-text = 'Rate 4'(F22).
table-v_old(12) = ihist-rate4.
table-v_new(12) = nhist-rate4.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
*if ihist-rate1 ne nhist-rate5. "JJMM20040330
if ihist-rate5 ne nhist-rate5. "JJMM20040330
table-field = 'RATE5'.
table-text = 'Rate 5'(F23).
table-v_old(12) = ihist-rate5.
table-v_new(12) = nhist-rate5.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
*if ihist-rate1 ne nhist-rate6. "JJMM20040330
if ihist-rate6 ne nhist-rate6. "JJMM20040330
table-field = 'RATE6'.
table-text = 'Rate 6'(F24).
table-v_old(12) = ihist-rate6.
table-v_new(12) = nhist-rate6.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
*if ihist-rate1 ne nhist-rate7. "JJMM20040330
if ihist-rate7 ne nhist-rate7. "JJMM20040330
table-field = 'RATE7'.
table-text = 'Rate 7'(F25).
table-v_old(12) = ihist-rate7.
table-v_new(12) = nhist-rate7.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
*if ihist-rate1 ne nhist-rate8. "JJMM20040330
if ihist-rate8 ne nhist-rate8. "JJMM20040330
table-field = 'RATE8'.
table-text = 'Rate 8'(F26).
table-v_old(12) = ihist-rate8.
table-v_new(12) = nhist-rate8.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
*if ihist-rate1 ne nhist-rate9. "JJMM20040330
if ihist-rate9 ne nhist-rate9. "JJMM20040330
table-field = 'RATE9'.
table-text = 'Rate 9'(F27).
table-v_old(12) = ihist-rate9.
table-v_new(12) = nhist-rate9.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
*if ihist-rate1 ne nhist-rate10. "JJMM20040330
if ihist-rate10 ne nhist-rate10. "JJMM20040330
table-field = 'RATE10'.
table-text = 'Rate 10'(F28).
table-v_old(12) = ihist-rate10.
table-v_new(12) = nhist-rate10.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
*if ihist-rate1 ne nhist-rate11. "JJMM20040330
if ihist-rate11 ne nhist-rate11. "JJMM20040330
table-field = 'RATE11'.
table-text = 'Rate 11'(F29).
table-v_old(12) = ihist-rate11.
table-v_new(12) = nhist-rate11.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
perform write_report.
endif.
The following lines of code have been added per change IJHM00001
if ihist-rate12 ne nhist-rate12.
table-field = 'RATE12'.
table-text = 'Rate 12'(F30).
table-v_old(12) = ihist-rate12.
table-v_new(12) = nhist-rate12.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
if ihist-rate13 ne nhist-rate13.
table-field = 'RATE13'.
table-text = 'Rate 13'(F31).
table-v_old(12) = ihist-rate13.
table-v_new(12) = nhist-rate13.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
if ihist-rate14 ne nhist-rate14.
table-field = 'RATE14'.
table-text = 'Rate 14'(F32).
table-v_old(12) = ihist-rate14.
table-v_new(12) = nhist-rate14.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
if ihist-rate15 ne nhist-rate15.
table-field = 'RATE15'.
table-text = 'Rate 15'(F33).
table-v_old(12) = ihist-rate15.
table-v_new(12) = nhist-rate15.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
if ihist-rate16 ne nhist-rate16.
table-field = 'RATE16'.
table-text = 'Rate 16'(F34).
table-v_old(12) = ihist-rate16.
table-v_new(12) = nhist-rate16.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
if ihist-rate17 ne nhist-rate17.
table-field = 'RATE17'.
table-text = 'Rate 17'(F35).
table-v_old(12) = ihist-rate17.
table-v_new(12) = nhist-rate17.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
if ihist-rate18 ne nhist-rate18.
table-field = 'RATE18'.
table-text = 'Rate 18'(F36).
table-v_old(12) = ihist-rate18.
table-v_new(12) = nhist-rate18.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
The following lines of code have been added per change IJHM00002
if ihist-rate19 ne nhist-rate19.
table-field = 'RATE19'.
table-text = 'Rate 19'(F37).
table-v_old(12) = ihist-rate19.
table-v_new(12) = nhist-rate19.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
if ihist-rate20 ne nhist-rate20.
table-field = 'RATE20'.
table-text = 'Rate 20'(F38).
table-v_old(12) = ihist-rate20.
table-v_new(12) = nhist-rate20.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
if ihist-rate21 ne nhist-rate21.
table-field = 'RATE21'.
table-text = 'Rate 21'(F39).
table-v_old(12) = ihist-rate21.
table-v_new(12) = nhist-rate21.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
if ihist-rate22 ne nhist-rate22.
table-field = 'RATE22'.
table-text = 'Rate 22'(F40).
table-v_old(12) = ihist-rate22.
table-v_new(12) = nhist-rate22.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
if ihist-intcrb ne nhist-intcrb.
table-field = 'INTCRB'.
table-text = 'Intcrb'(F47). "IJHM00002
table-text = 'Intcrb'(F37). "IJHM00002
table-v_old = ihist-intcrb.
table-v_new = nhist-intcrb.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
if ihist-intcrr ne nhist-intcrr.
table-field = 'INTCRR'.
table-text = 'Intcrr'(F48). "IJHM00002
table-text = 'Intcrr'(F38). "IJHM00002
table-v_old(12) = ihist-intcrr.
table-v_new(12) = nhist-intcrr.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
if ihist-zwktran ne nhist-zwktran.
table-field = 'ZWKTRAN'.
table-text = 'Data Trans End Unit'(F49). "IJHM00002
table-text = 'Data Trans End Unit'(F39). "IJHM00002
table-v_old = ihist-zwktran.
table-v_new = nhist-zwktran.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
if ihist-zwkbud ne nhist-zwkbud.
table-field = 'ZWKBUD'.
table-text = 'Wkly Budget Ind'(F50). "IJHM00002
table-text = 'Wkly Budget Ind'(F40). "IJHM00002
table-v_old = ihist-zwkbud.
table-v_new = nhist-zwkbud.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
if ihist-bcycle ne nhist-bcycle.
table-field = 'BCYCLE'.
table-text = 'Bcycle'(F51). "IJHM00002
table-text = 'Bcycle'(F41). "IJHM00002
table-v_old = ihist-bcycle.
table-v_new = nhist-bcycle.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
if ihist-ovind ne nhist-ovind.
table-field = 'OVIND'.
table-text = 'Ovind'(F52). "IJHM00002
table-text = 'Ovind'(F42). "IJHM00002
table-v_old = ihist-ovind.
table-v_new = nhist-ovind.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
*New code for PRSID -
"ZN032106
if ihist-prsid ne nhist-prsid.
table-field = 'PRSID'.
table-text = 'PRSID'(F53).
table-v_old = ihist-prsid.
table-v_new = nhist-prsid.
table-user = nhist-uname.
table-date = nhist-aedtm.
table-oprcd = nhist-oprcd.
append table.
endif.
*End of new code----
"ZN032106
endform.
FORM write_report *
form write_report.
loop at table.
write:/1 table-text, 25 table-v_old(12) left-justified,
55 table-v_new(12) left-justified, 85 table-oprcd,
106 table-user, 120 table-date.
uline.
endloop.
skip 5. "JJMM20040330
write:/35 TEXT-R01. "JJMM20040330
reserve 1 lines. "JJMM20040330
endform.
*& Form import_record
form import_record changing p_subrc.
import i_key
old_zsops to old_zzsops
new_zsops to new_zzsops
from database zsopshist(Z1)
id i_key.
p_subrc = sy-subrc.
endform. " import_record
*& Form import_record_prev
form import_record_prev changing p_subrc.
import i_key
old_zsops to old_prezsops
new_zsops to new_prezsops
from database zsopshist(Z1)
id i_key.
p_subrc = sy-subrc.
endform. " import_record_prev
*& Form import_record_long
form import_record_long changing p_subrc.
import i_key
old_zsops to old_lzsops
new_zsops to new_lzsops
from database zsopshist(Z1)
id i_key.
p_subrc = sy-subrc.
endform. " import_record_prev
===
<b>Here is the dump I am getting:</b>
====================
Error when attempting to IMPORT object "OLD_ZSOPS".
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_IMPORT_MISMATCH_ERROR', was
not caught in
procedure "IMPORT_RECORD" "(FORM)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
The object "OLD_ZSOPS" has a different object type in the dataset from
that in the target program "ZCFICO6010".
Try to find out why the type of the object is incorrect.
There are various possible options:
1. The type of the imported object has changed in the Data Dictionary.
Make sure that the type of the imported object matches the type
of the object in the Data Dictionary.
If the data cannot be restored from another source, the data must be
read by the 'old' structure, converted und again eported with the new
structure, so that future IMPORTs will always function with the new
structure.
2. A new program version is active, which no longer fits the dataset.
Try to solve the error generating the program "ZCFICO6010" again. This
works as follows: Select transaction SE38 in the SAP system. Enter
the program name "ZCFICO6010". Then activate the function 'Generate'.
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"CONNE_IMPORT_WRONG_OBJECT_TYPE" "CX_SY_IMPORT_MISMATCH_ERROR"
"ZCFICO6010" or "ZCFICO6010"
"IMPORT_RECORD"
If you cannot solve the problem yourself and want to send an error
notification to SAP, include the following information:
1. The description of the current problem (short dump)
To save the description, choose "System->List->Save->Local File
(Unconverted)".
2. Corresponding system log
Display the system log by calling transaction SM21.
Restrict the time interval to 10 minutes before and five minutes
after the short dump. Then choose "System->List->Save->Local File
(Unconverted)".
3. If the problem occurs in a problem of your own or a modified SAP
program: The source code of the program
In the editor, choose "Utilities->More
Utilities->Upload/Download->Download".
4. Details about the conditions under which the error occurred or which
actions and input led to the error.
The exception must either be prevented, caught within proedure
"IMPORT_RECORD" "(FORM)", or its possible occurrence must be declared in the
RAISING clause of the procedure.
To prevent the exception, note the following:
==============
Sorry forthis lengthy post but I was having difficulty explaining in previous post. All answers will be rewarded..
Thanks.
MithunWhat is the structure for zsops ?
There seems to be a compatibility issue.... -
i brought a iTunes card and the the code on the back is not there it has faded away can u please help me with this problem
Hi Daniel ...
Try here > iTunes Store: Invalid, inactive, or illegible codes -
i have a problem with xcode programming app when i lunch to it it asking me to enter my password and when i enter it the program show that it is wrong but am 100% sure it's wright so please help me with this issue thanks
That's not very intuitive
Check your mail server setup (mail>preferences>accounts>) choose your MobileMe account and select Outgoing Mail Server (SMTP) dropdown box, select Edit SMTP server list, verify that each instance of the me server has a password, if there are more than one and you only have one account then delete the one without a password. -
The address bar where I can type in internet addresses is not showing on my Mozilla, please help me with this.....how do I enable it?
Thanks friends, I got it resolved at last.............kdwis
-
Please help me transform this C++ code to java code....
guys...please help me transform this C++ code to java code....please try to explain the code..thanks
[program]
#include <stdio.h>
#define ALIVE 1
#define DEAD 0
#define SZ 33
int stschk (int ,int );
main()
int s[SZ][SZ], i, j;
for (i=0; i<sz; i++ ) s[0] = DEAD;
for (j=0; j<sz; j++ ) s[0][j] = DEAD;
s[0][1] = ALIVE;
for (i=0; i<sz-1; i++) {
for ( j=1;j<sz;j++ ) {
s[i][j] = stschk(s[i][j-1],s[i+1][j];
if(s[i][j-1]==ALIVE) printf("*");
else printf(" ");
printf("\n");
int stschk(int s1,int s2)
if(((s1==DEAD)&&(s2==ALIVE))||
((s1==ALIVE)&&(s2==DEAD))) return ALIVE;
else return DEAD;Being picky, that's not C++, that's C. Standard headers in C++ dont' have .h after them, loop variables are scoped with the for, you use constants rather than #defines, etc..
C and C++ both don't initialise arrays by default; you'd have to write an initialiser to get it to zero out the array:
int s[sz][sz] = {};gcc will insert a call to memset to zero the array.
If the author was assuming that the array was zeroed out, there would be no point zeroing the first row and column.
The code reads values which haven't been initialised. If you mark such values explicitly undefined, and change the program to report an error when undefined, then you get several cases where the program makes such report.
So either it' s a primitive random number generator (some random number generators use uninitialised memory as a source of randomness), or it's buggy, or it's processing undefined data and throwing away the result. Either way, it cannot be directly be ported to Java if the undefined values (which are limited to a small area of the ouput) are significant. -
Please help me with this statement
Hi gurus, glad to be back!
Please help me with this XML processing statement. The XMl I get is like this,
<EnumerationValue description="Motor Carriers-Operate w/o Certificate or Permit"
effectiveDate="1859-01-01">
<Text>26</Text>
<AssociatedValue type="SeverityLevelText" code="MSD">
<Text>Misdemeanor</Text>
</AssociatedValue>
<AssociatedValue type="SeverityLevelText" code="PMD">
<Text>Petty Misdemeanor</Text>
</AssociatedValue>
<AssociatedValue type="StatuteOrdinanceRuleCite">
<Text>221.291.4</Text>
</AssociatedValue>
I need to get the number value from <Text>26</Text>, the attribute description and the text value of <Text>221.291.4</Text> inside one of those AssociatedValue node. The following is what I have, though I get the 26, I do not get the description and I get the Misdemeanor, Petty Misdemeanor concatenated with the text value of <Text>221.291.4</Text>. The output I get is this,
26
MisdemeanorPetty Misdemeanor221.291.4MisdemeanorPe
4
MisdemeanorPetty Misdemeanor221.291.4MisdemeanorPe
My Code:
declare
v_xml sys.xmltype;
v_sid number;
v_SText varchar2(50);
begin
v_xml := sys.xmltype('<SimpleTypeCompanion>
<EnumerationValue description="Motor Carriers-Operate w/o Certificate or Permit" effectiveDate="1859-01-01">
<Text>26</Text>
<AssociatedValue type="SeverityLevelText" code="MSD">
<Text>Misdemeanor</Text>
</AssociatedValue>
<AssociatedValue type="SeverityLevelText" code="PMD">
<Text>Petty Misdemeanor</Text>
</AssociatedValue>
<AssociatedValue type="StatuteOrdinanceRuleCite">
<Text>221.291.4</Text>
</AssociatedValue>
</EnumerationValue>
<EnumerationValue description="Police Communication Equipment-Possession, Use-First Offense-M" effectiveDate="1859-01-01">
<Text>4</Text>
<AssociatedValue type="SeverityLevelText" code="MSD">
<Text>Misdemeanor</Text>
</AssociatedValue>
<AssociatedValue type="SeverityLevelText" code="PMD">
<Text>Petty Misdemeanor</Text>
</AssociatedValue>
<AssociatedValue type="StatuteOrdinanceRuleCite">
<Text>299C.37.1(b)</Text>
</AssociatedValue>
</EnumerationValue>
</SimpleTypeCompanion>');
---dbms_output.put_line(v_xml.getStringVal());
declare
cursor c_statutes is
select ms.* from
xmltable('for $s in /SimpleTypeCompanion/EnumerationValue/Text
let $sa := /SimpleTypeCompanion/EnumerationValue/AssociatedValue
let $sd := /SimpleTypeCompanion/EnumerationValue/@description
where $sa/@type = "StatuteOrdinanceRuleCite"
return
<MyStatutes>
<TextID>{$s}</TextID>
<SDesc>{$sd/@description}</SDesc>
<StatuteNumber>{$sa/Text}</StatuteNumber>
</MyStatutes>'
passing v_xml
columns
myTextID number path '/MyStatutes/TextID',
mySDesc varchar2(150) path '/MyStatutes/SDesc',
myStatute varchar2(50) path '/MyStatutes/StatuteNumber'
) ms;
begin
for v_s in c_statutes loop
dbms_output.put_line(v_s.myTextID);
dbms_output.put_line(v_s.MySDesc);
dbms_output.put_line(v_s.myStatute);
end loop;
end;
end;
Please show me the correct way to get the result I want.
Thanks a lot!
BenSQL> var xmltext varchar2(4000)
SQL> --
SQL> begin
2 :xmltext :=
3 '<SimpleTypeCompanion>
4 <EnumerationValue description="Motor Carriers-Operate w/o Certificate or Permit" effectiveDate="1859-01-01">
5 <Text>26</Text>
6 <AssociatedValue type="SeverityLevelText" code="MSD">
7 <Text>Misdemeanor</Text>
8 </AssociatedValue>
9 <AssociatedValue type="SeverityLevelText" code="PMD">
10 <Text>Petty Misdemeanor</Text>
11 </AssociatedValue>
12 <AssociatedValue type="StatuteOrdinanceRuleCite">
13 <Text>221.291.4</Text>
14 </AssociatedValue>
15 </EnumerationValue>
16 <EnumerationValue description="Police Communication Equipment-Possession, Use-First Offense-M" effectiveDate="1859-01-01">
17 <Text>4</Text>
18 <AssociatedValue type="SeverityLevelText" code="MSD">
19 <Text>Misdemeanor</Text>
20 </AssociatedValue>
21 <AssociatedValue type="SeverityLevelText" code="PMD">
22 <Text>Petty Misdemeanor</Text>
23 </AssociatedValue>
24 <AssociatedValue type="StatuteOrdinanceRuleCite">
25 <Text>299C.37.1(b)</Text>
26 </AssociatedValue>
27 </EnumerationValue>
28 </SimpleTypeCompanion>';
29 end;
30 /
PL/SQL procedure successfully completed.
SQL> set lines 150
SQL> --
SQL> select ms.*
2 from xmltable
3 (
4 '/SimpleTypeCompanion/EnumerationValue'
5 passing xmltype(:xmltext)
6 columns
7 DESCRIPTION varchar2(32) path '@description',
8 STATUTE_ID number(2) path 'Text/text()',
9 STATUTE_RULE_CITE varchar2(16) path 'AssociatedValue[@type="StatuteOrdinanceRuleCite"]/Text/text()',
10 MSD_TEXT varchar2(10) path 'AssociatedValue[@code="MSD"]/Text/text()',
11 PMD_TEXT varchar2(10) path 'AssociatedValue[@code="PMD"]/Text/text()'
12 ) ms
13 /
DESCRIPTION STATUTE_ID STATUTE_RULE_CIT MSD_TEXT PMD_TEXT
Motor Carriers-Operate w/o Certi 26 221.291.4 Misdemeano Petty Misd
Police Communication Equipment-P 4 299C.37.1(b) Misdemeano Petty Misd
SQL>
SQL> -
I would like to create a view on this table with four columns
1. PN#_EXP_DATE
2. PN#
3. PN#_EFF_DATE
4. PN#
P_S_C A_C P EXP_DT
21698 13921 1 5/29/2009 3:15:41 PM
21698 13921 1 5/29/2009 3:54:57 PM
21698 1716656 4 5/29/2009 3:15:41 PM
21698 3217 3 5/29/2009 3:15:40 PM
21698 3217 3 5/29/2009 3:54:57 PM
21698 60559 2 5/29/2009 3:15:41 PM
21698 60559 2 5/29/2009 3:54:57 PM
I have a trigger on A, which inserts the DML records into B. (Table A and B structure is the almost the same,
where table B will have one extra column exp_dt)
NOw Table B can have records with same P_S_C and A_C columns and exp_dt will capture the history.
for example: from the above sample data, let us take first two records..
P_S_C A_C P EXP_DT
21698 13921 1 5/29/2009 3:15:41 PM --- Record 1
21698 13921 1 5/29/2009 3:54:57 PM --- Record 2
from this..
Note: 1. Table A and Table C can be joined using A.P_S_C and C.R_C to get the start_date.
2. PN# comes from table D. It contains numbers for the resp. weeks.
3. PN#_EFF_DATE is the previous immediate previous date for that record in history table (Table B).
I wanted the data like..
---- this is for the second record in the above..
PN#_EXP_DATE PN# PN#_EFF_DATE PN#
5/29/2009 3:54:57 PM 214 5/29/2009 3:15:41 PM 214
---- this is for the first record in the above..
PN#_EXP_DATE PN# PN#_EFF_DATE PN#
5/29/2009 3:54:41 PM 214 ( for this we should query the table C to get the
start_date, for this combinatation of P_S_C and A_C in table B
where B.P_S_C = C.A_C
and that value should be the EFF_DT for this record)
Please help me with this....
Thanks in advance..Hi All,
select d.P# as "PN#_EXP_DATE", exp_date
from daily_prd d, cbs1_assoc_hist b
where to_char(d.day_date,'MM/DD/YYYY') = to_char(b.exp_date,'MM/DD/YYYY')
and d.period_type = 'TIMEREPORT';
This above query gives the output as follows:
pn#_exp_date exp_date
214 5/29/2009 3:15:40 PM
214 5/29/2009 3:15:41 PM
214 5/29/2009 3:15:41 PM
214 5/29/2009 3:15:41 PM
214 5/29/2009 3:54:57 PM
214 5/29/2009 3:54:57 PM
214 5/29/2009 3:54:57 PM
This below is the data from history table (Table B).
P_S_C A_C PLACE EXP_DATE
21698 3217 3 5/29/2009 3:15:40 PM
21698 13921 1 5/29/2009 3:15:41 PM
21698 1716656 4 5/29/2009 3:15:41 PM
21698 60559 2 5/29/2009 3:15:41 PM
21698 13921 1 5/29/2009 3:54:57 PM
21698 3217 3 5/29/2009 3:54:57 PM
21698 60559 2 5/29/2009 3:54:57 PM
I got the pn#_exp_date from the Table 'D', for the given exp_date from Table B.
My question is again....
CASE - 1
from the given records above, I need to look for exp_date for the given same P_S_C and A_C.
in this case we can take the example...
P_S_C A_C PLACE EXP_DATE
21698 3217 3 5/29/2009 3:15:40 PM
21698 3217 3 5/29/2009 3:54:57 PM
In this case, the
pn#_exp_date exp_date pn#_eff_date eff_date
214 5/29/2009 3:15:57 PM < PN# corresponding to the 5/29/2009 3:15:40 PM
eff_date .>
<Basically the eff_date is
nothing but the exp_date only.
we should take the immediate before one.
In this case, our eff_date is '5/29/2009 3:15:40 PM'.
but how to get this.
CASE - 2
from the above sample data, consider this
P_S_C A_C PLACE EXP_DATE
21698 1716656 4 5/29/2009 3:15:41 PM
In this case, there is only one record for the P_S_C and A_C combination.
The expected result :
pn#_exp_date exp_date pn#_eff_date eff_date
214 5/29/2009 3:15:41 PM < PN# corresponding to the 5/29/2009 3:15:40 PM
eff_date .>
<Basically the eff_date is
nothing but the exp_date only.
we should take the immediate before one.
In this case to get the eff_date, we should query the Table 'C', to get the eff_date, which is START_DT column in this table.
for this join B.P_S_C and C.R_C.
Hope I am clear now..
Thanks in advance..... -
Please Help me with this Logic.....
Seniors , Please Help me with this Requirment
BUKRS _____________________
GJAHR ____________________
LIFNR _____________________
MONAT _____________________
LIFNR NAME1 GSBER GJAHR HBAL SBAL ACCUMBAL
1001 ABB BUSS1 2005 300 00
ABB BUSS1 2005 00 100
300 100 (300-100)=200
ABB BUSS1 2006 200 00
ABB BUSS1 2006 200 00
400 00 (400-00)+ 200 =
600
ABB BUSS2 2005 300 00
ABB BUSS2 2005 00 100
300 100 ( 300-100) =200
ABB BUSS2 2006 400 00
ABB BUSS2 2006 00 100
400 100 (400-100)+200 =
500 ****************************************************************************
1400 300 (1400-300) **********************************************************************************************************
Same for the Next Vendor also...
This is the report for this Requirment i am working on....Please Help me in the Logic..How to Go on with it....
*& Report ZVENDOR_RECONCILLATION
REPORT ZVENDOR_RECONCILLATION.
TABLES : BSAK , BSIK , LFC1 , LFC3 , LFA1.
*ALV
TYPE-POOLS: SLIS.
*TYPE-POOLS icon.
DATA: It_SORT TYPE SLIS_T_SORTINFO_ALV ."WITH HEADER LINE.
DATA: TOP TYPE slis_t_listheader,
END TYPE slis_t_listheader,
EVENTS TYPE slis_t_event.
DATA : T_KEY TYPE SLIS_KEYINFO_ALV.
DATA : FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
LAYOUT TYPE SLIS_LAYOUT_ALV OCCURS 1 WITH HEADER LINE ,
LCAT TYPE SLIS_FIELDCAT_ALV.
*INTERNAL TABLE
DATA: BEGIN OF sd_bsak,
bukrs TYPE bsak-bukrs,
lifnr TYPE bsak-lifnr,
umsks TYPE bsak-umsks,
umskz TYPE bsak-umskz,
augdt TYPE bsak-augdt,
augbl TYPE bsak-augbl,
zuonr TYPE bsak-zuonr,
gjahr TYPE bsak-gjahr,
belnr TYPE bsak-belnr,
buzei TYPE bsak-buzei,
budat TYPE bsak-budat,
bldat TYPE bsak-bldat,
xblnr TYPE bsak-xblnr,
blart TYPE bsak-blart,
monat TYPE bsak-monat,
bschl TYPE bsak-bschl,
zumsk TYPE bsak-zumsk,
shkzg TYPE bsak-shkzg,
gsber TYPE bsak-gsber,
dmbtr TYPE bsak-dmbtr,
wrbtr TYPE bsak-wrbtr,
sgtxt TYPE bsak-sgtxt,
saknr TYPE bsak-saknr,
hkont TYPE bsak-hkont,
END OF sd_bsak.
DATA: BEGIN OF sd_bsik,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsik-lifnr,
umsks TYPE bsik-umsks,
umskz TYPE bsik-umskz,
augdt TYPE bsik-augdt,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
gjahr TYPE bsik-gjahr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
budat TYPE bsik-budat,
bldat TYPE bsik-bldat,
xblnr TYPE bsik-xblnr,
blart TYPE bsik-blart,
monat TYPE bsik-monat,
bschl TYPE bsik-bschl,
zumsk TYPE bsik-zumsk,
shkzg TYPE bsik-shkzg,
gsber TYPE bsik-gsber,
dmbtr TYPE bsik-dmbtr,
wrbtr TYPE bsik-wrbtr,
sgtxt TYPE bsik-sgtxt,
saknr TYPE bsik-saknr,
hkont TYPE bsik-hkont,
zlsch TYPE bsik-zlsch,
END OF sd_bsik.
DATA: BEGIN OF it_lfa1,
lifnr TYPE lfa1-lifnr,
name1 TYPE lfa1-name1,
END OF it_lfa1.
*FINAL INTERNAL TABLE DECLARATION
DATA: BEGIN OF IT_FINAL,
lifnr TYPE bsak-lifnr,
gsber TYPE bsak-gsber,
bukrs TYPE bsak-bukrs,
umsks TYPE bsak-umsks,
umskz TYPE bsak-umskz,
augdt TYPE bsak-augdt,
augbl TYPE bsak-augbl,
zuonr TYPE bsak-zuonr,
gjahr TYPE bsak-gjahr,
belnr TYPE bsak-belnr,
buzei TYPE bsak-buzei,
budat TYPE bsak-budat,
bldat TYPE bsak-bldat,
xblnr TYPE bsak-xblnr,
blart TYPE bsak-blart,
monat TYPE bsak-monat,
bschl TYPE bsak-bschl,
zumsk TYPE bsak-zumsk,
shkzg TYPE bsak-shkzg,
gsber TYPE bsak-gsber,
dmbtr TYPE bsak-dmbtr,
wrbtr TYPE bsak-wrbtr,
sgtxt TYPE bsak-sgtxt,
saknr TYPE bsak-saknr,
hkont TYPE bsak-hkont,
DMBTR_S TYPE BSAK-DMBTR,
DMBTR_H TYPE BSAK-DMBTR,
DS TYPE P DECIMALS 2,
DH TYPE P DECIMALS 2,
SUB TYPE P DECIMALS 2,
ADD TYPE P DECIMALS 2,
BAL TYPE P DECIMALS 2,
lifnr TYPE bsik-lifnr,
umsks TYPE bsik-umsks,
umskz TYPE bsik-umskz,
augdt TYPE bsik-augdt,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
gjahr TYPE bsik-gjahr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
budat TYPE bsik-budat,
bldat TYPE bsik-bldat,
xblnr TYPE bsik-xblnr,
blart TYPE bsik-blart,
monat TYPE bsik-monat,
bschl TYPE bsik-bschl,
zumsk TYPE bsik-zumsk,
shkzg TYPE bsik-shkzg,
gsber TYPE bsik-gsber,
dmbtr TYPE bsik-dmbtr,
wrbtr TYPE bsik-wrbtr,
sgtxt TYPE bsik-sgtxt,
saknr TYPE bsik-saknr,
hkont TYPE bsik-hkont,
zlsch TYPE bsik-zlsch,
lifnr TYPE lfa1-lifnr,
name1 TYPE lfa1-name1,
END OF IT_FINAL.
DATA: BEGIN OF SD_FINAL,
gsber TYPE bsak-gsber,
lifnr TYPE bsak-lifnr,
bukrs TYPE bsak-bukrs,
lifnr TYPE bsak-lifnr,
umsks TYPE bsak-umsks,
umskz TYPE bsak-umskz,
augdt TYPE bsak-augdt,
augbl TYPE bsak-augbl,
zuonr TYPE bsak-zuonr,
gjahr TYPE bsak-gjahr,
belnr TYPE bsak-belnr,
buzei TYPE bsak-buzei,
budat TYPE bsak-budat,
bldat TYPE bsak-bldat,
xblnr TYPE bsak-xblnr,
blart TYPE bsak-blart,
monat TYPE bsak-monat,
bschl TYPE bsak-bschl,
zumsk TYPE bsak-zumsk,
shkzg TYPE bsak-shkzg,
dmbtr TYPE bsak-dmbtr,
wrbtr TYPE bsak-wrbtr,
sgtxt TYPE bsak-sgtxt,
saknr TYPE bsak-saknr,
hkont TYPE bsak-hkont,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsik-lifnr,
umsks TYPE bsik-umsks,
umskz TYPE bsik-umskz,
augdt TYPE bsik-augdt,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
gjahr TYPE bsik-gjahr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
budat TYPE bsik-budat,
bldat TYPE bsik-bldat,
xblnr TYPE bsik-xblnr,
blart TYPE bsik-blart,
monat TYPE bsik-monat,
bschl TYPE bsik-bschl,
zumsk TYPE bsik-zumsk,
shkzg TYPE bsik-shkzg,
gsber TYPE bsik-gsber,
dmbtr TYPE bsik-dmbtr,
wrbtr TYPE bsik-wrbtr,
sgtxt TYPE bsik-sgtxt,
saknr TYPE bsik-saknr,
hkont TYPE bsik-hkont,
zlsch TYPE bsik-zlsch,
lifnr TYPE lfa1-lifnr,
name1 TYPE lfa1-name1,
line_color(4) TYPE c,
END OF SD_FINAL.
DATA IT_STD_BSAK LIKE TABLE OF SD_BSAK WITH HEADER LINE.
DATA IT_STD_BSIK LIKE TABLE OF SD_BSIK WITH HEADER LINE.
DATA IT_STD_LFA1 LIKE TABLE OF IT_LFA1 WITH HEADER LINE.
DATA IT_STD_FINAL LIKE TABLE OF IT_FINAL WITH HEADER LINE.
DATA IT_FINAL_DISPLAY LIKE TABLE OF SD_FINAL WITH HEADER LINE.
*SELECTION-SCREEN
SELECTION-SCREEN BEGIN OF BLOCK HEADER WITH FRAME TITLE TEXT-001.
PARAMETERS: P_BUKRS LIKE BSAK-BUKRS OBLIGATORY.
SELECT-OPTIONS : S_GJAHR FOR BSAK-GJAHR.
SELECT-OPTIONS: S_LIFNR FOR BSAK-LIFNR.
SELECT-OPTIONS: S_MONAT FOR BSAK-MONAT.
SELECTION-SCREEN END OF BLOCK HEADER.
START-OF-SELECTION.
SET PF-STATUS 'STATUS'.
PERFORM DATA_RETRIVAL.
PERFORM FIELD.
PERFORM EVENTS USING EVENTS.
PERFORM EVENTS_1 USING EVENTS.
PERFORM HEADER USING TOP.
PERFORM LAYOUT.
PERFORM DISPLAY.
END-OF-PAGE.
*& Form DATA_RETRIVAL
text
--> p1 text
<-- p2 text
FORM DATA_RETRIVAL .
SELECT BUKRS LIFNR UMSKS UMSKZ AUGDT AUGBL ZUONR GJAHR BELNR BUZEI BUDAT BLDAT XBLNR BLART
MONAT BSCHL ZUMSK SHKZG GSBER DMBTR WRBTR SGTXT SAKNR HKONT
FROM BSAK INTO TABLE IT_STD_BSAK
WHERE BUKRS = P_BUKRS
AND GJAHR IN S_GJAHR
AND LIFNR IN S_LIFNR
AND MONAT IN S_MONAT.
IF NOT IT_STD_BSAK[] IS INITIAL.
SELECT BUKRS LIFNR UMSKS UMSKZ AUGDT AUGBL ZUONR GJAHR BELNR BUZEI BUDAT BLDAT XBLNR
BLART MONAT BSCHL ZUMSK SHKZG GSBER DMBTR WRBTR SGTXT SAKNR HKONT ZLSCH
FROM BSIK INTO TABLE IT_STD_BSIK FOR ALL ENTRIES IN IT_STD_BSAK
WHERE BUKRS = IT_STD_BSAK-BUKRS AND LIFNR = IT_STD_BSAK-LIFNR AND GJAHR = IT_STD_BSAK-GJAHR .
ENDIF.
IF NOT IT_STD_BSAK[] IS INITIAL.
SELECT LIFNR NAME1
FROM LFA1 INTO TABLE IT_STD_LFA1 FOR ALL ENTRIES IN IT_STD_BSAK
WHERE LIFNR = IT_STD_BSAK-LIFNR.
ENDIF.
LOOP AT IT_STD_BSAK.
IT_STD_FINAL-BUKRS = IT_STD_BSAK-BUKRS.
IT_STD_FINAL-LIFNR = IT_STD_BSAK-LIFNR.
IT_STD_FINAL-UMSKS = IT_STD_BSAK-UMSKS.
IT_STD_FINAL-UMSKZ = IT_STD_BSAK-UMSKZ.
IT_STD_FINAL-AUGDT = IT_STD_BSAK-AUGDT.
IT_STD_FINAL-AUGBL = IT_STD_BSAK-AUGBL.
IT_STD_FINAL-ZUONR = IT_STD_BSAK-ZUONR.
IT_STD_FINAL-GJAHR = IT_STD_BSAK-GJAHR.
IT_STD_FINAL-BELNR = IT_STD_BSAK-BELNR.
IT_STD_FINAL-BUZEI = IT_STD_BSAK-BUZEI.
IT_STD_FINAL-BUDAT = IT_STD_BSAK-BUDAT.
IT_STD_FINAL-BLDAT = IT_STD_BSAK-BLDAT.
IT_STD_FINAL-XBLNR = IT_STD_BSAK-XBLNR.
IT_STD_FINAL-BLART = IT_STD_BSAK-BLART.
IT_STD_FINAL-MONAT = IT_STD_BSAK-MONAT.
IT_STD_FINAL-BSCHL = IT_STD_BSAK-BSCHL.
IT_STD_FINAL-ZUMSK = IT_STD_BSAK-ZUMSK.
IT_STD_FINAL-SHKZG = IT_STD_BSAK-SHKZG.
IT_STD_FINAL-GSBER = IT_STD_BSAK-GSBER.
IT_STD_FINAL-DMBTR = IT_STD_BSAK-DMBTR.
IT_STD_FINAL-WRBTR = IT_STD_BSAK-WRBTR.
IT_STD_FINAL-SGTXT = IT_STD_BSAK-SGTXT.
IT_STD_FINAL-SAKNR = IT_STD_BSAK-SAKNR.
IT_STD_FINAL-HKONT = IT_STD_BSAK-HKONT.
READ TABLE IT_STD_LFA1 WITH KEY LIFNR = IT_STD_FINAL-LIFNR.
IF SY-SUBRC = 0.
IT_STD_FINAL-NAME1 = IT_STD_LFA1-NAME1.
ENDIF.
APPEND IT_STD_FINAL.
CLEAR IT_STD_FINAL.
ENDLOOP.
LOOP AT IT_STD_BSIK.
IF SY-SUBRC = 0.
IT_STD_FINAL-BUKRS = IT_STD_BSIK-BUKRS.
IT_STD_FINAL-LIFNR = IT_STD_BSIK-LIFNR.
IT_STD_FINAL-UMSKS = IT_STD_BSIK-UMSKS.
IT_STD_FINAL-UMSKZ = IT_STD_BSIK-UMSKZ.
IT_STD_FINAL-AUGDT = IT_STD_BSIK-AUGDT.
IT_STD_FINAL-AUGBL = IT_STD_BSIK-AUGBL.
IT_STD_FINAL-ZUONR = IT_STD_BSIK-ZUONR.
IT_STD_FINAL-GJAHR = IT_STD_BSIK-GJAHR.
IT_STD_FINAL-BELNR = IT_STD_BSIK-BELNR.
IT_STD_FINAL-BUZEI = IT_STD_BSIK-BUZEI.
IT_STD_FINAL-BUDAT = IT_STD_BSIK-BUDAT.
IT_STD_FINAL-BLDAT = IT_STD_BSIK-BLDAT.
IT_STD_FINAL-XBLNR = IT_STD_BSIK-XBLNR.
IT_STD_FINAL-BLART = IT_STD_BSIK-BLART.
IT_STD_FINAL-MONAT = IT_STD_BSIK-MONAT.
IT_STD_FINAL-BSCHL = IT_STD_BSIK-BSCHL.
IT_STD_FINAL-ZUMSK = IT_STD_BSIK-ZUMSK.
IT_STD_FINAL-SHKZG = IT_STD_BSIK-SHKZG.
IT_STD_FINAL-GSBER = IT_STD_BSIK-GSBER.
IT_STD_FINAL-DMBTR = IT_STD_BSIK-DMBTR.
IT_STD_FINAL-WRBTR = IT_STD_BSIK-WRBTR.
IT_STD_FINAL-SGTXT = IT_STD_BSIK-SGTXT.
IT_STD_FINAL-SAKNR = IT_STD_BSIK-SAKNR.
IT_STD_FINAL-HKONT = IT_STD_BSIK-HKONT.
IT_STD_FINAL-ZLSCH = IT_STD_BSIK-ZLSCH.
ENDIF.
APPEND IT_STD_FINAL.
CLEAR IT_STD_FINAL.
ENDLOOP.
LOOP AT IT_STD_FINAL.
IF IT_STD_FINAL-SHKZG = 'S'.
IT_STD_FINAL-DMBTR_S = IT_STD_FINAL-DMBTR.
ELSE.
IF IT_STD_FINAL-SHKZG = 'H'.
IT_STD_FINAL-DMBTR_H = IT_STD_FINAL-DMBTR.
ENDIF.
ENDIF.
IT_STD_FINAL-DMBTR = ''.
MODIFY IT_STD_FINAL INDEX SY-TABIX TRANSPORTING DMBTR_H DMBTR_S DMBTR.
"VAR.
CLEAR IT_STD_FINAL.
ENDLOOP.
SORT IT_STD_FINAL BY LIFNR GSBER GJAHR.
ENDFORM. " DATA_RETRIVAL
*& Form FIELD
text
--> p1 text
<-- p2 text
form FIELD .
LCAT-FIELDNAME = 'LIFNR'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Vendor No'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'NAME1'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Vendor Name'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'GJAHR'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Fiscal Year'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'GSBER'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'BussArea'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'DMBTR_S'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Debit Balanace'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'DMBTR_H'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Credit Balance'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'BAL'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Accumulated Balance'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
endform. " FIELD
*& Form DISPLAY
text
--> p1 text
<-- p2 text
form DISPLAY .
CLEAR: IT_STD_BSAK,IT_STD_BSIK, IT_STD_LFA1 .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'STATUS '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = IT_SORT
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = IT_CHARG
t_outtab = IT_STD_FINAL[]
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. "DISPLAY
*& Form EVENTS
text
--> p1 text
<-- p2 text
form EVENTS USING P_EVENTS TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
ls_event-name = 'TOP_OF_PAGE'.
ls_event-form = 'TOP_OF_PAGE'.
APPEND ls_event TO P_EVENTS.
endform. " EVENTS
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = TOP.
ENDFORM. "TOP_OF_PAGE
*& Form LAYOUT
text
--> p1 text
<-- p2 text
form LAYOUT .
LAYOUT-ZEBRA = 'X'.
LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
APPEND LAYOUT." TO LAYOUT.
endform. " LAYOUT
*& Form EVENTS_1
text
-->P_EVENTS text
FORM EVENTS_1 USING P_EVENTS TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
WRITE: SY-UNAME.
ls_event-name = 'END_OF_PAGE'.
ls_event-form = 'END_OF_PAGE'.
APPEND ls_event TO P_EVENTS.
ENDFORM. " EVENTS_1Seniors , Please Help me with this Requirment
BUKRS _____________________
GJAHR ____________________
LIFNR _____________________
MONAT _____________________
LIFNR NAME1 GSBER GJAHR HBAL SBAL ACCUMBAL
1001 ABB BUSS1 2005 300 00
ABB BUSS1 2005 00 100
300 100 (300-100)=200
ABB BUSS1 2006 200 00
ABB BUSS1 2006 200 00
400 00 (400-00)+ 200 =
600
ABB BUSS2 2005 300 00
ABB BUSS2 2005 00 100
300 100 ( 300-100) =200
ABB BUSS2 2006 400 00
ABB BUSS2 2006 00 100
400 100 (400-100)+200 =
500 ****************************************************************************
1400 300 (1400-300) **********************************************************************************************************
Same for the Next Vendor also...
This is the report for this Requirment i am working on....Please Help me in the Logic..How to Go on with it....
*& Report ZVENDOR_RECONCILLATION
REPORT ZVENDOR_RECONCILLATION.
TABLES : BSAK , BSIK , LFC1 , LFC3 , LFA1.
*ALV
TYPE-POOLS: SLIS.
*TYPE-POOLS icon.
DATA: It_SORT TYPE SLIS_T_SORTINFO_ALV ."WITH HEADER LINE.
DATA: TOP TYPE slis_t_listheader,
END TYPE slis_t_listheader,
EVENTS TYPE slis_t_event.
DATA : T_KEY TYPE SLIS_KEYINFO_ALV.
DATA : FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
LAYOUT TYPE SLIS_LAYOUT_ALV OCCURS 1 WITH HEADER LINE ,
LCAT TYPE SLIS_FIELDCAT_ALV.
*INTERNAL TABLE
DATA: BEGIN OF sd_bsak,
bukrs TYPE bsak-bukrs,
lifnr TYPE bsak-lifnr,
umsks TYPE bsak-umsks,
umskz TYPE bsak-umskz,
augdt TYPE bsak-augdt,
augbl TYPE bsak-augbl,
zuonr TYPE bsak-zuonr,
gjahr TYPE bsak-gjahr,
belnr TYPE bsak-belnr,
buzei TYPE bsak-buzei,
budat TYPE bsak-budat,
bldat TYPE bsak-bldat,
xblnr TYPE bsak-xblnr,
blart TYPE bsak-blart,
monat TYPE bsak-monat,
bschl TYPE bsak-bschl,
zumsk TYPE bsak-zumsk,
shkzg TYPE bsak-shkzg,
gsber TYPE bsak-gsber,
dmbtr TYPE bsak-dmbtr,
wrbtr TYPE bsak-wrbtr,
sgtxt TYPE bsak-sgtxt,
saknr TYPE bsak-saknr,
hkont TYPE bsak-hkont,
END OF sd_bsak.
DATA: BEGIN OF sd_bsik,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsik-lifnr,
umsks TYPE bsik-umsks,
umskz TYPE bsik-umskz,
augdt TYPE bsik-augdt,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
gjahr TYPE bsik-gjahr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
budat TYPE bsik-budat,
bldat TYPE bsik-bldat,
xblnr TYPE bsik-xblnr,
blart TYPE bsik-blart,
monat TYPE bsik-monat,
bschl TYPE bsik-bschl,
zumsk TYPE bsik-zumsk,
shkzg TYPE bsik-shkzg,
gsber TYPE bsik-gsber,
dmbtr TYPE bsik-dmbtr,
wrbtr TYPE bsik-wrbtr,
sgtxt TYPE bsik-sgtxt,
saknr TYPE bsik-saknr,
hkont TYPE bsik-hkont,
zlsch TYPE bsik-zlsch,
END OF sd_bsik.
DATA: BEGIN OF it_lfa1,
lifnr TYPE lfa1-lifnr,
name1 TYPE lfa1-name1,
END OF it_lfa1.
*FINAL INTERNAL TABLE DECLARATION
DATA: BEGIN OF IT_FINAL,
lifnr TYPE bsak-lifnr,
gsber TYPE bsak-gsber,
bukrs TYPE bsak-bukrs,
umsks TYPE bsak-umsks,
umskz TYPE bsak-umskz,
augdt TYPE bsak-augdt,
augbl TYPE bsak-augbl,
zuonr TYPE bsak-zuonr,
gjahr TYPE bsak-gjahr,
belnr TYPE bsak-belnr,
buzei TYPE bsak-buzei,
budat TYPE bsak-budat,
bldat TYPE bsak-bldat,
xblnr TYPE bsak-xblnr,
blart TYPE bsak-blart,
monat TYPE bsak-monat,
bschl TYPE bsak-bschl,
zumsk TYPE bsak-zumsk,
shkzg TYPE bsak-shkzg,
gsber TYPE bsak-gsber,
dmbtr TYPE bsak-dmbtr,
wrbtr TYPE bsak-wrbtr,
sgtxt TYPE bsak-sgtxt,
saknr TYPE bsak-saknr,
hkont TYPE bsak-hkont,
DMBTR_S TYPE BSAK-DMBTR,
DMBTR_H TYPE BSAK-DMBTR,
DS TYPE P DECIMALS 2,
DH TYPE P DECIMALS 2,
SUB TYPE P DECIMALS 2,
ADD TYPE P DECIMALS 2,
BAL TYPE P DECIMALS 2,
lifnr TYPE bsik-lifnr,
umsks TYPE bsik-umsks,
umskz TYPE bsik-umskz,
augdt TYPE bsik-augdt,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
gjahr TYPE bsik-gjahr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
budat TYPE bsik-budat,
bldat TYPE bsik-bldat,
xblnr TYPE bsik-xblnr,
blart TYPE bsik-blart,
monat TYPE bsik-monat,
bschl TYPE bsik-bschl,
zumsk TYPE bsik-zumsk,
shkzg TYPE bsik-shkzg,
gsber TYPE bsik-gsber,
dmbtr TYPE bsik-dmbtr,
wrbtr TYPE bsik-wrbtr,
sgtxt TYPE bsik-sgtxt,
saknr TYPE bsik-saknr,
hkont TYPE bsik-hkont,
zlsch TYPE bsik-zlsch,
lifnr TYPE lfa1-lifnr,
name1 TYPE lfa1-name1,
END OF IT_FINAL.
DATA: BEGIN OF SD_FINAL,
gsber TYPE bsak-gsber,
lifnr TYPE bsak-lifnr,
bukrs TYPE bsak-bukrs,
lifnr TYPE bsak-lifnr,
umsks TYPE bsak-umsks,
umskz TYPE bsak-umskz,
augdt TYPE bsak-augdt,
augbl TYPE bsak-augbl,
zuonr TYPE bsak-zuonr,
gjahr TYPE bsak-gjahr,
belnr TYPE bsak-belnr,
buzei TYPE bsak-buzei,
budat TYPE bsak-budat,
bldat TYPE bsak-bldat,
xblnr TYPE bsak-xblnr,
blart TYPE bsak-blart,
monat TYPE bsak-monat,
bschl TYPE bsak-bschl,
zumsk TYPE bsak-zumsk,
shkzg TYPE bsak-shkzg,
dmbtr TYPE bsak-dmbtr,
wrbtr TYPE bsak-wrbtr,
sgtxt TYPE bsak-sgtxt,
saknr TYPE bsak-saknr,
hkont TYPE bsak-hkont,
bukrs TYPE bsik-bukrs,
lifnr TYPE bsik-lifnr,
umsks TYPE bsik-umsks,
umskz TYPE bsik-umskz,
augdt TYPE bsik-augdt,
augbl TYPE bsik-augbl,
zuonr TYPE bsik-zuonr,
gjahr TYPE bsik-gjahr,
belnr TYPE bsik-belnr,
buzei TYPE bsik-buzei,
budat TYPE bsik-budat,
bldat TYPE bsik-bldat,
xblnr TYPE bsik-xblnr,
blart TYPE bsik-blart,
monat TYPE bsik-monat,
bschl TYPE bsik-bschl,
zumsk TYPE bsik-zumsk,
shkzg TYPE bsik-shkzg,
gsber TYPE bsik-gsber,
dmbtr TYPE bsik-dmbtr,
wrbtr TYPE bsik-wrbtr,
sgtxt TYPE bsik-sgtxt,
saknr TYPE bsik-saknr,
hkont TYPE bsik-hkont,
zlsch TYPE bsik-zlsch,
lifnr TYPE lfa1-lifnr,
name1 TYPE lfa1-name1,
line_color(4) TYPE c,
END OF SD_FINAL.
DATA IT_STD_BSAK LIKE TABLE OF SD_BSAK WITH HEADER LINE.
DATA IT_STD_BSIK LIKE TABLE OF SD_BSIK WITH HEADER LINE.
DATA IT_STD_LFA1 LIKE TABLE OF IT_LFA1 WITH HEADER LINE.
DATA IT_STD_FINAL LIKE TABLE OF IT_FINAL WITH HEADER LINE.
DATA IT_FINAL_DISPLAY LIKE TABLE OF SD_FINAL WITH HEADER LINE.
*SELECTION-SCREEN
SELECTION-SCREEN BEGIN OF BLOCK HEADER WITH FRAME TITLE TEXT-001.
PARAMETERS: P_BUKRS LIKE BSAK-BUKRS OBLIGATORY.
SELECT-OPTIONS : S_GJAHR FOR BSAK-GJAHR.
SELECT-OPTIONS: S_LIFNR FOR BSAK-LIFNR.
SELECT-OPTIONS: S_MONAT FOR BSAK-MONAT.
SELECTION-SCREEN END OF BLOCK HEADER.
START-OF-SELECTION.
SET PF-STATUS 'STATUS'.
PERFORM DATA_RETRIVAL.
PERFORM FIELD.
PERFORM EVENTS USING EVENTS.
PERFORM EVENTS_1 USING EVENTS.
PERFORM HEADER USING TOP.
PERFORM LAYOUT.
PERFORM DISPLAY.
END-OF-PAGE.
*& Form DATA_RETRIVAL
text
--> p1 text
<-- p2 text
FORM DATA_RETRIVAL .
SELECT BUKRS LIFNR UMSKS UMSKZ AUGDT AUGBL ZUONR GJAHR BELNR BUZEI BUDAT BLDAT XBLNR BLART
MONAT BSCHL ZUMSK SHKZG GSBER DMBTR WRBTR SGTXT SAKNR HKONT
FROM BSAK INTO TABLE IT_STD_BSAK
WHERE BUKRS = P_BUKRS
AND GJAHR IN S_GJAHR
AND LIFNR IN S_LIFNR
AND MONAT IN S_MONAT.
IF NOT IT_STD_BSAK[] IS INITIAL.
SELECT BUKRS LIFNR UMSKS UMSKZ AUGDT AUGBL ZUONR GJAHR BELNR BUZEI BUDAT BLDAT XBLNR
BLART MONAT BSCHL ZUMSK SHKZG GSBER DMBTR WRBTR SGTXT SAKNR HKONT ZLSCH
FROM BSIK INTO TABLE IT_STD_BSIK FOR ALL ENTRIES IN IT_STD_BSAK
WHERE BUKRS = IT_STD_BSAK-BUKRS AND LIFNR = IT_STD_BSAK-LIFNR AND GJAHR = IT_STD_BSAK-GJAHR .
ENDIF.
IF NOT IT_STD_BSAK[] IS INITIAL.
SELECT LIFNR NAME1
FROM LFA1 INTO TABLE IT_STD_LFA1 FOR ALL ENTRIES IN IT_STD_BSAK
WHERE LIFNR = IT_STD_BSAK-LIFNR.
ENDIF.
LOOP AT IT_STD_BSAK.
IT_STD_FINAL-BUKRS = IT_STD_BSAK-BUKRS.
IT_STD_FINAL-LIFNR = IT_STD_BSAK-LIFNR.
IT_STD_FINAL-UMSKS = IT_STD_BSAK-UMSKS.
IT_STD_FINAL-UMSKZ = IT_STD_BSAK-UMSKZ.
IT_STD_FINAL-AUGDT = IT_STD_BSAK-AUGDT.
IT_STD_FINAL-AUGBL = IT_STD_BSAK-AUGBL.
IT_STD_FINAL-ZUONR = IT_STD_BSAK-ZUONR.
IT_STD_FINAL-GJAHR = IT_STD_BSAK-GJAHR.
IT_STD_FINAL-BELNR = IT_STD_BSAK-BELNR.
IT_STD_FINAL-BUZEI = IT_STD_BSAK-BUZEI.
IT_STD_FINAL-BUDAT = IT_STD_BSAK-BUDAT.
IT_STD_FINAL-BLDAT = IT_STD_BSAK-BLDAT.
IT_STD_FINAL-XBLNR = IT_STD_BSAK-XBLNR.
IT_STD_FINAL-BLART = IT_STD_BSAK-BLART.
IT_STD_FINAL-MONAT = IT_STD_BSAK-MONAT.
IT_STD_FINAL-BSCHL = IT_STD_BSAK-BSCHL.
IT_STD_FINAL-ZUMSK = IT_STD_BSAK-ZUMSK.
IT_STD_FINAL-SHKZG = IT_STD_BSAK-SHKZG.
IT_STD_FINAL-GSBER = IT_STD_BSAK-GSBER.
IT_STD_FINAL-DMBTR = IT_STD_BSAK-DMBTR.
IT_STD_FINAL-WRBTR = IT_STD_BSAK-WRBTR.
IT_STD_FINAL-SGTXT = IT_STD_BSAK-SGTXT.
IT_STD_FINAL-SAKNR = IT_STD_BSAK-SAKNR.
IT_STD_FINAL-HKONT = IT_STD_BSAK-HKONT.
READ TABLE IT_STD_LFA1 WITH KEY LIFNR = IT_STD_FINAL-LIFNR.
IF SY-SUBRC = 0.
IT_STD_FINAL-NAME1 = IT_STD_LFA1-NAME1.
ENDIF.
APPEND IT_STD_FINAL.
CLEAR IT_STD_FINAL.
ENDLOOP.
LOOP AT IT_STD_BSIK.
IF SY-SUBRC = 0.
IT_STD_FINAL-BUKRS = IT_STD_BSIK-BUKRS.
IT_STD_FINAL-LIFNR = IT_STD_BSIK-LIFNR.
IT_STD_FINAL-UMSKS = IT_STD_BSIK-UMSKS.
IT_STD_FINAL-UMSKZ = IT_STD_BSIK-UMSKZ.
IT_STD_FINAL-AUGDT = IT_STD_BSIK-AUGDT.
IT_STD_FINAL-AUGBL = IT_STD_BSIK-AUGBL.
IT_STD_FINAL-ZUONR = IT_STD_BSIK-ZUONR.
IT_STD_FINAL-GJAHR = IT_STD_BSIK-GJAHR.
IT_STD_FINAL-BELNR = IT_STD_BSIK-BELNR.
IT_STD_FINAL-BUZEI = IT_STD_BSIK-BUZEI.
IT_STD_FINAL-BUDAT = IT_STD_BSIK-BUDAT.
IT_STD_FINAL-BLDAT = IT_STD_BSIK-BLDAT.
IT_STD_FINAL-XBLNR = IT_STD_BSIK-XBLNR.
IT_STD_FINAL-BLART = IT_STD_BSIK-BLART.
IT_STD_FINAL-MONAT = IT_STD_BSIK-MONAT.
IT_STD_FINAL-BSCHL = IT_STD_BSIK-BSCHL.
IT_STD_FINAL-ZUMSK = IT_STD_BSIK-ZUMSK.
IT_STD_FINAL-SHKZG = IT_STD_BSIK-SHKZG.
IT_STD_FINAL-GSBER = IT_STD_BSIK-GSBER.
IT_STD_FINAL-DMBTR = IT_STD_BSIK-DMBTR.
IT_STD_FINAL-WRBTR = IT_STD_BSIK-WRBTR.
IT_STD_FINAL-SGTXT = IT_STD_BSIK-SGTXT.
IT_STD_FINAL-SAKNR = IT_STD_BSIK-SAKNR.
IT_STD_FINAL-HKONT = IT_STD_BSIK-HKONT.
IT_STD_FINAL-ZLSCH = IT_STD_BSIK-ZLSCH.
ENDIF.
APPEND IT_STD_FINAL.
CLEAR IT_STD_FINAL.
ENDLOOP.
LOOP AT IT_STD_FINAL.
IF IT_STD_FINAL-SHKZG = 'S'.
IT_STD_FINAL-DMBTR_S = IT_STD_FINAL-DMBTR.
ELSE.
IF IT_STD_FINAL-SHKZG = 'H'.
IT_STD_FINAL-DMBTR_H = IT_STD_FINAL-DMBTR.
ENDIF.
ENDIF.
IT_STD_FINAL-DMBTR = ''.
MODIFY IT_STD_FINAL INDEX SY-TABIX TRANSPORTING DMBTR_H DMBTR_S DMBTR.
"VAR.
CLEAR IT_STD_FINAL.
ENDLOOP.
SORT IT_STD_FINAL BY LIFNR GSBER GJAHR.
ENDFORM. " DATA_RETRIVAL
*& Form FIELD
text
--> p1 text
<-- p2 text
form FIELD .
LCAT-FIELDNAME = 'LIFNR'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Vendor No'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'NAME1'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Vendor Name'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'GJAHR'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Fiscal Year'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'GSBER'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'BussArea'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'DMBTR_S'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Debit Balanace'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'DMBTR_H'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Credit Balance'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
LCAT-FIELDNAME = 'BAL'.
LCAT-TABNAME = 'IT_STD_FINAL'.
LCAT-SELTEXT_L = 'Accumulated Balance'.
LCAT-JUST = 'M'.
APPEND LCAT TO FIELDCAT.
CLEAR LCAT.
endform. " FIELD
*& Form DISPLAY
text
--> p1 text
<-- p2 text
form DISPLAY .
CLEAR: IT_STD_BSAK,IT_STD_BSIK, IT_STD_LFA1 .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'STATUS '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = IT_SORT
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = IT_CHARG
t_outtab = IT_STD_FINAL[]
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. "DISPLAY
*& Form EVENTS
text
--> p1 text
<-- p2 text
form EVENTS USING P_EVENTS TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
ls_event-name = 'TOP_OF_PAGE'.
ls_event-form = 'TOP_OF_PAGE'.
APPEND ls_event TO P_EVENTS.
endform. " EVENTS
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = TOP.
ENDFORM. "TOP_OF_PAGE
*& Form LAYOUT
text
--> p1 text
<-- p2 text
form LAYOUT .
LAYOUT-ZEBRA = 'X'.
LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
APPEND LAYOUT." TO LAYOUT.
endform. " LAYOUT
*& Form EVENTS_1
text
-->P_EVENTS text
FORM EVENTS_1 USING P_EVENTS TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
WRITE: SY-UNAME.
ls_event-name = 'END_OF_PAGE'.
ls_event-form = 'END_OF_PAGE'.
APPEND ls_event TO P_EVENTS.
ENDFORM. " EVENTS_1 -
Hi Everyone...Please help me with this query...!
Please Help me with this doubt as I am unable to understand the logic...behind this code. It's a begineer level code but I need to understand the logic so that I am able to grasp knowledge. Thank you all for being supportive. Please help me.
//Assume class Demo is inherited from class SuperDemo...in other words class Demo extends SuperDemo
//Volume is a method declared in SuperDemo which returns an integer value
//weight is an integer vairable declared in the subclass which is Demo
class Example
public static void main(String qw[])
Demo ob1=new Demo(3,5,7,9);
//Calling Constructor of Demo which takes in 4 int parameters
SuperDemo ob2=new SuperDemo();
int vol;
vol=ob1.volume();
System.out.println("Volume of ob1 is " + vol);
System.out.println("Weight of ob1 is " + ob1.weight);
System.out.println();
ob2=ob1;
}Can someone please make me understand --- how is this possible and why !
If the above statement is valid then why not this one "System.out.println(ob2.weight);"
Thanks Thanks Thanks!u see the line wherein I am referencing the objectof
a subclass to the superclass...right? then why we
can't do System.out.println(ob2.weight)?You need to distinguish two things:
- the type of the object, which determines with the
object can do
- the type of the reference to the object, which
determines what you see that you can do
Both don't necessarily have to match. When you use a
SuperDemo reference (obj2) to access a Demo instance
(obj1), for all you know, the instance behind obj2 is
of type SuperDemo. That it's in reality of type Demo
is unknown to you. And usually, you don't care -
that's what polymorphism is about.
So you have a reference obj2 of type SuperDemo.
SuperDemo objects don't have weight, so you don't see
it - even though it is there.So from ur explanation wat I understand is - Even though u reference a subclass object to a superclass, u will only be able to access the members which are declared in the superclass thru the same...right
? -
Please help me with this SQL query
I am practicing SQL queries and have come across one involving fetching data from 3 different tables.
The three tables are as below
<pre>
Country
location_id country
loc1 Spain
loc2 England
loc3 Spain
loc4 USA
loc5 Italy
loc6 USA
loc7 USA
</pre>
<pre>
User
user_id location_id
u1 loc1
u2 loc1
u3 loc2
u4 loc2
u5 loc1
u6 loc3
</pre>
<pre>
Post
post_id user_id
p1 u1
p2 u1
p3 u2
p4 u3
p5 u1
p6 u2
</pre>
I am trying to write an SQL query - for each country of users, display the average number of posts
I understand the logic behind this that we first need to group together all the locations and then the users belonging to one country and then find the average of their posts.
But, i'm having a difficulty in putting this in SQL form. Could someone please help me with this query.
Thanks.select
country.country,
count(*) Totalpostspercountry,
count(distinct post.user_id) Totaldistincuserspercountry,
count(*)/count(distinct post.user_id) Avgpostsperuserbycountry
from
country, muser, post
where country.location_id = muser.location_id
and muser.user_id = post.user_id
group by country.country
The output is like this for your sample data - hope this is what you were looking for :)
COUNTRY,TOTALPOSTSPERCOUNTRY,TOTALDISTINCUSERSPERCOUNTRY,AVGPOSTSPERUSERBYCOUNTRY
England,1,1,1,
Spain,5,2,2.5, -
I bought(own) and gifted(friend) an app which i was charged 2 different prices please help me with this!!!
Apple does not sell an unlocked iPhone. Some cell carriers offer the option to purchase an unlocked phone at a significantly higher price. Your friend could go to Hong Kong and buy an unlocked phone from an authorized carrier but if he has any problems with the phone, he will need to take it back to the country where he purchased it.
-
I just bought this movie "Godzilla 2014" but it won't show in my Movie Library. I closed my Itunes and put it back on again but still won't show up. I checked my purchased list and it shows that I recently bought the movie but when I checked the itunes store it wants to buy the movie again. Please help me with this right away Apple.
Apple Store Customer Service at 1-800-676-2775 or visit online Help for more information.
To contact product and tech support: Contacting Apple for support and service - this includes
international calling numbers..
For Mac App Store: Apple - Support - Mac App Store.
For iTunes: Apple - Support - iTunes. -
Hello, Honestly I just updated my 4s and my iPad 3 to iOS 6 and when try to press on the Music app or the iTunes app it says "cannot connect to iTunes Store" Could you please help me with this thank you so much, Charbel from Lebanon
See these previous discussions help.
App Store Updates (but only Updates)...: Apple Support Communities
Apps suddenly don't update: Apple Support Communities -
I cannot install Itunes and Icloud on my Sony Vaio Laptop - Window 7. Error says " computer/system not modified". Please help me with this problem.
Hello there, jag123059.
The following Knowledge Base article offers up some great steps to follow for resolving issues with installing iTunes:
Issues installing iTunes or QuickTime for Windows
http://support.apple.com/kb/ht1926
Thanks for reaching out to Apple Support Communities.
Cheers,
Pedro.
Maybe you are looking for
-
Unable to install Acrobat Pro 6 Upgrade on Mac Mini single CPU, OS 10.4.5
I have a Mac Mini (1.5 GHz, Intel Core Solo) with 512 mb RAM running OS X (10.4.5) Unable to install Adobe Acrobat Professional 6 upgrade because I am unable to install earlier version full version (I own Acrobat 4 and 5 full versions). Finalizing in
-
Clearing the the street,Postal code and city in partner tab at sales order
Hi Experts, I have a requirement like in sales order header or Item, In partners tab, when they are selecting the particular partner function like CR and the customer number is 500, and if they press enter then automaticaly it fetches the name,street
-
How can i load a gif animation in Flex 1.5?
I used to use <mx:Image> control to load a static gif file.Now i have a gif file that is dynamic(I mean that it has animation).But when i use the <mx:Image> control, it has no animation, just static images.Which control should i use ? thanks in advan
-
Tab Access derived from template doesn't work
Hi, I have a template that has a tab to be accessible to a specific group.I derive all my pages from this template. The problem is that the tab shows on all the pages that are derived from the template even when the user did not have access to that t
-
Sync arbitrary number of episodes of podcasts (not 1, 3, 5, 10 or all)
Hi - I'd like to synchronize a user-defined number of episodes of podcasts with my iPod and not be restricted to 1, 3, 5 10 or all (whatever is the sync logic). This is strange that this is not just a parameter for users to decide. Did I miss somethi