cancel
Showing results for 
Search instead for 
Did you mean: 

regarding subroutine pool

Former Member
0 Kudos

hai guys,

i have wirtten a subroutine to modify my po.the following is the code.

FORM sub_form2 TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

DATA : l_kntyp type konv-kntyp,

l_knumv TYPE knumv.

break damlek.

READ TABLE IN_TAB WITH KEY NAME = 'EKKO-EBELN'.

IF SY-SUBRC = 0.

L_KNUMV = IN_TAB-VALUE.

ENDIF.

SELECT single kntyp FROM konv INTO l_kntyp WHERE KNUMV = l_knumv.

BREAK damlek.

IF sy-subrc EQ 0.

READ TABLE out_tab INDEX 1.

IF sy-subrc EQ 0.

out_tab-value = l_kntyp.

IF l_kntyp = 'F'.

out_tab-name = 'FREIGHT'.

out_tab-value = 'l_kntyp'.

append out_tab.

ELSEIF l_kntyp = 'C'.

out_tab-name = 'INSURANCE'.

out_tab-value = 'l_kntyp'.

append out_tab.

ENDIF.

MODIFY out_tab INDEX 1.

ENDIF.

  • ENDIF.

  • ENDIF.

ENDFORM. "sub_form2

in this my issue is that i am getting the value in to the variable l_knumv but i am not getting the value into l_kntyp.please sugeest me suitable solution for this.

points will b given for the solution.

it's very urgent.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member187452
Contributor
0 Kudos

Hi,

You have appended to out_tab instead of that you will have to use MODIFY statement along with key that you have provided in the script.

Regards,

Bharat

former_member195383
Active Contributor
0 Kudos

Hi..

chk in konV table...wheather for KNUMV = the value in l_knumv ..entry is thr or not..

if that entry is not thr...then the select query cant fetch anything.....

Former Member
0 Kudos

thanks for ur reply.but when i debug,if i give my own value in l_kntyp also,then the value is not populating into the po.

former_member195383
Active Contributor
0 Kudos

debugg and chk wat value u r having in the field l_knumv. just before the select query u put a break-point and chk it..if u are having any value...just go to konv table and check if any entry is thr or not...if no entry is thr...thr wont be any value in l_kntyp

Former Member
0 Kudos

yes u r correct.but if u see in my code, i have two default values for l_kntyp(f and c).even if i give these values in debugging then also,the value is not getting populated in to po.

former_member195383
Active Contributor
0 Kudos

remove the below append statement from bothe the conditions...

append out_tab.

Use only modify...then it ll work..

Former Member
0 Kudos

hai prasanna,

i am sorry.the coding has benn changed little bit now.

the perform in se71 is.

PERFORM SUB_FORM2 IN PROGRAM ZSSS_NEW

USING &EKKO-EBELN&

CHANGING &L_KBERT&

ENDPERFORM

FORM sub_form2 TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

TYPES : BEGIN OF ty_itab,

kschl TYPE konv-kschl,

kbetr TYPE konv-kbetr,

END OF ty_itab.

DATA : t_itab TYPE STANDARD TABLE OF ty_itab,

wa_itab TYPE ty_itab.

DATA :

l_knumv TYPE knumv,

l_ebeln TYPE ebeln.

break damlek.

READ TABLE in_tab WITH KEY name = 'EKKO-EBELN'.

IF sy-subrc = 0.

l_ebeln = in_tab-value.

ENDIF.

SELECT SINGLE knumv FROM ekko INTO l_knumv WHERE ebeln = l_ebeln.

if not l_knumv is initial.

SELECT kschl kbetr

FROM konv

INTO corresponding fields of table t_itab

where knumv = l_knumv.

endif.

break damlek.

if sy-subrc = 0.

  • loop at t_itab into wa_itab.

READ TABLE out_tab with key = 'KONV-KNUMV'.

out_tab-value = wa_itab-kbetr.

modify out_tab.

endif.

now here upto itab i am gettinfg the value of kbert,but i want to populate it into out_tab so that i can print it in po.

plz give me the solution.

sachin_mathapati
Contributor
0 Kudos

Try this..

READ TABLE out_tab with key = 'KONV-KNUMV'.

If sy-subrc eq 0.

out_tab-value = wa_itab-kbetr.

Modify out_tab Index sy-tabix.

Endif.

Regards,

Sachin M M

Edited by: Sachin Mathapati on Jul 4, 2008 10:10 AM

former_member195383
Active Contributor
0 Kudos

use the modify sentense as below..

modify out_tab index = sy-tabix.

that will work..

former_member195383
Active Contributor
0 Kudos

use the modify sentense as below..

modify out_tab index = sy-tabix.

that will work..

if u are getting value...in wa_itab-kbetr..

then the above shud work..

Former Member
0 Kudos

hai prasanna,

but it is giving syntax error if i use modify out_tab index = sy-tabix.

sachin_mathapati
Contributor
0 Kudos

MOdify Itab Index Sy-tabix.

Do not use '=' or EQ

former_member195383
Active Contributor
0 Kudos

modify out_tab index sy-tabix.

remove the = symbol...the query will work..