cancel
Showing results for 
Search instead for 
Did you mean: 

reg.script

Former Member
0 Kudos

Hi Experts,

iam modyfing one script , i want to add one field in the inf.window. so, iam writing a subroutine pool, i written the code, the code is given below . in that code , how i will assign the ekgrp to in_tab and out_tab.if any corrections is there please correct that .

&----


*& 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.

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.

*loop at gt_likp into gs_likp.

*read table gt_lips into gs_lips with key vbeln = gs_likp-vbeln binary search.

read table gt_ekko into gs_ekko with key ebeln = gs_lips-vgbel binary search.

if sy-subrc = 0.

move: gs_ekko-ekgrp to gs_output-ekgrp.

append gs_output to gt_output.

endif.

*endloop.

endform.

rewards are helpful answers.

Thanks& regards,

Narasimha Rao.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

In the script you might be calling the subroutine as

/:perform sub in program zname

/: using &ekko-ebeln&

/:changing &ekgrp&

/:endperform.

read table in_tab with key name = 'EKKO-EBELN'.

if sy-subrc = 0.

read table gt_ekko into gs_ekko with key ebeln = in_tab-value binary search.

if sy-subrc = 0.

read table out_tab with key name = 'EKGRP'.

if sy-subrc = 0.

move gs_ekko-ekgrp to out_tab-value.

modify out_tab.

endif.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

please do follow the pseudo code

In the sub routine program.

form get_cc_name

tables in_par_tab structure itcsy

out_par_tab structure itcsy.

read table in_par_tab with key name = 'BUKRS'.

if sy-subrc <> 0.

exit.

endif.

bukrs = in_par_tab-value.

and so on for all the values that are passed from the sap script

loop at out_par_tab.

if out_par_tab-name = 'NAME'.

move adrc-name1 to out_par_tab-value.

modify out_par_tab.

endif.

endloop.