Regarding header proble in FM GUI_download.
Hi,
I want to write header in XL file by using the paramter fieldnames, but the FM is not considering full text what i m giving ,
please see the below code
*To download
DATA : BEGIN OF t_header OCCURS 0,
name(100) TYPE c,
END OF t_header.
DATA : BEGIN OF itab OCCURS 0,
fld1(100) TYPE c,
fld2 TYPE char10,
fld3 TYPE char10,
END OF itab.
DATA: v_pass_path TYPE string.
itab-fld1 = 'Hi'.
itab-fld2 = 'hello'.
itab-fld3 = 'welsuresh'.
APPEND itab.
CLEAR itab.
itab-fld3 = 'welcome'.
APPEND itab.
t_header-name = 'Field1 for sure and ucb and acc'.
APPEND t_header.
t_header-name = 'Field2'.
APPEND t_header.
t_header-name = 'Field3'.
APPEND t_header.
v_pass_path = 'P:\Suresh\UCB\Incidents\INC - sanjay - pooja\File from pooja\suresh.xls'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = v_pass_path
filetype = 'DBF' " This is important
*for XL download
APPEND = 'X'
WRITE_FIELD_SEPARATOR = 'X'
header = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = 'X'
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = itab
fieldnames = t_header.
thanks,
Suresh
Hi Suresh,
Try to replicate through this code,
TABLES: sflight.
DATA:
BEGIN OF t_sflight OCCURS 0,
carrid TYPE sflight-carrid,
connid(5) TYPE c,
fldate TYPE sflight-fldate,
seatsmax TYPE sflight-seatsmax,
seatsocc TYPE sflight-seatsocc,
END OF t_sflight.
DATA:
BEGIN OF t_header OCCURS 0,
header(50) TYPE c,
END OF t_header.
PARAMETERS: p_carr TYPE sflight-carrid.
*DATA: t_sflight TYPE TABLE OF sflight WITH HEADER LINE.
SELECT carrid connid fldate seatsmax seatsocc
FROM sflight
INTO TABLE t_sflight
WHERE carrid = p_carr.
t_header-header = 'Carrid'.
APPEND t_header.
t_header-header = 'Connid'.
APPEND t_header.
t_header-header = 'Fldate'.
APPEND t_header.
t_header-header = 'Max'.
APPEND t_header.
t_header-header = 'Min'.
APPEND t_header.
LOOP AT t_sflight .
WRITE: / t_sflight-carrid,
t_sflight-connid,
t_sflight-fldate,
t_sflight-seatsmax,
t_sflight-seatsocc.
ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\My Documents\temp\test.xls'
filetype = 'DAT'
TABLES
data_tab = t_sflight
fieldnames = t_header.
Regards
Adil
Similar Messages
-
Header getting repeated in GUI_DOWNLOAD
Hi,
I am downloading a report output to local file on PC.
For this I'm using FM GUI_DOWNLOAD with file type as 'DAT'.
If the no. records in the table, that i am passing to the FM, are more than 30,000 then the header (which am passing to FM through 'Fieldnames') is getting repeated after every 9810 row.
Please suggest me how to get the header displayed only once as in this case it is getting displayed 4 times in the downloaded file (text file as well as excel file).
Thanks,
InderHi,
Sure it is unusual.
have you checked whether the "header" was not repeated in the internal table itself?
Best regards,
Guillaume -
Regarding Header And Footer in Data type Creation
Hi All,
Can Any One Please Send me One Screen Shot Developed with Header And Footer in the Data type Creation
I want to Know How to Create And where to create that in DT Creation
And Why Do we need Both of these in DT Creation
Regards
VamsiHi,
Will u Please send One Screen With These Details, So that I Can Uderstand More
ID : [email protected]
Please send
Regards
Vamsi -
Regarding Header(top-of-page) in ALV Report
Dear All,
I am displaying name and address of company on the top of alv report and after that alv grid is displaying.
e.g.
'XYZ' LTD.
ADDRESS1,PINCODE1.
ACCOUNTING DOC.NO. DOC TYPE G/L ACCT. AMOUNT
123456 DD 6353 444400
123457 DD 6334 455500
Issue : Header is coming on all the pages I want it to come only on first page.
I am using REUSE_ALV_COMMENTARY_WRITE function for top of page.
Pls , suggest any suitable suggestion.
Thanks & regards,
Sandip SonarHi,
check the below code
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = i_repid
it_fieldcat = header
is_layout = gt_layout
i_callback_top_of_page = 'TOP-OF-PAGE1'
i_grid_title = xyz
it_sort = gt_sort[]
i_default = 'X'
i_save = 'U'
is_variant = gt_variant
it_events = gt_events
tables
t_outtab = t_output.
form top-of-page1.
data: header type slis_t_listheader,
wa type slis_listheader,
flag(1).
if flag is initial.
TITLE AREA
wa-typ = 'S'.
wa-info = text-h04.
append wa to header.
wa-typ = 'S'.
write sy-datum to wa-info mm/dd/yyyy.
concatenate text-h03 wa-info into wa-info separated by space.
append wa to header.
wa-typ = 'S'.
concatenate text-h02 sy-uname into wa-info separated by space.
append wa to header.
wa-typ = 'S'.
concatenate text-h01 sy-repid into wa-info separated by space.
append wa to header.
********" LOGO
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = header
i_logo = 'ENJOYSAP_LOGO'.
*********" LOGO
flag = 'x'.
endif.
endform.
Edited by: sateesh kumar on Nov 30, 2009 10:47 AM -
Regarding header line in internal table
Hi Experts,
I wrote the following code to test the value of header line.
TABLES: sflight.
DATA: itab LIKE STANDARD TABLE OF sflight WITH HEADER LINE.
SELECT * FROM sflight UP TO 10 ROWS.
APPEND sflight to itab.
ENDSELECT.
WRITE:/ itab-carrid, itab-connid, itab-price
1. o/p i got was the initial default values.
My question is that->
will this display the last record appended to the itab or not???
Could anyone please clear my doubt ??
Regards
SudhansuHi
Loop at your itab and inside there write the code
TABLES: sflight.
DATA: itab LIKE STANDARD TABLE OF sflight WITH HEADER LINE.
SELECT * FROM sflight UP TO 10 ROWS.
APPEND sflight to itab.
ENDSELECT.
<b>loop at itab.
WRITE:/ itab-carrid, itab-connid, itab-price
endloop.</b>
regards
Shiva -
Hello
I am developing the software related to the Ethernet for vc707 board but i am getting difficulty to select the header file,
I got some demo code but confuse how they came to know about a particular header file is required for this, I have never
seen before these kind of library so please help me so i can choose the proper header file for the further development.
Thanks & Regards
AntrikshI had the same exception occur in my JNI code and I have some advice on things to look for.
Symptoms: The C++ code runs fine when called in an native executable but when it is wrapped by a JNI call inside a DLL you get the following exception:
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_STACK_OVERFLOW occurred at PC=0x100d72e5
Function name=_chkstk
The address will be different of course.
In my tests I isolated the problem to an allocation of a char array like so at the top of one of my wrapped C++ methods:
char buf[650000];
As you see this code is requesting 650000 bytes of stack memory. When run in a native executable there was no problem but when I ran it wrapped in the JNI call it blew up.
Conclusion: There is a much smaller stack space when using JNI OR the added overhead of my JNI wrapper exhausted the available stack space OR this is a stack space issue related to DLLs.
Hope this helps. Anyone with insight on this please put in your 2 cents. -
Hi all,
Below i m giving my ALV program actually my requirement is i have to get "program name","date" ,"time" , and "pageno".
in the header of the report.
so i tried but i m not getting can anyonehelp me or change my code as per my requirement.
<code>
*ztest_alv_raj.
*& Report ZSAMPLEALV3 *
REPORT ZSAMPLEALV3
MESSAGE-ID Z00.
TABLE DECLARATIONS
TABLES : EKKO. "Purchasing Document Header
CONSTANTS DECLARATIONS
CONSTANTS : C_EBELN(5) VALUE 'EBELN'.
DATA DECLARATIONS
DATA : V_FLAG, "For Select Status
V_DATA(50). "To Store Data
TYPE DECLARATIONS FOR ALV *
TYPE-POOLS : SLIS.
*Type Declarations for Field Catalog for Basic List
DATA : I_FLDCAT_HEAD TYPE SLIS_T_FIELDCAT_ALV,
WA_FLDCAT_HEAD TYPE SLIS_FIELDCAT_ALV.
*Type Declarations for Field Catalog for Secondary List
DATA : I_FLDCAT_ITEM TYPE SLIS_T_FIELDCAT_ALV,
WA_FLDCAT_ITEM TYPE SLIS_FIELDCAT_ALV.
*Type Declarations for Displaying Images on Basic Grid
DATA : I_COMMENT TYPE SLIS_T_LISTHEADER,
WA_COMMENT TYPE SLIS_LISTHEADER.
*Type Declarations for Displaying Images on Secondary Grid
DATA : I_COMMENT_SEC TYPE SLIS_T_LISTHEADER,
WA_COMMENT_SEC TYPE SLIS_LISTHEADER.
*Type Declarations for ALV Events for Basic Grid
DATA : I_EVENTS TYPE SLIS_T_EVENT,
WA_EVENT LIKE LINE OF I_EVENTS.
*Type Declarations for ALV Events for Secondary Grid
DATA : I_EVENTS_SEC TYPE SLIS_T_EVENT,
WA_EVENT_SEC LIKE LINE OF I_EVENTS.
*Type Declarations for Layout Design
DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
*Type Declarations for Linking the fields
DATA : WA_KEYINFO TYPE SLIS_KEYINFO_ALV.
Type declarations for coloring field
DATA : wa_color type LVC_S_SCOL.
DATA: IT_COLOR TYPE TABLE OF LVC_S_SCOL.
INTERNAL TABLE DECLARATIONS
*--Internal Table for Basic List
DATA : BEGIN OF IT_FINAL_BAS OCCURS 0,
EBELN LIKE EKKO-EBELN, "Purchasing Document Number
BUKRS LIKE EKKO-BUKRS, "Company Code
AEDAT LIKE EKKO-AEDAT, "Date on which the record was created
EKORG LIKE EKKO-EKORG, "Purchasing Organization
EKGRP LIKE EKKO-EKGRP, "Purchasing group
COLOR(3) , "For applying color
END OF IT_FINAL_BAS.
*--Internal Table for Secondary List
DATA : BEGIN OF IT_FINAL_SEC OCCURS 0,
EBELN LIKE EKPO-EBELN, "Purchasing Document Number
MATNR LIKE EKPO-MATNR, "Material Number
TXZ01 LIKE EKPO-TXZ01, "Material Desc
WERKS LIKE EKPO-WERKS, "Plant
LGORT LIKE EKPO-LGORT, "Location
MATKL LIKE EKPO-MATKL, "Material Group
MENGE LIKE EKPO-MENGE, "Purchase order quantity
MEINS LIKE EKPO-MEINS, "Order unit
NETPR LIKE EKPO-NETPR, "Net price in purchasing document (in document currency)
NETWR LIKE EKPO-NETWR, "Net order value in PO currency
DUMMY LIKE ICON-ID, "For placing Icon
COLOR(3) , "For applying color
END OF IT_FINAL_SEC.
*--Internal Table for Secondary List with selected records
DATA : BEGIN OF I_ITEM_DISPLAY OCCURS 0,
EBELN LIKE EKPO-EBELN, "Purchasing Document Number
MATNR LIKE EKPO-MATNR, "Material Number
TXZ01 LIKE EKPO-TXZ01, "Material Desc
WERKS LIKE EKPO-WERKS, "Plant
LGORT LIKE EKPO-LGORT, "Location
MATKL LIKE EKPO-MATKL, "Material Group
MENGE LIKE EKPO-MENGE, "Purchase order quantity
MEINS LIKE EKPO-MEINS, "Order unit
NETPR LIKE EKPO-NETPR, "Net price in purchasing document (in document currency)
NETWR LIKE EKPO-NETWR, "Net order value in PO currency
DUMMY LIKE ICON-ID, "For placing Icon
COLOR(3) , "For applying color
END OF I_ITEM_DISPLAY.
SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-H01.
SELECT-OPTIONS: S_EBELN FOR EKKO-EBELN.
SELECTION-SCREEN END OF BLOCK B1.
Event : INITIALIZATION
INITIALIZATION.
MOVE 'Developed by'(001) TO V_DATA.
Event : AT SELECTION SCREEN
AT SELECTION-SCREEN.
PERFORM VALIDATE_EBELN.
Event : START-OF-SELECTION
START-OF-SELECTION.
*--Getting the Data
PERFORM GET_DATA.
*--Generating the Field catalog for basic and secondary grid
PERFORM GET_FLDCAT.
*--Generating the Layout for basic and secondary grid
PERFORM GET_LAYOUT.
*--Generating the key infor to link Basic grid to Secondary grid
PERFORM GET_KEYINFO.
*--Generating the Events for Basic and Secondary Grid
PERFORM GET_EVENTS.
Event : END-OF-SELECTION
END-OF-SELECTION.
IF V_FLAG EQ 'X'.
*--Generating Basic List
PERFORM DISP_BASIC_LIST.
ELSE.
MESSAGE I010 WITH 'No Data Found To Display'(002).
ENDIF.
SUB-ROUTINES
*& Form VALIDATE_EBELN
Validating the PO No
FORM VALIDATE_EBELN .
SELECT EBELN
UP TO 1 ROWS
INTO (EKKO-EBELN)
FROM EKKO
WHERE EBELN IN S_EBELN.
ENDSELECT.
IF SY-SUBRC NE 0.
MESSAGE I010 WITH 'Invalid PO No'(003) S_EBELN-LOW 'To'(004) S_EBELN-HIGH.
ENDIF.
ENDFORM. " VALIDATE_EBELN
*& Form GET_DATA
Getting Basic List and Secondary List Data
FORM GET_DATA .
*--Getting Basic List Data
SELECT EBELN "PO No
BUKRS "Company Code
AEDAT "Creation Date
EKORG "Purch Org
EKGRP "Purch Group
INTO TABLE IT_FINAL_BAS
FROM EKKO
WHERE EBELN IN S_EBELN.
*--Getting Secondary List Data
IF SY-SUBRC EQ 0.
SELECT EBELN "PO No
MATNR "Material No
TXZ01 "Material Desc
WERKS "Plant
LGORT "Location
MATKL "Material Group
MENGE "PO Qty
MEINS "Unit
NETPR "Net Price
NETWR "Net Value
INTO TABLE IT_FINAL_SEC
FROM EKPO
WHERE EBELN IN S_EBELN.
ENDIF.
IF SY-SUBRC EQ 0.
V_FLAG = 'X'.
ELSE.
V_FLAG = SPACE.
ENDIF.
ENDFORM. " GET_DATA
*& Form GET_FLDCAT
Generating the Field Catalog
FORM GET_FLDCAT .
*--Generating the Field Catalog for Basic List
WA_FLDCAT_HEAD-FIELDNAME = 'EBELN'(005).
WA_FLDCAT_HEAD-COL_POS = '1'.
WA_FLDCAT_HEAD-JUST = 'C'.
WA_FLDCAT_HEAD-OUTPUTLEN = '12'.
WA_FLDCAT_HEAD-SELTEXT_M = 'PO Number'(006).
WA_FLDCAT_HEAD-DDICTXT = 'M'.
WA_FLDCAT_HEAD-REF_TABNAME = ' '.
WA_FLDCAT_HEAD-HOTSPOT = 'X'.
APPEND WA_FLDCAT_HEAD TO I_FLDCAT_HEAD.
CLEAR WA_FLDCAT_HEAD .
WA_FLDCAT_HEAD-FIELDNAME = 'BUKRS'(007).
WA_FLDCAT_HEAD-COL_POS = '2'.
WA_FLDCAT_HEAD-OUTPUTLEN = '12'.
WA_FLDCAT_HEAD-SELTEXT_M = 'Company Code'(008).
WA_FLDCAT_HEAD-DDICTXT = 'M'.
APPEND WA_FLDCAT_HEAD TO I_FLDCAT_HEAD.
WA_FLDCAT_HEAD-FIELDNAME = 'AEDAT'(009).
WA_FLDCAT_HEAD-COL_POS = '3'.
WA_FLDCAT_HEAD-OUTPUTLEN = '10'.
WA_FLDCAT_HEAD-SELTEXT_M = 'PO Date'(010).
WA_FLDCAT_HEAD-DDICTXT = 'M'.
APPEND WA_FLDCAT_HEAD TO I_FLDCAT_HEAD.
WA_FLDCAT_HEAD-FIELDNAME = 'EKORG'(011).
WA_FLDCAT_HEAD-COL_POS = '4'.
WA_FLDCAT_HEAD-OUTPUTLEN = '6'.
WA_FLDCAT_HEAD-SELTEXT_M = 'PO Org'(012).
WA_FLDCAT_HEAD-DDICTXT = 'M'.
APPEND WA_FLDCAT_HEAD TO I_FLDCAT_HEAD.
WA_FLDCAT_HEAD-FIELDNAME = 'EKGRP'(013).
WA_FLDCAT_HEAD-COL_POS = '5'.
WA_FLDCAT_HEAD-OUTPUTLEN = '8'.
WA_FLDCAT_HEAD-SELTEXT_M = 'PO Group'(014).
WA_FLDCAT_HEAD-DDICTXT = 'M'.
WA_FLDCAT_HEAD-DO_SUM = 'X'.
APPEND WA_FLDCAT_HEAD TO I_FLDCAT_HEAD.
*--Generating the Field Catalog for secondary List
WA_FLDCAT_ITEM-FIELDNAME = 'EBELN'(005).
WA_FLDCAT_ITEM-COL_POS = '1'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '12'.
WA_FLDCAT_ITEM-SELTEXT_M = 'PO Number'(006).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
WA_FLDCAT_ITEM-REF_TABNAME = ' '.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'MATNR'(015).
WA_FLDCAT_ITEM-COL_POS = '2'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '18'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Item Number'(016).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
WA_FLDCAT_ITEM-REF_TABNAME = ' '.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'TXZ01'(017).
WA_FLDCAT_ITEM-COL_POS = '3'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '40'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Item Desc'(018).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'WERKS'(019).
WA_FLDCAT_ITEM-COL_POS = '4'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '6'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Plant'(020).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'LGORT'(021).
WA_FLDCAT_ITEM-COL_POS = '5'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '9'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Location'(022).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'MATKL'(023).
WA_FLDCAT_ITEM-COL_POS = '6'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '10'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Mat Group'(024).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'MENGE'(025).
WA_FLDCAT_ITEM-COL_POS = '7'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '17'.
WA_FLDCAT_ITEM-SELTEXT_M = 'PO Qty'(026).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'MEINS'(027).
WA_FLDCAT_ITEM-COL_POS = '8'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '3'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Unit'(028).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'NETPR'(029).
WA_FLDCAT_ITEM-COL_POS = '9'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '14'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Net Price'(037).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'NETWR'(030).
WA_FLDCAT_ITEM-COL_POS = '10'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '16'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Net Value'(031).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
WA_FLDCAT_ITEM-FIELDNAME = 'DUMMY'(038).
WA_FLDCAT_ITEM-COL_POS = '11'.
WA_FLDCAT_ITEM-JUST = 'C'.
WA_FLDCAT_ITEM-OUTPUTLEN = '3'.
WA_FLDCAT_ITEM-SELTEXT_M = 'Status'(039).
WA_FLDCAT_ITEM-DDICTXT = 'M'.
WA_FLDCAT_ITEM-ICON = 'X'.
APPEND WA_FLDCAT_ITEM TO I_FLDCAT_ITEM.
ENDFORM. " GET_FLDCAT
*& Form DISP_BASIC_LIST
Generating the Basic List
FORM DISP_BASIC_LIST .
**--Applying the color to record in Basic List
SORT IT_FINAL_BAS BY BUKRS.
LOOP AT IT_FINAL_BAS.
IF IT_FINAL_BAS-BUKRS LE '1000'.
IT_FINAL_BAS-COLOR = 'C21'.
ELSEIF IT_FINAL_BAS-BUKRS GT '1000' AND IT_FINAL_BAS-BUKRS LE '2000'.
IT_FINAL_BAS-COLOR = 'C41'.
ELSEIF IT_FINAL_BAS-BUKRS GT '2000' AND IT_FINAL_BAS-BUKRS LE '3000'.
IT_FINAL_BAS-COLOR = 'C71'.
ELSEIF IT_FINAL_BAS-BUKRS GT '3000'.
IT_FINAL_BAS-COLOR = 'C51'.
ELSE.
IT_FINAL_BAS-COLOR = 'C61'.
ENDIF.
MODIFY IT_FINAL_BAS INDEX SY-TABIX.
ENDLOOP.
*--Generating the Grid output
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'ZTEST_ALV_RAJ'
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 = 'PLAIN_BACKGROUND'
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = I_FLDCAT_HEAD
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = I_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 = IT_FINAL_BAS
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. " DISP_BASIC_LIST
*& Form GET_EVENTS
Getting the ALV Events
FORM GET_EVENTS .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = I_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 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.
*--Calling the User Defined sub-routines for ALV Events
IF NOT I_EVENTS[] IS INITIAL.
READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
WA_EVENT-FORM = 'GENERATE_USERCOMMAND_HEADER'.
MODIFY I_EVENTS FROM WA_EVENT INDEX SY-TABIX.
READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
WA_EVENT-FORM = 'FRM_TOP_OF_PAGE'.
MODIFY I_EVENTS FROM WA_EVENT INDEX SY-TABIX.
READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'END_OF_LIST'.
WA_EVENT-FORM = 'GENERATE_USERCOMMAND_FOOTER'.
MODIFY I_EVENTS FROM WA_EVENT INDEX SY-TABIX.
READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
WA_EVENT-FORM = 'GENERATE_USERCOMMAND3'.
MODIFY I_EVENTS FROM WA_EVENT INDEX SY-TABIX.
ENDIF.
ENDFORM. " GET_EVENTS
*& Form GENERATE_USERCOMMAND_HEADER
Displaying Header-Text and Logo on Grid
FORM GENERATE_USERCOMMAND_HEADER.
CLEAR I_COMMENT[].
WA_COMMENT-TYP = 'H'.
WA_COMMENT-INFO = 'General Purchase Order Info'(032).
APPEND WA_COMMENT TO I_COMMENT.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_COMMENT
I_LOGO = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID = 'X'.
ENDFORM. " GENERATE_USERCOMMAND
FORM FRM_TOP_OF_PAGE.
write :/ text-005 intensified on.
write :/ text-006 , sy-sysid,14 sy-mandt.
write :/ text-007 , sy-uname.
write :/ text-008 , sy-datum.
write :/ text-009 , sy-uzeit.
skip.
ENDFORM.
*& Form GENERATE_USERCOMMAND_FOOTER
Displaying Footer-Text
FORM GENERATE_USERCOMMAND_FOOTER .
CLEAR I_COMMENT[].
WA_COMMENT-TYP = 'S'.
WA_COMMENT-KEY = V_DATA.
WA_COMMENT-INFO = 'Rajesh'(033).
APPEND WA_COMMENT TO I_COMMENT.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_COMMENT
I_LOGO = ''
I_END_OF_LIST_GRID = 'X'.
ENDFORM. " GENERATE_USERCOMMAND_FOOTER
*& Form GENERATE_USERCOMMAND3
Getting the F-Code and Calling Secondary List
--> P_UCOMM LIKE SY-UCOMM
--> P_SELFIELD TYPE SLIS_SELFIELD
FORM GENERATE_USERCOMMAND3 USING P_UCOMM LIKE SY-UCOMM
P_SELFIELD TYPE SLIS_SELFIELD.
CASE P_UCOMM.
WHEN '&IC1'. "DOUBLE CLICK Func-Code
READ TABLE IT_FINAL_BAS INDEX P_SELFIELD-TABINDEX.
REFRESH I_ITEM_DISPLAY.
*--Applying the color to record in Secondary List
LOOP AT IT_FINAL_SEC WHERE EBELN = IT_FINAL_BAS-EBELN.
IF IT_FINAL_SEC-NETPR EQ 0.
IT_FINAL_SEC-DUMMY = '@0A@'.
IT_FINAL_SEC-COLOR = 'C61'.
ELSEIF IT_FINAL_SEC-NETPR GT 0 AND IT_FINAL_SEC-NETPR LE 200.
IT_FINAL_SEC-DUMMY = '@09@'.
IT_FINAL_SEC-COLOR = 'C41'.
ELSEIF IT_FINAL_SEC-NETPR GT 200 AND IT_FINAL_SEC-NETPR LE 1000.
IT_FINAL_SEC-DUMMY = '@08@'.
IT_FINAL_SEC-COLOR = 'C71'.
ELSEIF IT_FINAL_SEC-NETPR GT 1000.
IT_FINAL_SEC-DUMMY = '@6P@'.
IT_FINAL_SEC-COLOR = 'C51'.
ENDIF.
MODIFY IT_FINAL_SEC INDEX SY-TABIX.
MOVE-CORRESPONDING IT_FINAL_SEC TO I_ITEM_DISPLAY.
APPEND I_ITEM_DISPLAY.
CLEAR I_ITEM_DISPLAY.
ENDLOOP.
*--Getting the ALV Events of Secondary List
PERFORM GET_EVENTS_SEC.
*--Generating the ALV Secondary Grid output
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'ZTEST_ALV_RAJ'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = 'PLAIN_BACKGROUND'
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = I_FLDCAT_ITEM
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = I_EVENTS_SEC
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
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = I_ITEM_DISPLAY
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.
ENDCASE.
ENDFORM. " GENERATE_USERCOMMAND3
*& Form GET_LAYOUT
Generating the Layout
FORM GET_LAYOUT .
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'. "OPTIMIZING FIELD WIDTH
WA_LAYOUT-ZEBRA = 'X'. "PUTTING ZEBRA COLORS
WA_LAYOUT-INFO_FIELDNAME = 'COLOR'(034). "APPLYING COLORS TO ROWS
ENDFORM. " GET_LAYOUT
*& Form GET_KEYINFO
Getting Key info
FORM GET_KEYINFO .
*--Linking the Basic List to Secondary List
WA_KEYINFO-HEADER01 = C_EBELN.
WA_KEYINFO-ITEM01 = C_EBELN.
ENDFORM. " GET_KEYINFO
*& Form GET_EVENTS_SEC
Getting Secondary List Events
FORM GET_EVENTS_SEC .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = I_EVENTS_SEC
EXCEPTIONS
LIST_TYPE_WRONG = 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.
*--Calling user-defined sub-routines for Secondary List
IF NOT I_EVENTS_SEC[] IS INITIAL.
READ TABLE I_EVENTS_SEC INTO WA_EVENT_SEC WITH KEY NAME = 'TOP_OF_PAGE'.
WA_EVENT_SEC-FORM = 'GENERATE_USERCOMMAND_H_SEC'.
MODIFY I_EVENTS_SEC FROM WA_EVENT_SEC INDEX SY-TABIX.
READ TABLE I_EVENTS_SEC INTO WA_EVENT_SEC WITH KEY NAME = 'END_OF_LIST'.
WA_EVENT_SEC-FORM = 'GENERATE_USERCOMMAND_F_SEC'.
MODIFY I_EVENTS_SEC FROM WA_EVENT_SEC INDEX SY-TABIX.
ENDIF.
ENDFORM. " GET_EVENTS_SEC
*& Form GENERATE_USERCOMMAND_H_SEC
Displaying Header-Text and Logo on Grid For Secondary List
FORM GENERATE_USERCOMMAND_H_SEC.
CLEAR I_COMMENT_SEC[].
WA_COMMENT_SEC-TYP = 'H'.
WA_COMMENT_SEC-INFO = 'Purchase Order Info'(035).
APPEND WA_COMMENT_SEC TO I_COMMENT_SEC.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_COMMENT_SEC
I_LOGO = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID = 'X'.
ENDFORM. " GENERATE_USERCOMMAND_H_SEC
*& Form GENERATE_USERCOMMAND_F_SEC
Displaying Footer-Text for Secondary List
FORM GENERATE_USERCOMMAND_F_SEC.
CLEAR I_COMMENT_SEC[].
WA_COMMENT_SEC-TYP = 'S'.
WA_COMMENT_SEC-KEY = V_DATA.
WA_COMMENT_SEC-INFO = 'rajesh'(036).
APPEND WA_COMMENT_SEC TO I_COMMENT_SEC.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_COMMENT_SEC
I_LOGO = ''
I_END_OF_LIST_GRID = 'X'.
ENDFORM. " GENERATE_USERCOMMAND_F_SEC
</code>
frnds the bolded code i need to get in the header. hlp me how to do that.
Thanks,
satishHi,
Please find below code..
*Global Constants
CONSTANTS:c_top_of_page(15) TYPE c VALUE 'SUB_TOP_OF_PAGE', "#EC NOTEXT
c_chk(1) TYPE c VALUE 'X', "check
c_save(1) TYPE c VALUE 'A', "save
c_final(15) TYPE c VALUE 't_sd_pa_dtl',
c_header TYPE char1 VALUE 'H', "Header in ALV
c_item TYPE char1 VALUE 'S'. "Item in ALV
*& Internal tables Declaration
DATA:
For ALV events
t_events TYPE slis_t_event,
For ALV top of page
t_alv_top_of_page TYPE slis_t_listheader,
For Field catalog
t_catlog TYPE slis_t_fieldcat_alv.
*& Form sub_create_events
For defining ALV Events
FORM sub_create_events .
Local variable for event
DATA: w_event TYPE slis_alv_event. "Events
Events for the ALV
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 1 "2
IMPORTING
et_events = t_events.
Sort by Name
SORT t_events BY name.
CLEAR w_event.
READ TABLE t_events INTO w_event WITH KEY name = slis_ev_top_of_page
BINARY SEARCH.
IF sy-subrc = 0.
MOVE c_top_of_page TO w_event-form.
MODIFY t_events FROM w_event TRANSPORTING form WHERE
name = slis_ev_top_of_page.
ENDIF.
CLEAR : w_event.
ENDFORM. " sub_create_events
*& Form SUB_CREATE_COMMENTRY_WRITE
text
FORM sub_bulid_header .
DATA: l_system TYPE char10 . " System id
DATA: l_r_line TYPE slis_listheader, " Hold list header
l_date TYPE char10, " Date
l_time TYPE char10, " Time
l_title(120) TYPE c. " Title
Title Display
l_r_line-typ = c_header. " header
l_title = sy-title.
l_r_line-info = l_title.
APPEND l_r_line TO t_alv_top_of_page.
CLEAR l_r_line.
Run date Display
l_r_line-typ = c_item. " Item
WRITE: sy-datum TO l_date MM/DD/YYYY.
l_r_line-key = 'Run Date :'(021).
l_r_line-info = l_date.
APPEND l_r_line TO t_alv_top_of_page.
CLEAR: l_r_line,
l_date.
Run time Display
l_r_line-typ = c_item. " Item
WRITE: sy-uzeit TO l_time USING EDIT MASK '__:__:__'.
l_r_line-key = 'Run Time :'(022).
l_r_line-info = l_time.
APPEND l_r_line TO t_alv_top_of_page.
CLEAR: l_r_line,
l_time.
User Display
l_r_line-typ = c_item. " Item
l_r_line-key = 'User :'(023).
l_r_line-info = sy-uname.
APPEND l_r_line TO t_alv_top_of_page.
CLEAR: l_r_line,
l_date.
CONCATENATE sy-sysid '-' sy-mandt INTO l_system .
System ID Display
l_r_line-typ = c_item. " Item
l_r_line-key = 'System :'(024) .
l_r_line-info = l_system.
APPEND l_r_line TO t_alv_top_of_page.
CLEAR: l_r_line.
ENDFORM. " sub_bulid_header
FORM sub_top_of_page
For defining Top Of Page
FORM sub_top_of_page. "#EC CALLED
This funcation module will diplay the top of the page
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_alv_top_of_page.
REFRESH:t_alv_top_of_page.
ENDFORM. "sub_a_top_of_page
Please Reward if my answer is helpful
Thanks,
Murali -
Regarding header item details on same screen
Hi All,
I have 2 internal tables with header and item details and i want to show them on same screen in ALV format.
I need to show header on first half of screen and when user double click on 1 line, corresponding item details needs to be shown on lower screen part.
Please help me with code for the requirement.
Thanks in advance.use OO ALV. You will find many concepts by using the search input field + button
-
Mail ignores my rule regarding header
Hi,
I added a rule in Mail:
If Delivered-To Contains moderator
then
Set Colour of Background to Red
I am subscibed to a mailing list and to know whether or not to CC somebody the Delivered-To heading has moderator for [email protected] in it:
List-Help: <mailto:[email protected]>
List-Unsubscribe: <mailto:[email protected]>
List-Post: <mailto:[email protected]>
Delivered-To: mailing list [email protected]
Delivered-To: moderator for [email protected]
Mail ignores my rule, any ideas why?
Cheers Tom
MacBook Pro Mac OS X (10.4.9) IntelHi,
Thanks for the reply.
So because there are two you don't think I can write a rule just based on one of them?
Every e-mail on this list has the first Delivered-To: header on it so there's not much I can do about that...
Any suggestions?
Cheers
Tom
MacBook Pro Mac OS X (10.4.9) Intel -
How to get Header in Downloaded .xls file using GUI_Download function
How to get Header in Downloaded .xls file using GUI_Download function ???
How to use the the Header parameter available in GUI_Download function .HI,
see this sample code..
data : Begin of t_header occurs 0,
name(30) type c,
end of t_header.
data : Begin of itab occurs 0,
fld1 type char10,
fld2 type char10,
fld3 type char10,
end of itab.
DATA: v_pass_path TYPE string.
append itab.
itab-fld1 = 'Hi'.
itab-fld2 = 'hello'.
itab-fld3 = 'welcome'.
append itab.
append itab.
append itab.
append itab.
append itab.
t_header-name = 'Field1'.
append t_header.
t_header-name = 'Field2'.
append t_header.
t_header-name = 'Field3'.
append t_header.
CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
EXPORTING
default_extension = 'XLS'
IMPORTING
fullpath = v_pass_path.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = v_pass_path
filetype = 'DBF'
TABLES
data_tab = itab
FIELDNAMES = t_header
Cheers,
jose. -
Displaying header in excel horizontally using FM GUI_DOWNLOAD
Dear Experts,
I'm exporting my data to an excel file using GUI_DOWNLOAD. The problem is that I'm having problems with exporting the headings of my excel. I can export the heading but the problem is that it is displayed vertically and not horizontally.
Is there a way I could display the heading horizontally? Hope you could help me.
Below is my program.
DATA: BEGIN OF itab OCCURS 0,
DVNO TYPE ZPFHEADER-DVNO,
EMPNO(8),
EMPNAME LIKE PA0002-CNAME,
LTYPE LIKE it_header-wtype,
LCODE LIKE it_header-dkond,
MA(6) TYPE p DECIMALS 2,
APRVDATE(15),
DTL LIKE ZPFHEADER-DVNO,
END OF itab.
DATA: BEGIN OF header OCCURS 0,
head1(15) TYPE c,
head2(15) TYPE c,
END OF header.
PERFORM DISPLAY_DATA.
FORM DISPLAY_DATA *
FORM DISPLAY_DATA.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
it_events = gt_events[]
TABLES
t_outtab = jtab.
ENDFORM.
*& FORM USER_COMMAND
COMMAND for ALV Grid Buttons
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
PERFORM write_header.
CASE r_ucomm.
WHEN 'XCEL'.
CONCATENATE: 'C:\' fname sy-datum INTO fname.
CONCATENATE: fname '.XLS' INTO FILENAME.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = FILENAME
HEADER = '00'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = header
FIELDNAMES = header.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = FILENAME
APPEND = 'X'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = jtab
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.
ELSEIF sy-subrc = 0.
MESSAGE S000(38) WITH 'File ' fname 'saved in Drive C.'.
ENDIF.
ENDCASE.
ENDFORM.
*& Form write_header
text
--> p1 text
<-- p2 text
FORM write_header.
DATA: ctr(2) TYPE N.
DO 6 TIMES.
ADD 1 TO ctr.
CASE ctr.
WHEN 1. header-head1 = 'EMPLOYEE'.
header-head2 = ' NO '.
WHEN 2. header-head1 = 'EMPLOYEE'.
header-head2 = ' NAME '.
WHEN 3. header-head1 = 'LOAN'.
header-head2 = 'TYPE'.
WHEN 4. header-head1 = 'APPROVAL'.
header-head2 = ' DATE '.
WHEN 5. header-head1 = 'LOAN'.
header-head2 = 'CODE'.
WHEN 6. header-head1 = ' MONTHLY '.
header-head2 = 'AMORTIZATION'.
ENDCASE.
APPEND header.
CLEAR: header.
ENDDO.
The output should be something like this as shown below:
Employee Employee Loan Approval
Number Name Type Date
6633 ABAD, JUSTINA DVP1 2-Apr-07Hi,
Check this sample code:
REPORT ZSW_DOWNLOAD_HEADER.
DATA : itab LIKE TABLE OF t001 WITH HEADER LINE.
SELECT * FROM t001 INTO TABLE itab.
PERFORM mydownload TABLES itab USING 'C:\t001.txt'.
FORM mydownload TABLES ptab USING filename.
DAta
*DATA : components LIKE rstrucinfo OCCURS 0 WITH HEADER LINE.
DATA: dfies_tab LIKE dfies OCCURS 0 WITH HEADER LINE.
DATA : allfields(300) TYPE c.
DATA : fld(100) TYPE c.
DATA : BEGIN OF htab OCCURS 0,
allfields(300) TYPE c,
END OF htab.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = 'T001'
FIELDNAME = ' '
LANGU = SY-LANGU
LFIELDNAME = ' '
ALL_TYPES = ' '
GROUP_NAMES = ' '
UCLEN = UCLEN
IMPORTING
X030L_WA = X030L_WA
DDOBJTYPE = DDOBJTYPE
DFIES_WA = DFIES_WA
LINES_DESCR = LINES_DESCR
TABLES
dfies_tab = dfies_tab
FIXED_VALUES = FIXED_VALUES
EXCEPTIONS
NOT_FOUND = 1
INTERNAL_ERROR = 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.
LOOP AT dfies_tab.
CONCATENATE dfies_tab-fieldtext
cl_abap_char_utilities=>horizontal_tab INTO fld.
CONCATENATE allfields fld INTO allfields .
ENDLOOP.
htab-allfields = allfields.
APPEND htab.
download first field list
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = 'c:\t001.xls'
filetype = 'DAT'
write_field_separator = 'X'
TABLES
data_tab = htab.
then download file data
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = 'c:\t001.xls'
filetype = 'DAT'
append = 'X'
write_field_separator = 'X'
TABLES
data_tab = ptab.
ENDFORM. "mydownload -
Problem in GUI_DOWNLOAD Function.
Hello Friends.
I am trying to do is to download data in a file from a BAPI
structure and make a flat file with this format and
then try to upload the same data in different client
via LSMW.
What happens is that I get the download of the file
contents but the spacing of the characters have
shifted and so when I run the same file in LSMW the
values of the fields do not appear consistent.
Ours is a unicode system ecc 6.0 and when i go in
debugger I see the values in consistent format but
when it comes to download it changes .
kindly please suggest something.
I also tried to write the file directly with open
dataset for output but in that also I get an error
regarding encoding.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = i_file
filetype = 'ASC'
append = ' '
write_field_separator = ' '
header = '00'
trunc_trailing_blanks = ' '
write_lf = 'X'
TABLES
data_tab = i_data_tab
I use the most standard settings.
Kindly suggest how can I get the required output.
Thanks in advance.
Regards,
SohailSohail Mansuri wrote:>
try to use field separator..then spaces will be maintained...
> CALL FUNCTION 'GUI_DOWNLOAD'
> EXPORTING
> * BIN_FILESIZE =
> filename = i_file
> filetype = 'ASC'
> append = ' '
write_field_separator = 'X '
> header = '00'
> trunc_trailing_blanks = ' '
> write_lf = 'X'
> TABLES
> data_tab = i_data_tab
>
> I use the most standard settings.
> Kindly suggest how can I get the required output.
>
>
> Thanks in advance.
> Regards,
> Sohail -
Hi all,
We have requirement to send data to FTP server,
am able to send data to FTP server, but the problem is am not able to send file with Header,
Eg:
oreder numer netvalue discount Grossamount
90000909 2323.34 343.33 4545.000
90000909 2323.34 343.33 4545.000
90000909 2323.34 343.33 4545.000
i have to send the file in the above format.
plz guide me hoe to create file with above format?
REgards,
DS kumarHi,
Use the following code to create header.
DEFINE add_field_header.
clear &1.
&1-field = &2.
append &1.
END-OF-DEFINITION.
add_field_header heading 'oreder numer'.
add_field_header heading 'netvalue'.
add_field_header heading 'discount'.
add_field_header heading 'Grossamount'.
In GUI_DOWNLOAD pass heading to Fieldnames parameter.
Regards,
Ni3 -
Download Excel including header
Dear Experts,
I am using FM GUI_Download. is working fine. But Body of the records will be downloaded.HEADER Data is not downloaded in the excel file.
for eg.
MATNR MATKL --->DO NOT DOWNLOADED
01255 test --->Downloaded.
45445 hi -->Downloaded.
NOTEL: FM GUI_DOWNLOAD (HEADER one field available) How to use it?
ASP.
Warm Regards,
raj.aHello Raj,
Use two GUI_DOWNLOAD FM.
First you create Header and put in one internal table.that is it_header.
second, create internal table for your data that is it_data
now first call GUI_DOWNLOAD FM like below for passing your header.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = it_header
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = it_final
second call again for data
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = file_name
FILETYPE = 'ASC'
APPEND = ' X' " use this to append your header
WRITE_FIELD_SEPARATOR = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = it_final
Have a Nice Day,
Regards,
Sujeet -
Header not getting displayed in the next page in the second table
Dear Experts ,
I have a query regarding Header not getting displayed in the next page in the second table of the main window. .Let me elobrate the issue.
I have a smartform in which there are 2 tables TABLE 1 and TABLE 2 in the smartform MAIN window. TABLE 1 is for pending PO and TABLE 2 is for future delivery date P O separated by text in between.
Now the header for both the tables and the data are getting displayed properly if the total output is in only one page. But If there are more entries in the TABLE 1 the Header for the TABLE 2 is not getting displayed. Header for TABLE 1 yet gets displayed properly in the next page in case of more entries.
Only issue is that Header for TABLE 2 is not getting displayed in second page but it gets displayed if the entries are less in TABLE 1 and the total output is in one page .
Please provide a elobrate solution on this problem as the requirement is urgent.
Thanks,
Regards,
Sachin HadaHi Sachin,
you need to cteate two pages FIRST and NEXT.
in first page --> FIRST
next --> NEXT
in next page
page---> NEXT
next ---> NEXT.
you copy the first page main window is the same in next page
aslo
I think help ful for you
thanks & Regards
BHUPAL.
Maybe you are looking for
-
Crashes when running Java Applets and trying to open Security System Preferences
Browser crashes when trying to run Java Applets, I've tried 4 different browsers. This is the crash report. Process: java [90472] Path: /usr/bin/java Identifier: com.apple.javajdk16.cmd Version: 1.0 (1.0) Code Type:
-
How to find out the sql details of Request ID
Hi Guru, I am running one crtical request i have all the SID,#serial details with me but i am not sure how i will get the sql query details of that request.so i will check why it's aking time. If any body have any script??
-
Disk Utility won't start up in 10.5.3
I have been unable to open up my Disk Utility at all. I was able to do so earlier, perhaps with 10.5.0 while I was mounting my external hard drive. Now, I cannot mount the hard drive, and therefore cannot use Time Machine all because DIsk Utility won
-
I have windows 7 and i upgraded adobe flash player as directed every since I did it I cant play game
s or download pictures it say I need to download it. It is listed under programs but will not open. I have already made sure that I was using 32 bit..Im so frustrated I have been trying to figure it out for over a week. I have uninstalled and reinsta
-
Playlist-Library file relationship questions...
Hello, I periodically sync my library with a family member.(via vpn) Here's what I've found: iTunes Library.xml seems to contain almost all the information that shows up in iTunes, i.e. playlists and songs. If I copy over the target iTunes Library.xm