cancel
Showing results for 
Search instead for 
Did you mean: 

Perform In Script

Former Member
0 Kudos

Hi,

I am using a perform statement in Script and writing a sub-routine pool in SE38 .

From this Perform i will be getting 3 values , and i need to pass only 1 value in USING . Here is the code .

/: PERFORM SUB_CUST_ACC_NO IN PROGRAM ZOAR_CUST_ACC_NO

/:USING &GV_SORT_CODE&

/:CHANGING &CUST_ACC_NO&

/:CHANGING &LV_SELVON&

/:CHANGING &LV_ACC_DOC_NO&

/:ENDPERFORM

In SE38 i am using GV_SORT_CODE and fetching other 3 Changing Parameters . Here is the code written in SE38 .

PROGRAM sub_cust_acc_no.

&----


*& Form SUB_CUST_ACC_NO

&----


  • text

----


  • -->INTAB text

  • -->OUTTAB text

----


FORM sub_cust_acc_no TABLES intab STRUCTURE itcsy

outtab STRUCTURE itcsy.

DATA : lv_sort_code(255) TYPE C,

lv_kukey(255) TYPE C,

lv_esnum(255) TYPE C,

lv_selvon(255) TYPE C,

lv_acc_doc_no(255) TYPE C,

lv_cust_accno(255) TYPE C.

READ TABLE intab WITH KEY name = 'GV_SORT_CODE' .

IF sy-subrc = 0 .

MOVE intab-value TO lv_sort_code.

ENDIF.

SELECT SINGLE kukey

esnum

FROM febep

INTO (lv_kukey,lv_esnum)

WHERE pablz = lv_sort_code.

SELECT SINGLE agkon

selvon

FROM febcl

INTO (lv_cust_accno,lv_selvon)

WHERE kukey = lv_kukey

AND esnum = lv_esnum.

SELECT SINGLE augbl

FROM

bseg

INTO

lv_acc_doc_no

WHERE belnr = lv_selvon .

MOVE lv_cust_accno TO outtab-value .

modify outtab INDEX 1.

MOVE lv_selvon TO outtab-value.

modify outtab INDEX 2.

MOVE lv_acc_doc_no TO outtab-value.

modify outtab INDEX 3.

ENDFORM. "sub_cust_acc_no

After this i am displaying those 3

( &CUST_ACC_NO& ,&LV_SELVON& , &ACC_DOC_NO&)

variables in Script but the values are not coming. Why? Please this is an Urgent Issue.

Note: Values are there in Database .

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Pavan,

try this...

<b>FORM sub_cust_acc_no TABLES intab STRUCTURE itcsy

outtab STRUCTURE itcsy.

DATA : lv_sort_code TYPE PABLZ_EB,

lv_kukey TYPE KUKEY_EB,

lv_esnum TYPE ESNUM_EB,

lv_selvon TYPE SEL01_F05A,

lv_acc_doc_no TYPE AUGBL,

lv_cust_accno TYPE AGKON.

READ TABLE intab WITH KEY name = 'GV_SORT_CODE' .

IF sy-subrc = 0 .

MOVE intab-value TO lv_sort_code.

ENDIF.

SELECT SINGLE kukey

esnum

FROM febep

INTO (lv_kukey,lv_esnum)

WHERE pablz = lv_sort_code.

SELECT SINGLE agkon

selvon

FROM febcl

INTO (lv_cust_accno,lv_selvon)

WHERE kukey = lv_kukey

AND esnum = lv_esnum.

Read table outtab with key 'CUST_ACC_NO'.

CHECK SY-SUBRC = 0.

outtab-value = LV_CUST_ACCNO.

modify outtab INDEX SY-TABIX.

Read table outtab with key 'LV_SELVON'.

CHECK SY-SUBRC = 0.

outtab-value = lv_selvon.

modify outtab INDEX SY-TABIX.

SELECT SINGLE augbl

FROM

bseg

INTO

lv_acc_doc_no

WHERE belnr = lv_selvon .

Read table outtab with key 'LV_ACC_DOC_NO'.

CHECK SY-SUBRC = 0.

outtab-value = lv_acc_doc_no.

modify outtab INDEX SY-TABIX.

ENDFORM. "sub_cust_acc_no</b>

Regards

SAB

Former Member
0 Kudos

Hi Pavan,

The issue is in the modifying the internal table part. You are passing the value to the outtab-value only, so when you say modify the outtab-name gets modified as well and there is a blank value is assigned to the outtab-name. Hence the values are blank when you display.

MOVE lv_cust_accno TO outtab-value .

modify outtab INDEX 1 <b>TRANSPORTING value</b>.

MOVE lv_selvon TO outtab-value.

modify outtab INDEX 2 <b>TRANSPORTING value</b>.

MOVE lv_acc_doc_no TO outtab-value.

modify outtab INDEX 3 <b>TRANSPORTING value</b>.

Moreover check the values to be displayed as well

After this i am displaying those 3 fields

( &CUST_ACC_NO& ,&LV_SELVON& , &ACC_DOC_NO&)

( &CUST_ACC_NO& ,&LV_SELVON& , &<b>LV_ACC_DOC_NO</b>&)

Now the values would be displayed.

Regards,

Tushar

Former Member
0 Kudos

Hi Pavan,

Use APPEND instead of Modify.

if u use modify it will modify the old values and replace with the new Values.

Append will add the New entries to ..

Thanks,

Nelson

Former Member
0 Kudos

Hai,

Make sure that the variable names are correctly used at all places(Both in Print Program and Script)

/:USING &GV_SORT_CODE&

/:CHANGING &CUST_ACC_NO&

/:CHANGING &LV_SELVON&

/:CHANGING &LV_<b>ACC_DOC_NO</b>&

And also,

Better to use USING for all(Expect readability purpose there is no much difference)

Hope this helps you.

Reward points if it helps you.

Regds,

Rama chary.Pammi

dev_parbutteea
Active Contributor
0 Kudos

HI, I didn't really understand the question but try

READ TABLE intab INDEX 1.

IF sy-subrc EQ 0.

lv_sort_code = intab-value.

ENDIF.

.

.

.

READ TABLE outtab ASSIGNING <fs_out_tab> INDEX 1.

IF sy-subrc EQ 0.

<fs_outtab>-value = lv_cust_accno.

ENDIF.

READ TABLE out_tab1 ASSIGNING <fs_out_tab> INDEX 2.

IF sy-subrc EQ 0.

<fs_outtab>-value = ws_adrc-street.

ENDIF.

READ TABLE out_tab1 ASSIGNING <fs_out_tab> INDEX 3.

IF sy-subrc EQ 0.

<fs_outtab>-value = lv_selvon.

ENDIF.

Former Member
0 Kudos

FORM <SUBR> [TABLES <FORMAL TABLE LIST>]

[USING <INPUT TABLE LIST>]

[CHANGING<OUTPUT TABLE LIST>]]....

PERFORM <SUBR> [TABLES <ACTUAL TABLE LIST>]

[USING <ACTUAL TABLE LIST>]

[CHANGING<ACTUALTABLE LIST>]]....

Hope this could help you