cancel
Showing results for 
Search instead for 
Did you mean: 

Sap Script Subroutine

Former Member
0 Kudos

Hi Experts ,

Below is my code for sap script modification subroutine.

But its not working ...the out_par value is not reflecting to CHANGING &RET_ADRS& in form...

Please can any one tell me what is the mistake and send me the correction code.

DEFINE &RET_ADRS&

IF &PAGE& = '1'

PERFORM GET_RETURN_ADDRESS IN PROGRAM ZFI0014_EFTCHECK

USING &REGUH-LIFNR&

CHANGING &RET_ADRS&

ENDPERFORM

IF &RET_ADRS& = 'AGNT'

INCLUDE Z_RETURN_AGNT OBJECT TEXT ID ADRS

ELSE

INCLUDE Z_RETURN_AP OBJECT TEXT ID ADRS

ENDIF

Report ZFI0014_EFTCHECK .

&----


*& Form GET_RETURN_ADDRESS

&----


FORM get_return_address TABLES in_par STRUCTURE itcsy

out_par STRUCTURE itcsy.

DATA: l_begru LIKE lfa1-begru,

l_lifnr TYPE lifnr.

  • Get Vendor

READ TABLE in_par WITH KEY 'REGUH-LIFNR'.

IF in_par-value NE space.

l_lifnr = in_par-value.

SELECT SINGLE begru INTO l_begru

FROM lfa1 WHERE lifnr EQ l_lifnr.

READ TABLE out_par WITH KEY 'RET_ADRS'.

out_par-value = l_begru.

IF l_begru = 'AGNT'.

out_par-value = 'Z_RETURN_AGNT'.

ELSE.

out_par-value = 'Z_RETURN_AP'.

ENDIF.

MODIFY out_par INDEX sy-tabix.

ENDIF.

ENDFORM.

Thnx in Advance.

Venky

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member673464
Active Contributor
0 Kudos

hi,

You are passing the values again to out put table so it is giving the values ' Z_RETURN_AGNT ' or 'Z_RETURN_AP'.In script it is checking for the value of AGNT.Comment the code for filling the values ' Z_RETURN_AGNT ' or 'Z_RETURN_AP' i.e if condition after the assignment of value.i hope that should work fine.

Regards,

veeresh

Former Member
0 Kudos

Hi

1. ) In Command prompt i defined /:

2. ) DEFINE &RET_ADRS& = u2018AGNTu2019 I tried in this way also but it doesnt work.

3. ) Commented the code for filling the values ' Z_RETURN_AGNT '

or 'Z_RETURN_AP' i.e if condition after the assignment of value.

but it doesnt work.

Already I tried the above 3 ways ...

any more suggestions plz.

dev_parbutteea
Active Contributor
0 Kudos

Hi,

FORM get_return_address TABLES in_par STRUCTURE itcsy

out_par STRUCTURE itcsy.

DATA: l_begru LIKE lfa1-begru,

l_lifnr TYPE lifnr.

  • Get Vendor

READ TABLE in_par index 1.

IF in_par-value NE space.

SELECT SINGLE begru INTO l_begru

FROM lfa1 WHERE lifnr EQ l_lifnr.

if sy-subrc = 0.

READ TABLE out_par index 1.

if sy-subrc = 0.

out_par-value = l_begru.

IF l_begru = 'AGNT'.

out_par-value = 'Z_RETURN_AGNT'.

ELSE.

out_par-value = 'Z_RETURN_AP'.

ENDIF.

MODIFY out_par INDEX 1.

endif.

endif.

ENDIF.

ENDFORM.

Regards,

Sooness

Former Member
0 Kudos

Hi,

1.Check in debugging Mode.The Text Symbols must be define using the Command Node.Like

/: DEFINE &COMP_NAME& = u2018University of Warwicku2019.

2.Check in Subroutine pool ,the ret_addr is coming or not.

Regards,

Shiva Kumar

Former Member
0 Kudos

What you defined in command column in script editor?

/: , *

Which one you have defined?

Your statements depends on that......please check it once.

Regards,

madan.