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: 

SAPSCRIPT problem - skipping lines in an element

0 Kudos

Hello,

I am having a weird problem with a SAPSCRIPT form that it is not executing an ELEMENT(/E) completely. When I debug it, I clearly see executimg only the first line and then it skips the rest of the code. I have ensured that I do not have any ENDIF's missing or any syntax errors. I also changed in the ABAP program(print program) to use another ELEMENT and it is also skipping the second and subsequent lines. I am not sure if it a problem with the print program or the SAPScript form.

Here is my ABAP code:

  • Init the barcode window

CALL FUNCTION 'WRITE_FORM'

EXPORTING

window = 'BARCODE'

element = 'INIT_BARCODE'

EXCEPTIONS

window = 1

element = 2.

Here is my SAPScript code:

/E INIT_BARCODE

/: DEFINE &G_XPOS1& = &ZBAR-G_XPOS1&

/: DEFINE &G_XPOS2& = &ZBAR-G_XPOS2&

/: DEFINE &G_XPOS3& = &ZBAR-G_XPOS3&

/: DEFINE &G_XPOS4& = &ZBAR-G_XPOS4&

/* Print startcode

/: POSITION XORIGIN '0.2' CM YORIGIN '28.4' CM

/: IF &Y2OF5-C01& = '1'

/: BOX XPOS &G_XPOS1& TW WIDTH 0 TW HEIGHT 6 MM FRAME 8 TW INTENSITY 100

/: ENDIF

/: IF &Y2OF5-C02& = '1'

/: BOX XPOS &G_XPOS2& TW WIDTH 0 TW HEIGHT 6 MM FRAME 8 TW INTENSITY 10

/: ENDIF

/: IF &Y2OF5-C03& = '1'

/: BOX XPOS &G_XPOS3& TW WIDTH 0 TW HEIGHT 6 MM FRAME 8 TW INTENSITY 10

/: ENDIF

/: IF &Y2OF5-C04& = '1'

/: BOX XPOS &G_XPOS4& TW WIDTH 0 TW HEIGHT 6 MM FRAME 8 TW INTENSITY 100

/: ENDIF

Any ideas on this problem?

Thanks,

Nick F.

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

It seems that you driver program doesn't have the variable called ZBAR-G_XPOS1.

In SE71, Check which text symbols are not defined or the symbols which are not known to your SAPScript from the driver program by:

Form > Check > Texts

In the popup select Include res.

In the next popup select your driver program

and hit enter.

If there are any symbols which SAPScript is not able to recognize than it will list them.

Regards,

Naimesh Patel

17 REPLIES 17

Former Member
0 Kudos

By executing the first line only, do you mean the first DEFINE?

Rob

0 Kudos

Yes, it is only executing the first DEFINE line and then it skips the rest...

naimesh_patel
Active Contributor
0 Kudos

It seems that you driver program doesn't have the variable called ZBAR-G_XPOS1.

In SE71, Check which text symbols are not defined or the symbols which are not known to your SAPScript from the driver program by:

Form > Check > Texts

In the popup select Include res.

In the next popup select your driver program

and hit enter.

If there are any symbols which SAPScript is not able to recognize than it will list them.

Regards,

Naimesh Patel

0 Kudos

Hello,

I did the check of the texts but it gives me a warning of "Ambiguous symbol G_XPOS1".. Is this a problem? The variable is defined in the ABAP print driver as follow:

DATA: w_n TYPE i,

w_digitos TYPE i,

w_restoDATA:

g_xpos1(4) TYPE n,

g_xpos2(4) TYPE n,

g_xpos3(4) TYPE n,

g_xpos4(4) TYPE n,

g_xpos5(4) TYPE n,

g_xpos6(4) TYPE n,

g_xpos7(4) TYPE n,

g_xpos8(4) TYPE n,

g_xpos9(4) TYPE n,

g_xpos10(4) TYPE n,

g_xpos11(4) TYPE n,

g_xpos12(4) TYPE n,

g_xpos13(4) TYPE n,

g_xpos14(4) TYPE n,

g_tw_esp(2) TYPE n. "TYPE i VALUE 12.

Thanks,

NIck F.

Edited by: Nick Fernandez on Nov 10, 2008 10:27 PM

0 Kudos

You have G_XPOS1 defined in the print program. Shouldn't you have ZBAR-G_XPOS1 defined in the program (or a TABLES statement for structure ZBAR)?

0 Kudos

Do you really mean:

w_restoDATA:

or should it be:

w_restoDATA,

Rob

0 Kudos

YES, table ZBAR is allready defined in a TABLES statement...

0 Kudos

Yes, you are correct. I fixed the definition that I had an error and it is as follow:

TABLES: j_1ai02, y2of5, zbar.

DATA:

g_xpos1(4) TYPE n,

g_xpos2(4) TYPE n,

g_xpos3(4) TYPE n,

g_xpos4(4) TYPE n,

g_xpos5(4) TYPE n,

g_xpos6(4) TYPE n,

g_xpos7(4) TYPE n,

g_xpos8(4) TYPE n,

g_xpos9(4) TYPE n,

g_xpos10(4) TYPE n,

g_xpos11(4) TYPE n,

g_xpos12(4) TYPE n,

g_xpos13(4) TYPE n,

g_xpos14(4) TYPE n,

g_tw_esp(2) TYPE n. "TYPE i VALUE 12.

DATA: w_n TYPE i,

w_digitos TYPE i,

w_resto TYPE i,

w_pos TYPE i,

w_nro(2) TYPE n,

w_barcode(44) TYPE n.

But, I am still getting the warning in the SE71 check and skipping the lines of the ELEMENT section...

0 Kudos

Are you using G_XPOS1 in the print program or is it just defined there?

If you are not using it, I don't think you need to define in the ABAP program

Also, do you need the DEFINE in the SAPscript?

Can't you remove the DEFINE and use something like...

/: BOX XPOS &ZBAR-G_XPOS1& TW WIDTH 0 TW HEIGHT 6 MM FRAME 8 TW INTENSITY 100

0 Kudos

Hello,

The variable g_xpos1 is being used in the Print Driver PGM and this logic is working in another Print Driver PGM, which makes this problem very puzzling..

Thanks,

Nick F.

0 Kudos

Oh. Now I understand. G_XPOS1 is a global variable in the print program.

You do a DEFINE in the SAPscript and make it a local variable to the layout set. Now there are two. It's ambiguous,

Try changing the DEFINE to something else... like G_XPOS1A and then change the BOX command.

/: BOX XPOS &G_XPOS1A& TW WIDTH 0 TW HEIGHT 6 MM FRAME 8 TW INTENSITY 100

You'll have to the same with the other duplicated variables.

0 Kudos

I should add that I do not fully understand what you are doing with G_XPOS1 in the print program. With the DEFINE statement in the SAPscript, you are creating a second variable with the same name.

0 Kudos

Hello Norman,

I renamed the variable G_XPOS1 to SG_XPOS1 and the problem with the ambigious error is solved, but the problem with skipping the block of code in the ELEMENT block is still happening..

Thanks,

Nick F.

0 Kudos

Do you need to do the DEFINE?

Can you just use -

/: BOX XPOS &ZBAR-G_XPOS1& TW WIDTH 0 TW HEIGHT 6 MM FRAME 8 TW INTENSITY 100

How is ZBAR-G_XPOS1 defined in the data dictionary?

0 Kudos

... and if you want to see if the value in that field is causing a problem, you can hard code a value

/: DEFINE &G_XPOS1& = '100'

and then see if it gets by this line.

If that does not work, you can use RSTXSCRP to EXPORT the layout set and send it to me. I can take a quick look.

0 Kudos

Hello Norman,

I eliminated the DEFINE stmts and it is still not working.. I am emailing a txt and binary version of the Form..

Thanks,

Nick F.

0 Kudos

Hello,

Thanks for the help.. The problem was that the elements needed to be in a MAIN window..

Thanks,

Nick F.