Application Development 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: 

In SAP-SCRIPT value gets displayed in debugging mode & does not in the Norm

Former Member
0 Kudos

Hi,

Iam working on a SAP-SCRIPT form related to the Production order printing, I have copied the form from the standard script and working on the same, the issue here is that I have added some of my fields in the appropriate text-elements of the Main Window. The values of the fields I get by doing a perform trhough SAP-SCRIPT in some other Z-program.

Now the problem here is that, while I activate the debugger in the program or the sap-script or in both of them the corresponding values are displayed appropriately in the text elements, but when the SAP-SCRIPT is run in the normal mode (debugging off) no values are displayed in the script. i.e the select condition itself fails in the script, Iam trying to display the JCDS-USNAM & JCDS-UDATE (i.e the person responsible for releasing the Prodn Order & the Date ) this fields gets populated properly when the form is run in the debugging mode, but in the normal mode sy-subrc is 4 all the times after the corresponding select. (the related select statement is on the aufk-objnr = jcds-objnr and jcds-stat = 'I0002')

Can anyone please help me out in letting me know where does the problem exactly lie...as I have been working on this for the last 2 days...

Thanks in Advance,

Regards,

Sanjay.

15 REPLIES 15

former_member193831
Active Participant
0 Kudos

Are you using SELECT stmt in SAPScript?

ABAP syntax cannot be used, select queries cannot be used in SAPSCript.

Use a Subroutine program instead.

Regards,

Vivek

Reward if helps

0 Kudos

Hi Vivek,

Thanks for your reply..

I have checked all the options and all are working fine..and also the values are passed from itcsy to the outtab. I have seen that. now the code is as follows:

READ TABLE I_TAB INDEX 1.

IF SY-SUBRC EQ 0.

MOVE I_TAB-VALUE TO LV_OBJNR.

ENDIF.

<b>SELECT SINGLE USNAM

UDATE

INTO (GV_RELNAME,

GV_RELDATE)

FROM JCDS

WHERE OBJNR EQ LV_OBJNR

AND STAT EQ 'I0002'.

IF SY-SUBRC EQ 0.</b>

READ TABLE O_TAB WITH KEY C_RELNAME.

MOVE GV_RELNAME TO O_TAB-VALUE.

MODIFY O_TAB INDEX SY-TABIX.

ENDIF.

The above code I have written in the form routine of a z-program called through the perform in the sap-script, now the issue here is that the select while in debugging mode returns sy-subrc eq 0 and the value's of gv_relname & gv_reldate are displayed in the sap-script but when run in the normal mode sy-subrc returns 4 and hence no values are returned in the sap-script.

Please try to help.

Regards.

Sanjay Mankar.

Former Member
0 Kudos

Hi

After retriving the value you need to change in OUT_PAR internal table filed value for the correpsonding field.

0 Kudos

Hi Saida,

Thanks for your reply..

I have checked all the options and all are working fine..and also the values are passed from itcsy to the outtab. I have seen that. now the code is as follows:

READ TABLE I_TAB INDEX 1.

IF SY-SUBRC EQ 0.

MOVE I_TAB-VALUE TO LV_OBJNR.

ENDIF.

<b>SELECT SINGLE USNAM

UDATE

INTO (GV_RELNAME,

GV_RELDATE)

FROM JCDS

WHERE OBJNR EQ LV_OBJNR

AND STAT EQ 'I0002'.

IF SY-SUBRC EQ 0.</b>

READ TABLE O_TAB WITH KEY C_RELNAME.

MOVE GV_RELNAME TO O_TAB-VALUE.

MODIFY O_TAB INDEX SY-TABIX.

ENDIF.

The above code I have written in the form routine of a z-program called through the perform in the sap-script, now the issue here is that the select while in debugging mode returns sy-subrc eq 0 and the value's of gv_relname & gv_reldate are displayed in the sap-script but when run in the normal mode sy-subrc returns 4 and hence no values are returned in the sap-script.

Please try to help.

Regards.

Sanjay Mankar.

Former Member
0 Kudos

1.

first of all are u able to see the TEXT ELEMENTS in

INSERT->SYMBOLS->TEXTSYMBOLS.

2. What is the Paragraph format and see if the space is fitting into the text . if there is a window compression for the paragraph format it will show in debugging but will not get printed in the layout.

to chk this out do a random chk like this.

3.if this is the case just pass a text in that place into the main window and print

if this dosent get printed then window spacing might be the probelm and also the paragaraph format issue.

JCDS-USNAM & JCDS-UDATE jsut pass a static text or a literal over here and see.

since u r using an external subroutine see if the values are being transferred from <b>itcsy</b> to the outtab.

regards,

vijay.

Message was edited by:

vijay k

0 Kudos

> 1.

> first of all are u able to see the TEXT ELEMENTS in

> INSERT->SYMBOLS->TEXTSYMBOLS.

>

> 2. What is the Paragraph format and see if the space

> is fitting into the text . if there is a window

> compression for the paragraph format it will show in

> debugging but will not get printed in the layout.

>

> to chk this out do a random chk like this.

> 3.if this is the case just pass a text in that place

> into the main window and print

> if this dosent get printed then window spacing might

> be the probelm and also the paragaraph format issue.

>

> JCDS-USNAM & JCDS-UDATE jsut pass a static text or a

> literal over here and see.

>

> since u r using an external subroutine see if the

> values are being transferred from <b>itcsy</b> to the

> outtab.

>

>

> regards,

> vijay.

>

> Message was edited by:

> vijay k

Hi Vijay,

Thanks for your reply..

I have checked all of your 3 options and all are working fine..and also the values are passed from itcsy to the outtab. I have seen that. now the code is as follows:

READ TABLE I_TAB INDEX 1.

IF SY-SUBRC EQ 0.

MOVE I_TAB-VALUE TO LV_OBJNR.

ENDIF.

SELECT SINGLE USNAM

UDATE

INTO (GV_RELNAME,

GV_RELDATE)

FROM JCDS

WHERE OBJNR EQ LV_OBJNR

AND STAT EQ 'I0002'.

<b>IF SY-SUBRC EQ 0.</b>

READ TABLE O_TAB WITH KEY C_RELNAME.

MOVE GV_RELNAME TO O_TAB-VALUE.

MODIFY O_TAB INDEX SY-TABIX.

ENDIF.

The above code I have written in the form routine of a z-program called through the perform in the sap-script, now the issue here is that the select while in debugging mode returns sy-subrc eq 0 and the value's of gv_relname & gv_reldate are displayed in the sap-script but when run in the normal mode sy-subrc returns 4 and hence no values are returned in the sap-script.

Please try to help.

Regards.

Sanjay Mankar.

0 Kudos

okay ..

u r saying that in debugging u r able to see the value being fetched and in the normal mode it fails ..??this thing cant happen.

just make me clear in this ..

in the debugging are u seeing this value in zprogram or SAPSCRIPT ?

i suppose u r seeing it in zprogram right!

so do one thing just activate the script debugger and do the debugging in script where u need to see the value of O_TAB-VALUE

since u r saying that in debugging it is fetching then it has to goto script right .

so

im repeating just debug the script and dont look in driver program .

now u tell me the value of the outtab .

it has to be there right ..

regards,

vijay

0 Kudos

Hi Vijay,

Yes I think you are now coming close to the problem, the issue is in z-program in debugging mode the slect query fetches the data and hence sy-subrc = 0 & the value is transferred ot o_tab-value and hece to the sap-script,

But in the nromal mode the select query fails sy-subrc = 4 & no values is passed to o_tab-value and hence in the sap-script value is displayed as empty. I have tested it and very much sure about it.

If I put a stop on the select the value is fetched, if I put a stop on sy-subrc after select & not on select ...I see the select has failed..this select works only when stopped before select or on select...but stop after select shows that select has failed..

????

Regards

Sanjay

0 Kudos

Hi Sanjay ,

A select statement will not show such a discurbency .

Please check the values which are passed to the select statement in both the cases.

Regards

Arun

0 Kudos

//

But in the nromal mode the select query fails sy-subrc = 4 & no values is passed to o_tab-value and hence in the sap-script value is displayed as empty. I have tested it and very much sure about it.

//

How can u say that select failed and sy-subrc eq 4 when run in normal mode since it is not fetching the value to out_tab and onto the script?

//and hence in the sap-script value is displayed as empty//

dont arrive at this conclusion.

<b>Plz debug the script for that</b> and make sure that in debugging the script is fetching the value also in debugging change the value of the outtab and see if that changes are reflecting over there.

vijay

Former Member
0 Kudos

Hi,

You said that you are retrieving data in a separate perform called from SAPscript editor. It will be fetched by the help of the struture ITCSY. I hope you will be passing a variable from the script to fetch the value.

In the subroutine just check whether the <b>OUT_PAR</b> table has fetched any values before coming back to the script editor. After fetching the values into that work-area just write this command

<b>MODIFY OUT_PAR INDEX SY-TABIX</b>

I think this will help.

Thanks & Regards,

Suresh.

0 Kudos

Hi Suresh,

Thanks for your reply..

I have checked all the options and all are working fine..and also the values are passed from itcsy to the outtab. I have seen that. now the code is as follows:

READ TABLE I_TAB INDEX 1.

IF SY-SUBRC EQ 0.

MOVE I_TAB-VALUE TO LV_OBJNR.

ENDIF.

<b>SELECT SINGLE USNAM

UDATE

INTO (GV_RELNAME,

GV_RELDATE)

FROM JCDS

WHERE OBJNR EQ LV_OBJNR

AND STAT EQ 'I0002'.

IF SY-SUBRC EQ 0.</b>

READ TABLE O_TAB WITH KEY C_RELNAME.

MOVE GV_RELNAME TO O_TAB-VALUE.

MODIFY O_TAB INDEX SY-TABIX.

ENDIF.

The above code I have written in the form routine of a z-program called through the perform in the sap-script, now the issue here is that the select while in debugging mode returns sy-subrc eq 0 and the value's of gv_relname & gv_reldate are displayed in the sap-script but when run in the normal mode sy-subrc returns 4 and hence no values are returned in the sap-script.

Please try to help.

Regards.

Sanjay Mankar.

Former Member
0 Kudos

Hi ,

Plese put in the code for this section in sapscript , the perform you call and where u print.

Regards

Arun

former_member188326
Active Participant
0 Kudos

Hi Sanjay,

It may be possible that the SAPScript needs to be activated in DE language also. So just check whether the SAPScript is active in DE language? if not, than activate it and check it.

Regards,

Bharat Mistry.

Former Member
0 Kudos

my conclusion is .

u r looking at the value in zprogram in debugging which always shows u sy-subrc eq 0 .

as per ur verison select is fine but this cannot be the case if it shows in debugging then it has to show in nowmal also.

now when it is being passed to the script due to some spacing problem or window adjust ments / or in paragraph format /page format this value is not getting displayed this has to be the probelm .

once u debug the script it will be clear .

if at all select is giving a problem then i will sue sap for millions and leave the job as a programmer

regards,

vijay.