WS_DOWNLOAD problem
I am trying to download an internal table with WS_DOWNLOAD. With one table (others work) the data I am getting is garbled in some fields (see below)
{{{{{ b|{{{{{{S,{{{{{ \
The only difference I can find with the tables is that the one I am having trouble with has a few fields of type CURR and CUKY and it seems that this is where the data is bad.
Does anyone know if there a problem with these data types in version 4.6C?
Thank you,
Scott
I see this is your first posting so let me welcome you to this forum. You will find a lot of good information here.
Now on to your question.
CURR fields are stored as packed numbers, i.e. type P in ABAP. CUKY fields are stored as character. You will need to convert the CURR field to character format before you download it the your PC. You can use the WRITE command to accomplish this:
WRITE MY_CURR to MY_CHAR_CURR CURRENCY MY_CUKY.
You can set the character field to the output length of the CURR field. To check that, look at the domain definition of the CURR field in transaction SE11 and on the Definition tab you will see the Output Length.
Also, WS_DOWNLOAD is considered obsolete so consider using GUI_DOWNLOAD instead.
Let us know how it goes.
Similar Messages
-
Problem with WS_DOWNLOAD (URGENT)
Hi All,
The WS_DOWNLOAD i am using is downloading the file to workstation SAP GUI640.
But when testing at client's side, It is coming out of the selection screen without download SAP GUI620.
Can any body help please ASAP.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = v_fname
filetype = 'DAT'
TABLES
data_tab = i_csv[]
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.Hi Kaleem,
As discussed, You can try following ..
1. Search on service.sap.com and findout reason. There is a SAP NOTE Explaining Similar Problem.
2. Remove filetype.
Hope it will work,
DARSHAN
**Reward Points if asnwer is helpful -
Dot - Comma problem in WS_download --
I have 3 fields in the internal table.
I want to download all those fields in to excel sheet based on the selection screen either dot or comma. I am using ws_download. I want to display all records in left side.
I have declared all 3 fields as characters.
Data: a, b,c type c.
If you select dot all the columns are displaying right side.(perfect)
Now if I select comma all the columns are displaying in right side.
Now I want to display all the records are right side even if its comma or dot.
Pl send me the sample code.HI!
It's not exactly an ABAP problem, but maybe an excel problem.
In ABAP you can remove all dots from a string with the following command:
REPLACE ALL OCCURRENCES OF '.' WITH '' IN column1.
In excel you can declare your cells as a text, or as a number. As text it is always aligned to the cell's left side, as a number it is aligned to the right side.
Select a few cells, then right click on them and choose cell properties.
The algnment of the texts, you can overrule with the manual align buttons (left, right, center...)
Regards
Tamá -
Problem with append mode in WS_DOWNLOAD
Hi everybody
I have a problem with downloading two internal tables in one excel sheet.
I am Using FM - WS_DOWNLOAD , MODE = 'A' .
I want to append one IT after another .
But I am getting only the second one ...
MODE - A is for append , correct?
Any clou?
I allready sow all the posts on the forumhi
good
go through this and use accordingly.
Often we face situations where we need to download internal table contents onto an Excel sheet. We are familiar with the function module WS_DOWNLOAD. Though this function module downloads the contents onto the Excel sheet, there cannot be any column headings or we cannot differentiate the primary keys just by seeing the Excel sheet.
For this purpose, we can use the function module XXL_FULL_API. The Excel sheet which is generated by this function module contains the column headings and the key columns are highlighted with a different color. Other options that are available with this function module are we can swap two columns or supress a field from displaying on the Excel sheet. The simple code for the usage of this function module is given below.
Program code :
REPORT Excel.
TABLES:
sflight.
header data................................
DATA :
header1 LIKE gxxlt_p-text VALUE 'Suresh',
header2 LIKE gxxlt_p-text VALUE 'Excel sheet'.
Internal table for holding the SFLIGHT data
DATA BEGIN OF t_sflight OCCURS 0.
INCLUDE STRUCTURE sflight.
DATA END OF t_sflight.
Internal table for holding the horizontal key.
DATA BEGIN OF t_hkey OCCURS 0.
INCLUDE STRUCTURE gxxlt_h.
DATA END OF t_hkey .
Internal table for holding the vertical key.
DATA BEGIN OF t_vkey OCCURS 0.
INCLUDE STRUCTURE gxxlt_v.
DATA END OF t_vkey .
Internal table for holding the online text....
DATA BEGIN OF t_online OCCURS 0.
INCLUDE STRUCTURE gxxlt_o.
DATA END OF t_online.
Internal table to hold print text.............
DATA BEGIN OF t_print OCCURS 0.
INCLUDE STRUCTURE gxxlt_p.
DATA END OF t_print.
Internal table to hold SEMA data..............
DATA BEGIN OF t_sema OCCURS 0.
INCLUDE STRUCTURE gxxlt_s.
DATA END OF t_sema.
Retreiving data from sflight.
SELECT * FROM sflight
INTO TABLE t_sflight.
Text which will be displayed online is declared here....
t_online-line_no = '1'.
t_online-info_name = 'Created by'.
t_online-info_value = 'SURESH KUMAR PARVATHANENI'.
APPEND t_online.
Text which will be printed out..........................
t_print-hf = 'H'.
t_print-lcr = 'L'.
t_print-line_no = '1'.
t_print-text = 'This is the header'.
APPEND t_print.
t_print-hf = 'F'.
t_print-lcr = 'C'.
t_print-line_no = '1'.
t_print-text = 'This is the footer'.
APPEND t_print.
Defining the vertical key columns.......
t_vkey-col_no = '1'.
t_vkey-col_name = 'MANDT'.
APPEND t_vkey.
t_vkey-col_no = '2'.
t_vkey-col_name = 'CARRID'.
APPEND t_vkey.
t_vkey-col_no = '3'.
t_vkey-col_name = 'CONNID'.
APPEND t_vkey.
t_vkey-col_no = '4'.
t_vkey-col_name = 'FLDATE'.
APPEND t_vkey.
Header text for the data columns................
t_hkey-row_no = '1'.
t_hkey-col_no = 1.
t_hkey-col_name = 'PRICE'.
APPEND t_hkey.
t_hkey-col_no = 2.
t_hkey-col_name = 'CURRENCY'.
APPEND t_hkey.
t_hkey-col_no = 3.
t_hkey-col_name = 'PLANETYPE'.
APPEND t_hkey.
t_hkey-col_no = 4.
t_hkey-col_name = 'SEATSMAX'.
APPEND t_hkey.
t_hkey-col_no = 5.
t_hkey-col_name = 'SEATSOCC'.
APPEND t_hkey.
t_hkey-col_no = 6.
t_hkey-col_name = 'PAYMENTSUM'.
APPEND t_hkey.
populating the SEMA data..........................
t_sema-col_no = 1.
t_sema-col_typ = 'STR'.
t_sema-col_ops = 'DFT'.
APPEND t_sema.
t_sema-col_no = 2.
APPEND t_sema.
t_sema-col_no = 3.
APPEND t_sema.
t_sema-col_no = 4.
APPEND t_sema.
t_sema-col_no = 5.
APPEND t_sema.
t_sema-col_no = 6.
APPEND t_sema.
t_sema-col_no = 7.
APPEND t_sema.
t_sema-col_no = 8.
APPEND t_sema.
t_sema-col_no = 9.
APPEND t_sema.
t_sema-col_no = 10.
t_sema-col_typ = 'NUM'.
t_sema-col_ops = 'ADD'.
APPEND t_sema.
CALL FUNCTION 'XXL_FULL_API'
EXPORTING
DATA_ENDING_AT = 54
DATA_STARTING_AT = 5
filename = 'TESTFILE'
header_1 = header1
header_2 = header2
no_dialog = 'X'
no_start = ' '
n_att_cols = 6
n_hrz_keys = 1
n_vrt_keys = 4
sema_type = 'X'
SO_TITLE = ' '
TABLES
data = t_sflight
hkey = t_hkey
online_text = t_online
print_text = t_print
sema = t_sema
vkey = t_vkey
EXCEPTIONS
cancelled_by_user = 1
data_too_big = 2
dim_mismatch_data = 3
dim_mismatch_sema = 4
dim_mismatch_vkey = 5
error_in_hkey = 6
error_in_sema = 7
file_open_error = 8
file_write_error = 9
inv_data_range = 10
inv_winsys = 11
inv_xxl = 12
OTHERS = 13
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
thanks
mrutyun^ -
Problem while using 'WS_DOWNLOAD'
Hi All,
I am using the following function to download internal table data to Excel format.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = wf_dsktp
filetype = 'DBF'
TABLES
data_tab = tb_sprinter
fieldnames = tb_fieldnames
EXCEPTIONS
Here I am filling the tb_fieldnames with the required headings. But the problem is ...
In excel I am getting the headings truncated after 10 characters. Do I need to pass aNy
other parameters to get the complete heading.
before calling the function if I check tb_fieldnames in debugging, I see the full headings .
Please suggest the needful...Hi Rudra,
[ws_download|http://sapearth.com/index.php?option=com_fireboard&func=view&catid=9&id=20]
Regards,
Sravanthi -
Problem with WS_DOWNLOAD
Hi Experts,
I am using WS_DOWNLOAD Function to download internal table to notepad on the desktop.
If the value in the internal table is 23,46 after downloading the table into notepad i'm getting the value as 23.46
all "," in the internal table are replaced by "." while downloading.
I tried to download the internal table using GUI_DOWNLOAD, but here also i am facing the same problem
I have declared the field OF INTERNAL TABLE using WTY_VALOC.
Please give me the solution to the above problem,
Thanks in advance,
Regards,
Kavya.Check with System-->list--->local file--
>spreadsheet. Try once with this download option.
Right now i'm not connected to server so check with the excel settings too.
Hope there is issue with excel settings. This problem doesn't arise in GUI_DOWNLOAD. fm -
Problem with append mode in WS_DOWNLOAD - URGENT
Can anybody help me with this, it is werry urgent .
Thank you werry much .Hi Neno,
WS_DOWNLOAD is no longer used in latest version of SAP. Though this function module exists. You can use GUI_DOWNLOAD instead of it.
Now coming back to your question.
IN WS_DOWNLOAD
parameter MODE = 'A' . "for append
I hope this will solve your issue.
Reward points for all useful answers.
Regards,
SaiRam -
Problem in ws_download while executing in background
Hi,
I am downloading an excel file.
I have written a code like this.
If it is in foreground, it will display in ALV and download the data in an excel file in C:/ drive. IF i run in foreground i am getting the output and also the file is created in C:/ with the data.
If i run that program in background the file is not created. I am not able to see the file in C:/.
How to download a file in background..??
Kindly help meout plz..
KumarThere is a way to download to PC from background, but you really have to jump thru some hoops and there is some stuff to be done on the PC itself. Really its not worth it.
There are a couple ways to work around this, but it depends on the real requirement. For example, say you have a long running report and the user wants to have the report in excel. So you need to run in background, you can run your report in backgroun and update a custom table with the data(or just write to the application server as a file), then the user can run a transaction after the job is completed to download the data to the PC, either from the custom db, or the application server.
Here is a short program which shows how to download a file from the application server to the frontend PC.
report zrich_0001.
parameters: p_file type localfile
default '/usr/sap/trans/data/R903289.TST'.
data: begin of idata occurs 0,
rec type string,
end of idata.
data: xdata type string.
data: stripped type rlgrap-filename.
data: file_path type rlgrap-filename.
data: fe_path type string.
start-of-selection.
* Download Data Files
open dataset p_file for input in text mode.
if sy-subrc = 0.
do.
read dataset p_file into xdata.
if sy-subrc <> 0.
exit.
endif.
idata-rec = xdata.
append idata.
enddo.
endif.
call function 'SO_SPLIT_FILE_AND_PATH'
exporting
full_name = p_file
importing
stripped_name = stripped
file_path = file_path.
concatenate 'C:' stripped into fe_path.
call function 'GUI_DOWNLOAD'
exporting
filename = fe_path
tables
data_tab = idata
exceptions
others = 22.
Regards,
Rich Heilman -
Problem with asset sub no (ANLN2) urgent
hi all experts,
Wishing u All very Happy New Year 2007.
in the asset aquisition report i am getting right output but only one problem is there when asset sub no is changed then i am not getting only aqusition value & Depreciation.
what may be the problem.plz modify the logic where this is required to get the right output.
REPORT Z_FA_ACQ NO STANDARD PAGE HEADING
LINE-SIZE 400
LINE-COUNT 65(3).
TYPE-POOLS : SLIS.
TABLES : ANLA, "ASSET MASTER RECORD-SEGMENT
ANLZ, "time dependent asset allocations
ANLC,
ANEP,
ANEK.
DATA : BEGIN OF T_ANLA OCCURS 0,
BUKRS LIKE ANLA-BUKRS,
ANLN1 LIKE ANLA-ANLN1,
ANLN2 LIKE ANLA-ANLN2,
AKTIV LIKE ANLA-AKTIV,
TXT50 LIKE ANLA-TXT50,
ZUGDT LIKE ANLA-ZUGDT,
MENGE LIKE ANLA-MENGE,
MEINS LIKE ANLA-MEINS,
ANLKL LIKE ANLA-ANLKL,
END OF T_ANLA.
DATA : BEGIN OF T_ANLZ OCCURS 0,
BUKRS LIKE ANLZ-BUKRS,
ANLN1 LIKE ANLZ-ANLN1,
ANLN2 LIKE ANLZ-ANLN2,
GSBER LIKE ANLZ-GSBER,
KOSTL LIKE ANLZ-KOSTL,
STORT LIKE ANLZ-STORT,
RAUMN LIKE ANLZ-RAUMN,
KFZKZ LIKE ANLZ-KFZKZ,
WERKS LIKE ANLZ-WERKS,
END OF T_ANLZ.
DATA : BEGIN OF T_ANEK OCCURS 0,
BUKRS LIKE ANEK-BUKRS,
ANLN1 LIKE ANEK-ANLN1,
ANLN2 LIKE ANEK-ANLN2,
BELNR LIKE ANEK-BELNR,
BUDAT LIKE ANEK-BUDAT,
BZDAT LIKE ANEK-BZDAT,
BLDAT LIKE ANEK-BLDAT,
BUZEI LIKE ANEK-BUZEI,
XBLNR LIKE ANEK-XBLNR,
SGTXT LIKE ANEK-SGTXT,
GJAHR LIKE ANEK-GJAHR,
LNRAN LIKE ANEK-LNRAN,
END OF T_ANEK.
DATA : BEGIN OF T_ANLC OCCURS 0,
BUKRS LIKE ANLC-BUKRS,
ANLN1 LIKE ANLC-ANLN1,
ANLN2 LIKE ANLC-ANLN2,
ANSWL LIKE ANLC-ANSWL,
NAFAP LIKE ANLC-NAFAP,
AAFAP LIKE ANLC-AAFAP,
AFABE LIKE ANLC-AFABE,
GJAHR LIKE ANLC-GJAHR,
END OF T_ANLC.
DATA : BEGIN OF T_ANEP OCCURS 0,
BUKRS LIKE ANEP-BUKRS,
ANLN1 LIKE ANEP-ANLN1,
ANLN2 LIKE ANEP-ANLN2,
ANBTR LIKE ANEP-ANBTR,
NAFAB LIKE ANEP-NAFAB,
GJAHR LIKE ANEP-GJAHR,
AFABE LIKE ANEP-AFABE,
BELNR LIKE ANEP-BELNR,
BUZEI LIKE ANEP-BUZEI,
LNRAN LIKE ANEP-LNRAN,
END OF T_ANEP.
DATA : BEGIN OF IT_FINAL OCCURS 0,
ANLN1 LIKE ANLA-ANLN1,
ANLN2 LIKE ANLA-ANLN2,
AKTIV LIKE ANLA-AKTIV,
TXT50 LIKE ANLA-TXT50,
ZUGDT LIKE ANLA-ZUGDT,
MENGE LIKE ANLA-MENGE,
MEINS LIKE ANLA-MEINS,
GSBER LIKE ANLZ-GSBER,
KOSTL LIKE ANLZ-KOSTL,
STORT LIKE ANLZ-STORT,
RAUMN LIKE ANLZ-RAUMN,
KFZKZ LIKE ANLZ-KFZKZ,
BELNR LIKE ANEK-BELNR,
BUDAT LIKE ANEK-BUDAT,
BZDAT LIKE ANEK-BZDAT,
BLDAT LIKE ANEK-BLDAT,
XBLNR LIKE ANEK-XBLNR,
SGTXT LIKE ANEK-SGTXT,
ANBTR LIKE ANEP-ANBTR,
NAFAB LIKE ANEP-NAFAB,
AAFAP LIKE ANLC-AAFAP,
ANLKL LIKE ANLA-ANLKL,
GJAHR LIKE ANEK-GJAHR,
END OF IT_FINAL.
*added for date logic by sanjeev
DATA:V_LOW LIKE SY-DATUM,
V_HIGH LIKE SY-DATUM,
V_MON(02) TYPE N,
V_YEAR(04) TYPE N.
*end of date logic
DATA : LINE_COLOR(4) TYPE C.
DATA : FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA: EVENT TYPE SLIS_ALV_EVENT OCCURS 0 WITH HEADER LINE.
SELECTION-SCREEN : BEGIN OF BLOCK B_FA WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_BUKRS FOR ANLA-BUKRS DEFAULT 'ML',
S_ANLN1 FOR ANLA-ANLN1,
S_ANLN2 FOR ANLA-ANLN2,
S_ANLKL FOR ANLA-ANLKL,
S_AKTIV FOR ANLA-AKTIV,
S_GSBER FOR ANLZ-GSBER,
S_KOSTL FOR ANLZ-KOSTL,
S_WERKS FOR ANLZ-WERKS,
S_STORT FOR ANLZ-STORT,
S_BUDAT FOR ANEK-BUDAT.
SELECTION-SCREEN : END OF BLOCK B_FA.
SET PF-STATUS '100'.
added for date logic by Sanjeev
IF S_BUDAT-HIGH IS INITIAL.
V_YEAR = S_BUDAT-LOW+0(4).
V_MON = S_BUDAT-LOW+4(2).
IF V_MON LT '04'.
V_YEAR = V_YEAR - 1.
CONCATENATE V_YEAR '0401' INTO V_LOW.
V_HIGH = SY-DATUM.
ELSE.
CONCATENATE V_YEAR '0401' INTO V_LOW.
V_HIGH = S_BUDAT-LOW.
ENDIF.
ELSE.
V_LOW = S_BUDAT-LOW.
V_HIGH = S_BUDAT-HIGH.
ENDIF.
end of logic
SELECT BUKRS ANLN1 ANLN2 AKTIV TXT50 ZUGDT MENGE MEINS ANLKL
FROM ANLA
INTO CORRESPONDING FIELDS OF TABLE T_ANLA
WHERE ANLN1 IN S_ANLN1
AND ANLN2 IN S_ANLN2
AND BUKRS IN S_BUKRS
AND ANLKL IN S_ANLKL
AND AKTIV IN S_AKTIV
AND ZUGDT >= V_LOW " added to get the date logic work
AND ZUGDT <= V_HIGH. " added to get the date logic work
CHECK : NOT T_ANLA[] IS INITIAL.
SELECT BUKRS ANLN1 ANLN2 GSBER KOSTL STORT RAUMN KFZKZ
FROM ANLZ
INTO CORRESPONDING FIELDS OF TABLE T_ANLZ
FOR ALL ENTRIES IN T_ANLA
WHERE ANLN1 = T_ANLA-ANLN1
AND ANLN2 = T_ANLA-ANLN2
AND BUKRS = T_ANLA-BUKRS
AND GSBER IN S_GSBER
AND KOSTL IN S_KOSTL
AND WERKS IN S_WERKS.
SELECT BUKRS ANLN1 ANLN2 BELNR BUDAT XBLNR SGTXT GJAHR BZDAT BLDAT BUZEI
LNRAN FROM ANEK
INTO CORRESPONDING FIELDS OF TABLE T_ANEK
FOR ALL ENTRIES IN T_ANLA
WHERE ANLN1 = T_ANLA-ANLN1
AND ANLN2 = T_ANLA-ANLN2
AND BUKRS = T_ANLA-BUKRS
AND BUDAT >= V_LOW " added to get the date logic work
AND BUDAT <= V_HIGH " added to get the date logic work
AND BZDAT >= V_LOW AND BZDAT <= V_HIGH
AND BLDAT >= V_LOW AND BLDAT <= V_HIGH.
SELECT BUKRS ANLN1 ANLN2 ANSWL NAFAP AAFAP AFABE GJAHR
FROM ANLC
INTO CORRESPONDING FIELDS OF TABLE T_ANLC
FOR ALL ENTRIES IN T_ANLA
WHERE ANLN1 = T_ANLA-ANLN1
AND ANLN2 = T_ANLA-ANLN2
AND BUKRS = T_ANLA-BUKRS
AND AFABE = '01'.
SELECT BUKRS ANLN1 ANLN2 ANBTR NAFAB GJAHR AFABE BELNR BUZEI LNRAN
FROM ANEP
INTO CORRESPONDING FIELDS OF TABLE T_ANEP
FOR ALL ENTRIES IN T_ANLA
WHERE ANLN1 = T_ANLA-ANLN1
AND ANLN2 = T_ANLA-ANLN2
AND BUKRS = T_ANLA-BUKRS
AND AFABE = '01'
AND BZDAT >= V_LOW AND BZDAT <= V_HIGH.
SORT T_ANLC BY BUKRS ANLN1 ANLN2.
SORT T_ANLZ BY BUKRS ANLN1 ANLN2.
SORT T_ANEP BY BUKRS ANLN1 ANLN2 BELNR BUZEI LNRAN.
LOOP AT T_ANLA.
MOVE : T_ANLA-ANLN1 TO IT_FINAL-ANLN1,
T_ANLA-ANLN2 TO IT_FINAL-ANLN2,
T_ANLA-AKTIV TO IT_FINAL-AKTIV,
T_ANLA-TXT50 TO IT_FINAL-TXT50,
t_anla-zugdt TO it_final-zugdt,
T_ANLA-MENGE TO IT_FINAL-MENGE,
T_ANLA-MEINS TO IT_FINAL-MEINS.
READ TABLE T_ANLZ WITH KEY BUKRS = T_ANLA-BUKRS
ANLN1 = T_ANLA-ANLN1
ANLN2 = T_ANLA-ANLN2 BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE : T_ANLZ-GSBER TO IT_FINAL-GSBER,
T_ANLZ-KOSTL TO IT_FINAL-KOSTL,
T_ANLZ-STORT TO IT_FINAL-STORT,
T_ANLZ-RAUMN TO IT_FINAL-RAUMN,
T_ANLZ-KFZKZ TO IT_FINAL-KFZKZ.
ENDIF.
READ TABLE T_ANLC WITH KEY BUKRS = T_ANLA-BUKRS
ANLN1 = T_ANLA-ANLN1
ANLN2 = T_ANLA-ANLN2 BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE : T_ANLC-AAFAP TO IT_FINAL-AAFAP.
ENDIF.
added to get the date logic work
LOOP AT T_ANEK WHERE BUKRS = T_ANLA-BUKRS AND ANLN1 = T_ANLA-ANLN1 AND
ANLN2 = T_ANLA-ANLN2 AND BZDAT >= V_LOW AND BZDAT <= V_HIGH
AND BLDAT >= V_LOW AND BLDAT <= V_HIGH.
MOVE : T_ANEK-BELNR TO IT_FINAL-BELNR,
T_ANEK-BUDAT TO IT_FINAL-BUDAT,
T_ANEK-BZDAT TO IT_FINAL-BZDAT,
T_ANEK-GJAHR TO IT_FINAL-GJAHR,
T_ANEK-XBLNR TO IT_FINAL-XBLNR,
T_ANEK-SGTXT TO IT_FINAL-SGTXT.
READ TABLE T_ANEP WITH KEY BUKRS = T_ANEK-BUKRS
ANLN1 = T_ANLA-ANLN1
BELNR = T_ANEK-BELNR
BUZEI = T_ANEK-BUZEI
LNRAN = T_ANEK-LNRAN
ANLN2 = T_ANLA-ANLN2.
MOVE : T_ANEP-ANBTR TO IT_FINAL-ANBTR,
T_ANEP-NAFAB TO IT_FINAL-NAFAB.
APPEND IT_FINAL.
ENDLOOP.
ENDLOOP.
PERFORM BUILD_FIELDCATALOG.
PERFORM DISPLAY_ALV_REPORT.
PERFORM BUILD_LAYOUT.
FORM BUILD_FIELDCATALOG *
FORM BUILD_FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'ANLN1'.
FIELDCATALOG-SELTEXT_M = 'ASSET MAIN NO'.
FIELDCATALOG-COL_POS = 0.
FIELDCATALOG-OUTPUTLEN = 14.
FIELDCATALOG-EMPHASIZE = 'X'.
FIELDCATALOG-KEY = 'X'.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'ANLN2'.
FIELDCATALOG-SELTEXT_M = 'SUB NO'.
FIELDCATALOG-COL_POS = 1.
FIELDCATALOG-OUTPUTLEN = 7.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'AKTIV'.
FIELDCATALOG-SELTEXT_M = 'CAP.DATE'.
FIELDCATALOG-COL_POS = 2.
FIELDCATALOG-OUTPUTLEN = 10.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'TXT50'.
FIELDCATALOG-SELTEXT_M = 'NAME'.
FIELDCATALOG-COL_POS = 3.
FIELDCATALOG-OUTPUTLEN = 50.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'BUDAT'.
FIELDCATALOG-SELTEXT_M = 'POSTING DATE'.
FIELDCATALOG-COL_POS = 4.
FIELDCATALOG-OUTPUTLEN = 10.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'MENGE'.
FIELDCATALOG-SELTEXT_M = 'QTY'.
FIELDCATALOG-COL_POS = 5.
FIELDCATALOG-OUTPUTLEN = 13.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'MEINS'.
FIELDCATALOG-SELTEXT_M = 'UNITS'.
FIELDCATALOG-COL_POS = 6.
FIELDCATALOG-OUTPUTLEN = 3.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'GSBER'.
FIELDCATALOG-SELTEXT_M = 'BA'.
FIELDCATALOG-COL_POS = 7.
FIELDCATALOG-OUTPUTLEN = 4.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'KOSTL'.
FIELDCATALOG-SELTEXT_M = 'COST CENTER'.
FIELDCATALOG-COL_POS = 8.
FIELDCATALOG-OUTPUTLEN = 13.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'STORT'.
FIELDCATALOG-SELTEXT_M = 'LOCATION'.
FIELDCATALOG-COL_POS = 9.
FIELDCATALOG-OUTPUTLEN = 10.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'RAUMN'.
FIELDCATALOG-SELTEXT_M = 'ROOM'.
FIELDCATALOG-COL_POS = 10.
FIELDCATALOG-OUTPUTLEN = 10.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'KFZKZ'.
FIELDCATALOG-SELTEXT_M = 'LICENSE PLATE NO'.
FIELDCATALOG-COL_POS = 11.
FIELDCATALOG-OUTPUTLEN = 20.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'BELNR'.
FIELDCATALOG-SELTEXT_M = 'DOC NO'.
FIELDCATALOG-COL_POS = 12.
FIELDCATALOG-OUTPUTLEN = 13.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'BZDAT'.
FIELDCATALOG-SELTEXT_M = 'ASSET VAL DATE'.
FIELDCATALOG-COL_POS = 13.
FIELDCATALOG-OUTPUTLEN = 15.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'XBLNR'.
FIELDCATALOG-SELTEXT_M = 'REF NO'.
FIELDCATALOG-COL_POS = 14.
FIELDCATALOG-OUTPUTLEN = 25.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'SGTXT'.
FIELDCATALOG-SELTEXT_M = 'TEXT'.
FIELDCATALOG-COL_POS = 15.
FIELDCATALOG-OUTPUTLEN = 50.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'ANBTR'.
FIELDCATALOG-SELTEXT_M = 'ACQ VAL'.
FIELDCATALOG-DATATYPE = 'CURR'.
FIELDCATALOG-DO_SUM = 'X'.
FIELDCATALOG-COL_POS = 16.
FIELDCATALOG-OUTPUTLEN = 13.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'NAFAB'.
FIELDCATALOG-SELTEXT_M = 'ORD.DEP'.
FIELDCATALOG-DO_SUM = 'X'.
FIELDCATALOG-DATATYPE = 'CURR'.
FIELDCATALOG-COL_POS = 17.
FIELDCATALOG-OUTPUTLEN = 13.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
FIELDCATALOG-FIELDNAME = 'AAFAP'.
FIELDCATALOG-SELTEXT_M = 'UNPLAN DEP'.
FIELDCATALOG-COL_POS = 18.
FIELDCATALOG-OUTPUTLEN = 13.
APPEND FIELDCATALOG TO FIELDCATALOG.
CLEAR FIELDCATALOG.
ENDFORM.
FORM BUILD_LAYOUT *
FORM BUILD_LAYOUT.
GD_LAYOUT-ZEBRA = 'X'.
GD_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
ENDFORM.
FORM DISPLAY_ALV_REPORT *
FORM DISPLAY_ALV_REPORT.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = SY-REPID
i_callback_pf_status_set = '100'
i_callback_user_command = sy-ucomm
I_STRUCTURE_NAME =
IS_LAYOUT = GD_LAYOUT
IT_FIELDCAT = FIELDCATALOG[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT = ' '
IT_EVENTS =
IT_EVENT_EXIT = EVENT[]
IS_PRINT =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'EXCEL'.
PERFORM DOWNEXCEL.
ENDCASE.
form downexcel *
FORM DOWNEXCEL.
DATA : B_FILE1 LIKE RLGRAP-FILENAME.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = ' '
DEF_PATH = 'C:\'
MASK = ',.,..'
MODE = 'S'
TITLE = 'SAVE THIS AS'
IMPORTING
FILENAME = B_FILE1
rc =
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = ' '
CODEPAGE = 'IBM'
FILENAME = B_FILE1
FILETYPE = 'DAT'
MODE = 'A'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = IT_FINAL
fieldnames =
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
GUI_REFUSE_FILETRANSFER = 8
OTHERS = 9.
ENDFORM.
Message was edited by: sanjeev
sanjeev singhHi Prabhu,
THanks for the update but I couldn't find Capitalized Date in BAPI.
I am again getting a new problem please check the following link for my post and let me know if you have come across such issue.
LSMW - Fixed Assets "unexpected record type" problem
Thanks,
Asha. -
Smartforms o/p 2 PDF conversion problem , plz see my code
Hi Smartform Guys
1)I m getting error <b>"CONVT_NO_NUMBER "</b> in converting my Smartform output to PDF.
*Printing of Export Invoice, Packing List,Enclosure to Packing List & *
*Case Marking in one SMART FORMS Layout *
REPORT ZSD_REP_MULTI_PRINT.
TABLES :
vbak,
vbap,
vbpa,
vbfa,
VBRK,
VBRP,
LIKP,
LIPS,
KONV,
objk,
tvko,
ser01,
sadr,
equi,
makt,
mast,
t005t,
kna1,
t001w,
T001,
ADRC,
sscrfields,
zpp_plcmi, "Packing list history For Conf: Item data
zplh, "PACKING LIST HISTORY : HEADER DATA
zpli. "PACKING LIST HISTORY : ITEM DATA
DATA: FM_NAME TYPE RS38L_FNAM,
P_E_DEVTYPE TYPE RSPOPTYPE,
P_JOB_OUTPUT_INFO TYPE SSFCRESCL OCCURS 2000 WITH HEADER LINE,
P_OUTPUT_OPTIONS TYPE SSFCOMPOP OCCURS 0 WITH HEADER LINE,
P_CONTROL_PARAMETERS TYPE SSFCTRLOP OCCURS 0 WITH HEADER LINE ,
P_DOC LIKE DOCS OCCURS 2000 WITH HEADER LINE,
P_LINES LIKE TLINE OCCURS 200,
P_BIN_FILESIZE TYPE I,
P_LANGUAGE TYPE SFLANGU,
P_BIN_FILE TYPE XSTRING.
DATA: T_ITEM TYPE ZSD_TABL_LITEM,
WA_ITEM TYPE ZSD_STRUCT_LITEM,
T_ADRS LIKE ZSD_STRUCT_ADRS OCCURS 0 WITH HEADER LINE,
MSLINES LIKE TLINE OCCURS 1 WITH HEADER LINE,
TIDNO LIKE STXL-TDID,
TNAME LIKE STXL-TDNAME,
TOBJT LIKE STXL-TDOBJECT,
SSORD LIKE VBAK-VBELN,
TOT LIKE VBAK-NETWR,
WORD LIKE SPELL.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
PARAMETERS: P_DELNO LIKE LIKP-VBELN OBLIGATORY,
P_INVNO LIKE VBRK-VBELN OBLIGATORY,
P_DATE LIKE SY-DATUM.
SELECTION-SCREEN END OF BLOCK blk1.
AT SELECTION-SCREEN.
CLEAR T_ADRS.
REFRESH T_ITEM.
T_ADRS-INVNO = P_INVNO.
T_ADRS-INVDAT = P_DATE.
SELECT SINGLE VBELV INTO VBFA-VBELV
FROM VBFA
WHERE VBELN = P_DELNO
AND VBTYP_N = 'J' .
SSORD = VBFA-VBELV.
*Exporter's Address
SELECT SINGLE BUKRS_VF INTO VBAK-BUKRS_VF
FROM VBAK
WHERE VBELN = VBFA-VBELV.
SELECT SINGLE ADRNR
INTO T001-ADRNR
FROM T001
WHERE BUKRS = VBAK-BUKRS_VF.
SELECT SINGLE NAME1 STREET CITY1 POST_CODE1 COUNTRY
INTO (T_ADRS-NAME1,T_ADRS-STREET,T_ADRS-CITY1,
T_ADRS-POST_CODE1, ADRC-COUNTRY)
FROM ADRC
WHERE ADDRNUMBER EQ T001-ADRNR.
SELECT SINGLE LANDX
INTO T_ADRS-COUNTRY
FROM T005T
WHERE SPRAS = 'EN'
AND LAND1 = ADRC-COUNTRY.
**BUYERS NO & DATE
SELECT SINGLE BSTNK BSTDK INTO (T_ADRS-BSTNK,T_ADRS-BSTDK)
FROM VBAK
WHERE VBELN = VBFA-VBELV.
*Consignee Address & Buyer Other Than Consignee
SELECT SINGLE KUNNR KUNAG INTO (LIKP-KUNNR, LIKP-KUNAG)
FROM LIKP WHERE VBELN = P_DELNO.
IF LIKP-KUNNR = LIKP-KUNAG.
SELECT SINGLE NAME1 NAME2 STRAS ORT01 PSTLZ REGIO TELF1 ADRNR
INTO (T_ADRS-CNAME1, T_ADRS-CNAME2, T_ADRS-CSTREET,
T_ADRS-CCITY, T_ADRS-CPCODE, T_ADRS-CREGIO,
T_ADRS-CTELF1, KNA1-ADRNR)
FROM KNA1
WHERE KUNNR = LIKP-KUNNR.
SELECT SINGLE COUNTRY INTO ADRC-COUNTRY
FROM ADRC
WHERE ADDRNUMBER EQ KNA1-ADRNR.
SELECT SINGLE LANDX
INTO T_ADRS-CCOUNTRY
FROM T005T
WHERE SPRAS = 'EN'
AND LAND1 = ADRC-COUNTRY.
T_ADRS-ONAME1 = T_ADRS-CNAME1 .
T_ADRS-ONAME2 = T_ADRS-CNAME2 .
T_ADRS-OSTREET = T_ADRS-CSTREET .
T_ADRS-OCITY = T_ADRS-CCITY.
T_ADRS-OPCODE = T_ADRS-CPCODE .
T_ADRS-OREGIO = T_ADRS-CREGIO.
T_ADRS-OTELF1 = T_ADRS-CTELF1 .
T_ADRS-OCOUNTRY = T_ADRS-CCOUNTRY.
ELSE.
SELECT SINGLE NAME1 NAME2 STRAS ORT01 PSTLZ REGIO TELF1 ADRNR
INTO (T_ADRS-CNAME1, T_ADRS-CNAME2, T_ADRS-CSTREET,
T_ADRS-CCITY, T_ADRS-CPCODE, T_ADRS-CREGIO,
T_ADRS-CTELF1, KNA1-ADRNR)
FROM KNA1
WHERE KUNNR = LIKP-KUNNR.
SELECT SINGLE COUNTRY INTO ADRC-COUNTRY
FROM ADRC
WHERE ADDRNUMBER EQ KNA1-ADRNR.
SELECT SINGLE LANDX
INTO T_ADRS-CCOUNTRY
FROM T005T
WHERE SPRAS = 'EN'
AND LAND1 = ADRC-COUNTRY.
*Buyer Other than Consignee
SELECT SINGLE NAME1 NAME2 STRAS ORT01 PSTLZ REGIO TELF1 ADRNR
INTO (T_ADRS-ONAME1, T_ADRS-ONAME2, T_ADRS-OSTREET,
T_ADRS-OCITY, T_ADRS-OPCODE, T_ADRS-OREGIO,
T_ADRS-OTELF1, KNA1-ADRNR)
FROM KNA1
WHERE KUNNR = LIKP-KUNAG.
SELECT SINGLE COUNTRY INTO ADRC-COUNTRY
FROM ADRC
WHERE ADDRNUMBER EQ KNA1-ADRNR.
SELECT SINGLE LANDX
INTO T_ADRS-OCOUNTRY
FROM T005T
WHERE SPRAS = 'EN'
AND LAND1 = ADRC-COUNTRY.
ENDIF.
*Other's Ref
TIDNO = 'Z071'.
TNAME = SSORD.
TOBJT = 'VBBK'.
PERFORM FINDTEXT.
LOOP AT MSLINES.
T_ADRS-OREF = mslines-tdline(25).
EXIT.
ENDLOOP.
*Buyer's Order No Ref
TIDNO = 'Z023'.
TNAME = SSORD.
TOBJT = 'VBBK'.
PERFORM FINDTEXT.
LOOP AT MSLINES.
T_ADRS-BUYER = mslines-tdline(25).
EXIT.
ENDLOOP.
*Exporter Ref
TIDNO = 'Z072'.
TNAME = SSORD.
TOBJT = 'VBBK'.
PERFORM FINDTEXT.
LOOP AT MSLINES.
T_ADRS-XPREF = mslines-tdline(25).
EXIT.
ENDLOOP.
*Pre-Carraige By
TIDNO = 'Z074'.
TNAME = SSORD.
TOBJT = 'VBBK'.
PERFORM FINDTEXT.
LOOP AT MSLINES.
T_ADRS-PCRG = mslines-tdline(25).
EXIT.
ENDLOOP.
*Place Of reciept by Pre-Carraige
TIDNO = 'Z073'.
TNAME = SSORD.
TOBJT = 'VBBK'.
PERFORM FINDTEXT.
LOOP AT MSLINES.
T_ADRS-PLPCRG = mslines-tdline(25).
EXIT.
ENDLOOP.
*Vessel/Flight No
TIDNO = 'Z075'.
TNAME = SSORD.
TOBJT = 'VBBK'.
PERFORM FINDTEXT.
LOOP AT MSLINES.
T_ADRS-VFNO = mslines-tdline(25).
EXIT.
ENDLOOP.
*Port Of Loading
TIDNO = 'Z077'.
TNAME = SSORD.
TOBJT = 'VBBK'.
PERFORM FINDTEXT.
LOOP AT MSLINES.
T_ADRS-PLOAD = mslines-tdline(25).
EXIT.
ENDLOOP.
*Port Of Discharge
TIDNO = 'Z076'.
TNAME = SSORD.
TOBJT = 'VBBK'.
PERFORM FINDTEXT.
LOOP AT MSLINES.
T_ADRS-PDISG = mslines-tdline(25).
EXIT.
ENDLOOP.
*Final Destination
TIDNO = 'Z070'.
TNAME = SSORD.
TOBJT = 'VBBK'.
PERFORM FINDTEXT.
LOOP AT MSLINES.
T_ADRS-FDEST = mslines-tdline(25).
EXIT.
ENDLOOP.
*Terms Of Delivery & Payment
TIDNO = 'Z080'.
TNAME = SSORD.
TOBJT = 'VBBK'.
PERFORM FINDTEXT.
LOOP AT MSLINES.
T_ADRS-TERMS = mslines-tdline(50).
EXIT.
ENDLOOP.
APPEND T_ADRS.
*BODY SECTION FOR LINE ITEMS
SELECT POSNR KWMENG VRKME WAERK
INTO (VBAP-POSNR, VBAP-KWMENG, VBAP-VRKME, VBAP-WAERK)
FROM VBAP
WHERE VBELN = SSORD.
*Mark/Case No
TIDNO = '0002'.
CONCATENATE SSORD
VBAP-POSNR
INTO TNAME.
TOBJT = 'VBBP'.
PERFORM FINDTEXT.
LOOP AT MSLINES.
WA_ITEM-MARKNO = mslines-tdline(40).
EXIT.
ENDLOOP.
*Packing Type
TIDNO = '0003'.
CONCATENATE SSORD
VBAP-POSNR
INTO TNAME.
TOBJT = 'VBBP'.
PERFORM FINDTEXT.
LOOP AT MSLINES.
WA_ITEM-PACKTYP = mslines-tdline(40).
EXIT.
ENDLOOP.
*Goods Description
TIDNO = '0001'.
CONCATENATE SSORD
VBAP-POSNR
INTO TNAME.
TOBJT = 'VBBP'.
PERFORM FINDTEXT.
LOOP AT MSLINES.
WA_ITEM-PACKTYP = mslines-tdline(40).
EXIT.
ENDLOOP.
*Goods Quantity
WA_ITEM-QTY = VBAP-KWMENG.
WA_ITEM-VRKME = VBAP-VRKME.
*Goods Rate
SELECT SINGLE KNUMV INTO VBAK-KNUMV FROM VBAK WHERE VBELN = SSORD.
SELECT SINGLE KBETR WAERS
INTO (WA_ITEM-RATE, WA_ITEM-WAERS)
FROM KONV
WHERE KNUMV = VBAK-KNUMV
AND KPOSN = VBAP-POSNR
AND KSCHL = 'PR00'.
*Goods Amount
WA_ITEM-AMOUNT = WA_ITEM-QTY * WA_ITEM-RATE.
WA_ITEM-WAERK = VBAP-WAERK.
TOT = TOT + WA_ITEM-AMOUNT.
APPEND WA_ITEM TO T_ITEM.
ENDSELECT.
T_ADRS-TOT = TOT.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = TOT
CURRENCY = VBAP-WAERK
FILLER = ' '
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = WORD
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
TEXT = WORD-WORD.
CONCATENATE TEXT
'DECIMAL'
WORD-WORD
INTO TEXT
SEPARATED BY ' '.
T_ADRS-TOT_WORDS = WORD-WORD.
APPEND T_ADRS.
START-OF-SELECTION.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'Z_SD_REP_MULTI_PRINT'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
P_LANGUAGE = 'EN'.
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
I_LANGUAGE = P_LANGUAGE
I_APPLICATION = 'SAPDEFAULT'
IMPORTING
E_DEVTYPE = P_E_DEVTYPE.
P_OUTPUT_OPTIONS-XSFCMODE = 'X'.
P_OUTPUT_OPTIONS-XSF = SPACE.
P_OUTPUT_OPTIONS-XDFCMODE = 'X'.
P_OUTPUT_OPTIONS-XDF = SPACE.
P_OUTPUT_OPTIONS-TDPRINTER = P_E_DEVTYPE.
P_OUTPUT_OPTIONS-TDDEST = 'LOCL'.
APPEND P_OUTPUT_OPTIONS.
P_CONTROL_PARAMETERS-NO_DIALOG = 'X'.
P_CONTROL_PARAMETERS-GETOTF = 'X'.
P_CONTROL_PARAMETERS-NO_CLOSE = SPACE.
APPEND P_CONTROL_PARAMETERS.
CALL FUNCTION FM_NAME
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = P_CONTROL_PARAMETERS
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = P_OUTPUT_OPTIONS
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = P_JOB_OUTPUT_INFO
JOB_OUTPUT_OPTIONS =
TABLES
T_ADRS = T_ADRS
T_ITEM = T_ITEM
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
P_OTF[] = P_JOB_OUTPUT_INFO-OTFDATA.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
EXPORTING
USE_OTF_MC_CMD = 'X'
ARCHIVE_INDEX =
IMPORTING
BIN_FILESIZE = P_BIN_FILESIZE
TABLES
OTF = P_JOB_OUTPUT_INFO-OTFDATA
DOCTAB_ARCHIVE = P_DOC
LINES = P_LINES
EXCEPTIONS
ERR_CONV_NOT_POSSIBLE = 1
ERR_OTF_MC_NOENDMARKER = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
BREAK-POINT.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = P_BIN_FILESIZE
CODEPAGE = ' '
FILENAME = 'C:\TEMP.PDF'
FILETYPE = 'BIN'
MODE = ''
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH = P_BIN_FILESIZE
TABLES
DATA_TAB = P_LINES
FIELDNAMES =
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = P_BIN_FILESIZE
FILENAME = 'C:\Documents and Settings\pvipin\Desktop\sd.pdf'
FILETYPE = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
IMPORTING
FILELENGTH =
*TABLES
DATA_TAB = P_LINES.
FIELDNAMES =
**EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22 .
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*& Form FINDTEXT
text
FORM FINDTEXT.
REFRESH mslines.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = tidno
language = sy-langu
name = tname
object = tobjt
TABLES
lines = mslines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
DELETE mslines WHERE tdline IS INITIAL.
ENDFORM. "FINDTEXTThnx in Advnce
Moni
Message was edited by: md monirujjaman
Message was edited by: md monirujjaman
Message was edited by: md monirujjaman
Message was edited by: md monirujjaman
Message was edited by: md monirujjaman
Message was edited by: md monirujjaman
Message was edited by: md monirujjaman
Message was edited by: md monirujjaman
Message was edited by: md monirujjamanHello,
I think the following statement is causing problem.
P_OTF[] = P_JOB_OUTPUT_INFO-OTFDATA.
either give:
P_OTF[] = P_JOB_OUTPUT_INFO-OTFDATA[].
or
directly pass P_JOB_OUTPUT_INFO-OTFDATA into FM parameter.
This is because you are filling only header into P_OTF and NOT the Contents of internal table by the statement
P_OTF[] = P_JOB_OUTPUT_INFO-OTFDATA.
let me know whether it works.
Regards, Murugesh AS
have alook at this thread:
Re: SX_OBJECT_CONVERT_OTF_PDF
this may help you
Message was edited by: Murugesh Arcot
Message was edited by: Murugesh Arcot -
Problem with direct input program while uploading data into database
TABLES: BGR00, " Mappensatz
BMM00, " MM01/MM02 BTCI-Kopfdaten
BMMH1, " MM01/MM02 Hauptdaten
BMMH2, " Länderdaten (Steuern)
BMMH3, " Prognosewerte
BMMH4, " Verbrauchswerte
BMMH5, " Kurztexte
BMMH6, " Mengeneinheiten
BMMH7, " Langtexte
BMMH8. " Referentielle EAN's
Satztypen
DATA: MAPPENSATZ LIKE BMM00-STYPE VALUE '0',
KOPFSATZ LIKE BMM00-STYPE VALUE '1',
HAUPTSATZ LIKE BMM00-STYPE VALUE '2',
KUN_SATZ LIKE BMM00-STYPE VALUE 'Z',
LANDSATZ LIKE BMM00-STYPE VALUE '3',
PROGSATZ LIKE BMM00-STYPE VALUE '4',
VERBSATZ LIKE BMM00-STYPE VALUE '5',
KTEXTSATZ LIKE BMM00-STYPE VALUE '6',
MESATZ LIKE BMM00-STYPE VALUE '7',
TEXTSATZ LIKE BMM00-STYPE VALUE '8',
EANSATZ LIKE BMM00-STYPE VALUE '9'.
Common Data Bereich fuer die extern aufgerufenen Routinen
Initialstrukturen
DATA: BEGIN OF COMMON PART RMMMBIMY.
DATA: BEGIN OF I_BMM00.
INCLUDE STRUCTURE BMM00. " Kopfdaten
DATA: END OF I_BMM00.
DATA: BEGIN OF I_BMMH1.
INCLUDE STRUCTURE BMMH1. " Haupdaten
DATA: END OF I_BMMH1.
DATA: BEGIN OF I_BMMH2.
INCLUDE STRUCTURE BMMH2. " Länderdaten
DATA: END OF I_BMMH2.
DATA: BEGIN OF I_BMMH3.
INCLUDE STRUCTURE BMMH3. " Prognosewerte
DATA: END OF I_BMMH3.
DATA: BEGIN OF I_BMMH4.
INCLUDE STRUCTURE BMMH4. " Verbrauchswerte
DATA: END OF I_BMMH4.
DATA: BEGIN OF I_BMMH5.
INCLUDE STRUCTURE BMMH5. " Kurztexte
DATA: END OF I_BMMH5.
DATA: BEGIN OF I_BMMH6.
INCLUDE STRUCTURE BMMH6. " Mengeneinheiten
DATA: END OF I_BMMH6.
DATA: BEGIN OF I_BMMH7.
INCLUDE STRUCTURE BMMH7. " Textzeilen
DATA: END OF I_BMMH7.
DATA: BEGIN OF I_BMMH8.
INCLUDE STRUCTURE BMMH8. " Referentielle EAN's
DATA: END OF I_BMMH8.
DATA: END OF COMMON PART.
DATA: WA LIKE TEDATA-DATA.
Einzelfelder
DATA: GROUP_COUNT(6) TYPE C, " Anzahl Mappen
TRANS_COUNT(6) TYPE C, " alte Definition für rmmmbim0
SATZ_COUNT LIKE MUEB_REST-TRANC, " Trans.zähler neu
H_IND_COUNT LIKE MUEB_REST-D_IND, " Index welches Feld zurücks.
SATZ2_COUNT(6) TYPE C. " Anz. Sätze je Trans. ohne Kopfsatz
DATA: XEOF(1) TYPE C, " X=End of File erreicht
XHAUPTSATZ_EXIST TYPE C, " X=Hauptsatz zum Kopf exi.
NODATA(1) TYPE C. " kein BI für dieses Feld
mk/15.08.94:
DATA: GROUP_OPEN(1) TYPE C. " X=Mappe schon geöffnet
*eject
Konstanten
DATA: C_NODATA(1) TYPE C VALUE '/'. " Default für NODATA
DATA: MATNR_ERW LIKE MARA-MATNR VALUE '0 '.
DATA: MATNR_ERW_INT LIKE MARA-MATNR. "internal sight of '0 '
DATA: MATNR_LAST LIKE MARA-MATNR. "Material number
mk/11.08.94 2.1H:
If this flag is initial, the database updates will be done directly
during background maintenance instead of using a separate update
task. (no usage of this flag in dialogue mode!)
DATA: DBUPDATE_VB(1) VALUE ' '. "note 306628
data: matsync type mat_sync. "wk/99a no update in dialog if called
***INCLUDE ZMUSD070.
TABLES: MARA, "Material Master: General Data
MARC, "Material Master: C Segment
MARD, "Material Master: St Loc/Batch
MBEW, "Material Valuation
MVKE, "Material Master: Sales Data
MLGN, "Material Data per Whse Number
MLAN, "Tax Classification: Material
T001W, "Plants/Branches
TBICU.
DATA: BEGIN OF VALUTAB OCCURS 0.
INCLUDE STRUCTURE RSPARAMS.
DATA: END OF VALUTAB.
DATA: BEGIN OF VARTECH.
INCLUDE STRUCTURE VARID.
DATA: END OF VARTECH.
DATA: PARMS LIKE ZXXDCONV.
DATA: REC_COUNT TYPE I,
REC_COUNT_BAD TYPE I,
ZJOBID LIKE TBIZU-JOBID,
ZJOBCOUNT LIKE TBIZU-JOBCOUNT,
ZMATNR LIKE MARA-MATNR,
ZTEXT(80) TYPE C.
CONSTANTS: LIT_ZERO(18) TYPE C VALUE '000000000000000000',
LIT_CHAR TYPE C VALUE '_',
LIT_CREATE LIKE BMM00-TCODE VALUE 'MM01',
LIT_CHANGE LIKE BMM00-TCODE VALUE 'MM02',
LIT_CHECK(1) TYPE C VALUE 'X'.
DATA: BEGIN OF INP_DATA OCCURS 0,
MATNR(18) TYPE C, " Material code
UMREN(6) TYPE C, " Denominator
MEINH(3) TYPE C, " Alternate UOM
UMREZ(6) TYPE C, " Numerator
END OF INP_DATA.
*eject
SELECTION-SCREEN BEGIN OF BLOCK INOUT WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (13) TEXT-004.
PARAMETERS: P_PC RADIOBUTTON GROUP SRC DEFAULT 'X'.
SELECTION-SCREEN COMMENT (6) TEXT-005.
PARAMETERS: P_UNIX RADIOBUTTON GROUP SRC.
SELECTION-SCREEN COMMENT (6) TEXT-006.
PARAMETERS: P_DS_TYP LIKE ZXXDCONV-DS_TYP
DEFAULT 'ASC'.
SELECTION-SCREEN END OF LINE.
*SELECT-OPTIONS: S_PATH FOR PARMS-PATH
NO INTERVALS
LOWER CASE.
PARAMETERS: P_PATH TYPE RLGRAP-FILENAME.
PARAMETERS: P_HDRLIN LIKE ZXXDCONV-HDR_LINES
DEFAULT 0,
P_JOBNAM LIKE TBICU_S-JOBNAME
MEMORY ID BM1,
P_DI_EXE AS CHECKBOX
DEFAULT LIT_CHECK,
P_MAPPE LIKE BGR00-GROUP
DEFAULT 'MRP_UOM_LOAD'
NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK INOUT.
*eject
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PATH.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_PATH'
CHANGING
FILE_NAME = S_PATH-LOW
FILE_NAME = P_PATH
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2.
AT SELECTION-SCREEN.
Set up parameter record
PARMS-UNIX = P_UNIX.
PARMS-PC = P_PC.
PARMS-DS_TYP = P_DS_TYP.
PARMS-JOBNAME = P_JOBNAM.
PARMS-MAPPE = P_MAPPE.
PARMS-HDR_LINES = P_HDRLIN.
*eject
Main Processing Routine *
START-OF-SELECTION.
Initialization
PERFORM 0000_HOUSEKEEPING.
Initialize transaction data in I_BM00
PERFORM 0500_INIT_BMM00.
Process input files
SORT S_PATH BY SIGN OPTION LOW.
MOVE S_PATH-LOW TO PARMS-PATH.
MOVE P_PATH TO PARMS-PATH.
LOOP AT S_PATH.
AT NEW LOW.
CLEAR INP_DATA.
REFRESH INP_DATA.
Read source data into internal table
PERFORM 1000_GET_SOURCE_DATA TABLES INP_DATA.
Processs each record in internal table
ZTEXT = TEXT-007.
ZTEXT+13 = PARMS-DS_NAME.
PERFORM 4000_PROGRESS_INDICATOR USING ZTEXT.
Initialize transaction data in I_BM00
PERFORM 0500_INIT_BMM00.
LOOP AT INP_DATA.
Reset tables for each record
BMM00 = I_BMM00.
BMMH1 = I_BMMH1.
BMMH6 = I_BMMH6.
Load structures with data
MOVE-CORRESPONDING INP_DATA TO BMM00.
PERFORM 2000_WRITE_OUTPUT USING BMM00.
MOVE-CORRESPONDING INP_DATA TO BMMH1.
PERFORM 2000_WRITE_OUTPUT USING BMMH1.
MOVE-CORRESPONDING INP_DATA TO BMMH6.
PERFORM 2000_WRITE_OUTPUT USING BMMH6.
REC_COUNT = REC_COUNT + 1.
ENDLOOP.
ENDAT.
ENDLOOP.
IF REC_COUNT GT 0
AND P_DI_EXE EQ LIT_CHECK.
PERFORM 3000_START_DI_JOB.
ENDIF.
WRITE: / TEXT-008,
REC_COUNT.
PERFORM 9000_END_OF_JOB.
*eject
Include containing common routines used by direct input programs
INCLUDE ZMUSD071.
*eject
FORM 0500_INIT_BMM00 *
Initialize I_BMM00 with transaction code and views selected *
FORM 0500_INIT_BMM00.
***this changes done by samson**
if not inp_data[] is initial.
select single matnr from mara INTO ZMATNR where matnr = inp_data-matnr.
if sy-subrc = 0.
I_BMM00-TCODE = LIT_CHANGE.
Basic data
I_BMM00-XEIK1 = LIT_CHECK.
else.
I_BMM00-TCODE = LIT_CREATE.
Basic data
I_BMM00-XEIK1 = LIT_CHECK.
endif.
endif.
**this changes above done by samson**
Transaction code
I_BMM00-TCODE = LIT_CHANGE.
Basic data
I_BMM00-XEIK1 = LIT_CHECK.
ENDFORM.
INCLUDE ZMUSD069.
*eject
FORM 0000_HOUSEKEEPING *
Initialization routines *
FORM 0000_HOUSEKEEPING.
PERFORM 0010_LDS_NAME.
PERFORM 0020_DS_NAME.
PERFORM 0030_OPEN_FILE.
PERFORM 0040_INIT_STRUCTS.
ENDFORM.
*eject
FORM 0010_LDS_NAME *
Obtain logical file name from DI job details *
FORM 0010_LDS_NAME.
Check valid job name
SELECT SINGLE * FROM TBICU
WHERE JOBNAME EQ PARMS-JOBNAME.
IF SY-SUBRC EQ 0.
CALL FUNCTION 'RS_VARIANT_VALUES_TECH_DATA'
EXPORTING
REPORT = TBICU-REPNAME
VARIANT = TBICU-VARIANT
IMPORTING
TECHN_DATA = VARTECH
TABLES
VARIANT_VALUES = VALUTAB
EXCEPTIONS
VARIANT_NON_EXISTENT = 1
VARIANT_OBSOLETE = 2
OTHERS = 3.
IF SY-SUBRC EQ 0.
READ TABLE VALUTAB WITH KEY 'LDS_NAME'.
MOVE VALUTAB-LOW TO PARMS-LDS_NAME.
ELSE.
MESSAGE I001 WITH PARMS-JOBNAME.
MESSAGE A099.
ENDIF.
ELSE.
MESSAGE I000 WITH PARMS-JOBNAME.
MESSAGE A099.
ENDIF.
ENDFORM.
*eject
FORM 0040_INIT_STRUCTS *
Initialize structures for direct input records *
FORM 0040_INIT_STRUCTS.
Start of standard SAP initialization from example program RMMMBIME
*------- Write session record -
CLEAR BGR00.
BGR00-STYPE = MAPPENSATZ.
BGR00-GROUP = PARMS-MAPPE.
BGR00-NODATA = C_NODATA.
BGR00-MANDT = SY-MANDT.
BGR00-USNAM = SY-UNAME.
BGR00-START = BGR00-NODATA.
BGR00-XKEEP = BGR00-NODATA.
PERFORM 2000_WRITE_OUTPUT USING BGR00.
*----- Initialize structures -
NODATA = BGR00-NODATA.
PERFORM INIT_STRUKTUREN_ERZEUGEN(RMMMBIMI) USING NODATA.
End of standard SAP initialization from example program RMMMBIME
ENDFORM.
*eject.
FORM 3000_START_DI_JOB *
Start direct input job *
FORM 3000_START_DI_JOB.
ZTEXT = 'Starting '(021).
ZTEXT+9 = TBICU-JOBNAME.
PERFORM 4000_PROGRESS_INDICATOR USING ZTEXT.
CALL FUNCTION 'BI_START_JOB'
EXPORTING
JOBID = ' '
JOBTEXT = TBICU-JOBNAME
REPNAME = TBICU-REPNAME
SERVER = TBICU-EXECSERVER
VARIANT = TBICU-VARIANT
NEW_JOB = 'X'
CONTINUE_JOB = ' '
START_IMMEDIATE = 'X'
DO_NOT_PRINT = 'X'
USERNAME = SY-UNAME
IMPORTING
JOBID = ZJOBID
JOBCOUNT = ZJOBCOUNT
EXCEPTIONS
JOB_OPEN_FAILED = 1
JOB_CLOSE_FAILED = 2
JOB_SUBMIT_FAILED = 3
WRONG_PARAMETERS = 4
JOB_DOES_NOT_EXIST = 5
WRONG_STARTTIME_GIVEN = 6
JOB_NOT_RELEASED = 7
WRONG_VARIANT = 8
NO_AUTHORITY = 9
DIALOG_CANCELLED = 10
JOB_ALREADY_EXISTS = 11
PERIODIC_NOT_ALLOWED = 12
ERROR_NUMBER_GET_NEXT = 13
OTHERS = 14.
IF SY-SUBRC EQ 0.
WRITE: / 'Direct input job'(022), TBICU-JOBNAME, 'started'.
ELSE.
WRITE: / 'Direct input failed with return code'(023), SY-SUBRC.
ENDIF.
FORM 0020_DS_NAME.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
CLIENT = SY-MANDT
LOGICAL_FILENAME = PARMS-LDS_NAME
OPERATING_SYSTEM = SY-OPSYS
IMPORTING
FILE_NAME = PARMS-DS_NAME
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
MESSAGE E002 WITH PARMS-LDS_NAME.
MESSAGE A099.
ENDIF.
ENDFORM.
*eject
FORM 0030_OPEN_FILE *
Open physical file for output *
FORM 0030_OPEN_FILE.
OPEN DATASET PARMS-DS_NAME FOR OUTPUT IN TEXT MODE. "thg191105
OPEN DATASET PARMS-DS_NAME FOR OUTPUT IN TEXT MODE
encoding default. "thg191105
IF SY-SUBRC NE 0.
MESSAGE E003 WITH PARMS-DS_NAME.
MESSAGE A099.
ENDIF.
ENDFORM.
*eject
FORM 1000_GET_SOURCE_DATA *
Read source data into internal table *
--> INP_DATA " Name of internal table passed as parameter *
FORM 1000_GET_SOURCE_DATA TABLES INP_DATA.
CALL FUNCTION 'Z_FILE_UPLOAD'
EXPORTING
UNIX = PARMS-UNIX
PC = PARMS-PC
FILETYPE = PARMS-DS_TYP
FILENAME = PARMS-PATH
HDR_LINES = PARMS-HDR_LINES
TABLES
DATA_TAB = INP_DATA
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
INVALID_SOURCE = 8
OTHERS = 9.
ENDFORM.
*eject
FORM 2000_WRITE_OUTPUT *
Write record in standard SAP structure to UNIX file *
--> I_STRUCT " Name of record passed as parameter *
*FORM 2000_WRITE_OUTPUT USING I_STRUCT."SRY28NOV05
FORM 2000_WRITE_OUTPUT USING I_STRUCT TYPE ANY. "SRY28NOV05
TRANSFER I_STRUCT TO PARMS-DS_NAME.
IF SY-SUBRC NE 0.
MESSAGE E004 WITH PARMS-DS_NAME.
MESSAGE A099.
ENDIF.
ENDFORM.
*eject
*& Form 2100_WS_DOWNLOAD
text *
--> p1 text
<-- p2 text
FORM 2100_WS_DOWNLOAD TABLES INP_DATA.
DATA: FILENAME LIKE RLGRAP-FILENAME. "SRY28NOV05
DATA: W_FILENAME TYPE STRING. "SRY28NOV05
DATA: W_FTYP(10) TYPE C VALUE 'DAT'. "SRY28NOV05
MOVE PARMS-DS_NAME TO FILENAME. "SRY28NOV05
MOVE PARMS-DS_NAME TO W_FILENAME. "SRY28NOV05
*BEGIN OF BLOCK COMMENT BY SRY28NOV05
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = ' '
CODEPAGE = ' '
FILENAME = FILENAME
FILETYPE = 'DAT'
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
importing
filelength =
TABLES
DATA_TAB = INP_DATA
FIELDNAMES =
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
*END OF BLOCK COMMENT BY SRY28NOV05
*BEGIN OF BLOCK ADDED BY SRY28NOV05
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = W_FILENAME
FILETYPE = W_FTYP
TABLES
DATA_TAB = INP_DATA
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*END OF BLOCK ADDED BY SRY28NOV05
ENDFORM. " 2100_WS_DOWNLOAD
*eject
FORM 4000_PROGRESS_INDICATOR *
Write progress text to status bar *
--> TEXT " Text passed as parameter *
FORM 4000_PROGRESS_INDICATOR USING TEXT.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT
EXCEPTIONS
OTHERS = 1.
ENDFORM.
*eject.
FORM 9000_END_OF_JOB *
Close files on UNIX *
FORM 9000_END_OF_JOB.
CLOSE DATASET PARMS-DS_NAME.
ENDFORM.
FORM 1000_GET_SOURCE_DATA TABLES INP_DATA.
CALL FUNCTION 'Z_FILE_UPLOAD'
EXPORTING
UNIX = PARMS-UNIX
PC = PARMS-PC
FILETYPE = PARMS-DS_TYP
FILENAME = PARMS-PATH
HDR_LINES = PARMS-HDR_LINES
TABLES
DATA_TAB = INP_DATA
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
INVALID_SOURCE = 8
OTHERS = 9.
ENDFORM.
*eject
FORM 2000_WRITE_OUTPUT *
Write record in standard SAP structure to UNIX file *
--> I_STRUCT " Name of record passed as parameter *
*FORM 2000_WRITE_OUTPUT USING I_STRUCT."SRY28NOV05
FORM 2000_WRITE_OUTPUT USING I_STRUCT TYPE ANY. "SRY28NOV05
TRANSFER I_STRUCT TO PARMS-DS_NAME.
IF SY-SUBRC NE 0.
MESSAGE E004 WITH PARMS-DS_NAME.
MESSAGE A099.
ENDIF.
ENDFORM.
*eject
*& Form 2100_WS_DOWNLOAD
text *
--> p1 text
<-- p2 text
FORM 2100_WS_DOWNLOAD TABLES INP_DATA.Hi,
Thnaks for your reply, This is my requirement.
Here my problem is i am trying to upload the data from flatfile which contain materil number, denominator, Actual UOM, Nominator field values.
Which is the data i need to upload into MM02 and MM01, if material number is new then it has to create the material, if material is already existing it has to update the UOM values.
here i am getting data into my internal table INP_DATA, from that i am trying to upload the data to database by using job name MRP_MATERIAL_MASTER_DATA_UPLOAD with direct input program RMDATIND.
when i execute my program i am getting success message all the records writtin from flatfile to application server. and job started message.
then if i go into sm37 screen there i execute the job it is also giving active message. if i refresh it it is showing job completed message.
then i look at job log status. there i found that for existing material it is expecting material type, for new material it is giving some gravity error.
So could u help me in this it will be gr8.
Thanks & Regards,
RamNV -
In WS_DOWNLOAD , FILETYPE = 'WK1'
Hi pals,
I am using WS_DOWNLOAD function module in 4.6c, with file type = 'WK1'. i am getting EXCEL(.XLS File) results with out lines(similar to EXCEL SHEET). I need to get excel format(boxes)by using same file type (WK1)
Can any body suggest me.
Thanks in advance.
Balaji.Ok, if you still need a solution. for this. This will work. This program uses the WS_DOWNLOAD function module(as you were) and then uses OLE to open the excel and put the grid lines in. The data is stored on the PC in a temp file, then is save to the real file name after adding the grid lines. The temp file is then deleted from the frontend.
report zrich_0002.
data: it001 type table of t001.
include ole2incl.
data: e_sheet type ole2_object.
data: e_appl type ole2_object.
data: e_work type ole2_object.
data: e_cell type ole2_object.
data: e_borders type ole2_object.
data: tmp_file type localfile value 'C:tmpfile.xls'.
parameters: p_file type localfile default 'C:Test.xls'.
start-of-selection.
select * into table it001
from t001.
call function 'WS_DOWNLOAD'
exporting
filename = tmp_file
filetype = 'WK1'
tables
data_tab = it001.
* Start the application
create object e_appl 'EXCEL.APPLICATION'.
set property of e_appl 'VISIBLE' = 0.
* Open the file
call method of e_appl 'WORKBOOKS' = e_work.
call method of e_work 'OPEN'
exporting
#1 = tmp_file.
get property of e_appl 'Cells' = e_cell.
call method of e_cell 'Select'.
*left
call method of e_cell 'BORDERS' = e_borders exporting #1 = '1'.
set property of e_borders 'LineStyle' = '1'.
set property of e_borders 'WEIGHT' = '2'. "4=max
free object e_borders.
* right
call method of e_cell 'BORDERS' = e_borders exporting #1 = '2'.
set property of e_borders 'LineStyle' = '2'.
set property of e_borders 'WEIGHT' = '2'.
free object e_borders.
* top
call method of e_cell 'BORDERS' = e_borders exporting #1 = '3'.
set property of e_borders 'LineStyle' = '3'.
set property of e_borders 'WEIGHT' = '2'.
free object e_borders.
* bottom
call method of e_cell 'BORDERS' = e_borders exporting #1 = '4'.
set property of e_borders 'LineStyle' = '4'.
set property of e_borders 'WEIGHT' = '2'.
** Close the file
get property of e_appl 'ActiveWorkbook' = e_work.
call method of e_work 'SAVEAS'
exporting
#1 = p_file
#2 = 1. " Don't ask me when closing
call method of e_work 'close'.
* Quit the file
call method of e_appl 'QUIT'.
* Free them up
free object e_borders.
free object e_cell.
free object e_work.
free object e_appl.
* Remove the tmp file from frontend
call function 'WS_FILE_DELETE'
exporting
file = tmp_file.
Please remember to award points for helpful answers and mark you post as solved when your problem is solved completely. Thanks.
Regards,
RIch Heilman -
GUI_DOWNLOAD problem in unicode system
Hi Guru's,
I am facing one prolem in gui_download. we are doing unicode remediation in one report. In the program one internal table declared as of type c with length 255 and data filled into the internal table by importing the data ifrom cluster. After that this internal table used by ws_download function moduel with file type as BIN to download it in word doc file. We replaced the function module with gui_download. It is working fine in non-unicode system but it is not downloading properly in the unicode system.
i am unable to find what is the cause.. I tried with different different codepages giving in run time..it is not solving my problem.
<< Moderator message - Everyone's problem is important. Please do not ask for help quickly. >>
Thanks & Regards,
Sastry R
Edited by: Rob Burbank on Dec 13, 2010 9:39 AMHi Clemens.
I replaced the ws_download function module with gui_download.
here is my code
Earlier before 6.0 code as follows
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
bin_filesize = data_len
filename = p_file
filetype = 'BIN'
TABLES
data_tab = data_tab
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_table_width = 4
invalid_type = 5
no_batch = 6
unknown_error = 7
gui_refuse_filetransfer = 8
OTHERS = 9.
IF sy-subrc <> 0 AND no_error_dlg = space.
MESSAGE i002(sy) WITH text-i03. "FILE OPEN ERROR
ENDIF.
Replaced above with following code
DATA:lv_fname TYPE string,
lv_ftype(10) VALUE 'BIN',
lv_codepage type abap_encod VALUE '4102'.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = data_len
filename = lv_fname
filetype = lv_ftype
codepage = lv_codepage
CHANGING
data_tab = data_tab
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
IF sy-subrc <> 0 AND no_error_dlg = space.
MESSAGE i002(sy) WITH text-i03. "FILE OPEN ERROR
ENDIF.
I tried with all othr code pages also like 4110/4103/1110/1100/1102. It is not working,
It is giving problem in unicode system. File is downloading.but not properly..
and when i am opening the word file it is asking me select encoding type to make document readble along with the available text encoding formats.
Please help me..
Thanks & Regards,
Sastry R -
View maintenence problem in UCCHECK?
Hi everyone,
Does anyone know anything about the unicode error 'VIEW'. I got this when I executed the tcode UCCHECK.
The message I got is:
'Generated Code for View Maintenance Dialog is not Unicode-Compatible You can regenerate with the program RSVIMT_UC_VIEW_MAINT_GEN'.
I tried to regenrate with the current program, but no use.
I read in one of the threads, that if we set the unicode checks active flag in the error program it will be solved.
Tried it but no result again.
I even tried to activate the view related to this program in SE11, as you can expect didn't work again.
So has anyone ever come across this problem? if so please help me in solving this.
Thank you all in anticipation.
Goldie.hi ,
You need to use the transaction UCCHECK.
The report documentation is here
ABAP Unicode Scan Tool UCCHECK
You can use transaction UCCHECK to examine a Unicode program set for syntax errors without having to set the program attribute "Unicode checks active" for every individual program. From the list of Unicode syntax errors, you can go directly to the affected programs and remove the errors. It is also possible to automatically create transport requests and set the Unicode program attribute for a program set.
Some application-specific checks, which draw your attention to program points that are not Unicode-compatible, are also integrated.
Selection of Objects:
The program objects can be selected according to object name, object type, author (TADIR), package, and original system. For the Unicode syntax check, only object types for which an independent syntax check can be carried out are appropriate. The following object types are possibilities:
PROG Report
CLAS Class
FUGR Function groups
FUGX Function group (with customer include, customer area)
FUGS Function group (with customer include, SAP area)
LDBA Logical Database
CNTX Context
TYPE Type pool
INTF Interface
Only Examine Programs with Non-Activated Unicode Flag
By default, the system only displays program objects that have not yet set the Unicode attribute. If you want to use UCCHECK to process program objects that have already set the attribute, you can deactivate this option.
Only Objects with TADIR Entry
By default, the system only displays program objects with a TADIR entry. If you want to examine programs that don't have a TADIR entry, for example locally generated programs without a package, you can deactivate this option.
Exclude Packages $*
By default, the system does not display program objects that are in a local, non-transportable package. If you want to examine programs that are in such a package, you can deactivate this option.
Display Modified SAP Programs Also
By default, SAP programs are not checked in customer systems. If you also want to check SAP programs that were modified in a customer system (see transaction SE95), you can activate this option.
Maximum Number of Programs:
To avoid timeouts or unexpectedly long waiting times, the maximum number of program objects is preset to 50. If you want to examine more objects, you must increase the maximum number or run a SAMT scan (general program set processing). The latter also has the advantage that the data is stored persistently. Proceed as follows:
Call transaction SAMT
Create task with program RSUNISCAN_FINAL, subroutine SAMT_SEARCH
For further information refer to documentation for transaction SAMT.
Displaying Points that Cannot Be Analyzed Statically
If you choose this option, you get an overview of the program points, where a static check for Unicode syntax errors is not possible. This can be the case if, for example, parameters or field symbols are not typed or you are accessing a field or structure with variable length/offset. At these points the system only tests at runtime whether the code is sufficient for the stricter Unicode tests. If possible, you should assign types to the variables used, otherwise you must check runtime behavior after the Unicode attribute has been set.
To be able to differentiate between your own and foreign code (for example when using standard includes or generated includes), there is a selection option for the includes to be displayed. By default, the system excludes the standard includes of the view maintenance LSVIM* from the display, because they cause a large number of messages that are not relevant for the Unicode conversion. It is recommended that you also exclude the generated function group-specific includes of the view maintenance (usually L<function group name>F00 and L<function group name>I00) from the display.
Similarly to the process in the extended syntax check, you can hide the warning using the pseudo comment ("#EC *).
Applikation-Specific Checks
These checks indicate program points that represent a public interface but are not Unicode-compatible. Under Unicode, the corresponding interfaces change according to the referenced documentation and must be adapted appropriately.
View Maintenance
Parts of the view maintenance generated in older releases are not Unicode-compatible. The relevant parts can be regenerated with a service report.
UPLOAD/DOWNLOAD
The function modules UPLOAD, DOWNLOAD or WS_UPLOAD and WS_DOWNLOAD are obsolete and cannot run under Unicode. Refer to the documentation for these modules to find out which routines serve as replacements.
http://www.pac.co.il/infoweek/Resources%5CKeter_ECC6_Upgrade_Presentation_170107.ppt
The above link gives u a power point file on ecc 6.0 updation and what are required .
Check the below links for understanding of unicode.
UCCHECK downporting
UCCHECK
http://www.sap.com/korea/Company/Events/techday05/img/data_01.pdf
http://www.sap-press.de/download/dateien/1240/sappress_unicode_in_sap_systems.pdf
Re: ECC 6.0 Upgrade & changes required in programs
regards,
venkat. -
Problem to upload file in SE78 with REPORT
Hi, the problem is:
I must upload in SE78 from report some files .bmp that are located on server. In the report i use this code:
PERFORM import_bitmap_bds
IN PROGRAM saplstxbitmaps
USING filename
name
'GRAPHICS' "Object
'BMAP' "ID
'BCOL' "B/W
'BMP' "Extension
title
space
'X'
CHANGING l_docid
l_resolution.
Many PC don't have access to the directory of the file on server, so i used to download first the file on local PC (with OPEN DATASET in internal table and then GUI_DOWNLOAD to import on local) because the PERFORM above use in standard code the WS_DOWNLOAD. This work on many PC, but on few don't work because the directories on local are protected from writing (i use the root C:\). There's another solution to do that bypassing GUI_DOWNLOAD, or (more better!) a completely different way?Hi,
if You are Facing the Access problem then it will be difficult to access the path.Try to use some shared folder that way you can prevent this problem,..
Regards
vijay
Maybe you are looking for
-
Is it possible to use several Apple TV in the same home network?
I´ve got the latest Apple TV (ver 2) and I´m impressed of it´s Airplay function. Is it possible to install an Apple TV in several different rooms of your home, each connected to a separate sound- and/or TV system of that room for playing the same or
-
Error while login as sysdba for creating a new db
Hi DBAs, i need to create a new database base, so trying to login as sysdba after exporting <ORACLE_SID> and <ORACLE_HOME> and getting the following error, need your help urgently. SQL> conn / as sysdba exec(): 0509-036 Cannot load program oracleDBDO
-
Trying to upgrade ipad mini to ios7. extracts software but wont restore it . error message 3014..ipad no longer working, just image asking for connection to itunes.Have tried all the troubleshooting suggestions I am capable of. ((((((
-
When i record, it sounds okay when it isn't too loud.. but when I go in the car and turn it up to listen to my songs, it sounds very loud and choppy. What are the best features to make it sound as professional as possible? I have a Samson C01U mic wi
-
Test idoc SALESORDER_CREATEFROMDAT201
i have run this test idoc as inbound idoc using we-19 transaction(test tool for idoc).. when im filling the data into the segments it is asking to enter shipt-to-party or sold-to-party details..but i cannot find these fields in any of the segments..s