Skip to Content
author's profile photo Former Member
Former Member

GUI_DOWNLOAD problem

Dear all

The following codes generates PDF file when executed but the GUI_DOWNLOAD doesnt prompt to change the filepath to save the file, directly saves to the hardcoded filename path ,i want the system to give a prompt where user can change the file path to save the file.

Plz help.

Thnx

Moni

&----


*Printing of Export Invoice, Packing List,Enclosure to Packing List & *

*Case Marking in one SMART FORMS Layout *

----


REPORT ZSD_REP_MULTI_PRINT.

TABLES :

VBAK,

VBAP,

VBFA,

LIKP,

LIPS,

KONV,

t005t,

KNA1,

t001w,

T001,

ADRC,

ZPP_PLCMH, "PACKING LIST HISTORY : HEADER DATA(CONF)

ZPP_PLCMI, "PACKING LIST HISTORY : ITEM DATA(CONF)

ZPLH, "PACKING LIST HISTORY : HEADER DATA(NON-CONF)

ZPLI, "PACKING LIST HISTORY : ITEM DATA(NON-CONF)

SSCRFIELDS,

TBTCP,

TSP01,

TBTCJOB,

RALDB.

DATA: FM_NAME1 TYPE RS38L_FNAM,

FM_NAME2 TYPE RS38L_FNAM,

FM_NAME3 TYPE RS38L_FNAM,

E_DEVTYPE TYPE RSPOPTYPE,

T_JOB_OUTPUT_INFO TYPE SSFCRESCL OCCURS 200 WITH HEADER LINE,

T_OTF LIKE ITCOO OCCURS 200 WITH HEADER LINE,

T_OTF2 LIKE ITCOO OCCURS 200 WITH HEADER LINE,

T_OUTPUT_OPTIONS TYPE SSFCOMPOP OCCURS 0 WITH HEADER LINE,

T_CONTROL_PARAMETERS TYPE SSFCTRLOP OCCURS 0 WITH HEADER LINE ,

T_DOC LIKE DOCS OCCURS 200 WITH HEADER LINE,

T_LINES LIKE TLINE OCCURS 200 WITH HEADER LINE,

BIN_FILESIZE TYPE I,

LANGUAGE TYPE SFLANGU,

BIN_FILE TYPE XSTRING,

OK_CODE LIKE SY-UCOMM.

DATA: T_ITEM TYPE ZSD_TABL_LITEM,

WA_ITEM TYPE ZSD_STRUCT_LITEM,

T_PROD TYPE ZSD_TABL_PROD,

WA_PROD TYPE ZSD_STRUCT_PROD,

T_ADRS LIKE ZSD_STRUCT_ADRS OCCURS 0 WITH HEADER LINE,

MSLINES LIKE TLINE OCCURS 1 WITH HEADER LINE,

TIDNO LIKE STXL-TDID,

TNAME LIKE STXL-TDNAME,

TOBJT LIKE STXL-TDOBJECT,

SSORD LIKE VBAK-VBELN,

DNO LIKE LIKP-VBELN,

CKEY LIKE KONV-WAERS,

TOT LIKE VBAK-NETWR,

WORD LIKE SPELL,

ITNO LIKE VBAP-POSNR,

TCOD LIKE SY-TCODE VALUE 'ZPNE',

SPOOL_ID LIKE TSP01-RQIDENT,

STEP LIKE tbtcp-STEPCOUNT,

T_SPOOL_FILE LIKE TLINE OCCURS 200 WITH HEADER LINE,

T_FINAL_PDF LIKE TLINE OCCURS 500 WITH HEADER LINE,

BTC TYPE I,

TEXT02(20),

FINAL_SIZE TYPE I,

ST LIKE TBTCJOB-STATUS.

TYPES: BEGIN OF TP_LIPS,

VBELN LIKE LIPS-VBELN,

POSNR LIKE LIPS-POSNR,

END OF TP_LIPS.

DATA: T_LIPS TYPE TP_LIPS OCCURS 0 WITH HEADER LINE.

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.

PARAMETERS: P_DELNO LIKE LIKP-VBELN OBLIGATORY,

P_INVNO LIKE VBRK-VBELN OBLIGATORY,

P_DATE LIKE SY-DATUM.

SELECTION-SCREEN END OF BLOCK blk1.

AT SELECTION-SCREEN.

CLEAR T_ADRS.

REFRESH T_ITEM.

T_ADRS-INVNO = P_INVNO.

T_ADRS-INVDAT = P_DATE.

SELECT SINGLE VBELV INTO VBFA-VBELV

FROM VBFA

WHERE VBELN = P_DELNO

AND VBTYP_N = 'J' .

SSORD = VBFA-VBELV.

*Exporter's Address

SELECT SINGLE BUKRS_VF INTO VBAK-BUKRS_VF

FROM VBAK

WHERE VBELN = VBFA-VBELV.

SELECT SINGLE ADRNR

INTO T001-ADRNR

FROM T001

WHERE BUKRS = VBAK-BUKRS_VF.

SELECT SINGLE NAME1 STREET CITY1 POST_CODE1 COUNTRY

INTO (T_ADRS-NAME1,T_ADRS-STREET,T_ADRS-CITY1,

T_ADRS-POST_CODE1, ADRC-COUNTRY)

FROM ADRC

WHERE ADDRNUMBER EQ T001-ADRNR.

SELECT SINGLE LANDX

INTO T_ADRS-COUNTRY

FROM T005T

WHERE SPRAS = 'EN'

AND LAND1 = ADRC-COUNTRY.

*Consignee Address & Buyer Other Than Consignee

SELECT SINGLE KUNNR KUNAG INTO (LIKP-KUNNR, LIKP-KUNAG)

FROM LIKP WHERE VBELN = P_DELNO.

IF LIKP-KUNNR = LIKP-KUNAG.

SELECT SINGLE NAME1 NAME2 STRAS ORT01 PSTLZ REGIO TELF1 ADRNR

INTO (T_ADRS-CNAME1, T_ADRS-CNAME2, T_ADRS-CSTREET,

T_ADRS-CCITY, T_ADRS-CPCODE, T_ADRS-CREGIO,

T_ADRS-CTELF1, KNA1-ADRNR)

FROM KNA1

WHERE KUNNR = LIKP-KUNNR.

SELECT SINGLE COUNTRY INTO ADRC-COUNTRY

FROM ADRC

WHERE ADDRNUMBER EQ KNA1-ADRNR.

SELECT SINGLE LANDX

INTO T_ADRS-CCOUNTRY

FROM T005T

WHERE SPRAS = 'EN'

AND LAND1 = ADRC-COUNTRY.

T_ADRS-ONAME1 = T_ADRS-CNAME1 .

T_ADRS-ONAME2 = T_ADRS-CNAME2 .

T_ADRS-OSTREET = T_ADRS-CSTREET .

T_ADRS-OCITY = T_ADRS-CCITY.

T_ADRS-OPCODE = T_ADRS-CPCODE .

T_ADRS-OREGIO = T_ADRS-CREGIO.

T_ADRS-OTELF1 = T_ADRS-CTELF1 .

T_ADRS-OCOUNTRY = T_ADRS-CCOUNTRY.

ELSE.

SELECT SINGLE NAME1 NAME2 STRAS ORT01 PSTLZ REGIO TELF1 ADRNR

INTO (T_ADRS-CNAME1, T_ADRS-CNAME2, T_ADRS-CSTREET,

T_ADRS-CCITY, T_ADRS-CPCODE, T_ADRS-CREGIO,

T_ADRS-CTELF1, KNA1-ADRNR)

FROM KNA1

WHERE KUNNR = LIKP-KUNNR.

SELECT SINGLE COUNTRY INTO ADRC-COUNTRY

FROM ADRC

WHERE ADDRNUMBER EQ KNA1-ADRNR.

SELECT SINGLE LANDX

INTO T_ADRS-CCOUNTRY

FROM T005T

WHERE SPRAS = 'EN'

AND LAND1 = ADRC-COUNTRY.

*Buyer Other than Consignee

SELECT SINGLE NAME1 NAME2 STRAS ORT01 PSTLZ REGIO TELF1 ADRNR

INTO (T_ADRS-ONAME1, T_ADRS-ONAME2, T_ADRS-OSTREET,

T_ADRS-OCITY, T_ADRS-OPCODE, T_ADRS-OREGIO,

T_ADRS-OTELF1, KNA1-ADRNR)

FROM KNA1

WHERE KUNNR = LIKP-KUNAG.

SELECT SINGLE COUNTRY INTO ADRC-COUNTRY

FROM ADRC

WHERE ADDRNUMBER EQ KNA1-ADRNR.

SELECT SINGLE LANDX

INTO T_ADRS-OCOUNTRY

FROM T005T

WHERE SPRAS = 'EN'

AND LAND1 = ADRC-COUNTRY.

ENDIF.

*Other's Ref

TIDNO = 'Z071'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-OREF = mslines-tdline(50).

EXIT.

ENDLOOP.

*Buyer's Order No Ref

TIDNO = 'Z023'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-BUYER = mslines-tdline(50).

EXIT.

ENDLOOP.

*Exporter Ref

TIDNO = 'Z072'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-XPREF = mslines-tdline(50).

EXIT.

ENDLOOP.

*Pre-Carraige By

TIDNO = 'Z074'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-PCRG = mslines-tdline(50).

EXIT.

ENDLOOP.

*Place Of reciept by Pre-Carraige

TIDNO = 'Z073'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-PLPCRG = mslines-tdline(50).

EXIT.

ENDLOOP.

*Vessel/Flight No

TIDNO = 'Z075'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-VFNO = mslines-tdline(50).

EXIT.

ENDLOOP.

*Port Of Loading

TIDNO = 'Z077'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-PLOAD = mslines-tdline(50).

EXIT.

ENDLOOP.

*Port Of Discharge

TIDNO = 'Z076'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-PDISG = mslines-tdline(50).

EXIT.

ENDLOOP.

*Final Destination

TIDNO = 'Z070'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-FDEST = mslines-tdline(50).

EXIT.

ENDLOOP.

*Terms Of Delivery & Payment

TIDNO = 'Z080'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-TERMS = mslines-tdline(50).

EXIT.

ENDLOOP.

  • APPEND T_ADRS.

*BODY SECTION FOR LINE ITEMS

DNO = P_DELNO.

SELECT POSNR LFIMG VRKME

INTO (LIPS-POSNR, LIPS-LFIMG, LIPS-VRKME)

FROM LIPS

WHERE VBELN = DNO.

*Mark/Case No

TIDNO = '0002'.

CONCATENATE SSORD

LIPS-POSNR

INTO TNAME.

TOBJT = 'VBBP'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

WA_ITEM-MARKNO = mslines-tdline(40).

EXIT.

ENDLOOP.

*Packing Type

TIDNO = '0003'.

CONCATENATE SSORD

LIPS-POSNR

INTO TNAME.

TOBJT = 'VBBP'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

WA_ITEM-PACKTYP = mslines-tdline(40).

EXIT.

ENDLOOP.

*Goods Description

TIDNO = '0001'.

CONCATENATE SSORD

LIPS-POSNR

INTO TNAME.

TOBJT = 'VBBP'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

WA_ITEM-GDESC = mslines-tdline(40).

EXIT.

ENDLOOP.

WA_PROD-GDESC = WA_ITEM-GDESC .

APPEND WA_PROD TO T_PROD.

*Goods Quantity

WA_ITEM-QTY = LIPS-LFIMG.

WA_ITEM-VRKME = LIPS-VRKME.

*Goods Rate

SELECT SINGLE KNUMV INTO VBAK-KNUMV FROM VBAK

WHERE VBELN = SSORD AND VBTYP = 'C'.

SELECT SINGLE KBETR WAERS

INTO (WA_ITEM-RATE, WA_ITEM-WAERS)

FROM KONV

WHERE KNUMV = VBAK-KNUMV

AND KPOSN = LIPS-POSNR

AND KSCHL = 'PR00'.

*Item Remarks

TIDNO = 'ZREM'.

CONCATENATE SSORD

LIPS-POSNR

INTO TNAME.

TOBJT = 'VBBP'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

WA_ITEM-REMARK = mslines-tdline(40).

EXIT.

ENDLOOP.

*Goods Amount

WA_ITEM-AMOUNT = WA_ITEM-QTY * WA_ITEM-RATE.

  • WA_ITEM-WAERK = VBAP-WAERK.

TOT = TOT + WA_ITEM-AMOUNT.

CKEY = WA_ITEM-WAERS.

ITNO = LIPS-POSNR.

APPEND WA_ITEM TO T_ITEM.

ENDSELECT.

T_ADRS-TOT = TOT.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = TOT

CURRENCY = CKEY

  • FILLER = ' '

LANGUAGE = SY-LANGU

IMPORTING

IN_WORDS = WORD

EXCEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

*Gross Wieght

TIDNO = 'Z078'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-GWT = mslines-tdline(40).

EXIT.

ENDLOOP.

*Net Wieght

TIDNO = 'Z079'.

TNAME = SSORD.

TOBJT = 'VBBK'.

PERFORM FINDTEXT.

LOOP AT MSLINES.

T_ADRS-NWT = mslines-tdline(40).

EXIT.

ENDLOOP.

T_ADRS-TOT_WORDS = WORD-WORD.

APPEND T_ADRS.

START-OF-SELECTION.

LANGUAGE = 'EN'.

CALL FUNCTION 'SSF_GET_DEVICE_TYPE'

EXPORTING

I_LANGUAGE = LANGUAGE

I_APPLICATION = 'SAPDEFAULT'

IMPORTING

E_DEVTYPE = E_DEVTYPE.

T_OUTPUT_OPTIONS-XSFCMODE = 'X'.

T_OUTPUT_OPTIONS-XSF = SPACE.

T_OUTPUT_OPTIONS-XDFCMODE = 'X'.

T_OUTPUT_OPTIONS-XDF = SPACE.

T_OUTPUT_OPTIONS-TDPRINTER = E_DEVTYPE.

T_OUTPUT_OPTIONS-TDDEST = 'LOHP'.

APPEND T_OUTPUT_OPTIONS.

T_CONTROL_PARAMETERS-NO_DIALOG = 'X'.

T_CONTROL_PARAMETERS-GETOTF = 'X'.

T_CONTROL_PARAMETERS-NO_CLOSE = SPACE.

APPEND T_CONTROL_PARAMETERS.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZSD_REP_MULTI_PRINT1'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FM_NAME1

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3

.

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 FM_NAME1

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = T_CONTROL_PARAMETERS

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

OUTPUT_OPTIONS = T_OUTPUT_OPTIONS

USER_SETTINGS = 'X'

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

JOB_OUTPUT_INFO = T_JOB_OUTPUT_INFO

  • JOB_OUTPUT_OPTIONS =

TABLES

T_ADRS = T_ADRS

T_ITEM = T_ITEM

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 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.

LOOP AT T_JOB_OUTPUT_INFO-OTFDATA INTO T_OTF.

APPEND T_OTF.

ENDLOOP.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZSD_REP_MULTI_PRINT2'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FM_NAME2

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3

.

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 FM_NAME2

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = T_CONTROL_PARAMETERS

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

OUTPUT_OPTIONS = T_OUTPUT_OPTIONS

USER_SETTINGS = 'X'

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

JOB_OUTPUT_INFO = T_JOB_OUTPUT_INFO

  • JOB_OUTPUT_OPTIONS =

TABLES

T_ADRS = T_ADRS

T_ITEM = T_ITEM

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 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.

LOOP AT T_JOB_OUTPUT_INFO-OTFDATA INTO T_OTF.

APPEND T_OTF.

ENDLOOP.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZSD_REP_MULTI_PRINT4'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FM_NAME3

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3

.

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 FM_NAME3

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = T_CONTROL_PARAMETERS

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

OUTPUT_OPTIONS = T_OUTPUT_OPTIONS

USER_SETTINGS = 'X'

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

JOB_OUTPUT_INFO = T_JOB_OUTPUT_INFO

  • JOB_OUTPUT_OPTIONS =

TABLES

T_PROD = T_PROD

T_ADRS = T_ADRS

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 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.

LOOP AT T_JOB_OUTPUT_INFO-OTFDATA INTO T_OTF.

APPEND T_OTF.

ENDLOOP.

*ENCLOSER TO PACKING LIST

SELECT VBELN POSNR INTO CORRESPONDING FIELDS OF TABLE T_LIPS

FROM LIPS

WHERE VBELN = DNO.

*For capturing the o/p pages from ZPL3 and consolidating into table

*T_OTF to get single PDF

LOOP AT T_LIPS INTO T_LIPS.

ITNO = T_LIPS-POSNR.

SELECT SINGLE * FROM ZPP_PLCMH WHERE VBELN = SSORD

AND POSNR = ITNO.

IF SY-SUBRC EQ 0.

SET PARAMETER ID: 'AUN' FIELD SSORD ,

'APO' FIELD ITNO.

CALL TRANSACTION 'ZPCE' AND SKIP FIRST SCREEN.

IMPORT A = T_OTF2 FROM MEMORY ID 'MEMID'.

LOOP AT T_OTF2 INTO T_OTF2.

APPEND T_OTF2 TO T_OTF.

ENDLOOP.

REFRESH T_OTF2.

ELSE.

*For capturing the o/p pages from ZA3C and Appending

*at the end of the PDF file just created by the above code

SELECT SINGLE * FROM ZPLH WHERE VBELN = SSORD

AND POSNR = ITNO.

IF SY-SUBRC EQ 0.

DATA : v_jobcount LIKE tbtcjob-jobcount,

JNAME LIKE TBTCJOB-JOBNAME.

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = 'JNAME'

IMPORTING

jobcount = v_jobcount

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

EXIT.

ENDIF.

*-- submit the program in the background

SUBMIT ZPP_REP_ENCLOSURE_PACKLIST3

WITH JOBNO = SSORD

WITH LINENO = ITNO

USER sy-uname

TO SAP-SPOOL WITHOUT SPOOL DYNPRO

DESTINATION 'LOHP'

IMMEDIATELY 'X'

KEEP IN SPOOL 'X'

VIA JOB 'JNAME' NUMBER v_jobcount AND RETURN.

IF SY-SUBRC NE 0.

MESSAGE I023(ZQOTBANK) WITH 'Job Not scheduled successfully'.

ENDIF.

*-- close the job

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = v_jobcount

jobname = 'JNAME'

strtimmed = 'X'

EXCEPTIONS

cant_start_immediate = 1

invalid_startdate = 2

jobname_missing = 3

job_close_failed = 4

job_nosteps = 5

job_notex = 6

lock_failed = 7

OTHERS = 8.

IF sy-subrc <> 0.

  • MESSAGE ID sy-msgid TYPE 'W' NUMBER sy-msgno

  • WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CALL FUNCTION 'GET_JOB_RUNTIME_INFO'

IMPORTING

  • EVENTID =

  • EVENTPARM =

  • EXTERNAL_PROGRAM_ACTIVE =

  • JOBCOUNT =

  • JOBNAME =

STEPCOUNT = STEP

  • EXCEPTIONS

  • NO_RUNTIME_INFO = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

DO.

CALL FUNCTION 'BP_JOB_STATUS_GET'

EXPORTING

JOBCOUNT = V_JOBCOUNT

JOBNAME = 'JNAME'

IMPORTING

STATUS = ST.

IF ST = 'F'.

*----- job has finished

EXIT.

ENDIF.

ENDDO.

clear tbtcp.

  • STEP = 1.

select single listident from tbtcp

into tbtcp-listident

where jobname = 'JNAME'

and jobcount = v_jobcount

and stepcount = step.

IF SY-SUBRC EQ 0.

move tbtcp-listident to spool_id.

ENDIF.

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

EXPORTING

SRC_SPOOLID = SPOOL_ID

NO_DIALOG = 'X'

  • DST_DEVICE = 'LOHP' "E_DEVTYPE

  • PDF_DESTINATION = 'LOHP'

IMPORTING

PDF_BYTECOUNT = BTC

  • PDF_SPOOLID =

  • LIST_PAGECOUNT =

  • BTC_JOBNAME =

  • BTC_JOBCOUNT =

TABLES

PDF = T_SPOOL_FILE

EXCEPTIONS

ERR_NO_ABAP_SPOOLJOB = 1

ERR_NO_SPOOLJOB = 2

ERR_NO_PERMISSION = 3

ERR_CONV_NOT_POSSIBLE = 4

ERR_BAD_DESTDEVICE = 5

USER_CANCELLED = 6

ERR_SPOOLERROR = 7

ERR_TEMSEERROR = 8

ERR_BTCJOB_OPEN_FAILED = 9

ERR_BTCJOB_SUBMIT_FAILED = 10

ERR_BTCJOB_CLOSE_FAILED = 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 T_SPOOL_FILE INTO T_SPOOL_FILE.

APPEND T_SPOOL_FILE TO T_FINAL_PDF.

ENDLOOP.

REFRESH T_SPOOL_FILE.

ELSE.

CONCATENATE 'Enclosure Not Exist! for ItemNo' ITNO

INTO TEXT02 SEPARATED BY SPACE.

MESSAGE I021(ZQOTBANK) WITH TEXT02.

ENDIF.

ENDIF.

ENDLOOP.

CALL FUNCTION 'CONVERT_OTF_2_PDF'

EXPORTING

USE_OTF_MC_CMD = 'X'

  • ARCHIVE_INDEX =

IMPORTING

BIN_FILESIZE = BIN_FILESIZE

TABLES

OTF = T_OTF

DOCTAB_ARCHIVE = T_DOC

LINES = T_LINES

EXCEPTIONS

ERR_CONV_NOT_POSSIBLE = 1

ERR_OTF_MC_NOENDMARKER = 2

OTHERS = 3.

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 T_LINES INTO T_LINES.

APPEND T_LINES TO T_FINAL_PDF.

ENDLOOP.

FINAL_SIZE = BTC + BIN_FILESIZE.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

BIN_FILESIZE = FINAL_SIZE

FILENAME = 'C:\MULTI_PRINT.pdf'

FILETYPE = 'BIN'

APPEND = 'X'

  • WRITE_FIELD_SEPARATOR = ' '

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

IMPORTING

FILELENGTH = FINAL_SIZE

TABLES

DATA_TAB = T_FINAL_PDF

  • FIELDNAMES =

  • EXCEPTIONS

  • FILE_WRITE_ERROR = 1

  • NO_BATCH = 2

  • GUI_REFUSE_FILETRANSFER = 3

  • INVALID_TYPE = 4

  • NO_AUTHORITY = 5

  • UNKNOWN_ERROR = 6

  • HEADER_NOT_ALLOWED = 7

  • SEPARATOR_NOT_ALLOWED = 8

  • FILESIZE_NOT_ALLOWED = 9

  • HEADER_TOO_LONG = 10

  • DP_ERROR_CREATE = 11

  • DP_ERROR_SEND = 12

  • DP_ERROR_WRITE = 13

  • UNKNOWN_DP_ERROR = 14

  • ACCESS_DENIED = 15

  • DP_OUT_OF_MEMORY = 16

  • DISK_FULL = 17

  • DP_TIMEOUT = 18

  • FILE_NOT_FOUND = 19

  • DATAPROVIDER_EXCEPTION = 20

  • CONTROL_FLUSH_ERROR = 21

  • OTHERS = 22

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

&----


*& Form FINDTEXT

&----


  • text

----


FORM FINDTEXT.

REFRESH mslines.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = tidno

language = sy-langu

name = tname

object = tobjt

TABLES

lines = mslines

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

DELETE mslines WHERE tdline IS INITIAL.

ENDFORM. "FINDTEXT

Message was edited by: md monirujjaman

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Feb 28, 2005 at 04:33 AM

    Before calling GUI_DOWNLOAD function call the following method

    CALL METHOD cl_gui_frontend_services=>file_save_dialog
    *  EXPORTING
    *    WINDOW_TITLE         =
    *    DEFAULT_EXTENSION    =
    *    DEFAULT_FILE_NAME    =
    *    WITH_ENCODING        =
    *    FILE_FILTER          =
    *    INITIAL_DIRECTORY    =
    *    PROMPT_ON_OVERWRITE  = 'X'
        CHANGING
          filename             = filename
          path                 = path
          fullpath             = fpath
    *    USER_ACTION          =
    *    FILE_ENCODING        =
    *  EXCEPTIONS
    *    CNTL_ERROR           = 1
    *    ERROR_NO_GUI         = 2
    *    NOT_SUPPORTED_BY_GUI = 3
    *    others               = 4 .

    REgards

    Raja

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.