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

Problems with SAP Script print program

Former Member
0 Likes
594

Hi,

I have the following scenario:

I have a workflow which prints a sapscript with data stored in the workflow container.

The workflow method 'executeform' populates a selection table and submits it to the print program using:

SUBMIT ZPRINT_FORM WITH SELECTION-TABLE sel_table

This print program then populates the form with data and calls the OPEN_FORM/WRITE_FORM/CLOSE_FORM FM's.

My problem is that some of the variables in the workflow container are CHAR255, when these get moved to the selection table (seltab-low) they get truncated as seltab-low is a CHAR45. Is there a way round this??

This is the first time I have used sapscript, I notice that the variables printed on the form correspond to the parameters defined in the Print Program. I assume therefore that this is why the

SUBMIT ZPRINT_FORM WITH SELECTION-TABLE sel_table

has been used and why the OPEN_FORM/WRITE_FORM/CLOSE_FORM was not coded directly in the workflow executeform method.

Any guidance on how to proceed with this would be appreciated.

Many Thanks,

Paul

4 REPLIES 4
Read only

Former Member
0 Likes
551

You can use ABAP memory to overcome the length limitations of selection set .

Before Submit use EXPORT to MEMORY .

In the program ZPRINT_FORM use IMPORT from MEMORY.

Sapscript can print global variable of the print program so I guess it is used this way as you cannot define your variables in global section of workflow program.

Cheers.

Sanjay

Read only

Former Member
0 Likes
551

Hi Paul,

In general, in the statement

SUBMIT ZPRINT_FORM WITH SELECTION-TABLE sel_table.

sel_table is an internal table with the structure RSPARAMS.

This variant allows you to set the names and contents of the parameters and selection options dynamically at runtime.

You can use the function module RS_REFRESH_FROM_SELECTOPTIONS to read the contents of the parameters and selection options of the current program into an internal table seltab with the structure RSPARAMS. By using SUBMIT ... WITH SELECTION-TABLE seltab, you can then pass these values on directly.

The work around for the variables that cannot be passed using the submit statement, can be exported to Global memory ids and the same can be retrieved in the print progra.

The syntax for the export and import statements is something like this.

TABLES INDX.

TYPES: BEGIN OF ITAB3_TYPE,

CONT(4),

END OF ITAB3_TYPE.

DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE',

F1(4), F2 TYPE P,

ITAB3 TYPE STANDARD TABLE OF ITAB3_TYPE WITH NON-UNIQUE

DEFAULT KEY INITIAL SIZE 2,

WA_INDX TYPE INDX.

  • Fill the data fields before CLUSTR

  • before the actual export

INDX-AEDAT = SY-DATUM.

INDX-USERA = SY-UNAME.

  • Export der Daten.

EXPORT F1 FROM F1

F2 FROM F2

ITAB3 FROM ITAB3

TO DATABASE INDX(ST) FROM WA_INDX ID INDXKEY.

*********************************************************TYPES: BEGIN OF TAB3_TYPE,

CONT(4),

END OF TAB3_TYPE.

DATA: INDXKEY LIKE INDX-SRTFD,

F1(4), F2 TYPE P,

TAB3 TYPE STANDARD TABLE OF TAB3_TYPE WITH

NON-UNIQUE DEFAULT KEY,

WA_INDX TYPE INDX.

INDXKEY = 'INDXKEY'.

IMPORT F1 = F1

F2 = F2

TAB3 = TAB3 FROM DATABASE INDX(ST) ID INDXKEY

TO WA_INDX.

Regards,

Ravi

Read only

Former Member
0 Likes
551

Hi,

Thanks for the responses. I was hoping that there would be a more elegant solution to this problem than using Import/Export.

Thanks,

Paul

Read only

0 Likes
551

Use of seltab is optional.

You can also pass the parameters this way -

<b>RANGES SEL FOR DBTAB-FIELD.

SEL-OPTION = 'EQ'.

SEL-SIGN = 'I'

SEL-LOW = '<YOUR_LONG_VALUE>'.

APPEND SEL.

SUBMIT PROG ... WITH p IN sel .</b>

The DBTAB-FIELD used above should be same as the one used for select option P in PROG.

Cheers.

Sanjay