cancel
Showing results for 
Search instead for 
Did you mean: 

Script: Subroutine

Former Member
0 Kudos

tables:bseg

belnr bukrs gjahr buzei hkont wrbtr

5900000010 0001 2006 001 160000 2000

5900000010 0001 2006 001 170000 2500

5900000010 0001 2006 001 180000 3000

5900000010 0001 2006 001 150000 4000

5900000010 0001 2006 001 175000 5000

5900000010 0001 2006 001 177000 150 - tds value(tax value)

the table having values like this.

here i want to read the line of hkont =177000and diaplay its corresponding wrbtr value(150).

(the hkont number b/w 177000-177999.and it is aloted

for holding tds value).

each belnr hold only one tds value.

For normal program it is working fine.can anyone pl tel me how to write subroutine for this requirement.I want to displa this value in form.pl help me out.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member609120
Contributor
0 Kudos

perform get_tds in program ztest

using &variable for hkont&

changing &variable for tds&

endperform

In ZTEST

FORM GET_TDS TABLES ITST_INTAB STRUCTURE ITCSY ITST_OUTTAB STRUCTURE ITCSY.

DATA :

P_HKONT TYPE C,

P_TDS TYPE C.

READ TABLE ITST_INTAB WITH KEY NAME = 'VARIABLE FOR HKONT'.

IF SY-SUBRC EQ 0.

P_HKONT = ITST_INTAB-VALUE.

ENDIF.

Write the logic to fetch the TDS value based on p_hkont.

IF SY-SUBRC = 0.

ITST_OUTTAB-VALUE = P_TDS.

MODIFY ITST_OUTTAB TRANSPORTING VALUE WHERE NAME = 'VARIABLE FOR TDS'.

ENDIF.

ENDFORM. "GET_TDS