cancel
Showing results for 
Search instead for 
Did you mean: 

urgent script req.

Former Member
0 Kudos

Hi experts,

I have to add 2 fields to 5 zforms which are called by one standard print program.

Should i call a subroutine in form or checK whether those fields are send by print program itself.

I am new in scripts , so plz help me in this case.

Points will be rewarded.

REGARDS.

Edited by: S M on Feb 5, 2008 2:27 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello SM,

Write a Subroutine in all the Five forms to print the 2 fields.

Before writing this subroutine first check whether these two fields are populated from the Print program.

Else follow the first step.

CHeers,

Vasanth

Former Member
0 Kudos

Hi Vasanth,

I am greatful for ur reply.

I am adding fields Batch no.(charg) and expiry date(VFDAT) through MSEG.

Standard print progarm is SAPM07DR.

In INCLUDE: M07DRAUS mseg is being populated in line no.155.

will u plz make it clear that whether these 2 fields are also getting populated.I am a new joinee and don't have access to clients server till now.working on IDES and it is going to dump.

I want to breakpoint there and after exe. transaction for MIGO, wants to see whether these 2 fields are getting populated or not.

plz tell me is this the rigt way to do.

thanks.

sm.

Former Member
0 Kudos

Hello SM,

Since the fields u want to include are the fields of MSEG. These will be populated from ur print program only.

So just include these two fields in the forms where u need it.

like this.

 * &MSEG-CHARG&,,&MSEG-VFDAT& 

Definetly these fields will be printetd in the output.

If you want to debug the form Go to SE71 and give the form name. In the menu - ->Utilities --> Activate Debugger.

Then go to MIGO create GR and inlcude the message types and issue the output.

Now u can able to debug the form where u check whether these two fields are populated.

Cheers,

Vasanth

Former Member
0 Kudos

Hi Vasanth,

thanks for awnsering all my queries.

regards.

SM.

Former Member
0 Kudos

Hi Vasanth,

I discussed with u regarding the addition of fields in the form.

Same requirement is with program RM08NAST WHICH IS A CALLING PROGRAM FOR zscript and in this zscript i need to add refrence field RBKP-XBLNR. Table RBKP is being used in RM08NAST but i cant c any select statement which is populating RBKP.

plz tell me what to do?

Is there any need to call subroutine for this case?

Can we suppose that all the fields are being populated of table whch is being used in the program?

As till now i dont have the access of custom scripts, i can't even do R&D.

Thanks in advance.

SM.

Edited by: S M on Feb 6, 2008 10:41 AM

Former Member
0 Kudos

Hello SM,

I have analysed the report RM08NAST.

The table RBKP is used in the report. So dont worry about filling the value to the structure.

Do the change only in the form.

Regards,

Vasanth

Former Member
0 Kudos

Thanks Vasanth,

Take-care.

Answers (1)

Answers (1)

mahaboob_pathan
Contributor
0 Kudos

hi,

check this one.

REPORT YSTANDARD .

DATA : BEGIN OF ITAB OCCURS 0,

VBELN LIKE VBAP-VBELN,

ERDAT LIKE VBAP-ERDAT,

ERNAM LIKE VBAP-ERNAM,

POSNR LIKE VBAP-POSNR,

MATNR LIKE VBAP-MATNR,

KWMENG LIKE VBAP-KWMENG,

NETWR LIKE VBAP-NETWR,

KUNNR LIKE VBAK-KUNNR,

ADRNR LIKE KNA1-ADRNR,

NAME1 LIKE KNA1-NAME1,

PSTLZ LIKE KNA1-PSTLZ,

ORT01 LIKE KNA1-ORT01,

REGIO LIKE KNA1-REGIO,

LAND1 LIKE KNA1-LAND1,

END OF ITAB.

DATA : BEGIN OF IT_VBAP OCCURS 0,

VBELN LIKE VBAP-VBELN,

ERDAT LIKE VBAP-ERDAT,

ERNAM LIKE VBAP-ERNAM,

POSNR LIKE VBAP-POSNR,

MATNR LIKE VBAP-MATNR,

KWMENG LIKE VBAP-KWMENG,

NETWR LIKE VBAP-NETWR,

KUNNR LIKE VBAK-KUNNR,

END OF IT_VBAP.

DATA :BEGIN OF IT_KNA1 OCCURS 0,

ADRNR LIKE KNA1-ADRNR,

KUNNR LIKE KNA1-KUNNR,

NAME1 LIKE KNA1-NAME1,

PSTLZ LIKE KNA1-PSTLZ,

ORT01 LIKE KNA1-ORT01,

REGIO LIKE KNA1-REGIO,

LAND1 LIKE KNA1-LAND1,

END OF IT_KNA1.

SELECT-OPTIONS : S_VBELN FOR IT_VBAP-VBELN.

SELECT VBAP~VBELN

VBAP~ERDAT

VBAP~ERNAM

VBAP~POSNR

VBAP~MATNR

VBAP~KWMENG

VBAP~NETWR

VBAK~KUNNR

INTO TABLE IT_VBAP FROM VBAP INNER JOIN VBAK

ON VBAPVBELN = VBAKVBELN WHERE VBAP~VBELN IN

S_VBELN.

IF NOT IT_VBAP[] IS INITIAL.

SELECT ADRNR

KUNNR

NAME1

PSTLZ

ORT01

REGIO

LAND1

INTO TABLE IT_KNA1 FROM KNA1 FOR ALL ENTRIES IN IT_VBAP

WHERE KUNNR = IT_VBAP-KUNNR.

ENDIF.

  • SELECT BUKRS BUTXT INTO TABLE IT_T001 FROM T001 FOR ALL ENTRIES IN

*IT_VBAP WHERE BUKRS = IT_VBAP-BUKRS_VF.

*

SORT : IT_VBAP, IT_KNA1.

LOOP AT IT_VBAP.

READ TABLE IT_KNA1 WITH KEY KUNNR = IT_VBAP-KUNNR.

*READ TABLE IT_T001 WITH KEY BUKRS = IT_VBAP-BUKRS_VF.

IF SY-SUBRC = 0.

MOVE: IT_VBAP-VBELN TO ITAB-VBELN ,

IT_VBAP-ERDAT TO ITAB-ERDAT,

IT_VBAP-ERNAM TO ITAB-ERNAM,

IT_VBAP-POSNR TO ITAB-POSNR,

IT_VBAP-MATNR TO ITAB-MATNR,

IT_VBAP-KWMENG TO ITAB-KWMENG,

IT_VBAP-NETWR TO ITAB-NETWR,

IT_KNA1-KUNNR TO ITAB-KUNNR,

IT_KNA1-ADRNR TO ITAB-ADRNR,

IT_KNA1-NAME1 TO ITAB-NAME1,

IT_KNA1-PSTLZ TO ITAB-PSTLZ,

IT_KNA1-ORT01 TO ITAB-ORT01,

IT_KNA1-REGIO TO ITAB-REGIO,

IT_KNA1-LAND1 TO ITAB-LAND1.

  • IT_T001-BUTXT TO ITAB-BUTXT.

ENDIF.

APPEND ITAB.

CLEAR ITAB.

ENDLOOP.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

  • APPLICATION = 'TX'

  • ARCHIVE_INDEX =

  • ARCHIVE_PARAMS =

  • DEVICE = 'PRINTER'

  • DIALOG = 'X'

FORM = 'YII'

LANGUAGE = SY-LANGU

  • OPTIONS =

  • MAIL_SENDER =

  • MAIL_RECIPIENT =

  • MAIL_APPL_OBJECT =

  • RAW_DATA_INTERFACE = '*'

  • IMPORTING

  • LANGUAGE =

  • NEW_ARCHIVE_PARAMS =

  • RESULT =

  • EXCEPTIONS

  • CANCELED = 1

  • DEVICE = 2

  • FORM = 3

  • OPTIONS = 4

  • UNCLOSED = 5

  • MAIL_OPTIONS = 6

  • ARCHIVE_ERROR = 7

  • INVALID_FAX_NUMBER = 8

  • MORE_PARAMS_NEEDED_IN_BATCH = 9

  • SPOOL_ERROR = 10

  • CODEPAGE = 11

  • OTHERS = 12

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LOOP AT ITAB.

AT NEW VBELN.

CALL FUNCTION 'START_FORM'

EXPORTING

  • ARCHIVE_INDEX =

FORM = 'YII'

LANGUAGE = SY-LANGU

  • STARTPAGE = ' '

  • PROGRAM = ' '

  • MAIL_APPL_OBJECT =

  • IMPORTING

  • LANGUAGE =

  • EXCEPTIONS

  • FORM = 1

  • FORMAT = 2

  • UNENDED = 3

  • UNOPENED = 4

  • UNUSED = 5

  • SPOOL_ERROR = 6

  • CODEPAGE = 7

  • OTHERS = 8

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDAT.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ELE'

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

WINDOW = 'INFO'

  • IMPORTING

  • PENDING_LINES =

  • EXCEPTIONS

  • ELEMENT = 1

  • FUNCTION = 2

  • TYPE = 3

  • UNOPENED = 4

  • UNSTARTED = 5

  • WINDOW = 6

  • BAD_PAGEFORMAT_FOR_PRINT = 7

  • SPOOL_ERROR = 8

  • CODEPAGE = 9

  • OTHERS = 10

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'FOOTER'

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

WINDOW = 'FOOTER'

  • IMPORTING

  • PENDING_LINES =

  • EXCEPTIONS

  • ELEMENT = 1

  • FUNCTION = 2

  • TYPE = 3

  • UNOPENED = 4

  • UNSTARTED = 5

  • WINDOW = 6

  • BAD_PAGEFORMAT_FOR_PRINT = 7

  • SPOOL_ERROR = 8

  • CODEPAGE = 9

  • OTHERS = 10

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ELEMENT'

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

WINDOW = 'MAIN'

  • IMPORTING

  • PENDING_LINES =

  • EXCEPTIONS

  • ELEMENT = 1

  • FUNCTION = 2

  • TYPE = 3

  • UNOPENED = 4

  • UNSTARTED = 5

  • WINDOW = 6

  • BAD_PAGEFORMAT_FOR_PRINT = 7

  • SPOOL_ERROR = 8

  • CODEPAGE = 9

  • OTHERS = 10

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

AT END OF VBELN.

CALL FUNCTION 'END_FORM'

  • IMPORTING

  • RESULT =

  • EXCEPTIONS

  • UNOPENED = 1

  • BAD_PAGEFORMAT_FOR_PRINT = 2

  • SPOOL_ERROR = 3

  • CODEPAGE = 4

  • OTHERS = 5

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDAT.

ENDLOOP.

CALL FUNCTION 'CLOSE_FORM'

  • IMPORTING

  • RESULT =

  • RDI_RESULT =

  • TABLES

  • OTFDATA =

  • EXCEPTIONS

  • UNOPENED = 1

  • BAD_PAGEFORMAT_FOR_PRINT = 2

  • SEND_ERROR = 3

  • SPOOL_ERROR = 4

  • CODEPAGE = 5

  • OTHERS = 6

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.