How to Print the space in Top-of-Page in ALV output
Hi gurus,
I had a problem in Printing the Spaces in Top-of-Page.
My Requirement is like.
Material no: (space with 18 char) to 5235268
but it is coming like .
Material no: to 5235268
i wrote the code like this.
form Top_of_page.
IF s_matnr IS NOT INITIAL.
wa_header-typ = 'S'.
wa_header-key = 'Material No:' .
IF s_matnr-high IS INITIAL.
MOVE s_matnr-low TO wa_header-info.
ELSE.
CONCATENATE s_matnr-low ' to ' s_matnr-high INTO wa_header-info SEPARATED BY space.
ENDIF.
APPEND wa_header TO tb_header.
CLEAR wa_header.
ENDIF.
Thanks & Regards,
Anil.
Hi Anil ,
If u concatenate anything with space , your space will be lost.
Give a try for this if your s_matnr-high is initial.
data : c(21) type c.
IF s_matnr-high IS INITIAL.
Concatenate '(19 spaces )to' into C. concatenate C s_matnr-low into wa_header-info SEPARATED BY space.
endif.
<b>Please Note i wanted to put spaces at "(19 spaces)to" but posting this message is removing those spaces so have put it in words.</b>you have to take Variable c with first 19spaces and then 'to' as shown.
Here the Variable C is with 21 length for 18 spaces , one space to separate the 18 spaces from 'to' , and then 2 chars for 'to'.
I hope this will help you.
Regards,
AShwini
Similar Messages
-
How To Print Field Value in TOP-OF-PAGE During Line Selection.
How To Print Field Value in TOP-OF-PAGE During Line Selection when double click on field.
(If my memory serves me well (not used for long time ago)
Assign values to system fields sy-tvar0 - sy-tvar9, they will replace the placeholders "&0" through "&9" in the list headers and column headers.
TOP-OF-PAGE DURING LINE-SELECTION.
WRITE: / 'Interactive Report &3'.
WRITE record-vbeln TO sy-tvar3.
Regards,
Raymond -
How to print the Actual Check on 1st Page if line items are more for F110_p
Hi,
How to print the Actual Check on 1st page if the line items are more in F110_PRENUM_CHCK script. The standard script is printing at the last page of line items.
I tried using
IF &PAGE& EQ '1 '
/E 545 --> text element
ENDIF
but it is of no use.
Please let me know if anyone knows. Thanks in Advance.Hi Krishna,
I guess, there is no other possible way to acheive this without modifying the standard driver program. Why because? in you driver program you check window will be called only on the last page... but before you change your driver program give a try like shown below....
Not sure, but give a try... In the first page you will be printing some void check try to replace the code inside the text element of void check with original check and make all the check void... note: in this text element, be sure you write two conditions...
IF &PAGE& = 1.
**PRint all check values..
ELSE.
***Print void values
ENDIF.
Close the thread if your question is answered.
Regards,
Sairam -
Space in Top of page on alv header
Hi Experts,
I do have a query on ALV , Can you please help me in solving my problem.
Here goes my query...
I have to develop a ALV where on the top of page i have to display two fields as shown in below which was highlighted in the screen
http://img410.imageshack.us/my.php?image=op2sn9.jpg
But i'm getting output as shown below screen
http://img410.imageshack.us/my.php?image=op1ut4.jpg
I have tried with space and all other alternatives but i'm unable to get the desired output.
Can i have any sample code for the same
Regards
NandaHi,
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
* Build Fieldcatalog for ALV Report
form build_fieldcatalog.
* There are a number of ways to create a fieldcat.
* For the purpose of this example i will build the fieldcatalog manualy
* by populating the internal table fields individually and then
* appending the rows. This method can be the most time consuming but can
* also allow you more control of the final product.
* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
* simply displaying the result
* I.e. Field type may be required in-order for
* the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material No'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
* Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
* gd_layout-totals_only = 'X'.
* gd_layout-f2code = 'DISP'. "Sets fcode for when double
* "click(press f2)
* gd_layout-zebra = 'X'.
* gd_layout-group_change_edit = 'X'.
* gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
* Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
* i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
* it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
* is_variant = z_template
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
* Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
* up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL
* Form TOP-OF-PAGE *
* ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
* Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
* Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
* Total No. of Records Selected
describe table it_ekko lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected:' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
* i_logo = 'Z_LOGO'.
endform.
* FORM USER_COMMAND *
* --> R_UCOMM *
* --> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Check function code
CASE r_ucomm.
WHEN '&IC1'.
* Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
* Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
* Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
* Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
*& Form BUILD_EVENTS
* Build events table
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[].
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS
*& Form BUILD_PRINT_PARAMS
* Setup print parameters
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
*& Form END_OF_PAGE
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.
*& Form END_OF_LIST
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
skip.
write:/40 'Page:', sy-pagno .
endform.
Try with this sample
Regards
Krishna -
How to add interactive feature in top of page in ALV .
Hi All ,
There is immediate requirement , I have to add interactive feature in top of page in ALV grid .
Can anyone sort this out ?
Reward points will be given.hi,
check this example:
REPORT ZSR_ALV_INTERACTIVE2.
TYPE-POOLS: SLIS.
*DATA DECLARATION.
TYPES: BEGIN OF I_VBAK,
VBELN TYPE VBELN_VA,
AUGRU TYPE AUGRU,
END OF I_VBAK.
TYPES: BEGIN OF I_VBAP,
VBELN TYPE VBELN_VA,
AUGRU TYPE AUGRU,
POSNR TYPE POSNR_VA,
MATNR TYPE MATNR,
ZMENG TYPE DZMENG,
END OF I_VBAP.
TYPES: BEGIN OF I_MAKT,
MATNR TYPE MATNR,
MAKTX TYPE MAKTX,
END OF I_MAKT.
TYPES: BEGIN OF I_LIPS,
POSNR TYPE POSNR_VL,
MATNR TYPE MATNR,
LFIMG TYPE LFIMG,
END OF I_LIPS.
TYPES: BEGIN OF I_REASON,
SPRAS TYPE SPRAS,
AUGRU TYPE AUGRU,
BEZEI TYPE BEZEI40,
END OF I_REASON.
TYPES: BEGIN OF I_VBPA,
VBELN TYPE VBELN,
PARVW TYPE PARVW,
KUNNR TYPE KUNNR,
END OF I_VBPA.
TYPES: BEGIN OF I_KNA1,
KUNNR TYPE KUNNR,
NAME1 TYPE NAME1_GP,
END OF I_KNA1.
TYPES: BEGIN OF I_FINAL,
VBELN TYPE VBELN_VA,
POSNR TYPE POSNR_VA,
MATNR TYPE MATNR,
ZMENG TYPE DZMENG,
MAKTX TYPE MAKTX,
LFIMG TYPE LFIMG,
SPRAS TYPE SPRAS,
AUGRU TYPE AUGRU,
BEZEI TYPE BEZEI40,
PARVW TYPE PARVW,
KUNNR TYPE KUNNR,
NAME1 TYPE NAME1_GP,
END OF I_FINAL.
*INTERNAL TABLES
DATA: IT_VBAK TYPE STANDARD TABLE OF I_VBAK.
DATA: IT_VBAP TYPE STANDARD TABLE OF I_VBAP.
DATA: IT_MAKT TYPE STANDARD TABLE OF I_MAKT.
DATA: IT_LIPS TYPE STANDARD TABLE OF I_LIPS.
DATA: IT_VBPA TYPE STANDARD TABLE OF I_VBPA.
DATA: IT_KNA1 TYPE STANDARD TABLE OF I_KNA1.
DATA: IT_FINAL TYPE STANDARD TABLE OF I_FINAL.
DATA: IT_REASON TYPE STANDARD TABLE OF I_REASON.
DATA : V_FLAG.
*WORK AREA
DATA: WA_VBAK TYPE I_VBAK.
DATA: WA_VBAP TYPE I_VBAP.
DATA: WA_MAKT TYPE I_MAKT.
DATA: WA_LIPS TYPE I_LIPS.
DATA: WA_VBPA TYPE I_VBPA.
DATA: WA_KNA1 TYPE I_KNA1.
DATA: WA_FINAL TYPE I_FINAL.
DATA: WA_REASON TYPE I_REASON.
*DATA DECLARATION.
DATA: V_PROGNAME TYPE SY-REPID.
DATA: V_VBELN TYPE VBAK-VBELN.
DATA: V_GRIDTITLE TYPE LVC_TITLE.
***PARAMETERS: D_VARI LIKE DISVARIANT-VARIANT.
*DATA: I_VARIANT LIKE DISVARIANT.
*DATA: P_VARI LIKE DISVARIANT-VARIANT.
*DATA DECLARATION FOR CATALOGS LAYOUT SORT EVENTCATALOG TOPOFPAGE.
DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: I_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA: I_SORTINFO TYPE SLIS_T_SORTINFO_ALV.
DATA: I_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA: I_EVENTCAT TYPE SLIS_T_EVENT.
INITIALIZATION.
V_PROGNAME = SY-REPID.
V_FLAG = SPACE.
*SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS: S_VBELN FOR V_VBELN.
SELECTION-SCREEN END OF BLOCK BLK1.
*AT SLECTION-SCREEN.
AT SELECTION-SCREEN.
PERFORM Z_VALIDATIONS.
*START OF SELECTION.
START-OF-SELECTION.
PERFORM Z_SELECT.
PERFORM CHECK_VALIDATION_FLAG.
PERFORM Z_FIELDCAT USING I_FIELDCAT.
PERFORM Z_LAYOUT.
PERFORM Z_SORTINFO USING I_SORTINFO.
PERFORM Z_EVENTCAT USING I_EVENTCAT.
PERFORM Z_GRIDTITLE.
PERFORM Z_LISTHEADER USING I_LISTHEADER.
PERFORM Z_DISPLAY.
*& Form Z_VALIDATIONS
FORM Z_VALIDATIONS .
SELECT VBELN INTO V_VBELN
UP TO 1 ROWS
FROM VBAK
WHERE VBELN IN S_VBELN.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE I002(SY) WITH 'No Records'.
V_FLAG = 'X'.
ENDIF.
ENDFORM. " Z_VALIDATIONS
*& Form Z_FIELDCAT
FORM Z_FIELDCAT USING P_I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: I_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
*VBAK-VELN
I_FIELDCAT-COL_POS = '1'. " POSITION OF THE COLUMN.
I_FIELDCAT-FIELDNAME = 'VBELN'. " FIELD FOR WHICH CATALOG ID FILLED.
I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
*BELONGS TO.
I_FIELDCAT-KEY = 'X'. " SO THAT THIS FIELD IS NOT SCROLLABLE AND
*HIDDABLE.
I_FIELDCAT-JUST = 'C'. " FOR JUSTIFICATION.
I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
I_FIELDCAT-SELTEXT_L = 'SALES ORDER'. " LONG TEXT FOR HEADER.
I_FIELDCAT-OUTPUTLEN = 15. " SET THE OUTPUT LENGTH.
I_FIELDCAT-REF_TABNAME = 'VBAK'. " FOR F1 & F4 HELP AS REFERNCED TO
*THE DDIC TABLE.
APPEND I_FIELDCAT TO P_I_FIELDCAT.
*VBAP-SPRAS
I_FIELDCAT-COL_POS = '2'. " POSITION OF THE COLUMN.
I_FIELDCAT-FIELDNAME = 'SPRAS'. " FIELD FOR WHICH CATALOG ID FILLED.
I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
*BELONGS TO.
I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
I_FIELDCAT-SELTEXT_L = 'LANGUAGE'. " LONG TEXT FOR HEADER.
I_FIELDCAT-OUTPUTLEN = 5. " SET THE OUTPUT LENGTH.
I_FIELDCAT-REF_TABNAME = 'TVAUT'. " FOR F1 & F4 HELP AS REFERNCED TO
*TABLE.
APPEND I_FIELDCAT TO P_I_FIELDCAT.
*VBAP-AUGRU
I_FIELDCAT-COL_POS = '3'. " POSITION OF THE COLUMN.
I_FIELDCAT-FIELDNAME = 'AUGRU'. " FIELD FOR WHICH CATALOG ID FILLED.
I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
*BELONGS TO.
I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
I_FIELDCAT-SELTEXT_L = 'REASON'. " LONG TEXT FOR HEADER.
I_FIELDCAT-OUTPUTLEN = 5. " SET THE OUTPUT LENGTH.
I_FIELDCAT-REF_TABNAME = 'VBAK'. " FOR F1 & F4 HELP AS REFERNCED TO
*TABLE.
APPEND I_FIELDCAT TO P_I_FIELDCAT.
*VBAP-bezei
I_FIELDCAT-COL_POS = '4'. " POSITION OF THE COLUMN.
I_FIELDCAT-FIELDNAME = 'BEZEI'. " FIELD FOR WHICH CATALOG ID FILLED.
I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
*BELONGS TO.
I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
I_FIELDCAT-SELTEXT_L = 'DESCRIPTION'. " LONG TEXT FOR HEADER.
I_FIELDCAT-OUTPUTLEN = 20. " SET THE OUTPUT LENGTH.
I_FIELDCAT-REF_TABNAME = 'TVAUT'. " FOR F1 & F4 HELP AS REFERNCED TO
*TABLE.
APPEND I_FIELDCAT TO P_I_FIELDCAT.
*VBAP-POSNR
I_FIELDCAT-COL_POS = '5'. " POSITION OF THE COLUMN.
I_FIELDCAT-FIELDNAME = 'POSNR'. " FIELD FOR WHICH CATALOG ID FILLED.
I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
*BELONGS TO.
I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
I_FIELDCAT-SELTEXT_L = 'ITEM'. " LONG TEXT FOR HEADER.
I_FIELDCAT-OUTPUTLEN = 8. " SET THE OUTPUT LENGTH.
I_FIELDCAT-REF_TABNAME = 'VBAP'. " FOR F1 & F4 HELP AS REFERNCED TO
*TABLE.
APPEND I_FIELDCAT TO P_I_FIELDCAT.
*VBAP-MATNR.
I_FIELDCAT-COL_POS = '6'. " POSITION OF THE COLUMN.
I_FIELDCAT-FIELDNAME = 'MATNR'. " FIELD FOR WHICH CATALOG ID FILLED.
I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
*BELONGS TO.
I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
I_FIELDCAT-SELTEXT_L = 'MATERIAL'. " LONG TEXT FOR HEADER.
I_FIELDCAT-OUTPUTLEN = 10. " SET THE OUTPUT LENGTH.
I_FIELDCAT-REF_TABNAME = 'VBAP'. " FOR F1 & F4 HELP AS REFERNCED TO
*TABLE.
APPEND I_FIELDCAT TO P_I_FIELDCAT.
*VBAP-ZMENG
I_FIELDCAT-COL_POS = '7'. " POSITION OF THE COLUMN.
I_FIELDCAT-FIELDNAME = 'ZMENG'. " FIELD FOR WHICH CATALOG ID FILLED.
I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
*BELONGS TO.
I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
I_FIELDCAT-SELTEXT_L = 'QUANT'. " LONG TEXT FOR HEADER.
I_FIELDCAT-OUTPUTLEN = 10. " SET THE OUTPUT LENGTH.
I_FIELDCAT-REF_TABNAME = 'VBAP'. " FOR F1 & F4 HELP AS REFERNCED TO
*TABLE.
APPEND I_FIELDCAT TO P_I_FIELDCAT.
*MAKT-MAKTX
I_FIELDCAT-COL_POS = '8'. " POSITION OF THE COLUMN.
I_FIELDCAT-FIELDNAME = 'MAKTX'. " FIELD FOR WHICH CATALOG ID FILLED.
I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
*BELONGS TO.
I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
I_FIELDCAT-SELTEXT_L = 'DESCRIPTION'. " LONG TEXT FOR HEADER.
I_FIELDCAT-OUTPUTLEN = 20. " SET THE OUTPUT LENGTH.
I_FIELDCAT-REF_TABNAME = 'MAKT'. " FOR F1 & F4 HELP AS REFERNCED TO
*TABLE.
APPEND I_FIELDCAT TO P_I_FIELDCAT.
*LIPS-VBELN
I_FIELDCAT-COL_POS = '9'. " POSITION OF THE COLUMN.
I_FIELDCAT-FIELDNAME = 'VBELN'. " FIELD FOR WHICH CATALOG ID FILLED.
I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
*BELONGS TO.
I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
I_FIELDCAT-SELTEXT_L = 'DELIVERY'. " LONG TEXT FOR HEADER.
I_FIELDCAT-OUTPUTLEN = 15. " SET THE OUTPUT LENGTH.
I_FIELDCAT-REF_TABNAME = 'LIPS'. " FOR F1 & F4 HELP AS REFERNCED TO
*TABLE.
APPEND I_FIELDCAT TO P_I_FIELDCAT.
*LIPS-LFIMG
I_FIELDCAT-COL_POS = '10'. " POSITION OF THE COLUMN.
I_FIELDCAT-FIELDNAME = 'LFIMG'. " FIELD FOR WHICH CATALOG ID FILLED.
I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
*BELONGS TO.
I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
I_FIELDCAT-DO_SUM = 'X'.
I_FIELDCAT-SELTEXT_L = 'LFIMG'. " LONG TEXT FOR HEADER.
I_FIELDCAT-OUTPUTLEN = 18. " SET THE OUTPUT LENGTH.
I_FIELDCAT-REF_TABNAME = 'LIPS'. " FOR F1 & F4 HELP AS REFERNCED TO
*TABLE.
APPEND I_FIELDCAT TO P_I_FIELDCAT.
*parvw
I_FIELDCAT-COL_POS = '11'. " POSITION OF THE COLUMN.
I_FIELDCAT-FIELDNAME = 'PARVW'. " FIELD FOR WHICH CATALOG ID FILLED.
I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
*BELONGS TO.
I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
I_FIELDCAT-SELTEXT_L = 'PARTNER FUN'. " LONG TEXT FOR HEADER.
I_FIELDCAT-OUTPUTLEN = 18. " SET THE OUTPUT LENGTH.
I_FIELDCAT-REF_TABNAME = 'VBPA'. " FOR F1 & F4 HELP AS REFERNCED TO
*TABLE.
APPEND I_FIELDCAT TO P_I_FIELDCAT.
*KUNNR
I_FIELDCAT-COL_POS = '12'. " POSITION OF THE COLUMN.
I_FIELDCAT-FIELDNAME = 'KUNNR'. " FIELD FOR WHICH CATALOG ID FILLED.
I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
*BELONGS TO.
I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
I_FIELDCAT-SELTEXT_L = 'SHIP'. " LONG TEXT FOR HEADER.
I_FIELDCAT-OUTPUTLEN = 18. " SET THE OUTPUT LENGTH.
I_FIELDCAT-REF_TABNAME = 'VBPA'. " FOR F1 & F4 HELP AS REFERNCED TO
*TABLE.
APPEND I_FIELDCAT TO P_I_FIELDCAT.
*NAME1
I_FIELDCAT-COL_POS = '13'. " POSITION OF THE COLUMN.
I_FIELDCAT-FIELDNAME = 'NAME1'. " FIELD FOR WHICH CATALOG ID FILLED.
I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
*BELONGS TO.
I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
I_FIELDCAT-SELTEXT_L = 'NAME'. " LONG TEXT FOR HEADER.
I_FIELDCAT-OUTPUTLEN = 18. " SET THE OUTPUT LENGTH.
I_FIELDCAT-REF_TABNAME = 'KNA1'. " FOR F1 & F4 HELP AS REFERNCED TO
*TABLE.
APPEND I_FIELDCAT TO P_I_FIELDCAT.
ENDFORM. " Z_FIELDCAT
*& Form Z_SELECT
FORM Z_SELECT .
SELECT VBELN
AUGRU INTO CORRESPONDING FIELDS OF TABLE IT_VBAK
FROM VBAK
WHERE VBELN IN S_VBELN.
IF SY-SUBRC = 0.
SELECT VBELN
POSNR
MATNR
ZMENG INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
FROM VBAP
FOR ALL ENTRIES IN IT_VBAK
WHERE VBELN = IT_VBAK-VBELN.
IF SY-SUBRC = 0.
SELECT SPRAS
AUGRU
BEZEI INTO CORRESPONDING FIELDS OF TABLE IT_REASON
FROM TVAUT
FOR ALL ENTRIES IN IT_VBAK
WHERE AUGRU = IT_VBAK-AUGRU.
IF SY-SUBRC = 0.
SELECT VBELN
PARVW
KUNNR INTO CORRESPONDING FIELDS OF TABLE IT_VBPA
FROM VBPA
FOR ALL ENTRIES IN IT_VBAK
WHERE VBELN = IT_VBAK-VBELN.
IF SY-SUBRC = 0.
SELECT KUNNR
NAME1 INTO CORRESPONDING FIELDS OF TABLE IT_KNA1
FROM KNA1
FOR ALL ENTRIES IN IT_VBPA
WHERE KUNNR = IT_VBPA-KUNNR.
IF SY-SUBRC = 0.
SELECT POSNR
MATNR
LFIMG INTO CORRESPONDING FIELDS OF TABLE IT_LIPS
FROM LIPS
FOR ALL ENTRIES IN IT_VBAP
WHERE POSNR = IT_VBAP-POSNR.
IF SY-SUBRC = 0.
SELECT MATNR
MAKTX INTO CORRESPONDING FIELDS OF TABLE IT_MAKT
FROM MAKT
FOR ALL ENTRIES IN IT_VBAP
WHERE MATNR = IT_VBAP-MATNR.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
MESSAGE I002(SY) WITH 'No Data found'.
LEAVE LIST-PROCESSING.
ENDIF.
IF SY-SUBRC = 0.
LOOP AT IT_VBAP INTO WA_VBAP.
READ TABLE IT_VBAK INTO WA_VBAK WITH KEY VBELN = WA_VBAP-VBELN
BINARY SEARCH.
IF SY-SUBRC = 0.
*MOVE DATA INTO IT_FINAL.
MOVE: WA_VBAK-VBELN TO WA_FINAL-VBELN,
WA_VBAK-AUGRU TO WA_FINAL-AUGRU,
WA_VBAP-POSNR TO WA_FINAL-POSNR,
WA_VBAP-MATNR TO WA_FINAL-MATNR,
WA_VBAP-ZMENG TO WA_FINAL-ZMENG.
ENDIF.
READ TABLE IT_LIPS INTO WA_LIPS WITH KEY POSNR = WA_FINAL-POSNR
BINARY SEARCH.
IF SY-SUBRC = 0.
MOVE: WA_LIPS-LFIMG TO WA_FINAL-LFIMG.
ENDIF.
READ TABLE IT_REASON INTO WA_REASON WITH KEY AUGRU =
WA_FINAL-AUGRU BINARY SEARCH.
IF SY-SUBRC = 0.
MOVE: WA_REASON-SPRAS TO WA_FINAL-SPRAS,
WA_REASON-BEZEI TO WA_FINAL-BEZEI.
ENDIF.
READ TABLE IT_MAKT INTO WA_MAKT WITH KEY MATNR = WA_FINAL-MATNR
BINARY SEARCH.
IF SY-SUBRC = 0.
MOVE: WA_MAKT-MAKTX TO WA_FINAL-MAKTX.
ENDIF.
READ TABLE IT_VBPA INTO WA_VBPA WITH KEY VBELN = WA_FINAL-VBELN
BINARY SEARCH.
IF SY-SUBRC = 0.
MOVE: WA_VBPA-PARVW TO WA_FINAL-PARVW,
WA_VBPA-KUNNR TO WA_FINAL-KUNNR.
ENDIF.
READ TABLE IT_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_FINAL-KUNNR
BINARY SEARCH.
IF SY-SUBRC = 0.
MOVE: WA_KNA1-NAME1 TO WA_FINAL-NAME1.
ENDIF.
APPEND WA_FINAL TO IT_FINAL.
CLEAR WA_FINAL.
ENDLOOP.
ENDIF.
ENDFORM. " Z_SELECT
*& Form Z_LAYOUT
FORM Z_LAYOUT .
I_LAYOUT-ZEBRA = 'X'.
I_LAYOUT-TOTALS_TEXT = 'Total'(A00).
I_LAYOUT-SUBTOTALS_TEXT = 'SubTotal'(A01).
I_LAYOUT-BOX_TABNAME = 'IT_FINAL'.
ENDFORM. " Z_LAYOUT
*& Form Z_SORTINFO
FORM Z_SORTINFO USING P_I_SORTINFO TYPE SLIS_T_SORTINFO_ALV.
DATA: I_SORTINFO TYPE SLIS_SORTINFO_ALV.
CLEAR I_SORTINFO.
I_SORTINFO-SPOS = '1'.
I_SORTINFO-FIELDNAME = 'VBELN'.
I_SORTINFO-TABNAME = 'IT_FINAL'.
I_SORTINFO-UP = 'X'.
I_SORTINFO-GROUP = 'UL'. " I.E UNDERLINE AFTER EVERY GROUP
I_SORTINFO-SUBTOT = 'X'.
APPEND I_SORTINFO TO P_I_SORTINFO.
ENDFORM. " Z_SORTINFO
*& Form Z_EVENTCAT
FORM Z_EVENTCAT USING P_I_EVENTCAT TYPE SLIS_T_EVENT.
DATA: I_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = P_I_EVENTCAT
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.
CLEAR I_EVENT.
READ TABLE P_I_EVENTCAT WITH KEY NAME = SLIS_EV_TOP_OF_PAGE INTO
I_EVENT.
IF SY-SUBRC = 0.
MOVE 'TOP_OF_PAGE' TO I_EVENT-FORM.
APPEND I_EVENT TO P_I_EVENTCAT.
ENDIF.
READ TABLE P_I_EVENTCAT WITH KEY NAME = SLIS_EV_PF_STATUS_SET INTO
I_EVENT.
IF SY-SUBRC = 0.
MOVE 'SET_PF_STATUS' TO I_EVENT-FORM.
APPEND I_EVENT TO P_I_EVENTCAT.
ENDIF.
CLEAR I_EVENT.
READ TABLE P_I_EVENTCAT INTO I_EVENT WITH KEY NAME =
SLIS_EV_USER_COMMAND .
IF SY-SUBRC = 0.
MOVE 'USER_COMMAND' TO I_EVENT-FORM.
APPEND I_EVENT TO P_I_EVENTCAT.
ENDIF.
ENDFORM. " Z_EVENTCAT
*& Form Z_DISPLAY
FORM Z_DISPLAY .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_PROGNAME
*I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = V_GRIDTITLE
I_SAVE = 'A'
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = I_FIELDCAT[]
IT_SORT = I_SORTINFO
IT_EVENTS = I_EVENTCAT
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_FINAL
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. " Z_DISPLAY
*& Form Z_GRIDTITLE
FORM Z_GRIDTITLE .
V_GRIDTITLE = 'ALV FOR SALES ORDER DISPLAY'.
ENDFORM. " Z_GRIDTITLE
*TOP OF PAGE.
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_LISTHEADER.
ENDFORM. "TOP_OF_PAGE
*MENU SETTINGS.
FORM SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'ALV_MENU'.
ENDFORM. "SET_PF_STATUS
*USER-COMMAND
FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
DATA : VBELN TYPE VBELN_VA.
CASE P_UCOMM.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN '&IC1'.
CLEAR : VBELN.
VBELN = RS_SELFIELD-VALUE.
SET PARAMETER ID: 'AUN' FIELD VBELN.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. " USER_COMMAND
*& Form Z_LISTHEADER
FORM Z_LISTHEADER USING P_I_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA: L_LISTHEADER TYPE SLIS_LISTHEADER.
REFRESH P_I_LISTHEADER.
CLEAR L_LISTHEADER.
L_LISTHEADER-TYP = 'H'.
L_LISTHEADER-INFO = TEXT-001.
APPEND L_LISTHEADER TO P_I_LISTHEADER.
CLEAR L_LISTHEADER.
L_LISTHEADER-TYP = 'H'.
L_LISTHEADER-INFO = TEXT-002.
APPEND L_LISTHEADER TO P_I_LISTHEADER.
ENDFORM. " Z_LISTHEADER
*& Form check_validation_flag
text
--> p1 text
<-- p2 text
FORM CHECK_VALIDATION_FLAG .
IF NOT V_FLAG IS INITIAL.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " check_validation_flag -
How to print the logo in top centre (alv report)
Hi friends,
I need to print the company logo in the centre top of the alv report.Using the reuse_alv_commentry_write the logo is coming in the right side corner of report.
Thanks & Regards,
vijay.Hi,
Try this out
Build report title
PERFORM build_report_title USING gd_report_title gd_logo.
DATA: gd_logo TYPE sdydo_value,
*& Form BUILD_REPORT_TITLE
Build table for ALVtree header
<-> p1 Header details
<-> p2 Logo value
FORM build_report_title CHANGING
pt_report_title TYPE slis_t_listheader
pa_logo TYPE sdydo_value.
DATA: ls_line TYPE slis_listheader,
ld_date(10) TYPE c.
List Heading Line(TYPE H)
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-key "Not Used For This Type(H)
ls_line-info = 'User Message Service'.
APPEND ls_line TO pt_report_title.
Users name (Status Line- TYPE S)
ls_line-typ = 'S'.
ls_line-key = 'Name '.
ls_line-info = gd_myname.
APPEND ls_line TO pt_report_title.
Status Line(TYPE S)
ld_date(2) = sy-datum+6(2).
ld_date+2(1) = '/'.
ld_date3(2) = sy-datum4(2).
ld_date+5(1) = '/'.
ld_date+6(4) = sy-datum(4).
ls_line-typ = 'S'.
ls_line-key = 'Date'.
ls_line-info = ld_date.
APPEND ls_line TO pt_report_title.
Action Line(TYPE A)
CLEAR ls_line.
ls_line-typ = 'A'.
CONCATENATE 'Report: ' sy-repid INTO ls_line-info SEPARATED BY space
APPEND ls_line TO pt_report_title.
ENDFORM. "build_report_title
CALL METHOD gd_userlist->set_table_for_first_display
EXPORTING
is_hierarchy_header = gd_hierarchy_header
it_list_commentary = gd_report_title
<b> i_logo = gd_logo</b>
i_background_id = 'ALV_BACKGROUND'
i_save = 'A'
is_variant = gd_variant
CHANGING
it_outtab = it_emptytab "Must be empty
it_fieldcatalog = gd_fieldcat. -
Re: settings -- how to reduce waste space at top of page to one line only
I find that the wide screens are too short so it seems like more scolling is needed since less of web page is viewable and this problem is made worse by waste space taken up by various lines - for example on my firefox page, there is a blue line at the top that currently says "ask a question" Firefox help etc and then the rest of the line is blank -- about 70% of space not used/needed
The second line down shows: File, Edit, View, History, Bookmarks, Tools, Help -- then about 70%waste space -- rest of line is blank -- How can we put stuff from various lines into one or two lines Max ?
To continue, in my case, the next line has a couple of tabs -- this is useful -- maybe if there could be an easy way to show tabs in their own line when lots of various pages need to be open but when need max space viewable below to click a dropdown to push tabs up to end of next line above (in the waste space)
Finally, my page has the 4th line taken up by the Forward and Back arrows, the web address line, and then a shorter box called iLivid Web Search with a magnifying glass and then a little box at the end of a house -- which I use all the time to go to my home page for new tabs opened
I think it would be cool if we could easily elim all but the blue line and one more line by pushing stuff in line 3 and 4 up into line 1 (blue line) and line 2
My much older IE version had a feature you could drag the lines up they would do what I am saying with all the lines except the blue line at the top -- then when it compressed thje info, it would just show part of title and then a little // sort of button to click to see or expand a part of the line to read it all if needed
It seems likely this has mostly been solved but I can not seem to figure how to use the settting and buttons on my firefox page to accomplish these changes easily back and forth
From my looking at it, these features need to be available when you right click on each line but maybe my version8 is not set up quite right
so any and all assistance is greatly appreciated
Cheers, GFound settings in on the Layout tab of the page and changed the top px from 32 to 10.
Stunpals - Disclaimer: This posting is provided "AS IS" with no warranties. -
How to print the data in a seperate page / text file
Hi Experts,
I have created WD program which fetches data from R/3 using RFC. I am using following statement for printing the results:
wdComponentAPI.getMessageManager().reportSuccess("The value is " + value);
I am running the code for 20,000 rows. The results are printed on the same IE page. However it becomes difficult to see the results. I want to get the output printed in any of the following ways:
Option 1
1) There should be a link in WD program. When the user willl click on the link other IE page should get open and results should be printed in this page.
Option 2
2) The ouput should be written in a text file and user can store the file in local machine.
Please help me.
Regards,
GaryJust create a function in your WD application that writes these lines (in loop; pass array of strings to the function) on a text file and saved as a web resource object then have it available for download by the user. Simple as that.
Search for WD tutorials that involves downloads and using the web resouce object in WD applications.
This guide should provide you a good feel through the entire approach: /people/bertram.ganz/blog/2007/05/25/new-web-dynpro-java-tutorials--uploading-and-downloading-files-in-sap-netweaver-70 -
How to print the same data in different pages of different trys
Hi,
Part II: Check stub u2013
We need to print Vendor account # (REGUH-LIFNR), Vendor Name ((REGUH-NAME1), Payment doc # (REGUH-VBLNR), Check date (PAYR-ZALDT) and Check number (PAYR-CHECT) in the header portion and in the detail portion Invoice # (REGUP-XBLNR), Date (REGUP-BUDAT), Amount (REGUP-DMBTR), Amount, Discount and Net amount paid (REGUP-DMBTR).
Part III: Check stub u2013
We need to print Vendor account # (REGUH-LIFNR), Vendor Name ((REGUH-NAME1), Payment doc # (REGUH-VBLNR), Check date (PAYR-ZALDT) and Check number (PAYR-CHECT) in the header portion and in the detail portion Invoice # (REGUP-XBLNR), Date (REGUP-BUDAT), Amount (REGUP-DMBTR), Amount, Discount and Net amount paid (REGUP-DMBTR).
i am printing like the above and my question is as below.
Q) If the detail section of Part II and Part III spills beyond the available space then the remainder should be printed on a separate white paper picked from the next tray after printing all the checks. Ensure that this will not be printed on the following check.
Can anyone please answer this.Hi Swathi,
Where does that check box available, could please give your answer in details so that i can follow like that.
Thanks
Srinivas -
Adding Legends on TOP-OF-PAGE in alv
Hi All,
How can I add legends on top-of -page in ALV. This would include a colored cell and a text on what it depicts.
Thanks in advance ..
Edited by: aeterminator on Jun 16, 2011 11:09 AMThanks Marcin..
-
Hi gurus in BDC how to print the header on the top of the data
hi gurus in BDC how to print the header on the top of the data
hi,
while downloading the file using gui_download function module
in that function module in TABLES filednames parameter is used to get headings
example:
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = FILENAME1
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = T_ZETBR
FIELDNAMES = IT_HEADER
reward if useful,
thanks and regards -
How to devide the top of page in alv grid display
hi all
in the alv grid display am getting the page number and total number of pages in the left hand side
but what i need is i need in the right hand side
how to get thatHi,
PLease refer to the code below:
*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report *
*& The basic requirement for this demo is to display a number of *
*& fields from the EKKO table. *
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
* Build Fieldcatalog for ALV Report
form build_fieldcatalog.
* There are a number of ways to create a fieldcat.
* For the purpose of this example i will build the fieldcatalog manualy
* by populating the internal table fields individually and then
* appending the rows. This method can be the most time consuming but can
* also allow you more control of the final product.
* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
* simply displaying the result
* I.e. Field type may be required in-order for
* the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'.
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
* Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
* gd_layout-totals_only = 'X'.
* gd_layout-f2code = 'DISP'. "Sets fcode for when double
* "click(press f2)
* gd_layout-zebra = 'X'.
* gd_layout-group_change_edit = 'X'.
* gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
* Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
* i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
* it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
* is_variant = z_template
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
* Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL
* Form TOP-OF-PAGE *
* ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
* Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
* Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
* Total No. of Records Selected
describe table it_ekko lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
* i_logo = 'Z_LOGO'.
endform.
* FORM USER_COMMAND *
* --> R_UCOMM *
* --> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Check function code
CASE r_ucomm.
WHEN '&IC1'.
* Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
* Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
* Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
* Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
*& Form BUILD_EVENTS
* Build events table
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[].
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS
*& Form BUILD_PRINT_PARAMS
* Setup print parameters
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
*& Form END_OF_PAGE
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.
*& Form END_OF_LIST
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
skip.
write:/40 'Page:', sy-pagno .
endform.
Thanks,
Sriram Ponna. -
How to print the script in condensed mode
Hi to all,
Pls help me.
How to print the script in condensed mode and particular window only print in the condensed mode.Hi,
Hi
It will remove the blank spaces in front of the variable
and if you use the extension NO-GAPS
It will remove all the blank spaces in the variable field.
DATA: ws_val1 type char12.
ws_val1 = ' 100 123'.
Condense ws_val1.
Write / ws_val1.
Condense ws_val1 no-gaps.
write / ws_val1.
It will give output as
100 123
100123
The CONDENSE statement deletes redundant spaces from a string:
CONDENSE c NO-GAPS.
This statement removes any leading blanks in the field c and replaces other sequences of blanks by exactly one blank. The result is a left-justified sequence of words, each separated by one blank. If the addition NO-GAPS is specified, all blanks are removed.
Please check this link for sample code.
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb33e6358411d1829f0000e829fbfe/content.htm
Regards,
Raj. -
How to print the message in 2 lines?
How to print the message in 2 lines?
Here i am having it like this... MESSAGE i000(zm) WITH lv_uname.
here I want to print lv_uname in 2 lines because it lengthy one.
Thanks,
Sridhar.No man, itas not comming..I am using the below logic to print my message:
CONCATENATE text-I01 lv_printdate1 text-I02 INTO lv_printname
SEPARATED BY space.
MESSAGE i002(zm) WITH lv_printname.
its printing in a single line... -
How i can show the selection screen input field in the top of page in alv
hi ,
how i can show the selection screen input field in the top of page in alv grid output.
tell me the processHi,
excample from my program:
FORM topof_page.
DATA: l_it_header TYPE TABLE OF slis_listheader WITH HEADER LINE,
l_info LIKE l_it_header-info.
DATA: l_it_textpool TYPE TABLE OF textpool WITH HEADER LINE.
DATA: l_key LIKE l_it_textpool-key.
READ TEXTPOOL c_repid INTO l_it_textpool LANGUAGE sy-langu.
DEFINE m_selinfo.
if not &1 is initial.
clear l_it_header.
l_it_header-typ = 'S'.
l_key = '&1'.
translate l_key to upper case.
read table l_it_textpool with key key = l_key.
if sy-subrc = 0.
shift l_it_textpool-entry left deleting leading space.
l_it_header-key = l_it_textpool-entry .
endif.
loop at &1.
case &1-option.
when 'EQ'
or 'BT'
or 'CP'.
write &1-low to l_it_header-info.
when others.
write &1-low to l_it_header-info.
concatenate &1-option
l_it_header-info
into l_it_header-info
separated by space.
endcase.
if not &1-high is initial.
write &1-high to l_info left-justified.
concatenate l_it_header-info
l_info
into l_it_header-info
separated by space.
endif.
if &1-sign = 'E'.
concatenate ']'
l_it_header-info
into l_it_header-info.
endif.
append l_it_header.
clear: l_it_header-key,
l_it_header-info.
endloop.
endif.
END-OF-DEFINITION.
m_selinfo: s_trmdat,
s_trmext,
s_trmint,
s_fkdat,
s_delno,
s_vbeln,
s_deact,
s_kdmat.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = l_it_header[].
ENDFORM.
I hope, this will help you.
Regards
Nicole
Maybe you are looking for
-
'''bold text'''
-
How to retrieve the Conversation ID in ABAP
Does anyone know how to retrieve a conversation ID in ABAP? You can retrieve the reference ID from SXMSPMAST but how do you retrieve the conversation ID? Table names? FM? ABAP not Java or UDF All suggestions welcome. Regards, Nay
-
Why does the User Photo Keep Changing
I maintain two (2) users on my iMac. One personal and one business. I have separate Address Book cards for each user with different photos. For my business Address Book card, I only have my business name, phone number and address. For the personal A
-
What really is an ADFContext?
I am using the ADFContext to get/put some session variables. I spent one whole day behind a problem I have in some circumstances. Apparently, even for session variables, there might be different Contexts according to which point you call ADFContext f
-
6500 scan option in solution center reacts extremely slow
Problem 1.It usually takes 5-8 mins for the scan window to show up after I press "scan to file" in solution center. This 6500 is extremely slow. I have had other hp all-in-one before and scanning has never been a problem. I don't know how I would so