2007 Apr 24 8:17 PM
Hi everyone.
I´m trying to import the fields of an internal table to a dynpro for them to show when the screen is called.
I´ve used the export/import statements, so I already have the internal table in the PBO, but I don´t know how to assign this values to the different dynpro components.
I've got about ten fields of a Z table declared in my dynpro, the names that I can see in the attribute tabs are like ZTABLENAME-FIELD, but when I try to do something like:
ztablename-field = wa_internaltable-field
I get an error message saying that ztablename does not exist.
Does anybody know how to refer to the dynpro components from the PBO?
Thanks a lot,
Fernando Villa.
2007 Apr 24 8:23 PM
HI
Check this example
&----
*& *
&----
*& *
*& *
&----
PROGRAM ZTRANS_50572 message-id zz .
*Tables.
tables: vbak, knvv.
*Declaration of variables
data: v_kunnr type kna1-kunnr,
v_vkorg type knvv-vkorg,
v_vtweg type knvv-vtweg,
v_spart type knvv-spart,
okcode like sy-ucomm,
v_dynnr like sy-dynnr,
sel type c.
*Declaration of Internal tables for transactions.
data: begin of it_knvv occurs 0,
kunnr like kna1-kunnr,
vkorg like knvv-vkorg,
vtweg like knvv-vtweg,
spart like knvv-spart,
end of it_knvv.
data: begin of it_vbak occurs 0,
vbeln like vbak-vbeln,
erdat like vbak-erdat,
ernam like vbak-ernam,
audat like vbak-audat,
auart like vbak-auart,
bstnk like vbak-bstnk,
bstdk like vbak-bstdk,
kalsm like vbak-kalsm,
kokrs like vbak-kokrs,
bukrs_vf like vbak-bukrs_vf,
chk type c,
end of it_vbak.
*CONTROL STATEMENT FOR THE TABLE CONTROL.
controls tc type tableview using screen 0300.
&----
*& Module STATUS_0100 OUTPUT
&----
Setting the PF status for the screen
----
module STATUS_0100 output.
SET PF-STATUS 'FF'.
SET TITLEBAR 'xxx'.
endmodule. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
module USER_COMMAND_0100 input.
*Validating customer no whether present in table kna1.
SELECT KUNNR INTO V_KUNNR FROM KNA1 WHERE KUNNR = V_KUNNR.
IF SY-SUBRC <> 0.
MESSAGE E000(ZZ) with 'Invalid Customer'.
endif.
endselect.
*When it is in display mode it will show in display mode else
*show it in change mode
case sy-ucomm.
when 'DISPLAY' or 'CHANGE'.
IF V_KUNNR IS NOT INITIAL.
v_dynnr = 300.
*selecting data from the table vbak into internal table.
select vbeln
erdat
ernam
audat
auart
bstnk
bstdk
kalsm
kokrs
bukrs_vf into table it_vbak
from vbak.
move sy-ucomm to okcode.
leave to screen 0200.
endif.
when 'BACK'.
leave program.
when 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
&----
*& Module STATUS_0200 OUTPUT
&----
text
----
module STATUS_0200 output.
SET PF-STATUS 'SS'.
SET TITLEBAR 'xxx'.
endmodule. " STATUS_0200 OUTPUT
&----
*& Module USER_COMMAND_0200 INPUT
&----
text
----
module USER_COMMAND_0200 input.
case sy-ucomm.
when 'BACK'.
leave to screen 100.
when 'EXIT'.
leave to screen 0.
when 'CANCEL'.
leave to screen 0.
endcase.
endmodule. " USER_COMMAND_0200 INPUT
&----
*& Module STATUS_0300 OUTPUT
&----
text
----
module STATUS_0300 output.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
endmodule. " STATUS_0300 OUTPUT
&----
*& Module USER_COMMAND_0300 INPUT
&----
text
----
module USER_COMMAND_0300 input.
case sy-ucomm.
when 'DISPLAY'.
IF V_DYNNR = 300.
LOOP AT SCREEN.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
endcase.
endmodule. " USER_COMMAND_0300 INPUT
&----
*& Module MOD2 INPUT
&----
text
----
module MOD2 input.
*Validating sales organization.
SELECT VKORG INTO V_VKORG FROM TVKO WHERE VKORG = V_VKORG.
IF SY-SUBRC <> 0.
MESSAGE E000(ZZ) WITH 'Invalid Sales organization'.
endif.
endselect.
endmodule. " MOD2 INPUT
&----
*& Module MOD3 INPUT
&----
text
----
module MOD3 input.
*Validating distribution channel.
SELECT VTWEG INTO V_VTWEG FROM TVTW WHERE VTWEG = V_VTWEG.
IF SY-SUBRC <> 0.
MESSAGE E000(ZZ) WITH 'Invalid distribution channel'.
endif.
endselect.
endmodule. " MOD3 INPUT
&----
*& Module MOD4 INPUT
&----
text
----
module MOD4 input.
*Validating division.
SELECT SPART INTO V_SPART FROM TVTA WHERE SPART = V_SPART.
IF SY-SUBRC <> 0.
MESSAGE E000(ZZ) WITH 'Invalid division'.
endif.
endselect.
endmodule. " MOD4 INPUT
Regards
Laxmi
Hi everyone.
I´m trying to import the fields of an internal table to a dynpro for them to show when the screen is called.
I´ve used the export/import statements, so I already have the internal table in the PBO, but I don´t know how to assign this values to the different dynpro components.
I've got about ten fields of a Z table declared in my dynpro, the names that I can see in the attribute tabs are like ZTABLENAME-FIELD, but when I try to do something like:
ztablename-field = wa_internaltable-field
I get an error message saying that ztablename does not exist.
Does anybody know how to refer to the dynpro components from the PBO?
Thanks a lot,
Fernando Villa.
2007 Apr 24 8:20 PM
2007 Apr 24 8:23 PM
check the table control name and use that name to pass the data.
2007 Apr 24 8:23 PM
HI
Check this example
&----
*& *
&----
*& *
*& *
&----
PROGRAM ZTRANS_50572 message-id zz .
*Tables.
tables: vbak, knvv.
*Declaration of variables
data: v_kunnr type kna1-kunnr,
v_vkorg type knvv-vkorg,
v_vtweg type knvv-vtweg,
v_spart type knvv-spart,
okcode like sy-ucomm,
v_dynnr like sy-dynnr,
sel type c.
*Declaration of Internal tables for transactions.
data: begin of it_knvv occurs 0,
kunnr like kna1-kunnr,
vkorg like knvv-vkorg,
vtweg like knvv-vtweg,
spart like knvv-spart,
end of it_knvv.
data: begin of it_vbak occurs 0,
vbeln like vbak-vbeln,
erdat like vbak-erdat,
ernam like vbak-ernam,
audat like vbak-audat,
auart like vbak-auart,
bstnk like vbak-bstnk,
bstdk like vbak-bstdk,
kalsm like vbak-kalsm,
kokrs like vbak-kokrs,
bukrs_vf like vbak-bukrs_vf,
chk type c,
end of it_vbak.
*CONTROL STATEMENT FOR THE TABLE CONTROL.
controls tc type tableview using screen 0300.
&----
*& Module STATUS_0100 OUTPUT
&----
Setting the PF status for the screen
----
module STATUS_0100 output.
SET PF-STATUS 'FF'.
SET TITLEBAR 'xxx'.
endmodule. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
module USER_COMMAND_0100 input.
*Validating customer no whether present in table kna1.
SELECT KUNNR INTO V_KUNNR FROM KNA1 WHERE KUNNR = V_KUNNR.
IF SY-SUBRC <> 0.
MESSAGE E000(ZZ) with 'Invalid Customer'.
endif.
endselect.
*When it is in display mode it will show in display mode else
*show it in change mode
case sy-ucomm.
when 'DISPLAY' or 'CHANGE'.
IF V_KUNNR IS NOT INITIAL.
v_dynnr = 300.
*selecting data from the table vbak into internal table.
select vbeln
erdat
ernam
audat
auart
bstnk
bstdk
kalsm
kokrs
bukrs_vf into table it_vbak
from vbak.
move sy-ucomm to okcode.
leave to screen 0200.
endif.
when 'BACK'.
leave program.
when 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
&----
*& Module STATUS_0200 OUTPUT
&----
text
----
module STATUS_0200 output.
SET PF-STATUS 'SS'.
SET TITLEBAR 'xxx'.
endmodule. " STATUS_0200 OUTPUT
&----
*& Module USER_COMMAND_0200 INPUT
&----
text
----
module USER_COMMAND_0200 input.
case sy-ucomm.
when 'BACK'.
leave to screen 100.
when 'EXIT'.
leave to screen 0.
when 'CANCEL'.
leave to screen 0.
endcase.
endmodule. " USER_COMMAND_0200 INPUT
&----
*& Module STATUS_0300 OUTPUT
&----
text
----
module STATUS_0300 output.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
endmodule. " STATUS_0300 OUTPUT
&----
*& Module USER_COMMAND_0300 INPUT
&----
text
----
module USER_COMMAND_0300 input.
case sy-ucomm.
when 'DISPLAY'.
IF V_DYNNR = 300.
LOOP AT SCREEN.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
endcase.
endmodule. " USER_COMMAND_0300 INPUT
&----
*& Module MOD2 INPUT
&----
text
----
module MOD2 input.
*Validating sales organization.
SELECT VKORG INTO V_VKORG FROM TVKO WHERE VKORG = V_VKORG.
IF SY-SUBRC <> 0.
MESSAGE E000(ZZ) WITH 'Invalid Sales organization'.
endif.
endselect.
endmodule. " MOD2 INPUT
&----
*& Module MOD3 INPUT
&----
text
----
module MOD3 input.
*Validating distribution channel.
SELECT VTWEG INTO V_VTWEG FROM TVTW WHERE VTWEG = V_VTWEG.
IF SY-SUBRC <> 0.
MESSAGE E000(ZZ) WITH 'Invalid distribution channel'.
endif.
endselect.
endmodule. " MOD3 INPUT
&----
*& Module MOD4 INPUT
&----
text
----
module MOD4 input.
*Validating division.
SELECT SPART INTO V_SPART FROM TVTA WHERE SPART = V_SPART.
IF SY-SUBRC <> 0.
MESSAGE E000(ZZ) WITH 'Invalid division'.
endif.
endselect.
endmodule. " MOD4 INPUT
Regards
Laxmi
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |