Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Calling ABAP from SAPScript

Former Member
0 Likes
755

Hi ,

I am facing some problem in calling a subroutine from Standard Text element (Txn SO10).

I have done the following in a text element.

/: DEFINE &GD_PREV_NAME& = ''

/: PERFORM GET_PREV_NAME IN PROGRAM ZTEST

/: USING &P0001-PERNR&

/: USING &P0002-BEGDA&

/: CHANGING &GD_PREV_NAME&

/: ENDPERFORM

In the ABAP ZTEST,

FORM get_prev_name TABLES tabin STRUCTURE itcsy

tabout STRUCTURE itcsy.

DATA : ld_pernr LIKE pa0001-pernr.

READ TABLE tabin WITH KEY name = 'P0001-PERNR'.

IF sy-subrc = 0.

ld_pernr = tabin-value.

ENDIF.

........................

ENDFORM.

I found in debugging that the both tables TABIN & TABOUT are empty in the FORM get_prev_name !!!!

Can anyone hint on why the values are not passed to ABAP ??

Many thanks in advance.

Regards,

Sandip.

Ph : +44 121 683 2814.

6 REPLIES 6
Read only

Former Member
0 Likes
670

Hi ,

Just change tour code in the ABAP program like this.

FORM get_prev_name TABLES tabin STRUCTURE itcsy

tabout STRUCTURE itcsy.

DATA : ld_pernr LIKE pa0001-pernr.

READ TABLE tabin index 1.

IF sy-subrc = 0.

ld_pernr = tabin-value.

ENDIF.

ENDFORM.

Cheers,

Sam.

Read only

0 Likes
670

Sam,

I would like to inform that the table TABIN has got no values at all.TABIN[] is EMPTY.

So it does not matter whether you read it by INDEX 1 or by WITH KEY......

Please suggest.

Thanks,Sandip.

Read only

Former Member
0 Likes
670

Hi Sandip,

How did you check that tables are empty ?

Regards,

Sanjeev

Read only

0 Likes
670

Hi ,

In debigging I see tables are empty.

But the same text element is printing the P0001-PERNR and P0002-BEGDA correctly !

So I am just confused as why it is not passed to the ABAP Subroutine I am calling.

Help buddies with your views.I am ready for any hit-n-trial.

Thank you very much.

Sandip.

Read only

0 Likes
670

HI gotit!!!!

without the &s

Just try this.

/: DEFINE &GD_PREV_NAME& = ''

/: PERFORM GET_PREV_NAME IN PROGRAM ZTEST

/: USING P0001-PERNR

/: USING P0002-BEGDA

/: CHANGING &GD_PREV_NAME&

/: ENDPERFORM

Cheers,

Sam.

Read only

Former Member
0 Likes
670

Hi Sandip,

I guess the problem here might be that the values aren't getting flown.

First try this (hardcoding and testing),

/: DEFINE &GD_PREV_NAME& = ''

/: PERFORM GET_PREV_NAME IN PROGRAM ZTEST

/: USING '1000'

/: USING '20050101'

/: CHANGING &GD_PREV_NAME&

/: ENDPERFORM

if it works fine, then figure out whether the variables P0001-PERNR AND P0002-BEGDA are not null when passed. If not then try this

/: DEFINE &GD_PREV_NAME& = ''

/: PERFORM GET_PREV_NAME IN PROGRAM ZTEST

/: USING &P0000-PERNR&

/: USING &P0002-BEGDA&

/: CHANGING &GD_PREV_NAME&

/: ENDPERFORM

ELSE TRY PA0000-PERNR AND PA0002-BEGDA

Cheers,

Sam.