‎2006 Sep 25 9:42 AM
Hi experts,
this is my code here i am not getting any output.
plese help me . how to proceed.
report xxxxxxxx message-id zz
line-size 255
line-count 65
no standard page heading.
-
*
TABLE DEFINITION *
----
tables : knb1, "customer master (companycode)
kna1, "genaral data in customer master
knvp, "customer master partener functions
zvarv. " Program Hard Coded Values support table
----
TYPE-POOLS DEFINATION
----
type-pools : slis.
----
TYPES DECLARATION
----
Customer Master Company code Data
types : begin of t_knb1,
kunnr like knb1-kunnr,
akont like knb1-akont,
end of t_knb1.
data : i_knb1 type standard table of t_knb1 initial size 0 .
Customer Master
types : begin of t_kna1,
kunnr like kna1-kunnr,
name1 like kna1-name1,
stras like kna1-stras,
ort01 like kna1-ort01,
stcd1 like kna1-stcd1,
pstlz like kna1-pstlz,
end of t_kna1.
data : i_kna1 type standard table of t_kna1 initial size 0 .
Customer Partner Functions
types : begin of t_knvp,
kunnr like knvp-kunnr,
vkorg like knvp-vkorg,
parvw like knvp-parvw,
kunn2 like knvp-kunn2,
end of t_knvp.
data: i_knvp type standard table of t_knvp initial size 0 .
Output data
types : begin of t_output,
recordtype type c,
soldtocust(10) type c,
payer(10) type c,
sequence(5) type n,
custname(35) type c,
custaddress(35) type c,
custcity(35) type c,
taxid(16) type c,
postalcode(5) type c,
branch type c,
delivery(3) type c,
end of t_output.
data : i_output type standard table of t_output initial size 0 .
ZVARV Table
types : begin of t_zvarv,
zobject1 like zvarv-zobject1,
zobject2 like zvarv-zobject2,
zseqnumb like zvarv-zseqnumb,
zobjval like zvarv-zobjval,
zqualf1 like zvarv-zqualf1,
zqualf2 like zvarv-zqualf2,
zobjdesc like zvarv-zobjdesc,
end of t_zvarv.
data : i_zvarv type t_zvarv occurs 0 with header line.
Error messages and total records
types : begin of t_error_log,
message(200) type c,
end of t_error_log.
data : i_error_log type standard table of t_error_log initial size 0.
Field catalog
data : t_fieldcat_tab type slis_t_fieldcat_alv with header line.
----
----
Variables
----
data : v_knb1 type t_knb1, "Customer master company code
v_kna1 type t_kna1, "Customer master
v_knvp type t_knvp, "Customer masterpartenerfunctions
v_output type t_output, "Output data
v_error_log type t_error_log, "Error data
v_sequence(5) type n, "Total records
v_g_line type i, "Message
v_count type i, "Counter for KNA1 records
v_count1 type i, "Counter for KNVP records
v_result(100) type c, "Totals for KNA1
v_result1(100) type c, "Totals for KNVP
v_g_vkorg like knvp-vkorg. "Message for Validation
----
----
Constants
----
data : c_program(30) type c value 'ZSDI0215', " Program Name
c_aufsd(2) type c value 'CD'. "Central order block for Cust
----
----
Selection-screen
----
selection-screen : begin of block b1 with frame title text-001.
parameters : p_vkorg like knvp-vkorg obligatory. "Sales organization
select-options : p_akont for knb1-akont obligatory default '1050100'.
"Reconciliation Account in General Ledger
selection-screen : end of block b1.
selection-screen : begin of block ouputformat with frame title text-002.
parameters : c1 as checkbox.
selection-screen : end of block ouputformat.
selection-screen begin of block b2 with frame title text-003.
parameters : p_lfile like filetextci-fileintern
default 'Z_IO01989_CUSTOMER_MASTER_DATA', " Logical file
p_pfile like rfpdo-rfbifile. " Physical File
selection-screen end of block b2.
----
----
At selection-screen
----
at selection-screen on p_vkorg.
select single vkorg
into v_g_vkorg
from knvp
where vkorg = p_vkorg.
if v_g_vkorg is initial.
message e001(00) with 'PLEASE ENTER CORRECT SALES ORGANIZTION'.
endif.
----
----
Start-of-selection
----
start-of-selection.
Fetch data
perform get_data.
Processing the data
perform process_data.
----
----
End-of-Selection
----
end-of-selection.
if c1 eq 'X'.
Field catalog
perform f_prepare_fieldcat.
Disply alv report
perform f_display_report.
Disply error log
perform f_error_log.
else.
Display the list
perform f_list_display.
endif.
&----
*& Form get_data
&----
text
----
--> p1 text
<-- p2 text
----
form get_data .
Get zvarv data.
perform get_zvarv.
Get knb1 data
perform get_knb1.
Get kna1 data
perform get_kna1.
Get knvp data
perform get_knvp.
endform. " get_data
----
----
Form get_zvarv
----
zvarv data
----
form get_zvarv .
Fetch data from zvarv.
select zobject1 zobject2 zseqnumb zobjval
from zvarv
into table i_zvarv
where zobject1 eq c_program.
sort i_zvarv by zobject2.
endform. " get_zvarv
&----
*& Form get_knb1
&----
text
----
--> p1 text
<-- p2 text
----
form get_knb1 .
Fetch data from knb1.
select kunnr akont
from knb1
into table i_knb1
where akont = p_akont.
describe table i_knb1 lines v_g_line.
endform. " get_knb1
&----
*& Form get_kna1
&----
text
----
--> p1 text
<-- p2 text
----
form get_kna1 .
Fetch data from kna1.
select kunnr name1 stras ort01 stcd1 pstlz
from kna1
into table i_kna1
for all entries in i_knb1
where kunnr = i_knb1-kunnr and
aufsd NE 'CD'.
endform. " get_kna1
&----
*& Form get_knvp
&----
text
----
--> p1 text
<-- p2 text
----
form get_knvp .
Fetch data from knvp
select kunnr parvw kunn2 vkorg
from knvp
into table i_knvp
for all entries in i_knb1
where kunnr = i_knb1-kunnr
and vkorg = p_vkorg
and parvw = 'RG'.
endform. " get_knvp
&----
*& Form process_data
&----
text
----
--> p1 text
<-- p2 text
----
form process_data .
loop at i_knb1 into v_knb1.
read table i_kna1 into v_kna1 with key kunnr = v_knb1-kunnr.
if sy-subrc <> 0.
concatenate: 'in kna1 no Customer number'
v_knb1-kunnr
into v_result separated by space.
skip.
move v_result to v_error_log-message.
append v_error_log to i_error_log.
v_count = v_count + 1.
endif.
read table i_knvp into v_knvp with key kunnr = v_knb1-kunnr.
if sy-subrc <> 0.
concatenate : 'in knvp no customer number'
v_knb1-kunnr
into v_result1 separated by space.
skip.
loop at i_knvp where kunnr = v_knb1-kunnr.
move v_result1 to v_error_log-message.
append v_error_log to i_error_log.
v_count1 = v_count1 + 1.
endloop.
endif.
v_sequence = v_sequence + 1.
move : 'C' to v_output-recordtype,
v_knvp-kunnr to v_output-soldtocust,
v_knvp-kunn2 to v_output-payer,
v_sequence to v_output-sequence,
v_kna1-name1 to v_output-custname,
v_kna1-stras to v_output-custaddress,
v_kna1-ort01 to v_output-custcity,
v_kna1-stcd1 to v_output-taxid,
v_kna1-pstlz to v_output-postalcode,
'1' to v_output-branch,
'ABC' to v_output-delivery.
insert v_output into table i_output.
clear : v_knb1,
v_kna1,
v_knvp,
v_output.
endloop.
endform. " process_data
&----
*& Form f_prepare_fieldcat
&----
text
----
--> p1 text
<-- p2 text
----
form f_prepare_fieldcat .
t_fieldcat_tab-col_pos = 1.
t_fieldcat_tab-tabname = 'I_OUTPUT'.
t_fieldcat_tab-fieldname = 'RECORDTYPE'.
t_fieldcat_tab-seltext_l = 'Record type'.
append t_fieldcat_tab.
t_fieldcat_tab-col_pos = 2.
t_fieldcat_tab-tabname = 'I_OUTPUT'.
t_fieldcat_tab-fieldname = 'SOLDTOCUST'.
t_fieldcat_tab-seltext_l = 'Sold to custmer'.
append t_fieldcat_tab.
t_fieldcat_tab-col_pos = 3.
t_fieldcat_tab-tabname = 'I_OUTPUT'.
t_fieldcat_tab-fieldname = 'PAYER'.
t_fieldcat_tab-seltext_l = 'payer'.
append t_fieldcat_tab.
t_fieldcat_tab-col_pos = 4.
t_fieldcat_tab-tabname = 'I_OUTPUT'.
t_fieldcat_tab-fieldname = 'SEQUENCE'.
t_fieldcat_tab-seltext_l = 'Sequence Number'.
append t_fieldcat_tab.
t_fieldcat_tab-col_pos = 5.
t_fieldcat_tab-tabname = 'I_OUTPUT'.
t_fieldcat_tab-fieldname = 'CUSTNAME'.
t_fieldcat_tab-seltext_l = 'Customer Name'.
append t_fieldcat_tab.
t_fieldcat_tab-col_pos = 6.
t_fieldcat_tab-tabname = 'I_OUTPUT'.
t_fieldcat_tab-fieldname = 'CUSTADDRESS'.
t_fieldcat_tab-seltext_l = 'Customer Address'.
append t_fieldcat_tab.
t_fieldcat_tab-col_pos = 7.
t_fieldcat_tab-tabname = 'I_OUTPUT'.
t_fieldcat_tab-fieldname = 'CUSTCITY'.
t_fieldcat_tab-seltext_l = 'Customer City'.
append t_fieldcat_tab.
t_fieldcat_tab-col_pos = 8.
t_fieldcat_tab-tabname = 'I_OUTPUT'.
t_fieldcat_tab-fieldname = 'TAXID'.
t_fieldcat_tab-seltext_l = 'Tax id'.
append t_fieldcat_tab.
t_fieldcat_tab-col_pos = 9.
t_fieldcat_tab-tabname = 'I_OUTPUT'.
t_fieldcat_tab-fieldname = 'POSTALCODE'.
t_fieldcat_tab-seltext_l = 'Postal code'.
append t_fieldcat_tab.
t_fieldcat_tab-col_pos = 10.
t_fieldcat_tab-tabname = 'I_OUTPUT'.
t_fieldcat_tab-fieldname = 'BRANCH'.
t_fieldcat_tab-seltext_l = 'Branch'.
append t_fieldcat_tab.
t_fieldcat_tab-col_pos = 11.
t_fieldcat_tab-tabname = 'I_OUTPUT'.
t_fieldcat_tab-fieldname = 'DELIVERY'.
t_fieldcat_tab-seltext_l = 'Delivery'.
append t_fieldcat_tab.
endform. " f_prepare_fieldcat
&----
*& Form f_display_report
&----
text
----
--> p1 text
<-- p2 text
----
To display the ALV report
form f_display_report .
data:l_repid like sy-repid.
l_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
i_buffer_active = 'X'
i_callback_program = 'l_repid '
I_CALLBACK_PF_STATUS_SET = ' '
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 =
it_fieldcat = t_fieldcat_tab[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
i_default = 'X'
i_save = 'A'
IS_VARIANT =
IT_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
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = i_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. " f_display_report
&----
*& Form f_error_log
&----
text
----
--> p1 text
<-- p2 text
----
form f_error_log .
if not i_error_log is initial.
write : / 'ERROR RECORDS'.
loop at i_error_log into v_error_log.
write : / v_error_log-message.
endloop.
skip 1.
endif.
write : / 'Number of KNB1 values found ', v_g_line,
/ 'Number of KNA1 values not found ', v_count,
/ 'Number of KNVP values not found ', v_count1.
endform. " f_error_log
&----
*& Form f_list_display
&----
text
----
--> p1 text
<-- p2 text
----
form f_list_display .
uline.
write : /1 sy-vline, 2 'Recordtype',
13 sy-vline, 14 'Soldtocust',
28 sy-vline, 29 'payer',
40 sy-vline, 41 'Sequence',
56 sy-vline, 57 'Custname',
70 sy-vline, 71 'custadress',
84 sy-vline, 85 'Custcity',
98 sy-vline, 99 'Taxid',
115 sy-vline, 116 'Postalcode',
130 sy-vline, 131 'Branch',
150 sy-vline, 151 'Delivary',
170 sy-vline.
uline.
loop at i_output into v_output.
write : /1 sy-vline, 2 v_output-recordtype,
13 sy-vline, 14 v_output-soldtocust,
28 sy-vline, 29 v_output-payer,
40 sy-vline, 41 v_output-sequence,
56 sy-vline, 57 v_output-custname,
70 sy-vline, 71 v_output-custaddress,
84 sy-vline, 85 v_output-custcity,
98 sy-vline, 99 v_output-taxid,
115 sy-vline, 116 v_output-postalcode,
130 sy-vline, 131 v_output-branch,
150 sy-vline, 151 v_output-delivery,
170 sy-vline.
uline.
clear : v_output.
endloop.
endform. " f_list_display
Thanks,
venkat
‎2006 Sep 25 9:52 AM
first error
<b>remove the quots for l_repid</b>
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
i_buffer_active = 'X'
i_callback_program = <b>L_REPID</b>
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
‎2006 Sep 25 10:39 AM
Hi,
i removed quotes but the values not came.
plz suggest me.
Thanks,
venkat
‎2006 Sep 25 10:55 AM
1stb go to the debugger mode and check values are coming in final internal table i_output.
if not its means there is problem with query...just check it.
i found one more mistake...
form get_knb1 .
* Fetch data from knb1.
select kunnr akont
from knb1
into table i_knb1
<b>where akont in p_akont.</b>so it is better u goto debugger mode and check where is fault.
‎2006 Sep 25 9:54 AM
<b>One quick basic query ...when u run the ABAP you are populating the parameter for <b>P_AKONT</b> ?</b>
Please let us know the same...you need to do that otherwise if would not fetch any data.
Message was edited by: Anurag Bankley
Message was edited by: Anurag Bankley