‎2007 Dec 18 1:56 PM
hello ...
Iam getting error in the loop , can one check the code and tell me, where I went worng
TABLES: VBAP,VBAK.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm,
A1 type flag,
A2 type flag,
A3 type flag,
B1 type flag,
B2 type flag,
B3 type flag,
C1 type flag,
C2 type flag,
C3 type flag,
DATEFROM TYPE date,
DATETO type date,
val1 like datefrom,
val2 like dateto,
box TYPE c.
*DATA begin of ZSD_01001_STAT.
DATA: wa type STANDARD TABLE OF VBAK WITH HEADER LINE,
itab TYPE ZSD_01001_STAT.
Get CURSOR FIELD datefrom VALUE val1.
GET CURSOR FIELD dateto VALUE val2.
SELECT A~MANDT
A~ERDAT
A~KUNNR
A~VKGRP
B~MATNR
INTO CORRESPONDING FIELDS OF ITAB
from vbak AS A
INNER JOIN vbap AS B ON AVBELN = BVBELN.
loop at Itab.
select single matnr from vbak into itab-MATNR
where matnr = itab-matnr.
SELECT SINGLE ERDAT from VBAK INTO itab-ERDAT
where erdat = itab-ERDAT.
SELECT SINGLE VKGRP from VBAK INTO itab-VKGRP
where VKGRP = itab-ERDAT.
SELECT SINGLE MATNR from VBAP INTO itab-MATNR
where MATNR = itab-MATNR.
modify itab index sy-tabix transporting MATNR ERDAT VKGRP.
endloop.
ENDSELECT.
CALL SCREEN 100.
MODULE user_command_0100 INPUT.
SET PF-STATUS 'STATUS_100'.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'CANCEL'.
LEAVE PROGRAM.
when 'CLEAR'.
A1 = ''.
A2 = ''.
A3 = ''.
B1 = ''.
B2 = ''.
B3 = ''.
C1 = ''.
C2 = ''.
C3 = ''.
loop at screen.
screen-input = '1'.
modify screen.
endloop.
ENDCASE.
ENDMODULE. "user_command_0100 INPUT
----
MODULE user OUTPUT
----
*
----
MODULE user OUTPUT.
If A1 = 'X'.
loop at screen.
if ( screen-name ='A2' and A2 is initial )
or ( screen-name ='A3' and A3 is initial )
or ( screen-name ='B1' and B1 is initial )
or ( screen-name ='C1' and C1 is initial ) .
screen-input = '0'.
modify screen.
endif.
endloop.
endif.
IF B1 = 'X'.
loop at screen.
if ( screen-name ='B2' and B2 is initial )
or ( screen-name ='B3' and B3 is initial )
or ( screen-name ='A1' and A1 is initial )
or ( screen-name ='C1' and C1 is initial ).
screen-input = '0'.
modify screen.
endif.
endloop.
endif.
IF C1 = 'X'.
loop at screen.
if ( screen-name ='C2' and C2 is initial )
or ( screen-name ='C3' and C3 is initial )
or ( screen-name ='A1' and A1 is initial )
or ( screen-name ='B1' and B1 is initial ).
screen-input = '0'.
modify screen.
endif.
endloop.
endif.
IF A2 = 'x'.
loop at screen.
if ( screen-name ='A1' and A1 is initial )
or ( screen-name ='A3' and A3 is initial )
or ( screen-name ='B2' and B2 is initial )
or ( screen-name ='C2' and C2 is initial ).
screen-input = '0'.
modify screen.
endif.
endloop.
endif.
IF B2 = 'X'.
loop at screen.
if ( screen-name ='B1' and B1 is initial )
or ( screen-name ='B3' and B3 is initial )
or ( screen-name ='A2' and A2 is initial )
or ( screen-name ='C2' and C2 is initial ).
screen-input = '0'.
modify screen.
endif.
endloop.
endif.
IF C2 = 'X'.
loop at screen.
IF ( screen-name ='C1' and C1 is initial )
or ( screen-name ='C3' and C3 is initial )
or ( screen-name ='A2' and A2 is initial )
or ( screen-name ='B2' and B2 is initial ).
screen-input = '0'.
modify screen.
endif.
endloop.
endif.
IF A3 = 'X'.
loop at screen.
IF ( screen-name ='A1' and A1 is initial )
or ( screen-name ='A2' and A2 is initial )
or ( screen-name ='B3' and B3 is initial )
or ( screen-name ='C3' and C3 is initial ).
screen-input = '0'.
modify screen.
endif.
endloop.
endif.
IF B3 = 'X'.
loop at screen.
IF ( screen-name ='B1' and B1 is initial )
or ( screen-name ='B2' and B2 is initial )
or ( screen-name ='A3' and A3 is initial )
or ( screen-name ='C3' and C3 is initial ).
screen-input = '0'.
modify screen.
endif.
endloop.
endif.
IF C3 = 'X'.
loop at screen.
IF ( screen-name ='C1' and C1 is initial )
or ( screen-name ='C2' and C2 is initial )
or ( screen-name ='A3' and A3 is initial )
or ( screen-name ='B3' and B3 is initial ).
screen-input = '0'.
modify screen.
endif.
endloop.
endif.
CASE save_ok.
when 'A1'.
A1 = 'X'.
loop at screen.
if ( screen-name ='A2' and A2 is initial )
or ( screen-name ='A3' and A3 is initial )
or ( screen-name ='B1' and B1 is initial )
or ( screen-name ='C1' and C1 is initial ) .
screen-input = '0'.
modify screen.
endif.
endloop.
when'B1'.
B1 = 'X'.
loop at screen.
if ( screen-name ='B2' and B2 is initial )
or ( screen-name ='B3' and B3 is initial )
or ( screen-name ='A1' and A1 is initial )
or ( screen-name ='C1' and C1 is initial ).
screen-input = '0'.
modify screen.
endif.
endloop.
when'C1'.
C1 = 'X'.
loop at screen.
if ( screen-name ='C2' and C2 is initial )
or ( screen-name ='C3' and C3 is initial )
or ( screen-name ='A1' and A1 is initial )
or ( screen-name ='B1' and B1 is initial ).
screen-input = '0'.
modify screen.
endif.
endloop.
when'A2'.
A2 = 'x'.
loop at screen.
if ( screen-name ='A1' and A1 is initial )
or ( screen-name ='A3' and A3 is initial )
or ( screen-name ='B2' and B2 is initial )
or ( screen-name ='C2' and C2 is initial ).
screen-input = '0'.
modify screen.
endif.
endloop.
when'B2'.
B2 = 'X'.
loop at screen.
if ( screen-name ='B1' and B1 is initial )
or ( screen-name ='B3' and B3 is initial )
or ( screen-name ='A2' and A2 is initial )
or ( screen-name ='C2' and C2 is initial ).
screen-input = '0'.
modify screen.
endif.
endloop.
when'C2'.
C2 = 'X'.
loop at screen.
IF ( screen-name ='C1' and C1 is initial )
or ( screen-name ='C3' and C3 is initial )
or ( screen-name ='A2' and A2 is initial )
or ( screen-name ='B2' and B2 is initial ).
screen-input = '0'.
modify screen.
endif.
endloop.
when'A3'.
A3 = 'X'.
loop at screen.
IF ( screen-name ='A1' and A1 is initial )
or ( screen-name ='A2' and A2 is initial )
or ( screen-name ='B3' and B3 is initial )
or ( screen-name ='C3' and C3 is initial ).
screen-input = '0'.
modify screen.
endif.
endloop.
when'B3'.
B3 = 'X'.
loop at screen.
IF ( screen-name ='B1' and B1 is initial )
or ( screen-name ='B2' and B2 is initial )
or ( screen-name ='A3' and A3 is initial )
or ( screen-name ='C3' and C3 is initial ).
screen-input = '0'.
modify screen.
endif.
endloop.
when'C3'.
C3 = 'X'.
loop at screen.
IF ( screen-name ='C1' and C1 is initial )
or ( screen-name ='C2' and C2 is initial )
or ( screen-name ='A3' and A3 is initial )
or ( screen-name ='B3' and B3 is initial ).
screen-input = '0'.
modify screen.
endif.
endloop.
CLEAR save_ok.
endcase.
ENDMODULE. " user_command_0100 OUTPUT
‎2007 Dec 18 2:18 PM
Perhaps you'd care to enlighten us as to the nature of the error you're getting?
matt
‎2007 Dec 18 2:22 PM
MATNR does not exist in VBAK.
Also, why would you do this block of code.
SELECT A~MANDT
A~ERDAT
A~KUNNR
A~VKGRP
B~MATNR
INTO CORRESPONDING FIELDS OF ITAB
from vbak AS A
INNER JOIN vbap AS B ON AVBELN = BVBELN.
loop at Itab.
select single matnr from vbak into itab-MATNR
where matnr = itab-matnr.
SELECT SINGLE ERDAT from VBAK INTO itab-ERDAT
where erdat = itab-ERDAT.
SELECT SINGLE VKGRP from VBAK INTO itab-VKGRP
where VKGRP = itab-ERDAT.
SELECT SINGLE MATNR from VBAP INTO itab-MATNR
where MATNR = itab-MATNR.
modify itab index sy-tabix transporting MATNR ERDAT VKGRP.
endloop.
ENDSELECT.
‎2007 Dec 18 2:31 PM
error :
'itab' is neither specified under ''tables'' nor defined as an internal table.
‎2007 Dec 18 2:40 PM
Hello Martin Shinks
... this my program with details
write a report program 3x3 matrix which should display MANDT,customer number, material number, Sales Group, ERDAT, Create a structure which should be used in the program
selection critria:
VBAK-ERDAT and order of display should be according to selection of the user, using check box in the selection screen
___________________ 1 _______ 2 _________ 3
Customer number
Material
Sala org
output
display should be
1. mandt 2.erdat---> 3.4.5 should sort according to the user
who selects in the selection in matrix....
‎2007 Dec 18 2:51 PM
SELECT SINGLE VKGRP from VBAK INTO itab-VKGRP
where VKGRP = itab-ERDAT.
will not work.
I do not know why you are using this loop and then selecting the data again from VBAK.
You initial read should read the data into the table itab.
‎2007 Dec 18 3:00 PM
You've defined ITAB as type ZSD_01001_STAT. I'd guess you've defined ZSD_01001_STAT as a transparent table or structure in SE11.
DATA itab TYPE ZSD_01001_STAT.
Defines itab as a STRUCTURE with the same fields asZSD_01001_STAT. You need to define it as a table. You can't loop at a structure.
So: DATA itab TYPE tabletype TABLE OF zsd_01001_stat...
matt
‎2007 Dec 19 10:14 AM
I did as you said,
then i got an error '' tabletype'' is not a valid table type. you can use ''Standard'', '' Sorted '' or '' Hashed'',
what should I now