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: 

SAP script debugging

Former Member
0 Kudos

Hi experts,

i am new to sapscripts,

i want to do Retrieving data without modifying the original called program .

i got one exmplae program from sap img site.

i copied form into my z_medruck1 then i am calling the subroutine in my header window(PERFORM GET_BARCODE IN PROGRAM ZSCRIPTPERFORM).

i wrote the ZSCRIPTPERFORM as shown below.

now i want to know how to debugg this program.

or else you can give some other example programs then i can understand easily.

help...

Retrieving data without modifying the original called program

*

  • Retrieving data without modifying the original called program

*

  • Put this script code in your sapscripts

  • /: PERFORM GET_BARCODE IN PROGRAM ZSCRIPTPERFORM

  • /: USING &PAGE&

  • /: USING &NEXTPAGE&

  • /: CHANGING &BARCODE&

  • /: ENDPERFORM

  • / &BARCODE&

*

REPORT ZSCRIPTPERFORM.

FORM GET_BARCODE TABLES IN_PAR STRUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

DATA: PAGNUM LIKE SY-TABIX, "page number

NEXTPAGE LIKE SY-TABIX. "number of next page

READ TABLE IN_PAR WITH KEY 'PAGE'.

CHECK SY-SUBRC = 0.

PAGNUM = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY 'NEXTPAGE'.

CHECK SY-SUBRC = 0.

NEXTPAGE = IN_PAR-VALUE.

READ TABLE OUT_PAR WITH KEY 'BARCODE'.

CHECK SY-SUBRC = 0.

IF PAGNUM = 1.

OUT_PAR-VALUE = '|'. "First page

ELSE.

OUT_PAR-VALUE = '||'. "Next page

ENDIF.

IF NEXTPAGE = 0.

OUT_PAR-VALUE+2 = 'L'. "Flag: last page

ENDIF.

MODIFY OUT_PAR INDEX SY-TABIX.

ENDFORM.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Script:In SE71 give your form name and in Utilities-->Active debugger.

Then put a break point in your print prog where ever you want to stop it.

After that you need to go to your transaction like VF03/../..etc for Invoice you need to execute it by giving Outtype.

Then your print prog and form will debugg step by step.

Thanks.

Message was edited by: Deepak333 k

9 REPLIES 9

Former Member
0 Kudos

Hy,

To debugg a sapscript GOTO->UTILITIES->ACTIVE DEBUGGER.

REGARDS,

KARTIKEY

Former Member
0 Kudos

please explain and give some examples Retrieving data without modifying the original called program .

please help..

0 Kudos

i want to debugg the my perform statement .

help please

0 Kudos

hi ramesh,

you can debug the sapscript by using SE71->utilities -> Activate Debugger

2. if you want to add some logic without changing the original program

for examaple in the sapscript you can get value1 and value2,

but you want to do some manipulation and want to display value3

In that case in sapscript

insert the below statement

  • /: PERFORM GET_value3 IN PROGRAM ZSCRIPTPERFORM

  • /: USING &value1&

  • /: USING &value2&

  • /: CHANGING &value3&

  • /: ENDPERFORM

  • / &value3&

(you are passing value1 and value2 and getting value3)

then in the include program ZSCRIPTPERFORM add the logic below

FORM GET_value3 TABLES IN_PAR STRUCTURE ITCSY

OUT_PAR STRUCTURE ITCSY.

data : value1 type i,

value2 type i,

value3 type i.

READ TABLE IN_PAR index 1.

value1 = in_par-value

READ TABLE IN_PAR index 2.

value2 = in_par-value

value3 = value1 + value2 ( some manipulations)

READ TABLE OUT_PAR WITH index 1.

IF PAGNUM = 1.

OUT_PAR-VALUE = value3

ENDIF.

MODIFY OUT_PAR INDEX 1.

ENDFORM.

cheers,

sasi

0 Kudos

You will have to put a break point in the program in which you have written your subroutine. Just put a break point of first executable statement of subroutine and execute. It should stop at that point.

If you want to see what values are passed from SAPSCRIPT to this subroutine then you will need to activate SAPSCRIPT debugger and go upto that point of calling subroutine and see waht values are there.

Cheers.

0 Kudos

Hi Please I need attention from your end sanjay please see my query and answer to that.

Former Member
0 Kudos

SO WHILE U WILL DEBUG THE SCRIPT WHEN U COME TO THE PERFORM PART, U WILL HAVE TO CHECK THAT PROGRAM FROM WHERE IT'S TAKING THE VALUES.

REGSRDA,

KARTIKEY,.

Former Member
0 Kudos

Hi,

Script:In SE71 give your form name and in Utilities-->Active debugger.

Then put a break point in your print prog where ever you want to stop it.

After that you need to go to your transaction like VF03/../..etc for Invoice you need to execute it by giving Outtype.

Then your print prog and form will debugg step by step.

Thanks.

Message was edited by: Deepak333 k

0 Kudos

HI

as i shown above the example program for printing barcode

in purchase order form(header window in z_medruck1)

when i test my form z_medruck1 i can see the bar code in

print preview.

but when i am create the purchse order through me21 and

i test print privew i was not able to get barcode.

where i was doing wrong?

please help me