cancel
Showing results for 
Search instead for 
Did you mean: 

scripts

Former Member
0 Kudos

hai all,

pls tell me how to add new fields in the predefined script like medruck ,

pls send detail with code .

Regards ,

Nagendra.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Nagendra,

U can do it in two ways.

1) using perform..:PERFORM get_date IN PROGRAM zreport

/:USING &SALESORDER&

/:CHANGING &S_DATE&

/:ENDPERFORM

Now you can print S_DATE.

Write this code in the new ABAP program would be

REPORT zreport.

FORM get_date TABLES in_tab STRUCTURE ITCSY

out_tab STRUCTURE ITCSY .

READ TABLE in_tab INDEX 1.

SELECT some_date FROM ztab

WHERE salesorder = in_tab-value.

IF sy-subrc EQ 0.

READ TABLE out-tab INDEX 1.

MOVE ztab-somedate TO out_tab-value

MODIFY out_tab INDEX 1.

ENDIF.

ENDFORM.

2)use variable...

1st select the value in driver programm which u want to print in sap script .

than in sap script in which window u want to display it go there.

and rite ur variable value like &var&

Regards,

Priyanka.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Find the eg: to add a field in the form.

/: PERFORM <b>GET_BARCODE</b> IN PROGRAM <b>QCJPERFO</b>

/: USING &PAGE&

/: USING &NEXTPAGE&

/: CHANGING &BARCODE&

/: ENDPERFORM

/

/ <b>&BARCODE&</b>

Coding of the calling ABAP program:

REPORT <b>QCJPERFO.</b>

FORM <b>GET_BARCODE</b> TABLES IN_PAR STUCTURE 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.

Br,

Laxmi

Former Member
0 Kudos

hi,

To add new fields in the standard script form MEDRUCK is not a joke. However, it is not impossible. First thing is u need to copy the form as zmedruck and then you need to decide on which windows you're going to add new fields as there may be many windows. Also, the new fields you're going to add in the form layout window are existing in the print program. if the fields are needed to be added must exist in the program or you can write an externam program using Perform zform in program zprogram

using <var1>

chaning <var2>

and in the zprogram, use the below code

form zform using tables in_para ITC STRUCTURE

ut_para ITCSY STRUCTURE

endofrm

or in the medruck print program, SAPFM06P, you can add the fields from the tables you are going to use in the sap scriptform

and then

use them as program sysmbols

such as

&tablename-fieldname&

this shuold hav helped u

regards,

shamim.

Former Member
0 Kudos

Hi,

Please check the link,

Regards,

Hema.

    • Reward points if it is useful.