‎2006 Sep 29 9:13 AM
Hi SDN,
I have a button in a table control, initially i want all the buttons to be invisible.
when user fills in any row i want the button to be visible.
Please help in some sample code.
Thanks
Pratyusha
‎2006 Oct 03 3:09 AM
Hi Pratyu,
PROCESS AFTER INPUT.
LOOP AT IT_RFQITEM.
CHAIN.
FIELD : <button_field_name>.
module get_line.
ENDCHAIN.
ENDLOOP.
MODULE GET_LINE.
MODIFY IT_RFQITEM FROM IS_RFQITEM INDEX tc_table-current_line.
<b>l_line = tc_table-current_line.</b>
ENDMODULE.
USER COMMAND.
CASE OKCODE.
WHEN 'BUTTON'.
IS_RFQITEM-check = 'X'.
ZES_RFQ_ITEM-CHECK = 'X'.
modify IT_RFQITEM from IS_RFQITEM index l_line.
ENDCASE.
Also i would suggest that the field names on the Screen and table control should be IS_RFQITEM-<field_name> and not ZES_RFQ_ITEM-<field_Name>. Assigning work area directly to field names would make the program more easy rather than having different names for screen fields and work area.
Best regards,
Prashant
‎2006 Sep 29 9:23 AM
Hi Pratyu,
1. In the PBO check if the user has entered anything in the table control.
a. If no, then in Loop at screen of PBO.
For the fieldname of the button, set active = 0.
b. Else set active = 1.
Hope this helps.
Regards.
‎2006 Sep 29 9:32 AM
Hi,
PROCESS BEFORE OUTPUT.
MODULE validate_fields.
MODULE Validate_fields.
if itab_tc[] is initial.
loop at screen.
if screen-name = 'button1'.
screen-invisible = 0.
modify screen.
endif.
endloop.
endif.
ENDMODULE.
Best regards,
Prashant
‎2006 Sep 29 9:42 AM
Hi prashanth,
thanks for the reply, ur code worked out
but if in a row of table control if i enter a value buttons in all rows are being visible.
i dont need it that way, i wnat the button to be visible in each row only if the row contains a value
Thanks in advance
Pratyusha
‎2006 Sep 29 9:46 AM
Hi,
In PBO
if itab[] is initial.
loop at screen.
if screen-name = 'BUTT'.
screen-visible = 0.
mofify screen.
endif.
endloop.
else.
loop at screen.
if screen-name = 'BUTT'.
screen-visible = 1.
mofify screen.
endif.
endloop.
endif.
Regards
amole
‎2006 Sep 29 9:52 AM
Hi Pratyu,
Please change the code as follows :
Hi,
PROCESS BEFORE OUTPUT.
<b>LOOP AT itab_tc INTO wa_tc WITH CONTROL tc_tab CURSOR
tc_tab-current_line.
MODULE validate_fields.
ENDLOOP.</b>
MODULE Validate_fields.
loop at screen.
if screen-name = 'button1'.
screen-invisible = 0.
modify screen.
endif.
endloop.
endif.
ENDMODULE.
Best regards,
Prashant
PS : Please reward all helpful answers
‎2006 Sep 29 10:02 AM
this is what i changed to, but its giving a syntax error that "The addition "WITH CONTROL TC_ITEM" is missing in a LOOP in PBO."
Code as below :
loop at IT_RFQITEM into IS_RFQITEM with control TC_ITEM
cursor TC_ITEM-CURRENT_LINE.
module DISP_MODE.
endloop.
module DISP_MODE output.
if IT_RFQITEM[] is initial.
loop at screen.
if SCREEN-NAME = 'LT'.
SCREEN-INVISIBLE = 1.
modify screen.
endif.
endloop.
endif.
endmodule. " disp_mode OUTPUT
PAI is like this
loop with control TC_ITEM.
chain.
field: ZES_RFQ_ITEM-RFQ_LN,
ZES_RFQ_ITEM-RFQ_STEXT,
ZES_RFQ_ITEM-RFQ_QTY,
ZES_RFQ_ITEM-RFQ_UOM,
ZES_RFQ_ITEM-WAERS,
ZES_RFQ_ITEM-RFQ_LAMT,
ZES_RFQ_ITEM-WARRANTY,
ZES_RFQ_ITEM-REJ_CODE.
module READ_TC.
endchain.
endloop.
Thanks
Pratyusha
‎2006 Sep 29 10:05 AM
Hi Pratyu,
loop at IT_RFQITEM into IS_RFQITEM with control TC_ITEM
cursor TC_ITEM-CURRENT_LINE.
module DISP_MODE.
endloop.
module DISP_MODE output.
<b>if IT_RFQITEM[] is initial.</b> <u><i><b>NOT REQUIRED</b></i></u>
loop at screen.
if SCREEN-NAME = 'LT'.
SCREEN-INVISIBLE = 1.
modify screen.
Endif.
endloop.
<b>* endif.</b><u><i><b> Not Required</b></i></u>
endmodule. " disp_mode OUTPUT
Please declare the following in your top include :
<b>CONTROLS: tc_item TYPE TABLEVIEW USING SCREEN 0100.</b>
Best regards,
Prashant
PS : Please reward all helpful answers
‎2006 Sep 29 10:12 AM
Yes of course i declared the controls in top include.
and i took off the NOT REQUIRED mentioned by you.
but still i get the same error cursor pointing at PAI.
Thanks
Pratyusha
‎2006 Sep 29 10:17 AM
Hi Pratyu,
PAI is like this
loop AT <b>IT_RFQITEM.</b>
chain.
field: ZES_RFQ_ITEM-RFQ_LN,
ZES_RFQ_ITEM-RFQ_STEXT,
ZES_RFQ_ITEM-RFQ_QTY,
ZES_RFQ_ITEM-RFQ_UOM,
ZES_RFQ_ITEM-WAERS,
ZES_RFQ_ITEM-RFQ_LAMT,
ZES_RFQ_ITEM-WARRANTY,
ZES_RFQ_ITEM-REJ_CODE.
module READ_TC.
endchain.
endloop.
Best regards,
Prashant
‎2006 Sep 29 10:20 AM
no i still could not achieve it.
Confused on the same from morning.
‎2006 Sep 29 10:27 AM
Hi ,
What is the error message being displayed. I hope you have removed the WITH CONTROL statement from PAI.
Also what is the code inside MODULE READ...in PAI
Best regards,
Prashant
‎2006 Sep 29 10:30 AM
The error i get is
In the event PROCESS AFTER INPUT, no additions are allowed with " LOOP AT".
PAI
loop at it_rfqitem with control TC_ITEM.
chain.
field: ZES_RFQ_ITEM-RFQ_LN,
ZES_RFQ_ITEM-RFQ_STEXT,
ZES_RFQ_ITEM-RFQ_QTY,
ZES_RFQ_ITEM-RFQ_UOM,
ZES_RFQ_ITEM-WAERS,
ZES_RFQ_ITEM-RFQ_LAMT,
ZES_RFQ_ITEM-WARRANTY,
ZES_RFQ_ITEM-REJ_CODE.
module READ_TC.
endchain.
endloop.
<b>Hope this is correct and hope u got my requirement.</b>
<b>Please respond.</b>
Thanks
Pratyusha
Message was edited by: Pratyu Usha
‎2006 Sep 29 10:42 AM
Hi Pratyu,
THe correct code is as follows , please paste it :
PAI
<u><i><b>* WITH CONTROL IS NOT REQUIRED - So please remove tht</b></i></u>
<b>loop at it_rfqitem.</b>
chain.
field: ZES_RFQ_ITEM-RFQ_LN,
ZES_RFQ_ITEM-RFQ_STEXT,
ZES_RFQ_ITEM-RFQ_QTY,
ZES_RFQ_ITEM-RFQ_UOM,
ZES_RFQ_ITEM-WAERS,
ZES_RFQ_ITEM-RFQ_LAMT,
ZES_RFQ_ITEM-WARRANTY,
ZES_RFQ_ITEM-REJ_CODE.
module READ_TC.
endchain.
endloop.
Best regards,
Prashant
‎2006 Sep 29 10:46 AM
ya i tried that also but not working, i get the buttons once i enter a value in single row
‎2006 Oct 02 3:05 AM
Hi Prashanth, the problem is still not solved, please help me its very URGENT
‎2006 Oct 02 3:21 AM
Hi Pratyu,
It seems that you have given same name to all the Buttons. Please paste the entire code and let me know what names you have give to buttons and are these buttons displayed in a particular column for every row. What is the use of button ?
Best regards,
Prashant
‎2006 Oct 02 3:49 AM
the main purpose of this button is to enable the user to enter Loongtext, when the user presses the button, it goes to another screen (just like SAP Script editor) where user enters the LT.
ok, now what i am getting is when i enter a value in the first row of tab control i am getting the buttons being displayed in each and every row, i need the button to be visible only in the row if it is not initial.
secondly, how to handle the LT for each row ie for each item, it means if i enter value in 1st row and 2nd row i get the same LT to 2nd item as entered for 1st item. how do i differentiate the LT with respect to item?
Hope its clear.
thanks
Pratyusha
‎2006 Oct 02 3:57 AM
Hi,
loop at IT_RFQITEM into IS_RFQITEM with control TC_ITEM
cursor TC_ITEM-CURRENT_LINE.
module DISP_MODE.
endloop.
module DISP_MODE output.
<b>if NOT IS_RFQITEM is initial.</b>
loop at screen.
if SCREEN-NAME = 'LT'.
<b>SCREEN-INPUT = 0.</b>
<u><i>* SCREEN-INVISIBLE = 1.</i></u> "Please comment
modify screen.
endif.
endloop.
endif.
endmodule. " disp_mode OUTPUT
PAI is like this
<b>Loop at IT_RFQITEM.</b>
chain.
field: ZES_RFQ_ITEM-RFQ_LN,
ZES_RFQ_ITEM-RFQ_STEXT,
ZES_RFQ_ITEM-RFQ_QTY,
ZES_RFQ_ITEM-RFQ_UOM,
ZES_RFQ_ITEM-WAERS,
ZES_RFQ_ITEM-RFQ_LAMT,
ZES_RFQ_ITEM-WARRANTY,
ZES_RFQ_ITEM-REJ_CODE.
module READ_TC.
endchain.
endloop.
<b>MODULE READ_TC.
MODIFY IT_RFQITEM FROM ZES_RFQ_ITEM INDEX TC_ITEM-current_line.
ENDLOOP.</b>
Please incorporate the changes marked in BOLD.This should solve the problem.
Best regards,
Prashant
PS : Please reward helpful answers
‎2006 Oct 02 4:18 AM
Thanks, this is solved to some extent but still one more thing to be cleared, the button disabling / enabling is OK now if i give a 2nd item in 2nd row, i still get the same LT for each row. how do i rectify this.
my module read_tc is different to what u suggested as the table control initially will not at all contain any values, this screen is to create RFQ and RFQ items. so my module PAI is as below. please suggest necessary changes :
module READ_TC input.
read table IT_RFQITEM into IS_RFQITEM index TC_ITEM-CURRENT_LINE.
if SY-SUBRC = 0.
IS_RFQITEM-RFQ_LN = ZES_RFQ_ITEM-RFQ_LN.
IS_RFQITEM-RFQ_STEXT = ZES_RFQ_ITEM-RFQ_STEXT.
concatenate ZES_RFQ-RFQ_NO ZES_RFQ-SER_NO IS_RFQITEM-RFQ_LN into TD_NAME.
if SY-UCOMM = 'LT'.
HEADER-TDOBJECT = 'ZES_RFQ'.
HEADER-TDNAME = TD_NAME.
HEADER-TDID = 'Z01'.
HEADER-TDSPRAS = SY-LANGU.
HEADER-TDLINESIZE = 100.
call function 'EDIT_TEXT'
exporting
HEADER = HEADER
SAVE = 'X'
tables
LINES = LINES.
call function 'SAVE_TEXT'
exporting
HEADER = HEADER
SAVEMODE_DIRECT = 'X'
tables
LINES = LINES.
if SY-SUBRC <> 0.
endif.
endif.
IS_RFQITEM-WARRANTY = ZES_RFQ_ITEM-WARRANTY.
IS_RFQITEM-RFQ_QTY = ZES_RFQ_ITEM-RFQ_QTY.
IS_RFQITEM-RFQ_UOM = ZES_RFQ_ITEM-RFQ_UOM.
IS_RFQITEM-RFQ_LAMT = ZES_RFQ_ITEM-RFQ_LAMT.
IS_RFQITEM-WAERS = ZES_RFQ_ITEM-WAERS.
IS_RFQITEM-SVC_NO = ZES_RFQ_ITEM-SVC_NO.
modify IT_RFQITEM from IS_RFQITEM index TC_ITEM-CURRENT_LINE.
else.
if not ZES_RFQ_ITEM-RFQ_LN is initial.
IS_RFQITEM-RFQ_LN = ZES_RFQ_ITEM-RFQ_LN.
IS_RFQITEM-RFQ_STEXT = ZES_RFQ_ITEM-RFQ_STEXT.
IS_RFQITEM-WARRANTY = ZES_RFQ_ITEM-WARRANTY.
IS_RFQITEM-RFQ_QTY = ZES_RFQ_ITEM-RFQ_QTY.
IS_RFQITEM-RFQ_UOM = ZES_RFQ_ITEM-RFQ_UOM.
IS_RFQITEM-RFQ_LAMT = ZES_RFQ_ITEM-RFQ_LAMT.
IS_RFQITEM-WAERS = ZES_RFQ_ITEM-WAERS.
IS_RFQITEM-SVC_NO = ZES_RFQ_ITEM-SVC_NO.
append IS_RFQITEM to IT_RFQITEM.
endif.
endif.
endmodule. " READ_TC INPUT
I NEED DIFFERENT LT's FOR EACH ITEM. HOW TO ACHIEVE THIS?
Thanks
Pratyusha
‎2006 Oct 02 5:15 AM
Hi,
module READ_TC input.
data : l_lines type i.
describe table it_rfqitem lines l_lines.
if l_lines ne tc_item-current_line.
read table IT_RFQITEM into IS_RFQITEM index TC_ITEM-CURRENT_LINE.
<u><b>if SY-SUBRC = 0.</b></u>"Not required
IS_RFQITEM-RFQ_LN = ZES_RFQ_ITEM-RFQ_LN.
IS_RFQITEM-RFQ_STEXT = ZES_RFQ_ITEM-RFQ_STEXT.
concatenate ZES_RFQ-RFQ_NO ZES_RFQ-SER_NO IS_RFQITEM-RFQ_LN into TD_NAME.
if SY-UCOMM = 'LT'.
HEADER-TDOBJECT = 'ZES_RFQ'.
HEADER-TDNAME = TD_NAME.
HEADER-TDID = 'Z01'.
HEADER-TDSPRAS = SY-LANGU.
HEADER-TDLINESIZE = 100.
call function 'EDIT_TEXT'
exporting
HEADER = HEADER
SAVE = 'X'
tables
LINES = LINES.
call function 'SAVE_TEXT'
exporting
HEADER = HEADER
SAVEMODE_DIRECT = 'X'
tables
LINES = LINES.
if SY-SUBRC <> 0.
endif.
endif.
IS_RFQITEM-WARRANTY = ZES_RFQ_ITEM-WARRANTY.
IS_RFQITEM-RFQ_QTY = ZES_RFQ_ITEM-RFQ_QTY.
IS_RFQITEM-RFQ_UOM = ZES_RFQ_ITEM-RFQ_UOM.
IS_RFQITEM-RFQ_LAMT = ZES_RFQ_ITEM-RFQ_LAMT.
IS_RFQITEM-WAERS = ZES_RFQ_ITEM-WAERS.
IS_RFQITEM-SVC_NO = ZES_RFQ_ITEM-SVC_NO.
modify IT_RFQITEM from IS_RFQITEM index TC_ITEM-CURRENT_LINE.
else.
<u><b>if not ZES_RFQ_ITEM-RFQ_LN is initial.</b></u>
IS_RFQITEM-RFQ_LN = ZES_RFQ_ITEM-RFQ_LN.
IS_RFQITEM-RFQ_STEXT = ZES_RFQ_ITEM-RFQ_STEXT.
IS_RFQITEM-WARRANTY = ZES_RFQ_ITEM-WARRANTY.
IS_RFQITEM-RFQ_QTY = ZES_RFQ_ITEM-RFQ_QTY.
IS_RFQITEM-RFQ_UOM = ZES_RFQ_ITEM-RFQ_UOM.
IS_RFQITEM-RFQ_LAMT = ZES_RFQ_ITEM-RFQ_LAMT.
IS_RFQITEM-WAERS = ZES_RFQ_ITEM-WAERS.
IS_RFQITEM-SVC_NO = ZES_RFQ_ITEM-SVC_NO.
append IS_RFQITEM to IT_RFQITEM.
<u><b>endif.</b></u>
endif.
endmodule. " READ_TC INPUT
Best regards,
Prashant
‎2006 Oct 02 9:21 AM
Most of my things are solved, only thing whihc i need to know is HOW TO READ THE FUNC CODE of the button in each row.
what i meant is i have 2 rows in table control, i need to read the index of the row in which the button is pressed.
Hope this is clear
Thanks
Pratyusha
‎2006 Oct 02 9:47 AM
Hi Pratyu,
Assume the FUNC CODE is `SAVE`. So when User clicks on Button SAVE, SY-UCOMM will have value SAVE or in other words OK-CODE will be `SAVE`.
PROCESS AFTER INPUT.
MODULE user_command_1000.
MODULE user_command_1000.
CASE v_okcode.
WHEN `SAVE`.
read table it_tab into wa_tab index tc_control-current_line.
ENDCASE.
ENDMODULE.
Best regards,
Prashant
PS : Please reward all helpful answers and close the thread if the problem is solved
‎2006 Oct 02 9:50 AM
Sy-ucomm remain the same for any row which i select, if i select 1st row or 2nd row or any other row the sy-ucomm is still the same, so it goes to the LT of the first ITEM always,
Clear?
Pratyusha
‎2006 Oct 02 9:59 AM
Hi Pratyu,
In the CHAIN ... ENDCHAIN itself do the following
PROCESS AFTER INPUT
CHAIN.
FIELD : give the fieldname.
MODULE user_command_1000.
ENDCHAIN.
CASE v_okcode.
WHEN `SAVE`.
<b>read table it_tab into wa_tab index tc_control-current_line.</b>
ENDCASE.
ENDMODULE.
tc_control-current_line will return only the line in which the button was clicked.
Best regards,
Prashant
‎2006 Oct 02 10:07 AM
in user command we can not read using tc_control-current_line, i tried this even,
more over one more imp thing is USER_Command cant be between chain endchain at any case.
as said by you if i simply use read statement even if i press the 3rd row button the read table sy-subrc is always 0 for 1st row and it performs the action for that sy-ucomm in the first read it self
Thanks for all ur time and effort
Pratyusha
‎2006 Oct 03 2:15 AM
Hi Prashanth,
If not can you tell me a way to make the row selected if i press on the button in a selected row.
This would solve my purpose logically, coz if u c any std tcode like IW32, when user clks on buttons that correponding row is getting selected.
Thanks
Pratyusha
‎2006 Oct 03 2:37 AM
Hi Pratyu,
Goto the Screen Layout and Goto the Attributes of TABLE CONTROL. TICK the check box of w/ SelColumn and in the text field write ZES_RFQ_ITEM-CHECK.
Modify the work area of you table control to include CHECK field of type c.
types : begin of is_type,
RFQ_LN type ...,
RFQ_STEXT type ...,
WARRANTY type ...,
RFQ_QTY type ...,
RFQ_UOM type ...,
RFQ_LAMT type ...,
WAERS type ...,
SVC_NO type ...,
<b> CHECK type c,</b>
end of is_type.
<b>data : IS_RFQITEM type is_type,
IT_RFQITEM type standard table of is_type.
store the tc_table-current_line in variable l_line.</b>
CASE OKCODE.
<b>WHEN 'BUTTON'.
IS_RFQITEM-check = 'X'.
ZES_RFQ_ITEM-CHECK = 'X'.
modify IT_RFQITEM from IS_RFQITEM index l_line.</b>
ENDCASE.
Best regards,
Prashant
‎2006 Oct 03 2:51 AM
Sorry for replying to wrong Query
Message was edited by: Gopi Narendra
‎2006 Oct 03 2:55 AM
i already did the things which u told. modified work area, w/ selcolumn etc...
<b>store the tc_table-current_line in variable l_line.</b>
what is this for?
and the point here is to check the row selected if button pressed in that row,
as u said
case ok_code.
when 'BUTTON'.
the ok_code is always buttons if i press it either 1st row or 2nd row or .... (n)th row.
My prob will get solved if i got to know in which row the button is pressed. it means i need the index of table contorl in which i press the button.
Thanks
Pratyusha
‎2006 Oct 03 3:09 AM
Hi Pratyu,
PROCESS AFTER INPUT.
LOOP AT IT_RFQITEM.
CHAIN.
FIELD : <button_field_name>.
module get_line.
ENDCHAIN.
ENDLOOP.
MODULE GET_LINE.
MODIFY IT_RFQITEM FROM IS_RFQITEM INDEX tc_table-current_line.
<b>l_line = tc_table-current_line.</b>
ENDMODULE.
USER COMMAND.
CASE OKCODE.
WHEN 'BUTTON'.
IS_RFQITEM-check = 'X'.
ZES_RFQ_ITEM-CHECK = 'X'.
modify IT_RFQITEM from IS_RFQITEM index l_line.
ENDCASE.
Also i would suggest that the field names on the Screen and table control should be IS_RFQITEM-<field_name> and not ZES_RFQ_ITEM-<field_Name>. Assigning work area directly to field names would make the program more easy rather than having different names for screen fields and work area.
Best regards,
Prashant
‎2006 Oct 03 3:36 AM
How do we handle the scrolling of table contorl initially , because i see 7 visible rows in tab ctrl and if i try to enter 8th one it does not go.
‎2006 Oct 03 4:00 AM
‎2006 Oct 05 4:17 AM
Hi Prashanth,
thanks alot for ur effort and time, i could solve the issue by other ways, i took out the button from the tab ctrl and kept it below the tab ctrl, if user wants to create a long text he will have to select atleast one row in tab ctrl and i had make use of select_text, init_text, read_text and save_text function moudles also.
Thanks for all ur effort again
Pratyusha