How to add radiobuttons in ALV Grid
Hi,
I refered the threads in SDN but i am not able to get proper solution for my requirement.
I am displaying output in ALV Grid format. After displaying the output i mean in the output screen i need few buttons and radio buttons . when user selects the record and clicks the radio button accordingly my logic should work. Anybody can tell me how to add the radiobuttons in the output of the screen. Please find the below output format for the requirement is
Push button1 Pushbutton2 Radiobutton1 Radio button2
MY program output in Grid format.
Anybody can suggest me how to approach.
Regards,
Maheedhar
Check if this link helps..
http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-RadioButtonsinALVGRIDREPORT
Similar Messages
-
How to add row in alv grid displa
Hi all,
I am writing a report in ALV, in that the stock transist value must be apper only once against the plant, that is there should be only one row which shows stock transit value, but my output shows stock tranist value for each and every material since i passed the field catlog for that.
my reaauirment is there must be one empty row which shows the stock transist value per plant, the remaing rows must be shows empty value.
Any help will be appreciated..
thanks and regards,
babu
Message was edited by:
babuHI babu,
Before you pass your final internal table.
DELETE ADJACENT DUPLICATES FROM IT_FINAL COMPARING MATNR.
hopes it helps you.
Ali -
How to implement 'hypelink' in ALV GRID
Hi,everybody,please tell me how to implement 'hypelink' in ALV GRID?
I just try to design a ALV GRID report but I do not kown the way of using 'hypelink'. I refer to some documents but failsed. somebody can help me and give a example including entire code.1. Create a table where hyperlinks & corresponding handles are stored (TYpe LVC_T_HYPE)
DATA ls_hype TYPE lvc_s_hype .
data lt_hype type lvc_t_hype.
ls_hype-handle = '1' .
ls_hype-href = 'http://www.company.com/carrids/car1' .
APPEND ls_hype TO lt_hype .
2. In your list data table create additional field of type INT4 which will contain the handle of the hyper link (ex. '1' for above hyperlink)
DATA carrid_handle TYPE int4 .
3. For the field which shall contain the hyperlink, make an entry in the field catalog indicating the field name which contains handle for the hyperlink. This is done by setting the handle field name in WEB_FIELD.
ls_fieldcat-fieldname = 'CARRID'
ls_fieldcat-web_field = 'CARRID_HANDLE'.
4. While calling set_table_for_first_display, pass the hyperlink table created in step 1 to parameter 'it_hyperlink'
~Piyush Patil -
Hi,
How To add Logo in ALV Report?
I need step by step explanation.Hi uday,
go through this hope u can understand.
*& Report Z_OOALV_LOGO
*&--Sample Program using ooalv-> by SrikanthV--
REPORT z_ooalv_logo.
****DECLARATION FOR LOGO INSERT
CONSTANTS: cntl_true TYPE i VALUE 1,
cntl_false TYPE i VALUE 0.
DATA:h_picture TYPE REF TO cl_gui_picture,
h_pic_container TYPE REF TO cl_gui_custom_container.
DATA: graphic_url(255),
graphic_refresh(1),
g_result LIKE cntl_true.
DATA: BEGIN OF graphic_table OCCURS 0,
line(255) TYPE x,
END OF graphic_table.
DATA: graphic_size TYPE i.
CALL SCREEN 100.
*&----
*& Module PICTURE OUTPUT
text
MODULE picture OUTPUT.
DATA: l_graphic_xstr TYPE xstring,
l_graphic_conv TYPE i,
l_graphic_offs TYPE i.
CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
EXPORTING
p_object = 'GRAPHICS'
p_name = 'EDS'"IMAGE NAME - Image name from SE78
p_id = 'BMAP'
p_btype = 'BCOL'
RECEIVING
p_bmp = l_graphic_xstr
EXCEPTIONS
not_found = 1
OTHERS = 2.
graphic_size = XSTRLEN( l_graphic_xstr ).
CHECK graphic_size > 0.
l_graphic_conv = graphic_size.
l_graphic_offs = 0.
WHILE l_graphic_conv > 255.
graphic_table-line = l_graphic_xstr+l_graphic_offs(255).
APPEND graphic_table.
l_graphic_offs = l_graphic_offs + 255.
l_graphic_conv = l_graphic_conv - 255.
ENDWHILE.
graphic_table-line = l_graphic_xstr+l_graphic_offs(l_graphic_conv).
APPEND graphic_table.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'image'
subtype = cndp_sap_tab_unknown " 'X-UNKNOWN'
size = graphic_size
lifetime = cndp_lifetime_transaction "'T'
TABLES
data = graphic_table
CHANGING
url = graphic_url
EXCEPTIONS
dp_invalid_parameter = 1
dp_error_put_table = 2
dp_error_general = 3
OTHERS = 4 .
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
CREATE OBJECT h_pic_container
EXPORTING container_name = 'LOGO'.
CREATE OBJECT h_picture EXPORTING parent = h_pic_container.
CALL METHOD h_picture->load_picture_from_url
EXPORTING
url = graphic_url
IMPORTING
RESULT = g_result.
ENDMODULE. " PICTURE OUTPUT
Reward points if helpful.
Thanks -
I made my first attempt to use OO programing in ABAP and created an ALV Grid using CL_GUI_ALV_GRID. I have excluded toolbar buttons without a problem, but now I would like to add a button and code my own reaction to its ok_code. Can anyone tell me how to do this? Please keep in mind I am very new to ABAP Objects.
Hi Jason,
Have you had a look at the example program BCALV_GRID_05 ?
The program demonstrates exactly what you are intending to do.
Please get back with any specific doubts you may encounter.
Regards,
Anand MAndalika. -
How to display rsa3 with ALV grid
Hello,
In some of tyhe systems i'm working with, RSA3 have a button to display the data in ALV grid. I checked and it's not because of the support package. Cab someone please advice how to add the ALV functionality.
Thanks,
Amir
Edited by: Amir Dror on Jan 13, 2009 12:41 PMHello,
we had the same question and problem.
SAP told us via OSS the following:
"... The ALV grid in RSA3 will be supported with the PI_BASIS 2006_1_700.
But you have PI_BASIS 2005_1_700
Furthermore this software component PI_BASIS is independent from the
BW releases so that you can upgrade the latest support packages of the
PI_BASIS 2006_1_700 in source system"
So if you have PI_BASIS 2005 you won't have the functionality of ALV grid in TC RSA3.
(remark: At the moment I can not confirm that ALV grid in RSA3 is available with PI_BASIS 2006_x_xxx. We plan to upgrade in a few month.)
Best regards -
How to add Icons to ALV Reprt?
Hi,
I need to display icons (red, yellow) in my ALV Report in the first column in my report.
In my field catalog fieldcat-icon = 'X' has been taken into consideration, but still I am not able to see in my report. In the final internal table that is to display I created a field for this Icon type ICON_D. Is this the correct procedure to work with or else kindly let me know how to proceed?
Regards,
Raghu Ram.This is the code that has been incorporated in order to display Icon in the ALV Report.
* TABLES Declarations *
Tables: PROJ, " Project definition
PRPS, " WBS (Work Breakdown Structure) Element Master Data
ICON.
* TYPE POOLS *
TYPE-POOLS: SLIS, " Globale Typen für generische Listbausteine
ICON.
* ALV Data Declarations *
DATA:
GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
GT_REPID TYPE SY-REPID.
* Type Declarations *
TYPES:
* STRUCTURE OF TABLE PROJ
BEGIN OF TY_PROJ,
PSPNR TYPE PROJ-PSPNR,
PSPID TYPE PROJ-PSPID,
POST1 TYPE PROJ-POST1,
OBJNR TYPE PROJ-OBJNR,
VERNR TYPE PROJ-VERNR,
VERNA TYPE PROJ-VERNA,
END OF TY_PROJ,
* STRUCTURE OF TABLE PRPS
BEGIN OF TY_PRPS,
PSPNR TYPE PRPS-PSPNR,
POSID TYPE PRPS-POSID,
POST1 TYPE PRPS-POST1,
OBJNR TYPE PRPS-OBJNR,
PSPHI TYPE PRPS-PSPHI,
VERNR TYPE PRPS-VERNR,
END OF TY_PRPS,
BEGIN OF TY_FINAL,
LIGHT TYPE ICON_D,
PSPNR TYPE PROJ-PSPNR,
PSPID TYPE PROJ-PSPID,
POST1 TYPE PROJ-POST1,
OBJNR TYPE PROJ-OBJNR,
VERNR TYPE PROJ-VERNR,
VERNA TYPE PROJ-VERNA,
PSPNR_1 TYPE PRPS-PSPNR,
POSID TYPE PRPS-POSID,
POST1_1 TYPE PRPS-POST1,
OBJNR_1 TYPE PRPS-OBJNR,
PSPHI TYPE PRPS-PSPHI,
VERNR_1 TYPE PRPS-VERNR,
END OF TY_FINAL.
* Internal Table Declarations *
DATA:
IT_PROJ TYPE STANDARD TABLE OF TY_PROJ,
IT_PRPS TYPE STANDARD TABLE OF TY_PRPS,
IT_FINAL TYPE STANDARD TABLE OF TY_FINAL.
* Work Area Declarations *
DATA:
WA_PROJ TYPE TY_PROJ,
WA_PRPS TYPE TY_PRPS,
WA_FINAL TYPE TY_FINAL.
* Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME.
SELECT-OPTIONS: S_PSPNR FOR PROJ-PSPNR.
SELECTION-SCREEN END OF BLOCK BLK.
* Start Of Selection *
START-OF-SELECTION.
PERFORM DATA_RETREVIAL.
PERFORM BUILD_FIELDCAT.
PERFORM DISPLAY_ALV.
* Data Retrevial Logic *
*& Form DATA_RETREVIAL
form DATA_RETREVIAL .
DATA: status_icon TYPE icons-text,
icon_name(20) TYPE c,
icon_text(10) TYPE c.
ICON_NAME = 'ICON_RED_LIGHT'.
ICON_TEXT = 'RED'.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = ICON_NAME
TEXT = ICON_TEXT
* INFO = ' '
ADD_STDINF = 'X'
IMPORTING
RESULT = STATUS_ICON
EXCEPTIONS
ICON_NOT_FOUND = 1
OUTPUTFIELD_TOO_SHORT = 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.
SELECT PSPNR
PSPID
POST1
OBJNR
VERNR
VERNA
FROM PROJ
INTO TABLE IT_PROJ
WHERE PSPNR IN S_PSPNR.
SELECT PSPNR
POSID
POST1
OBJNR
PSPHI
VERNR
FROM PRPS
INTO TABLE IT_PRPS
FOR ALL ENTRIES IN IT_PROJ
WHERE PSPHI EQ IT_PROJ-PSPNR.
LOOP AT IT_PROJ INTO WA_PROJ.
LOOP AT IT_PRPS INTO WA_PRPS.
WA_FINAL-PSPNR = WA_PROJ-PSPNR.
WA_FINAL-PSPID = WA_PROJ-PSPID.
WA_FINAL-POST1 = WA_PROJ-POST1.
WA_FINAL-OBJNR = WA_PROJ-OBJNR.
WA_FINAL-VERNR = WA_PROJ-VERNR.
WA_FINAL-VERNA = WA_PROJ-VERNA.
WA_FINAL-PSPNR_1 = WA_PRPS-PSPNR.
WA_FINAL-POSID = WA_PRPS-POSID.
WA_FINAL-POST1_1 = WA_PRPS-POST1.
WA_FINAL-OBJNR_1 = WA_PRPS-OBJNR.
WA_FINAL-PSPHI = WA_PRPS-PSPHI.
WA_FINAL-VERNR_1 = WA_PRPS-VERNR.
WA_FINAL-light = STATUS_ICON.
APPEND WA_FINAL TO IT_FINAL.
CLEAR: WA_FINAL.
ENDLOOP.
ENDLOOP.
endform. " DATA_RETREVIAL
* Field Catalog *
*& Form BUILD_FIELDCAT
form BUILD_FIELDCAT .
* DATA: FIELDCAT TYPE GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'LIGHTS'.
GT_FIELDCAT-SELTEXT_M = 'STAUTS'.
GT_FIELDCAT-COL_POS = 0.
GT_FIELDCAT-ICON = 'X'.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'PSPNR'.
GT_FIELDCAT-SELTEXT_M = 'PROJECT DEFINITION(INTERNAL)'.
GT_FIELDCAT-COL_POS = 1.
GT_FIELDCAT-OUTPUTLEN = 8.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'PSPID'.
GT_FIELDCAT-SELTEXT_M = 'PROJECT DEFINITION'.
GT_FIELDCAT-COL_POS = 2.
GT_FIELDCAT-OUTPUTLEN = 24.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'POST1'.
GT_FIELDCAT-SELTEXT_M = 'PROJECT DESC'.
GT_FIELDCAT-COL_POS = 3.
GT_FIELDCAT-OUTPUTLEN = 40.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'OBJNR'.
GT_FIELDCAT-SELTEXT_M = 'Object number'.
GT_FIELDCAT-COL_POS = 4.
GT_FIELDCAT-OUTPUTLEN = 22.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'VERNR'.
GT_FIELDCAT-SELTEXT_M = 'Responsible Person'.
GT_FIELDCAT-COL_POS = 5.
GT_FIELDCAT-OUTPUTLEN = 8.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'VERNA'.
GT_FIELDCAT-SELTEXT_M = 'Responsible Person Desc'.
GT_FIELDCAT-COL_POS = 6.
GT_FIELDCAT-OUTPUTLEN = 25.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'PSPNR_1'.
GT_FIELDCAT-SELTEXT_M = 'WBS Element'.
GT_FIELDCAT-COL_POS = 7.
GT_FIELDCAT-OUTPUTLEN = 8.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'POSID'.
GT_FIELDCAT-SELTEXT_M = 'WBS Element'.
GT_FIELDCAT-COL_POS = 8.
GT_FIELDCAT-OUTPUTLEN = 24.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'POST1_1'.
GT_FIELDCAT-SELTEXT_M = 'WBS DESC'.
GT_FIELDCAT-COL_POS = 9.
GT_FIELDCAT-OUTPUTLEN = 40.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'OBJNR_1'.
GT_FIELDCAT-SELTEXT_M = 'Object number'.
GT_FIELDCAT-COL_POS = 10.
GT_FIELDCAT-OUTPUTLEN = 22.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'PSPHI'.
GT_FIELDCAT-SELTEXT_M = 'Currnet Projct'.
GT_FIELDCAT-COL_POS = 11.
GT_FIELDCAT-OUTPUTLEN = 8.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-FIELDNAME = 'VERNR_1'.
GT_FIELDCAT-SELTEXT_M = 'Responsible Person'.
GT_FIELDCAT-COL_POS = 12.
GT_FIELDCAT-OUTPUTLEN = 8.
APPEND GT_FIELDCAT TO GT_FIELDCAT.
CLEAR GT_FIELDCAT.
endform. " BUILD_FIELDCAT
* Display ALV Grid *
*& Form DISPLAY_ALV
form DISPLAY_ALV .
GT_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = GT_REPID
* 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 = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
IT_FIELDCAT = GT_FIELDCAT[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_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
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* 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. " DISPLAY_ALV -
How to set variant for ALV grid from ABAP
Hello,
I have a program which displays some data with ALV grid. Then after some operation I would like to set different layout for the grid, but not by choosing it manually but by the program. I thought that it would be enough to use the method SET_VARIANT, so I'm setting DISVARIANT structure properly, using SET_VARIANT method and after that I'm calling REFRESH_TABLE_DISPLAY but layout is not changed. What else should I do? Is that possible?
Best regards,
MarcinHi,
Check this
* While declaring select-options
parameters: p_vari like ltdx-variant. " Layout
* then add the following code in
at selection-screen on value-request for p_vari.
perform f_variant_f4 using p_vari.
* Code for f_variant_f4
form f_variant_f4 using p_vari.
* private variables
data : v_exit type c.
clear gs_variantt.
v_variant_save = 'U'.
call function 'LVC_VARIANT_F4'
exporting
is_variant = gs_variant
i_save = v_variant_save
importing
e_exit = v_exit
es_variant = gs_variantt
exceptions
not_found = 1
program_error = 2
others = 3.
if sy-subrc ne c_0.
message i999(yscc) with text-064. " No Layout Available for F4
endif.
if v_exit is initial.
gs_variant-variant = gs_variantt-variant.
p_vari = gs_variantt-variant.
endif.
endform. " F_variant_f4
* In PBO
call method grid1->set_table_for_first_display
exporting
is_layout = gs_layout
is_variant = gs_variant
i_save = 'A'
it_toolbar_excluding = i_exclude[]
changing
it_outtab = i_output[]
it_fieldcatalog = i_fieldcat[]
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
a® -
How to add linked button in grid?
Hi,
Does anyone know how to add linked button in a grid? I can't find it but i saw someone ask similar question but seems none of them works.
Thanks a lot!
P.S. For some reason, i can't use matrix because the data is from a SQL query.
LanHi,
as far as I know it is not possible, since this adjustment is made for the whole column. I have created a grid and I open the shown document by double clicking the row header. In the grid I can see if it is sales or purchase and so I use a workaround by opening the specific system form (e.g. sales invoice) in find mode and search the document by document number (also shown in the grid).
Sample:
oSBOapp.ActivateMenuItem("2053"); //sales invoice
oForm = oSBOapp.Forms.ActiveForm;
oForm.Mode = SAPbouiCOM.BoFormMode.fm_FIND_MODE;
oEdit = (SAPbouiCOM.EditText)oForm.Items.Item("8").Specific;
oEdit.Value = Convert.ToString(dNum);
oForm.Items.Item("1").Click(SAPbouiCOM.BoCellClickType.ct_Regular);
By the click event, you get the specific row number. Hope it helps...
Regards
Sebastian -
How to create functionality to ALV Grid?
Hi All,
My ALV code is running successfully,but I just wanna add few customer specific functionality and my own PF status.Can you suggest me something for this.
Thanks and Regards.
Rajarshi.Hi Rajarshi,
If you are using REUSE_ALV_GRID_CONTROL, Here is how you add
custom functionality.
1) In the fM REUSE_ALV_GRID_CONTROL pass the parameters
i_callback_user_command = 'USER_COMMAND' i_callback_pf_status_set = 'SET_PF_STATUS'. This are form name.
2) Create a form in your program as below.
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'PFSTAT1' EXCLUDING rt_extab.
ENDFORM. "SET_PF_STATUS
PFSTAT1 is a copy of the Pf-status STANDARD_FULSCREEN of the program SAPLKKBL (copy it using SE41).
Once PFSTAT1 is created you can modify it just like any other PF status and add your own menu or command buttons.
3) To handle the functioanlity create a form of name user_command in your program as below.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
The field "R_UCOMM" will contain the current value of *"SY-UCOMM"
"RS_SELFIELD" will hold contents of the selected line
CASE r_ucomm.
ENDCASE.
ENDFORM. "USER_COMMAND
Hope this helps -
How to supress dialog while ALV Grid output is send to Spool
Hi,
I need to get the ALV grid output in spool.But when i am executing my program using ALV grid function module with print parameter passed,first its giving a popup with default printer and number of copies and when i press ok for the popup ,spool request is created.But i dont want this popup to come while executing my program.It should create the spool request directly. How to solve this issue.
Regards
ShibinHi Shibin,
Try the below parameter in IS_PRINT Structure:
is_print-print = 'N'.
This will Supress the Dialog and create a Spool with no Immeadiate Output.
Hope This Helps you..
Thanks & Regards,
Suresh Karri -
How can i validate on ALV grid for the user
Dear Freinds,
I have developed one custom report using ALV Grid program , as per the requirement i have to enter on the
data and when i press the value save the program sumits the data into my custom table . Till here every thing is fine
but one particular field i have declared as Char1 in my internal table , on the ALV output it is allowing me to enter
more than one character eg : it is allowing me to enter as Hyderabad .........even though i have declared as char 1 in the internal table ....however it is saving in the database table as H only that is correct.......but it is giving confusion to user
i want to validate that user shouldnt allow to enter more than one character in the alv output of the input field .
Please could any one let me know how can i validate.
regard
divyaHi,
check that field length in the final internal table .
might be that filed lenth in final internal table declartion is more than 1 char.
regards,
Rama reddy
Edited by: ram reddy on Jul 15, 2009 7:57 AM -
Hi Friends,
How to add a header in ALV, Can you please tell me.
Regards,
Venu.hi,
chk this sample code.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
<b>i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM</b>
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
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.
rgds
anver
if hlped mark points -
How to upload logo for alv grid when we are using classes
Hi am using cl_gui_alv_tree for displaying alv grid. i want to upload logo in the heade section. as we do in simple alvs using resuse_alv_commentary_write.
plz update me in this regard.
regards
venkatWelcome to SDN.
Check the following threads -
How To use TOP OF PAGE event in OOPS ALV?
Logo & TOP_OF_PAGE in OO ALV
Regards,
Amit
Reward all helpful replies. -
How to give space in ALV grid display
Hi,
I have developed one report using alv grid.
Iam getting details like this.
ABCD |12345|34567|
|35363|74567|
but i want like this
ABCD <b>here i want space</b>
|12345|34567|
|35363|74567|
how to give space?
points guaranteed
cheers
kakiHi experts,
Iam trying to get the output like in this report
BALVHD01
for example: ID & No iam getting in the same line.I want to group the numbers for the particular ID.
In my code ID is 'STEXT'
and NO is 'QMNUM'.
this is my code.
REPORT YET_DISPLAYCOST
MESSAGE-ID ZM
NO STANDARD PAGE HEADING
LINE-SIZE 200.
TYPE-POOLS: SLIS.
TABLES: QPCT,
QPGT,
QMEL,
QMMA,
IHPA,
JEST,
HRP1000.
DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
ITAB_EXTAB TYPE SLIS_T_EXTAB.
DATA :
I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
S_FIELDCAT TYPE SLIS_FIELDCAT_ALV ,
G_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND' ,
G_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'T_TOP_OF_PAGE',
I_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER WITH HEADER LINE,
I_EVENTS TYPE SLIS_T_EVENT WITH HEADER LINE,
S_EVENT TYPE SLIS_ALV_EVENT ,
S_LAYOUT TYPE SLIS_LAYOUT_ALV,
IT_SORT TYPE SLIS_T_SORTINFO_ALV.
*to remove sort buttons on the tool bar
DATA : EX TYPE SLIS_T_EXTAB.
DATA : EXWA TYPE SLIS_EXTAB.
DATA: LS_LINE TYPE SLIS_LISTHEADER.
DATA: I_FCALV TYPE SLIS_FIELDCAT_ALV OCCURS 0 WITH HEADER LINE.
DATA:F_TDOBJECT LIKE THEAD-TDOBJECT,
F_TDNAME LIKE THEAD-TDNAME,
F_TDID LIKE THEAD-TDID,
ITAB_LINES LIKE tline OCCURS 0 WITH HEADER LINE.
DATA:BEGIN OF ITAB OCCURS 10,
QMNUM LIKE QMEL-QMNUM,
DESC(72),
END OF ITAB.
DATA: BEGIN OF T_HDR OCCURS 0,
QMNUM LIKE QMEL-QMNUM,
PARNR LIKE IHPA-PARNR,
OBJID LIKE HRP1000-OBJID,
STEXT LIKE HRP1000-STEXT,
END OF T_HDR.
DATA: BEGIN OF T_DET OCCURS 10,
SNO TYPE I,
QMNUM LIKE QMEL-QMNUM,
QMTXT LIKE QMEL-QMTXT,
QMGRP LIKE QMEL-QMGRP,
QMCOD LIKE QMEL-QMCOD,
PARNR LIKE IHPA-PARNR,
OBJNR LIKE QMEL-OBJNR,
STEXT LIKE HRP1000-STEXT,
DESC(72),
COST(20),
END OF T_DET.
DATA: T_FINAL LIKE T_DET OCCURS 0 WITH HEADER LINE.
DATA: SNO(3).
DATA: CHK2(4).
DATA: V_REPID TYPE SY-REPID.
SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS:S_QMNUM FOR QMEL-QMNUM,
S_QMART FOR QMEL-QMART,
S_QMDAT FOR QMEL-QMDAT.
SELECTION-SCREEN END OF BLOCK A1.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM DISPLAY_ALV.
END-OF-SELECTION.
*& FORM GET_DATA
TEXT
FORM GET_DATA.
DATA: G_STEXT LIKE T_DET-STEXT.
*TO GET DETAILS
SELECT QMNUM REFNUM QMDAT QMTXT OBJNR QMGRP QMCOD FROM QMEL
INTO CORRESPONDING FIELDS OF TABLE T_DET
WHERE QMNUM IN S_QMNUM AND
QMART IN S_QMART AND
QMDAT IN S_QMDAT.
LOOP AT T_DET.
SELECT SINGLE * FROM IHPA WHERE OBJNR = T_DET-OBJNR and
PARVW = 'AB'.
IF SY-SUBRC = 0.
T_DET-PARNR = IHPA-PARNR.
MODIFY T_DET.
CLEAR T_DET.
ENDIF.
ENDLOOP.
LOOP AT T_DET.
DELETE T_DET WHERE PARNR EQ ''.
SELECT SINGLE * FROM JEST WHERE OBJNR = T_DET-OBJNR AND
STAT = 'I0072' AND
INACT NE 'X'.
IF SY-SUBRC NE 0.
DELETE T_DET INDEX SY-TABIX.
ENDIF.
ENDLOOP.
LOOP AT T_DET.
SELECT SINGLE * FROM HRP1000 WHERE OBJID = T_DET-PARNR.
IF SY-SUBRC = 0.
T_DET-STEXT = HRP1000-STEXT.
MODIFY T_DET.
CLEAR T_DET.
ENDIF.
ENDLOOP.
LOOP AT T_DET.
CHK2 = T_DET-QMNUM+0(4).
IF CHK2 NE '0002'.
DELETE T_DET INDEX SY-TABIX.
ENDIF.
ENDLOOP.
*--FOR HEADER
LOOP AT T_DET.
SELECT SINGLE * FROM HRP1000 WHERE OBJID = T_DET-PARNR AND
STEXT NE ''.
T_HDR-QMNUM = T_DET-QMNUM.
T_HDR-STEXT = HRP1000-STEXT.
APPEND T_HDR.
CLEAR T_HDR.
ENDLOOP.
LOOP AT T_DET.
F_TDID = 'LTQM'.
F_TDNAME = T_DET-QMNUM.
F_TDOBJECT = 'QMEL'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = F_TDID
LANGUAGE = SY-LANGU
NAME = F_TDNAME
OBJECT = F_TDOBJECT
TABLES
LINES = ITAB_LINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
DESCRIBE TABLE ITAB_LINES LINES SY-TFILL.
IF SY-TFILL > 0.
LOOP AT ITAB_LINES.
ITAB-QMNUM = T_DET-QMNUM.
ITAB-DESC = ITAB_LINES-TDLINE.
APPEND ITAB.
CLEAR ITAB.
ENDLOOP.
ENDIF.
ENDLOOP.
SORT T_DET.
LOOP AT T_DET.
SNO = SNO + 1.
T_FINAL-SNO = SNO.
T_FINAL-QMNUM = T_DET-QMNUM.
T_FINAL-QMTXT = T_DET-QMTXT.
T_FINAL-COST = T_DET-COST.
IF G_STEXT NE T_DET-STEXT.
G_STEXT = T_DET-STEXT.
T_FINAL-STEXT = T_DET-STEXT.
ENDIF.
LOOP AT ITAB WHERE QMNUM = T_DET-QMNUM.
T_FINAL-DESC = ITAB-DESC.
APPEND T_FINAL.
CLEAR T_FINAL.
IF T_FINAL-SNO = '0'.
T_FINAL-SNO = ''.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM. "GET_DATA
*& FORM DISPLAY_ALV
TEXT
FORM DISPLAY_ALV.
V_REPID = SY-REPID.
PERFORM FIELD_CATLOG.
PERFORM EVENT.
PERFORM LAYOUT.
PERFORM SORT_T_FINAL.
PERFORM TOP-OF-PAGE.
PERFORM REMOVE_SORT.
CALL FUNCTION <b>'REUSE_ALV_GRID_DISPLAY'</b>
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
IS_LAYOUT = S_LAYOUT
IT_FIELDCAT = I_FIELDCAT[]
I_SAVE = 'A'
IT_SORT = IT_SORT
IT_EVENTS = I_EVENTS[]
IT_EXCLUDING = EX
TABLES
T_OUTTAB = T_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. "DISPLAY_ALV
*& Form FIELD_CATLOG
text
FORM FIELD_CATLOG .
PERFORM FILL_FCAT USING:
1 1 'STEXT' 'ATTRIBUTED DIV' 18 'T_FINAL' ' '
1 2 'SNO' 'SR.NO' 18 'T_FINAL' ' '
1 3 'QMNUM' 'ET.REF.NO' 30 'T_FINAL' ' '
1 4 'QMTXT' 'DESCRIPTION' 20 'T_FINAL' ' '
1 4 'DESC' 'DEFECT' 20 'T_FINAL' ' '
1 5 'COST' 'COST' 15 'T_FINAL' 'S'.
ENDFORM. " FIELD_CATLOG
*& Form FILL_FCAT
text
-->LEV text
-->POS text
-->FLD text
-->DES text
-->LEN text
-->TABLE text
-->F text
FORM FILL_FCAT USING LEV POS FLD DES LEN TABLE F.
CLEAR I_FCALV.
I_FCALV-COL_POS = POS.
I_FCALV-FIELDNAME = FLD.
I_FCALV-SELTEXT_L = DES.
I_FCALV-DDICTXT = 'L'.
I_FCALV-OUTPUTLEN = LEN.
I_FCALV-TABNAME = TABLE.
IF F EQ 'S'.
I_FCALV-DO_SUM = 'X'.
ENDIF.
APPEND I_FCALV TO I_FIELDCAT.
ENDFORM. "FILL_FCAT
*& Form SORT_T_FINAL
text
FORM SORT_T_FINAL.
DATA: L_SORT LIKE LINE OF IT_SORT.
REFRESH IT_SORT.
CLEAR L_SORT.
L_SORT-SPOS = '1'.
L_SORT-FIELDNAME = 'STEXT'.
L_SORT-TABNAME = 'T_FINAL'.
L_SORT-UP = 'X'.
APPEND L_SORT TO IT_SORT.
CLEAR L_SORT.
L_SORT-SPOS = '6'.
L_SORT-FIELDNAME = 'COST'.
L_SORT-TABNAME = 'T_FINAL'.
L_SORT-UP = 'X'.
L_SORT-SUBTOT = 'X'.
APPEND L_SORT TO IT_SORT.
CLEAR L_SORT.
S_LAYOUT-CELL_MERGE = 'X'.
ENDFORM. "SORT_T_FINAL
*& Form EVENT
text
FORM EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = I_EVENTS[].
LOOP AT I_EVENTS.
IF I_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
I_EVENTS-FORM = 'T_TOP_OF_PAGE'.
ENDIF.
IF I_EVENTS-NAME = SLIS_EV_USER_COMMAND.
I_EVENTS-FORM = 'USER_COMMAND'.
ENDIF.
MODIFY I_EVENTS.
ENDLOOP.
ENDFORM. " EVENT
*& Form LAYOUT
text
FORM LAYOUT .
S_LAYOUT-DETAIL_POPUP = 'X'.
<b> S_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.</b>
ENDFORM. " LAYOUT
*& Form TOP-OF-PAGE
text
FORM TOP-OF-PAGE .
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
LS_LINE-INFO = 'Error Trouble -by cost'.
APPEND LS_LINE TO I_LIST_TOP_OF_PAGE.
CLEAR LS_LINE.
ENDFORM. " TOP-OF-PAGE
*& Form REMOVE_SORT
text
FORM REMOVE_SORT.
EXWA-FCODE = '&ODN'.
APPEND EXWA TO EX.
EXWA-FCODE = '&OUP'.
APPEND EXWA TO EX.
ENDFORM. "REMOVE_SORT
*& Form T_TOP_OF_PAGE
text
FORM T_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_LIST_TOP_OF_PAGE[].
ENDFORM. " T_TOP_OF_PAGE
Maybe you are looking for
-
How to set Destination URI of a column in a multi row table
Hi, I need to programmatically set the destinationURI property of a 'messageStyleText' column in a multi-row table. I have used the below code in the processRequest of the Controller of the page: OAViewObject viewObject = (OAViewObject)am.findViewObj
-
Extract - Delete Adjacent Duplicates
Hi Experts, As in internal tables is it possible to delete adjacent duplicate records from an extract ? Thanks in advance. Ramesh.
-
Hello, As I'm new to scripting in SAP (and programming in general) I'm trying to read out an sap grid to excel. Below is my code which is (partly) working, however it only fills 96 lines in excel. I tried 'SapGuiGridScrollToRow' to scroll every 90 li
-
What is the difference between tab and cat....
Hi developers, I am new to oracle. I would like to know what is the difference between select * from tab; and select * from cat;. with Regards sure...:)-
-
Urgent --oracle service is not starting
hi everyone, in my server one of oracle service is not starting. "oracleorahome81httpserver" if i try to start this service its telling that " error 1067, the process terminated unexpectedly. i checked in cmd prompt, by r3trans -d. its telling " erro