Skip to Content
0
Former Member
May 09, 2008 at 05:21 AM

reg.script

102 Views

Hi Experts,

i written a code for one subroutine pool for adding one field to form that is ekgrp the code is given below. please correct the code if any error is there please mention. it is going to the dump.

&----


*& Subroutine Pool ZAN_GOODS_RECEIPT

*&

&----


*&

*&

&----


PROGRAM ZAN_GOODS_RECEIPT.

*----


TABLES DECLARATION.

tables : likp,lips,ekko,ekpo.

*----


FORM STRUCTURE DECLARATION.

form f_head tables in_tab structure itcsy

out_tab structure itcsy.

*----


types declaration .

types:begin of gty_likp,

vbeln type likp-vbeln,

end of gty_likp,

begin of gty_lips,

vbeln type lips-vbeln,

vgbel type lips-vgbel,

end of gty_lips,

begin of gty_ekko,

ebeln type ekko-ebeln,

ekgrp type ekko-ekgrp,

end of gty_ekko,

begin of gty_output,

cno type mara-zeinr,

ekgrp type ekko-ekgrp,

end of gty_output.

*----


internal tables declaration.

data: gt_likp type standard table of gty_likp,

gt_lips type table of gty_lips,

gt_ekko type table of gty_ekko,

gt_output type table of gty_output.

*----


work area declaration.

data:gs_likp type gty_likp,

gs_lips type gty_lips,

gs_ekko type gty_ekko,

gs_output type gty_output.

*.............. constants declarations

data:gc_var(20) type c,

gc_var1(20) type c,

head type ekko-ekgrp.

select vbeln

into table gt_likp

from likp.

if sy-subrc = 0.

select vbeln

vgbel

into table gt_lips

from lips

for all entries in gt_likp

where vbeln = gt_likp-vbeln.

endif.

if sy-subrc = 0.

select ebeln

ekgrp

into table gt_ekko

from ekko

for all entries in gt_lips

where ebeln = gt_lips-vgbel.

endif.

perform is as follows.

STORER &EKKO-EKGRP&

PERFORM F_HEAD IN PROGRAM ZAN_GOODS_RECEIPT

USING &EKKO-EBELN&

CHANGING &EKGRP&

ENDPERFORM.

read table in_tab with key 'EKKO-EBELN'.

if sy-subrc = 0.

gc_var = in_tab-value.

endif.

read table gt_ekko into gs_ekko with key ebeln = gc_var binary search.

if sy-subrc = 0.

head = gs_ekko-ekgrp.

gC_var1 = head.

read table out_tab with key 'HEAD'.

if sy-subrc = 0.

move gc_var1 to out_tab-value.

modify out_tab.

endif.

endif.

endform.