Combo box in a selection screen
Hi,
how can I get a combo box with values into s selection screen field.
Thanks,
Marian
Hi..
just paste this code..
<b>TYPE-POOLS VRM.
DATA:
VRM_VALUE TYPE VRM_VALUE.
DATA:
T_DATA TYPE STANDARD TABLE OF VRM_VALUE.
DATA:
W_NUM TYPE I.
PARAMETERS:
P_LIST AS LISTBOX VISIBLE LENGTH 10
USER-COMMAND RAM. " DEFAULT 'X'.
PARAMETERS:
P_F1(10) TYPE C MODIF ID GR1.
INITIALIZATION.
VRM_VALUE-KEY = 'A'.
VRM_VALUE-TEXT = 'RAM'.
APPEND VRM_VALUE TO T_DATA.
VRM_VALUE-KEY = '2'.
VRM_VALUE-TEXT = 'MOHAN'.
APPEND VRM_VALUE TO T_DATA.
VRM_VALUE-KEY = '3'.
VRM_VALUE-TEXT = 'RAO'.
APPEND VRM_VALUE TO T_DATA.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'P_LIST'
VALUES = T_DATA
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF P_LIST NE 'A'.
IF SCREEN-GROUP1 = 'GR1'.
SCREEN-ACTIVE = '0'.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
AT SELECTION-SCREEN.
START-OF-SELECTION.
WRITE: / P_LIST.</b>
Similar Messages
-
Index of Values in the List Boxes on a Selection Screen
Hi,
I have a list box on the selection screen for Month field. It has the values Jan, Feb, Mar....etc in it.
These entries, I added thru the VRM_SET_VALUES.
Now, I want to default the month to current month SY-DATUM+4(2).
Is there any FM to which I can send this SY-DATUM+4(2) as an Index and the corresponding value gets set for the Month field.
As an alternatvie, I could use<b> Case Sy-DATUM+4(2). when '01'. p_month = 'Jan'. etc etc..</b> But I want to avoid this big case statement.
Please suggest.
Thanks,
Suryakiran D.Hi Suryakiran,
Try to use the func <b>MONTH_NAMES_GET</b>.It will
return the month name along with the number.
And also you can directly select from table <b>T247</b>
Thanks&Regards,
Siri.
Message was edited by: Srilatha T -
How to Create a DropDown Box in a Selection Screen.
Hi,
I have a question. i.e, How to create a dropdown box in a Selection Screen. Could you please assist me.
Thanks & Regards
Sathish Kumarhi satish,
The following can assist u to create a drop down ....
Drop down list box can be created in a dialog screen(SE51) as well as selection screen.
The sap list box allows to select a value from the list but we cannot enter our own value in the list box .The value list that will be displayed consists of two
fields TEXT field of TYPE 80(C) and internal KEY field of TYPE 40(C).
In screen painter to create a input/output field into list box we use
'L" as a value for dropdown attribute for the i/o field.
In screen painter to determine the type of method that will be used to fill the value
list we use the attribute value list.
If it is blank the value list will be filled by the first column of the input help assigned to the screen field.This input help can be defined in the ABAP Dictionary, on screen using SELECT,VALUES screen statements or in event POV (PROCESS ON VALUE-REQUEST ) and the input help that will be passed to the field should consists of 2 columns ,the key column is filled automatically by the system.SAP recommends value list field should be blank.
or
The value can be 'A' meaning that the value list will be filled in the event PBO(PROCESS BEFORE OUTPUT) or before the screen is displayed.In this method we use function module VRM_SET_VALUES to fill the values and pass it to the i/o field.
If a function code is attached to the list box the selection of a value triggers a PAI
otherwise PAI will not trigger.
Example
Dropdown list boxes
REPORT DEMO_DYNPRO_DROPDOWN_LISTBOX.
TYPE-POOLS VRM.
DATA: NAME TYPE VRM_ID,
LIST TYPE VRM_VALUES,
VALUE LIKE LINE OF LIST.
DATA: WA_SPFLI TYPE SPFLI,
OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM.
TABLES DEMOF4HELP.
NAME = 'DEMOF4HELP-CONNID'.
CALL SCREEN 100.
MODULE CANCEL INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE INIT_LISTBOX OUTPUT.
CLEAR DEMOF4HELP-CONNID.
SELECT CONNID CITYFROM CITYTO DEPTIME
FROM SPFLI
INTO CORRESPONDING FIELDS OF WA_SPFLI
WHERE CARRID = DEMOF4HELP-CARRIER2.
VALUE-KEY = WA_SPFLI-CONNID.
WRITE WA_SPFLI-DEPTIME TO VALUE-TEXT
USING EDIT MASK '__:__:__'.
CONCATENATE VALUE-TEXT
WA_SPFLI-CITYFROM
WA_SPFLI-CITYTO
INTO VALUE-TEXT SEPARATED BY SPACE.
APPEND VALUE TO LIST.
ENDSELECT.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = NAME
VALUES = LIST.
ENDMODULE.
MODULE USER_COMMAND_100.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
IF SAVE_OK = 'CARRIER'
AND NOT DEMOF4HELP-CARRIER2 IS INITIAL.
LEAVE TO SCREEN 200.
ELSE.
SET SCREEN 100.
ENDIF.
ENDMODULE.
MODULE USER_COMMAND_200.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
IF SAVE_OK = 'SELECTED'.
MESSAGE I888(BCTRAIN) WITH TEXT-001 DEMOF4HELP-CARRIER2
DEMOF4HELP-CONNID.
ENDIF.
ENDMODULE.
Reward if useful.
Thank you,
Regards. -
How to create the list box in the selection screen.
hai friends..
i want to create the list box for the selection screen input boxes.
thanks,
velu.hi..
1. There are two important things :
a)PARAMETERS : a(10) TYPE c AS LISTBOX VISIBLE LENGTH 10.
b) Fm VRM_SET_VALUES
2. just copy paste
3.
REPORT abc.
TYPE-POOLS : vrm.
DATA : v TYPE vrm_values.
DATA : vw LIKE LINE OF v.
PARAMETERS : a(10) TYPE c AS LISTBOX VISIBLE LENGTH 10.
INITIALIZATION.
vw-key = '1'.
vw-text = 'Jan'.
APPEND vw TO v.
vw-key = '2'.
vw-text = 'Feb'.
APPEND vw TO v.
vw-key = '3'.
vw-text = 'Mar'.
APPEND vw TO v.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'A'
values = v
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
regards,
veeresh -
List Boxes on a Selection Screen
Hi,
I have a list box on the selection screen. In the At Selection Screen Output, I filled the List box with 12 Values.
Now, I want to default the List box value with one of those values.
So, after the CALL FM 'VRM_SET_VALUES', I say p_field = 'Value'.
But this Value is being shown in the Drop down list twice.
I could not understand the mistake.
Please suggest.
Thanks,
Suryakiran D.Hi suryakiran,
1. Its happening bcos
u must be giving NAME
2. give p_field = Key
3. ie. 1 for Jan
2 for Feb etc
in the FM VRM_SET_VALUES
we are filling the parameter VALUES
VALUES-key
VALUES-TEXT
so, give KEY, (and not text)
after calling this FM.
4.
REPORT abc.
TYPE-POOLS : vrm.
DATA : v TYPE vrm_values.
DATA : vw LIKE LINE OF v.
PARAMETERS : a(10) TYPE c AS LISTBOX VISIBLE LENGTH 10.
INITIALIZATION.
vw-key = '1'.
vw-text = 'Jan'.
APPEND vw TO v.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'A'
values = v
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
a = '1'.
Problem
a = 'Jan'.
regards,
amit m.
Message was edited by: Amit Mittal -
Check Box On Standrad Selection-screen
Hi Friends
I am working on HR ABAP .I added 4 check boxes On Standrad Selection-screen. Its working on Development but its not working on production.can anyone suggest how its happend.Hello,
A few questions.
- what exactly is not working in production?
- do the check boxes appear at all?
- did the changes get recorded on a change request and transported?
- was the transport successful?
- do the checkboxes 'work' in the QA envirionment?
Regards
Greg Kern -
Handling Check Boxes in the selection screen
Hi All,
I have defined 3 Check Boxes in the selection screen and one box will be ticked as 'X" by default.
I need to put restriction so that only any one should be selected as 'X' whenever user wish to select.
Hence any time, when user selects a box, other two should be unchecked.
How to put this kind of control?
Regards
PavanI think you should go for 'Radiobutton'
But if U want check box then
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF cb_option1 = 'X'.
CLEAR cb_option2.
MODIFY SCREEN.
ELSEIF cb_option2 = 'X'.
CLEAR cb_option1.
MODIFY SCREEN.
ENDIF.
ENDLOOP. -
How to create Option Boxes IN A SELECTION SCREEN
How to create Option Boxes IN A SELECTION SCREEN.
Thanks!Hi Rajesh,
The following explanation gives clear picture of what is mean of check box and radio button with coding.....................
<b>CHECK BOX :</b>
AS CHECKBOX [USER-COMMAND fcode]
Effect:
This addition specifies that the input field in the first position of the selection screen is displayed as a checkbox, with the corresponding description next to it on the right. The checkbox is selected if the value of para is "X" or r "x". Otherwise, it is not selected.
The parameter must be created with the type c and length 1. An explicit length len is not permitted. If the addition TYPE is used, this can only be followed by the generic type c or a non-generic data type of type c and length 1.
The addition USER-COMMAND can be used to assign a function code fcode to the parameter. The function code fcode must be directly specified and may have a maximum length of 20 characters. To evaluate the function code, an interface work area of the structure SSCRFIELDS from the ABAP Dictionary must be declared using the statement TABLES. When the user selects the checkbox on the selection screen, the runtime environment triggers the event AT SELECTION-SCREEN and transfers the function code fcode to the component ucomm of the interface work area sscrfields.
Notes
If the TYPE addition is used to make a reference to a data type in the ABAP Dictionary of type CHAR and length 1, and for which t the valid values in the domain are defined as "X" and " ", the parameter is automatically displayed as a checkbox on the selection screen.
If the addition USER-COMMAND is specified without the addition AS CHECKBOX, and the parameter is of type c with length 1, it is also displayed as a checkbox.
The addition USER-COMMAND can, for example, be used for screen modifications with the addition MODIF ID (see example).
<b>Coding :</b>
PARAMETERS show_all AS CHECKBOX USER-COMMAND flag.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: p1(10) TYPE c,
p2(10) TYPE c,
p3(10) TYPE c.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
PARAMETERS: p4(10) TYPE c MODIF ID bl2,
p5(10) TYPE c MODIF ID bl2,
p6(10) TYPE c MODIF ID bl2.
SELECTION-SCREEN END OF BLOCK b2.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF show_all <> 'X' AND
screen-group1 = 'BL2'.
screen-active = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
<b>RADIO BUTTON COMMAND :</b>
RADIOBUTTON GROUP group [USER-COMMAND fcode]
Effect:
This addition specifies that the input field is displayed as a radio button in the first position on the selection screen, and the output field is displayed next to it on the right. The radio button is selected if the value of para is "X" or "x". Otherwise, it is not selected.
group is used to define the radio button group for the parameter. The name group is entered directly as a character string with a maximum of 4 characters. Within a selection screen, there must be a minimum of two parameters in the same radio button group. There cannot be more than one radio button group with the same name in one program, even if they are defined in different selection screens.
The parameter must be specified with the type c and length 1. Explicit length specification using len is not permitted. If the addition TYPE is used, it can only be followed by the generic type c or a non-generic data type of type c and length 1.
In a radio button group, only one parameter can be defined with the addition DEFAULT, and the specified value must be "X". By default, the first parameter in a radio button group is set to the value "X", and the rest are set to " ".
The addition USER-COMMAND can be used to assign a function code fcode to the first parameter in a radio button group. The function code fcode must be specified directly, and have a maximum length of 20 characters. To evaluate the function code, an interface work area of the structure SSCRFIELDS from the ABAP Dictionary must be declared using the statement TABLES. When the user selects any radio button of the radio button group on the selection screen, the runtime environment triggers the event AT SELECTION-SCREEN and transfers the function code fcode to the component ucomm of the interface work area sscrfields.
Note:
It is recommended to define the radio buttons of a radio button group directly underneath each other. If the selection screen also contains other elements, it is recommended to define each radio button group within a block surrounded by a frame.
<b>CODING :</b>
tables : mkpf,mseg,ekko.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETER : P_WERKS LIKE MARC-WERKS MODIF ID S1,
c as checkbox.
SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN NO INTERVALS MODIF ID S2.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-004.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X' USER-COMMAND UC1.
SELECTION-SCREEN COMMENT 5(20) TEXT-002 FOR FIELD R1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : R2 RADIOBUTTON GROUP G1.
SELECTION-SCREEN COMMENT 5(20) TEXT-003 FOR FIELD R2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
write :/ p_werks,
/ s_ebeln.
AT SELECTION-SCREEN OUTPUT .
LOOP AT SCREEN .
IF R1 EQ 'X' AND SCREEN-GROUP1 EQ 'S2'.
SCREEN-INPUT = 0.
SCREEN-REQUIRED = 1.
clear s_ebeln[].
clear p_werks.
MODIFY SCREEN.
ENDIF.
IF R2 EQ 'X' AND SCREEN-GROUP1 EQ 'S1'.
SCREEN-INPUT = 0.
SCREEN-REQUIRED = 1.
clear s_ebeln[].
clear p_werks.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Let me knwo if any doubts.
<b>Reward with points if it helpful</b>
Regards,
Vijay -
Input box on default selection screen
Hi,
how to create an input box on the default selection screen which will accept only 1275 characters.
Can u please help me?
Thanks in Advance,
Sreekala.Hi Sreekala,
You need to use the CL_GUI_TEXTEDIT for creating the box, also you need use the dialog program for that.
For more info on that class check this
Usage of CL_GUI_TEXTEDIT
Text box on selection screen
Hope they helps you.
Regards! -
VBA Userforms – Getting errors when item from combo box is not selected
Hi there
Thank you in advance for taking the time to check this out.
Objective:
I have 2 combo boxes, one is dependent on what has been selected in the first combo box (dynamic named range), they work fine except for an irritating error when the user accidentally clicks in the empty
Cmbox_IncCategory and it won’t allow the user to go back to the
cmbx_Category_Type box if the user forgot he had to make a selection from that first before selecting the
Cmbox_IncCategory.
The error that pops up is “Invalid property value”.
I tried having text in there to say “please select from Cmbox_IncCategory first, but that didn’t fix it.
I tried to ‘If error resume next’ but that didn’t like it either. Now I am stumped.
Main combo box= cmbx_Category_Type
2nd combo box (displaying a list dependent on what was selected in Main combo box)= Cmbox_IncCategory
I know there must be a way to fix it so that if a user clicks on the combo box, but doesn’t make a selection it won’t lock up the form.
Yes, it is a mandatory field, and I was considering using a message box to advise the user that this must be completed, but I am not sure how to do it (and avoid the errors
Here’s the current code I have for the combo boxes.
Me.Cmbox_IncCategory = "" 'Clears the contents of the 2nd combobox when another category is chosen
On Error Resume Next
'I can't seem to have the Incident Category combobox to be empty when the form is open _
I have tried Cmbox_IncCategory.Value = "", but I get an error. I then tried Cmbox_IncCategory.text = "" _
but also get the error. I don't know how else to get it to work .. I tried both codes in the _
form_initialize, but get an error ... I'm stumped !
Select Case Me.cmbx_Category_Type
Case "Crime"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_CRIME"
Case "Property Damage - Minor - NS"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_PROPRTY_NS"
Case "Property Damage - Significant - S"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_Proprty_S"
Case "Safety"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_SAFETY"
Case "Security Breach"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_BREACH_S"
Case "Support"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_SUPPORT"
Case "Vehicle"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_VEHICLE_S"
End Select
End Sub
I’d be really grateful if someone could help me out, or perhaps direct me to where I might find some coding that will achieve the result I am seeking.
This links to
My Sample form
With much gratitude,
TheShyButterfly
Hope you have a terrific day, theShyButterflyHi Peter,
Thank you for your quick response :) Brave man! :)
Both combo boxes are blank to start with (because nothing has been selected). If I click on the first combo box (cmbx_Category_Type) which lists the main events/category types, but I don't select any thing, and I click in the secondary box
(Cmbox_IncCategory) and then click on any other control, I get an “Invalid property value” error. When I click OK on the error (a few times) and I return to the code window, it gives no indication where/what is breaking
the code/causing the error. I have no choice but to exit the form by stopping in the code window.
If I click on the first textbox, (cmbx_Category_Type), and then do the right thing and make a selection, then I have no problems with the secondary textbox (Cmbox_IncCategory).
As I am not that up on VBA I am trying to follow your instructions... I have changed the code as follows, removed and replaced the rowsource name, but I encounter the very same problem.
When I changed my code from Me.Cmbox_IncCategory="" to yours myCombo.ListIndex = -1 (changing the combo box name to reflect my combo box name) and adding the second line of code ...
Me.Cmbox_IncCategory.ListIndex = 0 I still got the same behaviour and error.
I even tried moving each row of the named rows down one row (so that there would be a 'blank' row which could be selected to get out of trouble, but it wasn't very successful either.
Have you opened my form to see what happens, I included the link so whoever was looking at my problem (and yes, I have many I know), could see for themselves what it is doing/not doing.
The code now reads as below (is this what you meant?) - the results were as I mentioned above.
Me.Cmbox_IncCategory.ListIndex = -1 'Clears the contents of the 2nd combobox when another category is chosen
Me.Cmbox_IncCategory.ListIndex = 0
' On Error Resume Next
'I can't seem to have the Incident Category combobox to be empty when the form is open _
I have tried Cmbox_IncCategory.Value = "", but I get an error. I then tried Cmbox_IncCategory.text = "" _
but also get the error. I don't know how else to get it to work .. I tried both codes in the _
form_initialize, but get an error ... I'm stumped !
Select Case Me.cmbx_Category_Type
Case "Crime"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_CRIME"
Case "Property Damage - Minor - NS"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_PROPRTY_NS"
Case "Property Damage - Significant - S"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_Proprty_S"
Case "Safety"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_SAFETY"
Case "Security Breach"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_BREACH_S"
Case "Support"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_SUPPORT"
Case "Vehicle"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_VEHICLE_S"
End Select
End Sub
I appreciate your patience :) I am growing in knowledge, but its a slow process. Please let me know if there is anything else I can help clarify for you :)
This links to
My Sample form
Thanking you again
TheShyButterfly
Hope you have a terrific day, theShyButterfly -
How to get a check box on the selection screen
Hi all
can any body tell me how to get a check box on the selection screenparameter: pa_check as checkbox.
To define the input field of a parameter as a checkbox, you use the following syntax:
PARAMETERS <p> ...... AS CHECKBOX ......
Parameter <p> is created with type C and length 1. In this case, you may not use the additions TYPE and LIKE. Valid values for <p> are ' ' and 'X'. These values are assigned to the parameter when the user clicks the checkbox on the selection screen.
If you use the TYPE addition to refer to a data type in the ABAP Dictionary of type CHAR and length 1 for which 'X' and ' ' are defined as valid values in the domain, the parameter automatically appears as a checkbox on the selection screen.
REPORT DEMO.
PARAMETERS: A AS CHECKBOX,
B AS CHECKBOX DEFAULT 'X'. -
Problem in PRD to display check box parameter on selection screen
hi ,
i had one problem, i created one report which will show customer advances, for this report i created one selection screen, i transport req to QAS and PRD it shows fine. after that i need to add one more check box to that report selection screen. i transport reqt to QAS and PRD, in QAS it is woking fine but in PRD i am not able to see the check box which i was enterd. transport was perfect. i am saw the report coding in PRD that has the Check box statement. but it not comming,
1, why the selection screen is not showing that check box parameter ?
2, i had 19 selection fields is their any restriction to display the selection screen ?
please try to solve it for me,
thanq,
rajesh.kHello Rajesh,
First check the Log of your TR. whether it is transported properly without any error or with error.
again delete your Checkbox statement and write code again then try to transport again.
there is no any limitation to provide option on selection screen. you can give as per your requirement.
Regards,
Sujeet -
How to create check boxes dynamically in selection screen
Hi Experts,
I have a requirement of creating dynamic check boxes based on the number of records that are retrieved from a database table.
Can you please suggest me how to achieve it.
Regards
RP.Hey RP,
Try this way.
REPORT ztest_program .
DATA: it_data TYPE TABLE OF t001.
DATA:check TYPE char3.
DATA:sy_index TYPE char2.
DEFINE checkbox.
parameters:&1 as checkbox.
END-OF-DEFINITION.
CHECKbox:c01,c02,c03,c04,c05,c06,c07,c08,c09,c10,
c11,c12,c13,c14,c15,c16,c17,c18,c19,c20,
c21,c22,c23,c24,c25,c26,c27,c28,c29,c30,
c31,c32,c33,c34,c35,c36,c37,c38,c39,c40.
AT SELECTION-SCREEN OUTPUT.
DESCRIBE TABLE it_data LINES sy-tfill.
sy-tfill = 39. "This will be changed based on the itab records. I just hardcoded the value
sy_index = 1.
LOOP AT SCREEN.
CONCATENATE 'C' sy_index INTO check.
IF screen-name = check.
IF sy_index GT sy-tfill.
screen-active = '0'.
MODIFY SCREEN.
sy_index = sy_index + 1.
CONTINUE.
ENDIF.
sy_index = sy_index + 1.
ENDIF.
ENDLOOP.
Thanks
Venkat.O -
Check box in ALV selection screen
Hi to all
I like to know how to create a checkbox in the input screen of an ALV.What do you mean by ALV check box selection screen?
ALV and selection screen check box( you are mixing two cases in your Question).
You need use the Function moduel in the user command to get the updated data.
in fieldcatalog you have to use INPUT = 'X' and EDIT = 'X' for the columns which ever you want edit.
GET_GLOBALS_FROM_SLVC_FULLSCR
follow the sample code.
REPORT ZTEST_ALV_CHECK MESSAGE-ID ZZ .
TYPE-POOLS: SLIS.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
L_LAYOUT TYPE SLIS_LAYOUT_ALV,
X_EVENTS TYPE SLIS_ALV_EVENT,
IT_EVENTS TYPE SLIS_T_EVENT.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
CHK(1),
color(4),
END OF ITAB.
SELECT VBELN
POSNR
FROM VBAP
UP TO 20 ROWS
INTO TABLE ITAB.
X_FIELDCAT-FIELDNAME = 'CHK'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
X_FIELDCAT-INPUT = 'X'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-CHECKBOX = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-SELTEXT_L = 'VBELN'.
X_FIELDCAT-HOTSPOT = 'X'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 2.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-SELTEXT_L = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 3.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_LAYOUT-info_fieldname = 'COLOR'.
*L_LAYOUT-ZEBRA = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = ITAB
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.
*& Form STATUS
text
-->P_EXTAB text
FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.
Pf status
SET PF-STATUS 'STATUS'.
ENDFORM. " STATUS
*& Form USER_COMMAND
text
-->R_UCOMM text
-->RS_SELFIELD text
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
DATA: GD_REPID LIKE SY-REPID, "Exists
REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
IF REF_GRID IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF_GRID.
ENDIF.
IF NOT REF_GRID IS INITIAL.
CALL METHOD REF_GRID->CHECK_CHANGED_DATA .
ENDIF.
loop at itab where chk = 'X'.
itab-color = 'C300'.
modify itab index sy-tabix transporting color.
endloop.
RS_SELFIELD-refresh = 'X'.
break-point.
ENDFORM. "USER_COMMAND
Regards
Vijay Babu Dudla -
Dynamic check box creation in selection screen
Hello,
I am trying to put up some check boxes dynamically in a selection screen. The number: of check boxes required and the 'checkbox label text' is to be retrieved from a database table. I have retrieved all these values in AT SELECTION-SCREEN OUTPUT event. But, I dont know how to create check box parameters using these dynamic values. Please help..hi Giffin,
Create a program with name 'Z_13317_DYN_CHKBOX' and paste the following code in it. Also make ensure that an include with name 'Z_13317_DYN_INCL' is not existing earlier because this program will be overwritten each and everytime.
Z_13317_DYN_CHKBOX will take an integer as an input. After giving input, click on the button on selection screen.
Suppose, if you have given 3 as input and if you have clicked the button, then 3 checkboxes will be generated on your selection screen.
REPORT Z_13317_DYN_CHKBOX.
types :begin of t_itab1,
line(72),
end of t_itab1.
data: incl type table of t_itab1 with header line.
parameters: p_tab type i,
p_frst type c no-display.
selection-screen begin of line.
selection-screen: pushbutton 2(20) but1 user-command cli1.
selection-screen end of line.
include z_13317_dyn_incl if found.
initialization.
at selection-screen output.
if p_frst = ' '.
p_frst = 'X'.
perform crt_dyn_incl.
endif.
at selection-screen.
case sy-ucomm.
when 'CLI1'.
perform crt_dyn_incl.
endcase.
*& Form crt_dyn_incl
* text
form crt_dyn_incl .
perform populate_incl.
perform del_incl.
insert report 'Z_13317_DYN_INCL' from incl.
commit work.
submit z_13317_dyn_chkbox via selection-screen with p_frst = p_frst.
endform. " crt_dyn_incl
*& Form del_incl
* text
form del_incl .
call function 'RS_DELETE_PROGRAM'
exporting
program = 'Z_13317_DYN_INCL'
suppress_checks = 'X'
suppress_popup = 'X'
with_cua = ' '
with_documentation = ' '
with_dynpro = 'X'
with_includes = ' '
with_textpool = ' '
with_variants = ' '
if sy-subrc <> 0.
endif.
endform. " del_incl
*& Form populate_incl
* text
form populate_incl .
data: v_cnt type n.
do p_tab times.
v_cnt = v_cnt + 1.
incl-line = 'parameters: '.
concatenate incl-line 'p_chk' v_cnt into incl-line.
concatenate incl-line 'as checkbox.' into incl-line separated by space.
append incl.
clear incl.
enddo.
endform. " populate_incl
Regards,
Sailaja.
Maybe you are looking for
-
Security project.. help needed
hi friendz and gurus! i am doing a project on security and permissions i have planned to use passwords for that purpose and i have to use java! coz' i am a student and doing this for purpose of learning. can somebody implementat the encryption algo o
-
Session geting disconnected before IDLE_TIME in profile
Hi ! My database is : SQL> select * from v$version; BANNER Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production PL/SQL Release 9.2.0.4.0 - Production CORE 9.2.0.3.0 Production TNS for Linux: Version 9.2.0.4.0 - Production NLSRTL Version 9.2.0.4
-
It would be really convenient if iTunes had a WishList function for account holders. They could add a little button next to a song or movie that would add it to your wishlist. I can't just buy from iTunes whenever I want, so it would be really nice i
-
*In tech. specifications of many of the latest software (for example Adobe's CS) is stated that they work with OSX 10.5.* *Is it possible to install such programs in previous systems like OSX 10.4 and 10.3.9 ? Will they work?* *Also, will they work p
-
My iPhone 5 continues to reaarange photos that are in a particular order from my iPhoto on my MacBook Air ... This has to be some sort of software glitch with iOs6 ... Anyone have any remedies?