report zsmartformstest.
data: fm_name type rs38l_fnam ,
p_form type tdsfname value 'ZSMARTFORMS'.
data : begin of t_vbpa occurs 0,
vbeln type vbpa-vbeln,
kunnr type vbpa-kunnr ,
adrnr type vbpa-adrnr,
end of t_vbpa.
data : begin of t_kna1 occurs 0,
name1 type kna1-name1,
name2 type kna1-name2 ,
adrnr type kna1-adrnr,
end of t_kna1.
data : begin of t_kna2 occurs 0,
vbeln type vbpa-vbeln,
name1 type kna1-name1,
name2 type kna1-name2 ,
end of t_kna2.
data: t_kna3 like t_kna2 occurs 0 with header line.data: t_kna4 like t_kna2 occurs 0 with header line.
data: vb like vbpa-vbeln.data: n1 like kna1-name1.data: n2 like kna1-name2.
parameters : vbeln like vbpa-vbeln.
start-of-selection .
perform data_selection.
perform data_display.
form data_selection.
select
vbeln
name1
name2
from kna1 as k inner join vbpa as v on k~adrnr = v~adrnr
into corresponding fields of table t_kna2
where vbeln = vbeln.
endform.
form data_display.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = p_form
importing
fm_name = fm_name
exceptions
no_form = 1
no_function_module = 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.
call function fm_name
exporting
vbeln = vbeln
tables
t_kna2 = t_kna2
exceptions
error_message ss.
endform.
data: fm_name type rs38l_fnam ,
p_form type tdsfname value 'ZSMARTFORMS'.
data : begin of t_vbpa occurs 0,
vbeln type vbpa-vbeln,
kunnr type vbpa-kunnr ,
adrnr type vbpa-adrnr,
end of t_vbpa.
data : begin of t_kna1 occurs 0,
name1 type kna1-name1,
name2 type kna1-name2 ,
adrnr type kna1-adrnr,
end of t_kna1.
data : begin of t_kna2 occurs 0,
vbeln type vbpa-vbeln,
name1 type kna1-name1,
name2 type kna1-name2 ,
end of t_kna2.
data: t_kna3 like t_kna2 occurs 0 with header line.data: t_kna4 like t_kna2 occurs 0 with header line.
data: vb like vbpa-vbeln.data: n1 like kna1-name1.data: n2 like kna1-name2.
parameters : vbeln like vbpa-vbeln.
start-of-selection .
perform data_selection.
perform data_display.
form data_selection.
select
vbeln
name1
name2
from kna1 as k inner join vbpa as v on k~adrnr = v~adrnr
into corresponding fields of table t_kna2
where vbeln = vbeln.
endform.
form data_display.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = p_form
importing
fm_name = fm_name
exceptions
no_form = 1
no_function_module = 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.
call function fm_name
exporting
vbeln = vbeln
tables
t_kna2 = t_kna2
exceptions
error_message ss.
endform.
very simple but effective. thanks
ReplyDelete