‎2006 Sep 15 10:05 PM
Hi all,
I am trying to create table control TC1 (VBELN,POSNR and Matnr).Actually in PBO,we will be moving data from ITAB to Table Control.And
in PAI,we will be moving data to ITAB,which will be displayed on the table control.I created one screen with single field VBELN and table control with (VBELN,POSNR and Matnr) as fields and I also created 'DISPLAY' button.
PROCESS BEFORE OUTPUT.
MODULE ITAB.
LOOP AT ITAB WITH CONTROL TC1.
MODULE BEFORE.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT ITAB.
MODULE AFTER.
ENDLOOP.
MODULE AFTER INPUT.
CASE SY-UCOMM.
WHEN 'DISP'.
SELECT VBELN POSNR MATNR FROM VBAP INTO corresponding fields of TABLE ITAB WHERE VBELN = VBAK-VBELN.
ENDCASE.
ENDMODULE. " AFTER INPUT
MODULE BEFORE OUTPUT." BEFORE OUTPUT
MOVE-CORRESPONDING ITAB TO VBAP.
ENDMODULE. " BEFORE OUTPUT
MODULE ITAB OUTPUT.
do 5 times.
itab-vbeln = sy-index.
*itab-posnr = sy-index.
*itab-matnr = sy-index.
*itab-no = sy-index.
append itab.
enddo.
My question what should be data initially in ITAB.My question is I filled data into ITAB(VBELN,POSNR and Matnr) in the MODULE ITAB.but when i am executing the Transaction code, the data intially present in the ITAB getting displayed on to the table control.After giving VBELN and pressing 'DISPLAY' button,then the records are getting replaced with fetched records based on the VBELN.
So my question is intially I dont want the data(ITAB data) to be displayed in the table control,when I execute the transaction code.I want only the records fetched based on the VBELN to be displayed on the table control.
If i tried fillling only filling the value ITAB-NO like the below code means.Remember table control TC1 contains only VBELN,POSNR and MATNR.
MODULE ITAB OUTPUT.
do 5 times.
itab-vbeln = sy-index.
*itab-posnr = sy-index.
*itab-matnr = sy-index.
itab-no = sy-index.
append itab.
enddo.
Initially I am getting no values on my table control but after giving VBELN and pressing DISPLAY button I am getting nothing onto the table control.Surprisingly when i debugged by giving /h ,in the PAI module
I am able to loop the internal table but it is not exectuting the 'MODULE AFTER(it is skipping that line)eventhough ITAB contains data.It is directly going to loop and endloop statements continuously.
PROCESS AFTER INPUT.
LOOP AT ITAB.
MODULE AFTER.
ENDLOOP
Could any one explain me in this problem..
Rgds,
Balaji
‎2006 Sep 16 6:12 AM
Hi Balaji,
The problem is in the looping of the internal table.
<b>PROCESS AFTER INPUT.
LOOP AT ITAB.
ENDLOOP.
MODULE AFTER.</b>
Best regards,
Prashant
‎2006 Sep 16 6:25 AM
hi,
PROCESS BEFORE OUTPUT.
MODULE ITAB.
LOOP AT ITAB WITH CONTROL TC1.
MODULE BEFORE.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT ITAB.
MODULE AFTER.
ENDLOOP.
MODULE AFTER INPUT.
CASE SY-UCOMM.
WHEN 'DISP'.
<b>if ITAB is initial and VBAK-VBELN is not initial.</b>
SELECT VBELN POSNR MATNR FROM VBAP
INTO corresponding fields of TABLE ITAB
WHERE VBELN = VBAK-VBELN.
<b>
endif.</b>
ENDCASE.
ENDMODULE. " AFTER INPUT
MODULE BEFORE OUTPUT." BEFORE OUTPUT
MOVE-CORRESPONDING ITAB TO VBAP.
ENDMODULE. " BEFORE OUTPUT
MODULE ITAB OUTPUT.
do 5 times.
itab-vbeln = sy-index.
*itab-posnr = sy-index.
*itab-matnr = sy-index.
*itab-no = sy-index.
append itab.
enddo.
look at the bold part.
pls try this code.
rgds
anver
if hklped mark points
Message was edited by: Anversha s