‎2008 Jul 29 9:21 AM
hi all ,,
i have a requirement of having to download file presentation server or application server .while downloading making sure that if the field is available then its downloaded to the correct length for which its defined. If its a character field then text should be followed by space and if its a number then it should be leaded by zero to make it to the correct length.this is the piece of code i have used for it to download .but when i see the file after it has been downloaded when the field is empty it is not displaying spaces and what shud be done for zeros to be preceding and for character field followed by a text .any sample code .thanx in advance ......
TYPES : BEGIN OF tp_output,
z1633code(20),
lot_no LIKE mchb-charg,
zcontainer(20),
zserialno(20),
zdeltaqty(15),
not_allocated(15),
committed(15),
END OF tp_output.
TYPES : BEGIN OF tp_data,
line(4096),
END OF tp_data.
DATA : itab_csv_output TYPE STANDARD TABLE OF tp_data,
wa_csv_output TYPE tp_data.
DATA : l_count TYPE i.
DATA : itab_output TYPE STANDARD TABLE OF tp_output WITH HEADER LINE,
wa_ouput TYPE tp_output.
CONSTANTS: con_tab TYPE x VALUE '09'.
FIELD-SYMBOLS: <fs_download>.
*--Count the number of fields
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE wa_output TO <fs_download>.
IF sy-subrc <> 0.
EXIT.
ELSE.
l_count = l_count + 1.
ENDIF.
ENDDO.
CLEAR wa_output.
*--Inserting the fields to the internal table in the required format
LOOP AT itab_output INTO wa_output.
DO l_count TIMES.
ASSIGN COMPONENT sy-index OF STRUCTURE wa_output TO <fs_download>
.
SHIFT <fs_download> LEFT DELETING LEADING space.
CONCATENATE wa_csv_output <fs_download> INTO
wa_csv_output SEPARATED BY con_tab.
ENDDO.
SHIFT wa_csv_output.
APPEND wa_csv_output TO itab_csv_output.
CLEAR wa_csv_output.
ENDLOOP.
‎2008 Jul 29 11:53 AM
Declare the varible as numeric. so that you will get leading zeros....
‎2008 Jul 29 11:53 AM
Declare the varible as numeric. so that you will get leading zeros....