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

SAPSCRIPT OUTPUT ?

Former Member
0 Likes
639

For a specific output type for a transaction , A SAPSCRIPT form is assigned . I need to make some changes to the form , so i copied the script to a zscript and after making the changes i want to test the output of the script . I created a print prog and called the script , I want to know how can we pass the data ( like del num ) to the script ?????

How to test the script and see the output ? In Print preview it does not show the full output ?>

4 REPLIES 4
Read only

abdul_hakim
Active Contributor
0 Likes
572

hi sharma,

you could pass the values to ur SAPScript using the interface of ur print program.First of all you should define the program parameters in the selection screen say for eg &itab-num1& &itab-num2&. and lets assume that we are passing the values to the above program symbols from our program..then ur print program should be like below..

data: begin of itab occurs 0,

num1 type i,

num2 type i,

end of itab.

you call ur OPEN_FORM first

then call ur WRITE_FORM as follows..

LOOP AT itab.

WRITE_FORM

ENDLOOP.

In the WRITE_FORM specify ur window name where you have placed ur program symbols and corresponding text elements if necessary...

finally call the CLOSE_FORM

Cheers,

Abdul Hakim

Mark all useful answers..

Read only

Former Member
0 Likes
572

Hi Tamanna,

If the SAP Std form is maintained somewhere in the config & picked up at runtime, then your Z Script should replace that. That way whatever variables you have in the sapscript would get populated.

If you have a print program to test, then check out whats the del num in the SAP Script. Use exactly the same variable in your Print program & make sure to populate it.

Try changing your printer settings to see the full output.

Read only

Former Member
0 Likes
572

Hi Tamanna,

after changing the script form you can add or design some rountine for the modified fields, this is one way instead of modifying the print program we can design the logic in subroutine and we can call this in the form

like take the case of delvery application

form name is RVDELNOTE

print program RVADDN01

here modification is based upon the input of delivery no we should get the output of delivery type.

create an executable program

Report: -


tables: VBDKL

maintain the declarations

Form YGPRM TABLES

intab structure itcsy

outtab structure itcsy.

*add the logic for i/p

Read Table intab with key 'delno'.

DNo = intab-value.

*logic for o/p

Read Table outtab with key 'DTTYPE'.

if DNo = '-----'.

outtab-value = 'lf'.

else

outtab-value = 'sr'.

endif.

save and activate it

in se71 in the info window in the change mode afer endif call the above subroutine like

perform YGFRM in program YGPRG

using &delno& changing &DTYPE&

endperform.

Delevery type &DTYPE&.

save and activate the form.

assingn this modified form to the print program through nace transaction

i think it would be helpful for u

Regards,

Naveen

Read only

aris_hidalgo
Contributor
0 Likes
572

Hi,

Please do debug your program and form to see if it really has data to be passed on the form. Anyway, below is a sample code for the report and code for 1 of my window in SAPscript form.

DATA: l_lines TYPE i.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'KOPF'

window = 'KOPF'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'POS_ZEILE'

window = 'MAIN'.

v_first_num = 'Y'.

v_finish = 'N'.

DESCRIBE TABLE serial_tab LINES l_lines.

LOOP AT serial_tab.

IF sy-tabix EQ l_lines.

v_finish = 'Y'.

ENDIF.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'SERNUM'

window = 'MAIN'.

v_first_num = 'N'.

ENDLOOP.

PERFORM print_footer.

*AVH - start of insertion - 05/31/06

*At every end of ls_lines1, v_flag will be triggered to close the

*current form and start a new one for the new dealer

IF v_flag = 1.

CLEAR v_flag.

PERFORM close_form.

PERFORM open_form_sammel.

ENDIF.

*AVH - end of insertion

Element KOPF

/: PROTECT

/: IF &MSEG-BWART& EQ '601' OR &MSEG-BWART& EQ '653'

LH ,,<H>Del Order #:</>

= ,,&MKPF-XBLNR&

/: ELSEIF &MSEG-BWART& EQ '631'

LH ,,<H>Del Order #:</>

= ,,&MKPF-XBLNR&

LH ,,<H>Ship-to-party:</>

= ,,&LS_LINES&

LH ,,,,&LS_LINES2&

LH ,,,,&LS_LINES3&

/: ELSE

LH ,,<H>Ref. Doc.:</>

/: ENDIF

/* IF &MSEG-BWART& NE '261'

/* ,,&MKPF-XBLNR&

/* ENDIF

/* IF &MSEG-BWART& EQ '261'

/* ENDIF

= ,,

/: IF &MKPF-TCODE2& EQ 'MB1A' AND &V_REVRS& EQ 'N'

= ,,<HB>GOODS ISSUE SLIP</>

/: ELSEIF &MKPF-TCODE2& EQ 'MIGO_GI' AND &V_REVRS& EQ 'N'

= ,,<HB>GOODS ISSUE SLIP</>

/: ELSEIF &MKPF-TCODE2& EQ 'MB1A' AND &V_REVRS& EQ 'Y'

= ,,<HT>RETURNS FROM ISSUANCE SLIP</>

/: ELSEIF &MKPF-TCODE2& EQ 'MIGO_GI' AND &V_REVRS& EQ 'Y'

= ,,<HT>RETURNS FROM ISSUANCE SLIP</>

/: ELSEIF &MKPF-TCODE2& EQ 'MB1B'

/: IF &MSEG-BWART& EQ '601'

= ,,<HB>DELIVERY RECEIPT</>

/: ELSEIF &MSEG-BWART& EQ '653'

= ,,<HB>RETURN RECEIPT</>

/: ELSE

= ,,<HB>GOODS TRANSFER SLIP</>

/: ENDIF

/: ELSEIF &MKPF-TCODE2& EQ 'MB1C'

= ,,<HB>GOODS RECEIPT SLIP</>

/: ELSEIF &MKPF-TCODE2& EQ 'MB01' AND &V_REVRS& EQ 'N'

= ,,<HB>GOODS RECEIPT SLIP</>

/: ELSEIF &MKPF-TCODE2& EQ 'MIGO_GR' AND &V_REVRS& EQ 'N'

= ,,<HB>GOODS RECEIPT SLIP</>

/: ELSEIF &MKPF-TCODE2& EQ 'MB01' AND &V_REVRS& EQ 'Y'

= ,,<HB>GOODS RETURN SLIP</>

/: ELSEIF &MKPF-TCODE2& EQ 'MIGO_GR' AND &V_REVRS& EQ 'Y'

= ,,<HB>GOODS RETURN SLIP</>

/: ENDIF

UL &uline(100)&

CH ,,<H>Item,,Material/,,Quantity,,U/M</>

/: IF &MSEG-BWART& EQ '631'

= ,,<H>Sloc/</>

/: ENDIF

/: IF &MKPF-TCODE2& EQ 'MB1A' OR &MKPF-TCODE2& EQ 'MB1C' OR &MKPF-TCODE2& EQ 'MB01'

= ,,<H>Str Loc</>

/: ELSEIF &MKPF-TCODE2& EQ 'MIGO_GR' OR &MKPF-TCODE2& EQ 'MIGO_GI'

= ,,<H>Str Loc</>

/: ELSEIF &MKPF-TCODE2& EQ 'MB1B'

= ,,<H>Iss Sloc</>

/: ENDIF

/: IF &MSEG-BWART& EQ '631'

= ,,<H>Customer</>

/: ENDIF

/: IF &MKPF-TCODE2& NE 'MB01' AND &MKPF-TCODE2& NE 'MIGO_GR' AND &MSEG-BWART& NE '631'

= ,,<H>Recipient</>

/: ELSE

/: IF &MSEG-BWART& NE '631'

= ,,<H>Ref PO No</>

/: ENDIF

/: ENDIF

CH ,,,,<H>Description</>

/: IF &MSEG-BWART& EQ '631'

= ,,,,,,<H>Recipient</>

/: IF &MKPF-TCODE2& EQ 'MB1A' OR &MKPF-TCODE2& EQ 'MB1C'

= ,,,,,,<H>Reason</>

/: ELSEIF &MKPF-TCODE2& EQ 'MIGO_GI'

= ,,,,,,<H>Reason</>

/: ELSEIF &MKPF-TCODE2& EQ 'MB01' AND &V_REVRS& EQ 'N'

= ,,,,,,<H>Reason</>

/: ELSEIF &MKPF-TCODE2& EQ 'MIGO_GR' AND &V_REVRS& EQ 'N'

= ,,,,,,<H>Reason</>

/: ELSEIF &MKPF-TCODE2& EQ 'MB1B'

= ,,,,,,<H>Rcv Sloc</>

/: ENDIF

/: IF &MKPF-TCODE2& EQ 'MB1A' OR &MKPF-TCODE2& EQ 'MIGO_GI'

/: IF &MSEG-BWART& EQ 'Z29'

= ,,<H>Text,,Customer</>

/: ELSE.

= ,,<H>Cost Center,,Customer</>

/: ENDIF.

/: ELSEIF &MKPF-TCODE2& EQ 'MB1B'

/: IF &MSEG-BWART& EQ '323' OR &MSEG-BWART& EQ 'Z73'

= ,,<H>Reason for Movement</>

/: ELSEIF &MSEG-BWART& EQ 'Z75'

= ,,<H>Reason for Movement</>

/: ELSEIF &MSEG-BWART& EQ '351'

= ,,<H>STO Number</>

/: ELSE

= ,,<H>Recvg Batch</>

/: ENDIF

/: ENDIF

/: ENDIF

UL &uline(100)&

/: ENDPROTECT

Regards!