‎2006 Sep 15 2:32 AM
Hi SDN Experts,
I am doing a screen in which i have 2 table controls, one table control show the header details and the second one shows item details.
i am able to display them perfectly fine, but what i want is in the item table control i shud be able to create new items.. how to do it, since the item table which i am filling comes from an internal table. so how do i add the newly appended items to the item table in PAI.
Please suggest.
Many Thanks
Pratyusha
‎2006 Sep 15 2:52 AM
Hi,
In the PAI
LOOP AT it_mat.
CHAIN.
FIELD : wa_mat-partno.
MODULE update_tc.
ENDCHAIN.
ENDLOOP.
MODULE UPDATE_TC.
append WA_MAT to IT_MAT.
ENDMODULE.
Put the field name of the Last column in table control inside CHAIN - ENDCHAIN. So, when user enters value in the last field and hits enter, the CHAIN. ENDCHAIN would be triggered and record would be updated in the internal table of table control.
Best regards,
Prashant
‎2006 Sep 15 2:43 AM
Hi,
Append blank rows to the item internal table when the new rows are pressed..
Then make the entries enabled for input..
Thanks,
Naren
‎2006 Sep 15 2:52 AM
Hi,
In the PAI
LOOP AT it_mat.
CHAIN.
FIELD : wa_mat-partno.
MODULE update_tc.
ENDCHAIN.
ENDLOOP.
MODULE UPDATE_TC.
append WA_MAT to IT_MAT.
ENDMODULE.
Put the field name of the Last column in table control inside CHAIN - ENDCHAIN. So, when user enters value in the last field and hits enter, the CHAIN. ENDCHAIN would be triggered and record would be updated in the internal table of table control.
Best regards,
Prashant
‎2006 Sep 15 2:59 AM
Hi Naren / Patil plz reply
Hi thanks for the reply.. see the code below and plz suggest
Select statement for IT_RFQSVC.
select * from ZES_RFQ_SVC
into table IT_RFQSVC
where RFQ_NO = ZES_RFQ-RFQ_NO
and RFQ_LN = ITEMLIST.
sort IT_RFQSVC by SVC_NO.
describe table IT_RFQSVC lines FILL2.
TC2-LINES = FILL2.
PBO
module FILL_TC2 output.
if TC2-CURRENT_LINE le FILL2.
read table IT_RFQSVC into IS_RFQSVC index TC2-CURRENT_LINE.
if SY-SUBRC = 0.
if not IS_RFQSVC-SVC_LN is initial.
loop at screen.
if SCREEN-NAME = 'ZES_RFQ_SVC-SVC_LN' or
SCREEN-NAME = 'ZES_RFQ_SVC-SVC_NO' or
SCREEN-NAME = 'ZES_RFQ_SVC-SVC_STEXT'.
SCREEN-INPUT = 0.
modify screen.
endif.
endloop.
endif.
ZES_RFQ_SVC-SVC_NO = IS_RFQSVC-SVC_NO.
ZES_RFQ_SVC-SVC_LN = IS_RFQSVC-SVC_LN.
ZES_RFQ_SVC-SVC_STEXT = IS_RFQSVC-SVC_STEXT.
ZES_RFQ_SVC-SVC_LTEXT = IS_RFQSVC-SVC_LTEXT.
ZES_RFQ_SVC-SVC_QTY = IS_RFQSVC-SVC_QTY.
ZES_RFQ_SVC-SVC_UOM = IS_RFQSVC-SVC_UOM.
ZES_RFQ_SVC-SVC_LAMT = IS_RFQSVC-SVC_LAMT.
ZES_RFQ_SVC-WAERS = IS_RFQSVC-WAERS.
endif.
clear IS_RFQSVC.
endif.
endmodule. " fill_tC2 OUTPUT
PAI
if TC2-CURRENT_LINE le FILL2.
read table IT_RFQSVC into IS_RFQSVC index TC2-CURRENT_LINE. " with key RFQ_LN = ITEMLIST.
if SY-SUBRC = 0.
IS_RFQSVC-SVC_LTEXT = ZES_RFQ_SVC-SVC_LTEXT.
IS_RFQSVC-SVC_QTY = ZES_RFQ_SVC-SVC_QTY.
L_SQTY = L_SQTY + IS_RFQSVC-SVC_QTY.
IS_RFQSVC-SVC_UOM = ZES_RFQ_SVC-SVC_UOM.
IS_RFQSVC-SVC_LAMT = ZES_RFQ_SVC-SVC_LAMT.
L_SAMT = L_SAMT + IS_RFQSVC-SVC_LAMT.
IS_RFQSVC-WAERS = ZES_RFQ_SVC-WAERS.
modify IT_RFQSVC from IS_RFQSVC index TC2-CURRENT_LINE.
clear : IS_RFQSVC.
endif.
endif.
so when ever i add a new row the select statement is getting executed and it returns the same value in FILL2 which i use to populate the Table control.
and one more thing, i use a drop down list to change items in the 2nd tab ctrl, so when ever i change a value in the drop down the previous values are not getting cleared off. but is over writing the new item details with the previous ones.
Please suggest.
Message was edited by: Pratyu Usha
‎2006 Sep 15 5:06 AM
when ever u try to add a new row check it with existing values and then fill it, if already exists then throw a error or append them to IT_RFQSVC and add 1 to FILL2, so that when u read the table in PBO there will not be any mimatch of number of rows.