09-28-2007 6:15 AM
Hi,
I am working on a report where in i have to display the data on the screen as well as upload it into appl server.Here the data is getting uploaded into server,but it is not matching with the data on the screen.Only the last few records of the table are getting uploaded into server.Can anyone tell me why this is happenening?I am sending my code.
FORM data_retrieval.
SELECT kunnr
vkorg
vtweg
spart
parvw
kunn2
FROM knvp
INTO TABLE t_knvp
PACKAGE SIZE 500
WHERE kunnr IN s_kunnr
AND vkorg IN s_vkorg.
IF NOT t_knvp[] IS INITIAL.
SELECT kunnr
vkorg
vtweg
spart
loevm
FROM knvv
INTO TABLE t_knvv
FOR ALL ENTRIES IN t_knvp
WHERE kunnr = t_knvp-kunnr
AND vkorg = t_knvp-vkorg
AND vtweg = t_knvp-vtweg
AND spart = t_knvp-spart
AND loevm IN s_loevm.
LOOP AT t_knvp INTO wa_knvp.
READ TABLE t_knvv INTO wa_knvv WITH KEY kunnr = wa_knvp-kunnr
vkorg = wa_knvp-vkorg
vtweg = wa_knvp-vtweg
spart = wa_knvp-spart.
IF sy-subrc IS INITIAL.
wa_knvp-loevm = wa_knvv-loevm.
MODIFY t_knvp FROM wa_knvp.
APPEND wa_knvp TO t_output.
ENDIF.
ENDLOOP.
*-- generate file
PERFORM download_background.
ENDIF.
ENDSELECT.
ENDFORM. "data_retrieval
&----
*& Form build_cat
&----
text
----
--> p1 text
<-- p2 text
----
FORM build_cat USING temp_fcat TYPE slis_t_fieldcat_alv.
DATA:w_fcat TYPE slis_fieldcat_alv.
*-Customer Number 1
CLEAR w_fcat.
w_fcat-tabname = 't_output'.
w_fcat-fieldname = 'KUNNR'.
w_fcat-reptext_ddic = 'Customer Number1'.
w_fcat-outputlen = 10.
APPEND w_fcat TO temp_fcat.
*-Sales Organization
CLEAR w_fcat.
w_fcat-tabname = 't_output'.
w_fcat-fieldname = 'VKORG'.
w_fcat-reptext_ddic = 'Sales Organization'.
w_fcat-outputlen = 4.
APPEND w_fcat TO temp_fcat.
*-Partner Function
CLEAR w_fcat.
w_fcat-tabname = 't_output'.
w_fcat-fieldname = 'PARVW'.
w_fcat-reptext_ddic = 'Partner Function'.
w_fcat-outputlen = 2.
w_fcat-no_zero = 'X'.
APPEND w_fcat TO temp_fcat.
*-Customer Number of bussiness partner
CLEAR w_fcat.
w_fcat-tabname = 't_output'.
w_fcat-fieldname = 'KUNN2'.
w_fcat-reptext_ddic = 'Customer Number of bussiness partner'.
w_fcat-outputlen = 10.
w_fcat-no_zero = 'X'.
APPEND w_fcat TO temp_fcat.
*-Deletion flag for customer(sales level)
CLEAR w_fcat.
w_fcat-tabname = 't_output'.
w_fcat-fieldname = 'LOEVM'.
w_fcat-reptext_ddic = 'Deletion flag for customer'.
w_fcat-outputlen = 1.
APPEND w_fcat TO temp_fcat.
ENDFORM. "build_cat
&----
*& Form layout_build
&----
text
----
--> p1 text
<-- p2 text
----
FORM layout_build .
f_layout-zebra = 'X'.
f_layout-colwidth_optimize = 'X'. "Optimize column widths
f_layout-window_titlebar = 'Customer Download'.
ENDFORM. " Layout_build
&----
*& Form display_list_layout
&----
text
----
--> p1 text
<-- p2 text
----
form display_list_layout .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = v_repid
IS_LAYOUT = f_layout
IT_FIELDCAT = t_fcat
I_SAVE = 'A'
TABLES
t_outtab = t_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. " display_list_layout
&----
*& Form f_clear_and_refresh
&----
text
----
--> p1 text
<-- p2 text
----
form f_clear_and_refresh .
REFRESH ALL INTERNAL TABLES
REFRESH : t_knvv,
t_knvp,
t_output,
t_fcat.
CLEAR ALL VARIABLES
CLEAR : v_repid,
v_file,
v_file1,
v_time,
v_line.
FREE ALL INTERNAL TABLES
FREE : t_knvv,
t_knvp,
t_output.
endform. " f_clear_and_refresh
&----
*& Form download_background
&----
text
----
--> p1 text
<-- p2 text
----
form download_background .
CONSTANTS: c_pipe TYPE c VALUE '|'.
Get the path to place the file.
IF sy-sysid = c_dev.
CONCATENATE c_dpath sy-datum v_time c_line
'.txt' INTO v_file1.
ENDIF.
Open the dataset to read data into file
OPEN DATASET v_file1 FOR OUTPUT IN TEXT MODE encoding default.
IF NOT t_knvp[] IS INITIAL.
LOOP AT t_knvp INTO wa_knvp.
CONCATENATE : wa_knvp-kunnr
wa_knvp-vkorg
wa_knvp-vtweg
wa_knvp-spart
wa_knvp-parvw
wa_knvp-kunn2
wa_knvp-loevm
INTO v_line SEPARATED BY c_pipe.
TRANSFER v_line TO v_file1.
ENDLOOP.
CLOSE DATASET v_file1.
ENDIF.
09-28-2007 8:36 AM
Hi,
Down load ur data onto presentation server and check it. because if data length exceeds 920 characters per line, u can not see data on file.
use Tcode CG3Y to download file from Application server to Presentation server.
Thanks
Swapna P