Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Reg:Listbox in tablecontrol

Former Member
0 Likes
906

Hello All,

Am having a field with list box inside a table control, i can able to append the values in the list box using vrm_id function module.

my problem was after am selecting the value from the list box it doesn't come to internal table or work area since am declaring my fields in the table control as work area-field name.

say for example

X_ASSIGNMENT-employee_id this is my field name i have declared for employee column in table control when i select the value

from the list box the field X_ASSIGNMENT-employee_id contains blank how to get the value here.

could you please explain why its not coming. and also could you explain how to bring the list box values based on another list box inside a table control?

Hello All,

Am having a field with list box inside a table control, i can able to append the values in the list box using vrm_id function module.

my problem was after am selecting the value from the list box it doesn't come to internal table or work area since am declaring my fields in the table control as work area-field name.

say for example

X_ASSIGNMENT-employee_id this is my field name i have declared for employee column in table control when i select the value

from the list box the field X_ASSIGNMENT-employee_id contains blank how to get the value here.

could you please explain why its not coming. and also could you explain how to bring the list box values based on another list box inside a table control?

4 REPLIES 4
Read only

Former Member
0 Likes
866

Hi Suresh,

Did you tried editting any other values in any other fields in the table contol, before selecting values from list box. If the value of the field is not changing to the previous ,

then in the pai you have to read the selected value from the list box and set that value as default value for the list box.

pls let me know if this is working

Regards

Sarath

Read only

0 Likes
866

&----


*& Report ZTABLEC

*&

&----


*&

*&

&----


REPORT ZTABLEC.

tables : mara.

data : it like mara occurs 0 with header line.

data : begin of it1 occurs 0 ,

matnr like mara-matnr ,

end of it1 .

*data : begin of it occurs 0 ,

matnr like mara-matnr ,

end of it .

data: OK_CODE type SY-UCOMM .

data :STATUS like zaiod3-status .

controls : t1 type tableview using screen 1000.

call screen 1000.

&----


*& Module STATUS_1000 OUTPUT

&----


text

-


MODULE STATUS_1000 OUTPUT.

SET PF-STATUS 'xxxxxxxx'.

SET TITLEBAR 'xxx'.

select * from mara into table it up to 10 rows.

ENDMODULE. " STATUS_1000 OUTPUT

&----


*& Module USER_COMMAND_1000 INPUT

&----


text

-


MODULE USER_COMMAND_1000 INPUT.

IF SY-UCOMM = 'SAVE'.

IT-MATNR = mara-matnr.

append it.

modify MARA from it.

ENDIF.

ENDMODULE. " USER_COMMAND_1000 INPUT

&----


*& Module create_dropdown_box INPUT

&----


text

-


MODULE create_dropdown_box INPUT.

SELECT matnr FROM mara

INTO CORRESPONDING FIELDS OF TABLE it1.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

DDIC_STRUCTURE = ' '

RETFIELD = 'MATNR'

PVALKEY = ' '

DYNPPROG = ' '

DYNPNR = ' '

DYNPROFIELD = ' '

STEPL = 0

WINDOW_TITLE =

VALUE = ' '

VALUE_ORG = 'S'

MULTIPLE_CHOICE = ' '

DISPLAY = ' '

CALLBACK_PROGRAM = ' '

CALLBACK_FORM = ' '

MARK_TAB =

IMPORTING

USER_RESET =

TABLES

VALUE_TAB = IT1

FIELD_TAB =

RETURN_TAB =

DYNPFLD_MAPPING =

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 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.

ENDMODULE. " create_dropdown_box INPUT

procedure.....

above coding do in se38

go to se51 make a table control go to secondary window click on dictionary table control fields for passing data from database now select the column on which u want to list box double click on that in the toolbox click dropdownbox select listbox ...

save check activate

go to layout......

PROCESS BEFORE OUTPUT.

MODULE STATUS_1000.

loop at it with control t1.

endloop.

PROCESS AFTER INPUT.

MODULE USER_COMMAND_1000.

loop at it.

endloop.

MODULE USER_COMMAND_1000.

PROCESS ON VALUE-REQUEST.

FIELD mara-matnr MODULE create_dropdown_box.

save check activate

regards

Aniruddh Singh

Read only

Former Member
0 Likes
866

Hi,

Try to attach search help for the screen field at design time

Read only

former_member200872
Active Participant
0 Likes
866

Hi,

I tried working on this.

Now, im able to display values selected in listbox.

Try the following code in se80 by creating a program sapmyz and screen 100 (upload it from a text file).

Regards,

Wajid Hussain P.

  • * * * * Program

*=======================================

&----


*& Module Pool SAPMYZ

*&

&----


*&

*&

&----


INCLUDE myztop . " global Data

  • INCLUDE MYZO01 . " PBO-Modules

  • INCLUDE MYZI01 . " PAI-Modules

  • INCLUDE MYZF01 . " FORM-Routines

**&----


**

**& Include MYZTOP Module Pool SAPMYZ

**&

**&----


**

*

*PROGRAM SAPMYZ.

*TYPE-POOLS: VRM.

*controls: tc type TABLEVIEW USING screen 100.

*tables: vbrk.

*data: it_vbrk type table of vbrk,

  • wa_vbrk type vbrk,

  • IT_VALUES TYPE VRM_VALUES ,

  • WA_VALUES LIKE LINE OF IT_VALUES.

&----


*& Module read_tc INPUT

&----


  • text

----


MODULE read_tc INPUT.

MOVE vbrk TO wa_vbrk.

MODIFY it_vbrk INDEX tc-current_line FROM wa_vbrk .

IF NOT sy-subrc IS INITIAL.

APPEND wa_vbrk TO it_vbrk.

ENDIF.

ENDMODULE. " read_tc INPUT

&----


*& Module show_tc OUTPUT

&----


  • text

----


MODULE show_tc OUTPUT.

MOVE-CORRESPONDING wa_vbrk TO vbrk.

ENDMODULE. " show_tc OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE user_command_0100 INPUT.

SORT it_vbrk BY vbeln fkart.

DELETE ADJACENT DUPLICATES FROM it_vbrk COMPARING vbeln fkart.

DESCRIBE TABLE it_vbrk LINES tc-lines.

tc-lines = tc-lines + 1.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0100 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

ENDMODULE. " STATUS_0100 OUTPUT

*=======================================

  • * * * *

  • * * * * Screen 100 " --- Copy/Paste & save as txt file

*=======================================

****************************************************************

  • THIS FILE IS GENERATED BY THE SCREEN PAINTER. *

  • NEVER CHANGE IT MANUALLY, PLEASE ! *

****************************************************************

%_DYNPRO

SAPMYZ

0100

700

40

%_HEADER

SAPMYZ 0100 0100 19 58192 37 0 0 27120 0G E 20080701112016

%_DESCRIPTION

hi

%_FIELDS

TC 56 F5 C0 00 00 00 3 4 E 101 1 1 17 T 0 0

VBRK-VBELN 2 CHAR 15 30 00 04 30 80 1 1 T 101 1 1 10 0 0 Billing_Doc.___

VBRK-FKART 2 CHAR 15 30 00 04 30 80 1 2 T 101 1 1 22 0 0 Billing_Type___

VBRK-VBELN C CHAR 10 A0 00 84 00 08 1 1 T 101 1 1 10 VF ALPHA 20 0 __________ X

VBRK-FKART C CHAR 4 A0 00 84 00 08 1 2 T 101 1 1 22 8 0 ____ XDL

CHAR 20 80 10 00 00 00 255 1 O 0 0 0 0 0 0 ____________________

%_FLOWLOGIC

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

*

loop at it_vbrk into wa_vbrk with control tc.

module show_tc.

endloop.

PROCESS AFTER INPUT.

loop at it_vbrk.

module read_tc.

endloop.

MODULE USER_COMMAND_0100.

%_PARAMS