Application Development 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: 

Abap

Former Member
0 Kudos

1.what is the diff between variable window and Constant window?

2.what is the diff betwrrn protect and endprotect?

3.what is the diff between classical and interactive reports?

4.what is the diff between basic list and secondary list?

5How to send smartform through email?

7 REPLIES 7

Former Member
0 Kudos

Variable and Constant Window:

The system internally processes windows of type CONST similar to windows of type VAR. Therefore, if you create a new window, always use type VAR.

The contents of variable windows is processed again for each page, on which the window appears. The system outputs only as much text as fits into the window. Text exceeding the window size is truncated; the system does not trigger a page break. Unlike constant windows, the page windows declared as variable windows may have different sizes on different form pages.

As far as the processing of the window contents is concerned, the system currently treats constant and variable windows alike. The only difference is that constant windows have the same size throughout the form.

Protect and End-Protect:

If this page protect attribute is set, then the complete paragraph is always printed on one page

/: PROTECT

:

:

/: ENDPROTECT

The text lines to be protected are enclosed between the two commands.

An ENDPROTECT command without a preceding PROTECT command has no effect.

If the terminating ENDPROTECT is missing, SAPscript assumes it at the end of the text.

PROTECT.. ENDPROTECT command pairs cannot be nested. If a second PROTECT command occurs before the first one has been terminated by an ENDPROTECT, it is ignored.

If the text enclosed by a PROTECT.. ENDPROTECT pair is itself too long for a single page, then a page break is generated immediately before the text and the text is printed in the normal way. It is then unavoidable that a page break will occur at some point within the text.

Basiclist and Secondary list:

Normal list is known as Basic list. When we bouble click are press eny function key system will generate new list which is known as secondary list. This done by using AT-LINE-SELECTION and AT PF <nn>.

p291102
Active Contributor
0 Kudos

Hi,

Hope below links are helpful to u always in abap.

go through the links

Start with this.Refer this

http://www.sapbrain.com/FAQs/TECHNICAL/SAP_ABAP_DATADICTIONARY_FAQ.html

http://www.saptechnical.com/InterviewQ/interviewQ.htm

http://help.sap.com/saphelp_46c/helpdata/en/35/2cd77bd7705394e10000009b387c12/frameset.htm

Reports

http://www.sapgenie.com/abap/reports.htm

http://www.allsaplinks.com/material.html

http://www.sapdevelopment.co.uk/reporting/reportinghome.htm

http://www.sapfans.com/forums/viewtopic.php?t=58286

http://www.sapfans.com/forums/viewtopic.php?t=76490

http://www.sapfans.com/forums/viewtopic.php?t=20591

http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.

ALE/ IDOC

http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm

http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc

http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419

http://www.netweaverguru.com/EDI/HTML/IDocBook.htm

http://www.sapgenie.com/sapedi/index.htm

http://www.sappoint.com/abap/ale.pdf

http://www.sappoint.com/abap/ale2.pdf

http://www.sapgenie.com/sapedi/idoc_abap.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/0b/2a60bb507d11d18ee90000e8366fc2/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/78/217da751ce11d189570000e829fbbd/frameset.htm

http://www.allsaplinks.com/idoc_sample.html

http://www.sappoint.com/abap.html

http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm

http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc

http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419

http://www.netweaverguru.com/EDI/HTML/IDocBook.htm

http://www.sapgenie.com/sapedi/index.htm

http://www.allsaplinks.com/idoc_sample.html

Check these step-by-step links

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/ccab6730-0501...

https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-001...

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/3c5d9ae3-0501...

for Smartforms material

http://www.sap-basis-abap.com/sapsf001.htm

http://www.sap-press.com/downloads/h955_preview.pdf

http://www.ossincorp.com/Black_Box/Black_Box_2.htm

http://www.sap-img.com/smartforms/sap-smart-forms.htm

http://www.sap-img.com/smartforms/smartform-tutorial.htm

http://www.sapgenie.com/abap/smartforms.htm

How to trace smartform

http://help.sap.com/saphelp_47x200/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm

http://www.help.sap.com/bp_presmartformsv1500/DOCU/OVIEW_EN.PDF

http://www.sap-img.com/smartforms/smart-006.htm

http://www.sap-img.com/smartforms/smartforms-faq-part-two.htm

check most imp link

http://www.sapbrain.com/ARTICLES/TECHNICAL/SMARTFORMS/smartforms.html

step by step good ex link is....

http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.h...

SAPScripts

http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf

http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf

http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf

http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf

http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf

http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-sub...

SAP SCRIPT FIELDS

http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/8033ea454211d189710000e8322d00/content.htm

scripts easy material

http://www.allsaplinks.com/sap_script_made_easy.html

Debugging Document.

http://www.cba.nau.edu/haney-j/CIS497/Assignments/Debugging.doc

http://help.sap.com/saphelp_47x200/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm

http://www.cba.nau.edu/haney-j/CIS497/Assignments/Debugging.doc

http://help.sap.com/saphelp_erp2005/helpdata/en/b3/d322540c3beb4ba53795784eebb680/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/84/1f624f4505144199e3d570cf7a9225/frameset.htm

http://help.sap.com/saphelp_bw30b/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/b3/d322540c3beb4ba53795784eebb680/frameset.htm

BAPI

http://help.sap.com/saphelp_46c/helpdata/en/9b/417f07ee2211d1ad14080009b0fb56/frameset.htm

http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html

Checkout !!

http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html

http://techrepublic.com.com/5100-6329-1051160.html#

http://www.sap-img.com/bapi.htm

http://www.sap-img.com/abap/bapi-conventions.htm

http://www.sappoint.com/abap/bapiintro.pdf

http://www.sapgenie.com/abap/bapi/example.htm

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf

List of all BAPIs

http://www.planetsap.com/LIST_ALL_BAPIs.htm

http://www.sappoint.com/abap/bapiintro.pdf

http://www.sappoint.com/abap/bapiprg.pdf

http://www.sappoint.com/abap/bapiactx.pdf

http://www.sappoint.com/abap/bapilst.pdf

http://www.sappoint.com/abap/bapiexer.pdf

http://service.sap.com/ale

http://service.sap.com/bapi

http://www.geocities.com/mpioud/Abap_programs.html

http://www.sapdevelopment.co.uk/reporting/reportinghome.htm

Simple ALV report

http://www.sapgenie.com/abap/controls/alvgrid.htm

http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox

ALV

1. Please give me general info on ALV.

http://www.sapfans.com/forums/viewtopic.php?t=58286

http://www.sapfans.com/forums/viewtopic.php?t=76490

http://www.sapfans.com/forums/viewtopic.php?t=20591

http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.

2. How do I program double click in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=11601

http://www.sapfans.com/forums/viewtopic.php?t=23010

3. How do I add subtotals (I have problem to add them)...

http://www.sapfans.com/forums/viewtopic.php?t=20386

http://www.sapfans.com/forums/viewtopic.php?t=85191

http://www.sapfans.com/forums/viewtopic.php?t=88401

http://www.sapfans.com/forums/viewtopic.php?t=17335

4. How to add list heading like top-of-page in ABAP lists?

http://www.sapfans.com/forums/viewtopic.php?t=58775

http://www.sapfans.com/forums/viewtopic.php?t=60550

http://www.sapfans.com/forums/viewtopic.php?t=16629

5. How to print page number / total number of pages X/XX in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)

6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.

http://www.sapfans.com/forums/viewtopic.php?t=64320

http://www.sapfans.com/forums/viewtopic.php?t=44477

7. How can I set the cell color in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=52107

8. How do I print a logo/graphics in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=81149

http://www.sapfans.com/forums/viewtopic.php?t=35498

http://www.sapfans.com/forums/viewtopic.php?t=5013

9. How do I create and use input-enabled fields in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=84933

http://www.sapfans.com/forums/viewtopic.php?t=69878

10. How can I use ALV for reports that are going to be run in background?

http://www.sapfans.com/forums/viewtopic.php?t=83243

http://www.sapfans.com/forums/viewtopic.php?t=19224

11. How can I display an icon in ALV? (Common requirement is traffic light icon).

http://www.sapfans.com/forums/viewtopic.php?t=79424

http://www.sapfans.com/forums/viewtopic.php?t=24512

12. How can I display a checkbox in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=88376

http://www.sapfans.com/forums/viewtopic.php?t=40968

http://www.sapfans.com/forums/viewtopic.php?t=6919

Go thru these programs they may help u to try on some hands on

ALV Demo program

BCALV_DEMO_HTML

BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode

BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode

BCALV_GRID_DEMO Simple ALV Control Call Demo Program

BCALV_TREE_DEMO Demo for ALV tree control

BCALV_TREE_SIMPLE_DEMO

BC_ALV_DEMO_HTML_D0100

Remote Function Call:

RFC is an SAP interface protocol. Based on CPI-C, it considerably simplifies the programming of communication processes between systems.

RFCs enable you to call and execute predefined functions in a remote system - or even in the same system.

RFCs manage the communication process, parameter transfer and error handling.

http://help.sap.com/saphelp_47x200/helpdata/en/22/042860488911d189490000e829fbbd/frameset.htm.

ALE/ IDOC

http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm

http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc

http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419

http://www.netweaverguru.com/EDI/HTML/IDocBook.htm

http://www.sapgenie.com/sapedi/index.htm

http://www.sappoint.com/abap/ale.pdf

http://www.sappoint.com/abap/ale2.pdf

http://www.sapgenie.com/sapedi/idoc_abap.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/0b/2a60bb507d11d18ee90000e8366fc2/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/78/217da751ce11d189570000e829fbbd/frameset.htm

http://www.allsaplinks.com/idoc_sample.html

http://www.sappoint.com/abap.html

http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm

http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc

http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419

http://www.netweaverguru.com/EDI/HTML/IDocBook.htm

http://www.sapgenie.com/sapedi/index.htm

http://www.allsaplinks.com/idoc_sample.html

Refer this

http://www.sapbrain.com/FAQs/TECHNICAL/SAP_ABAP_DATADICTIONARY_FAQ.html

http://www.saptechnical.com/InterviewQ/interviewQ.htm

http://help.sap.com/saphelp_46c/helpdata/en/35/2cd77bd7705394e10000009b387c12/frameset.htm

http://www.techinterviews.com/?p=198

http://www.techinterviews.com/?p=326

http://www.sap-img.com/abap/answers-to-some-abap-interview-questions.htm

http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm

http://www.geekinterview.com/Interview-Questions/SAP-R-3/ABAP

http://sap.ittoolbox.com/documents/popular-q-and-a/abap-sample-interview-questions-3240

http://www.sap-img.com/abap/abap-interview-question.htm

http://www.allinterview.com/Interview-Questions/ABAP.html

Thanks,

Sankar M

Former Member
0 Kudos

1.what is the diff between variable window and Constant window?

In scripts, we r having both variable and constant windows...

Mostly we will use variable windows only...

COming to difference.. Variable windlow -- The content of the window may vary based on conditions...

constant window: The content is always constant....

2.what is the diff betwrrn protect and endprotect?

If we write any statements Between PROTECT and ENDPROTECT... all the data will be treated as a single block... Means it will come in a single page (if the page height is enough)...

we will use this in scripts mostly for the case of displaying item details...

Eg:

Item No,...data

Item Text

Item No,...data

Item Text

If we use PROTECT and ENDPROTECT then in the above output the 2 lines

Item No,...data

Item Text

will come together always. Otherwise they may come in two pages like 1 line in one page and 2nd line in another page... which will not look nice.

3.what is the diff between classical and interactive reports?

Classical reports are used to diplay data

Interactive report are used to diplay data as well as they provide events (based on tht the output will vary)

4.what is the diff between basic list and secondary list?

Basic List is the starting list which will come first always

Secondary list is the list on which the output comes (Interactive report) based on any event performed on basic list.

Former Member
0 Kudos

Hi

Variable window is nothing but the text inside the window will chage for every page but the size remains constant, but the constant window the text remains same but size may vary for eg address bar we can assign constant window.

Protect and end protect is mainly used to avoid PAGE BREAK if u want to display some text in single page without page break we need to go for protect and end protect.

Clasical report in normal report, but interactive report is we can navigate or we can get details about particular through navigation. this is can be up to 20 secondary list.

In interactive report the main page is called basic list from the basic list only we can navigate to interactive list those interactive lists are called secondary list.

Former Member
0 Kudos

Hi Vijay,

For the first four questions you got the answers in the above posts.

But, for the fifth one,you haven't received any answer.

<b>Here the solution...... How to Mail SMARTFORMS ??</b>

You can also mail to SMART FORM, in the initial screen in the MENU bar, Utilities -


> Download.

After downloading you can see the file in .xml format.

Mail this file,at the destination the we can upload file.

c.Mailing SMARTFORM

http://www.esnips.com/doc/282a6a3a-58e2-4663-aac3-5a489109ab53/Mailing_Smartform

Hope your problem is solved.

<b>Reward,if helpful</b>.

Regards,

V.Raghavender.

Former Member
0 Kudos

1. Diff between variable window and Constant window :

<b>variable window:</b>

Window with variable contents. The text can vary on each page in which the window is positioned. Variable windows are formatted for each page.

variable window is generally used for header data where the data in it is constant.You can make diffenrent headers in in each variable window.

To every window you can assign text, which is printed in the corresponding window when the form is formatted. To assign text, use text elements, which are stored with the form.

To create and maintain text elements with the SAPscript Editor, choose Text elements. For more information, see Text Elements.

Should the text selected for the window exceed the window size, then the text is cut off.

<b>Constant window</b>

Window with constant contents that is formatted only once.

Where as Constant window is obsolete one.You are not supposed to use it.

2.Diff betwrrn protect and endprotect :

Protect and endprotect collectively form a single statement like do...enddo.

Wharever you write between wiil not be broken i.e;outputs in single paragraph/page.It makes to print alll your data at one place only(some text in one page and some in other page ,it(protect... andprotect) won't allows like this)

3.Diff between classical and interactive reports?

In general the abap output can be in list.You can also have some button on the list like details of airline for the selected airlines(This is called Use intarcition with the report).Upon clicking it you will get one more list (of details)(Ofcourse you have write code(event-handling) generating next list.Like this upto 21 lists can be generated in abap.

So if a user interacts with the report it is a interactive report otherwise it is Classical report.

4.what is the diff between basic list and secondary list?

The First list generated is the basic list.You can check by writing like:write sy- listi in your program .

Upon clicking a button on the basic list, you will get one more list (of details).

whisc is called Interactive or detailed list.

(Ofcourse you have write code(event-handling) generating next list.Like this upto 21 lists can be generated in abap.

I think these are helpful to you.

Reward points if helpful.

Regds,

Rama chary.Pammi

Former Member
0 Kudos

Hi Vijay,

As you have received answers for the 4 Questions and even for the fifth , try closing this thread.

I am sending you a program for the fifth qusetion.

REPORT zptpfrm202p_pogr_pr_instr MESSAGE-ID zmm.

----


  • TABLES *

----


  • Database table made for getting information about PRINTPREVIEW and

  • PRINT command more than one times

TABLES: zgr_table.

TYPE-POOLS:syscr.

----


  • GLOBAL TYPE DECLARATION *

----


DATA: zdoc_output_info TYPE ssfcrespd, "SF:Return Document Inf.

zjob_output_info TYPE ssfcrescl, "SF:Return value at end of

  • form printing

i_control TYPE ssfctrlop ,

i_output_options TYPE ssfcompop,

zjob_output_opts TYPE ssfcresop. "SF:Return value at start

  • of form printing

*This internal table is used for storing Document Segment: Material

DATA: BEGIN OF i_mseg.

INCLUDE STRUCTURE mseg.

DATA: END OF i_mseg.

  • This internal table is used for storing Header: Material Document

DATA: BEGIN OF i_mkpf.

INCLUDE STRUCTURE mkpf.

DATA: END OF i_mkpf.

*Variables

DATA flag(1) TYPE c.

DATA: vfile TYPE string.

----


  • SELECTION-SCREEN *

----


SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.

PARAMETERS:p_mblnr TYPE mkpf-mblnr OBLIGATORY MATCHCODE OBJECT zganesh,

p_mjahr TYPE mkpf-mjahr OBLIGATORY MATCHCODE OBJECT zganesh1,

p_zeile TYPE mseg-zeile OBLIGATORY MATCHCODE OBJECT zganesh2.

SELECTION-SCREEN END OF BLOCK b1.

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

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN POSITION 10.

PARAMETER:r_disp RADIOBUTTON GROUP g1 USER-COMMAND u1 DEFAULT 'X'.

SELECTION-SCREEN:COMMENT 15(10) text-002 .

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN POSITION 10.

PARAMETERS: r_down RADIOBUTTON GROUP g1.

SELECTION-SCREEN:COMMENT 15(10) text-003.

*PARAMETERS: v_file LIKE rlgrap-filename .

*SELECTION-SCREEN:COMMENT 70(50) text-005.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN POSITION 10.

PARAMETERS: r_print RADIOBUTTON GROUP g1 .

SELECTION-SCREEN:COMMENT 15(10) text-004.

SELECTION-SCREEN END OF LINE.

PARAMETERS: v_file LIKE rlgrap-filename MODIF ID g12.

SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR v_file.

DATA : wlv_field_name LIKE dynpread-fieldname,

wlv_file_name LIKE ibipparms-path.

wlv_field_name = v_file.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

field_name = wlv_field_name

IMPORTING

file_name = wlv_file_name.

IF sy-subrc EQ 0.

vfile = wlv_file_name.

v_file = wlv_file_name.

ENDIF.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF screen-name = 'V_FILE'.

IF r_disp EQ 'X' OR r_print EQ 'X'.

screen-input = 0.

ELSE.

screen-input = '1'.

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

----


  • START-OF-SELECTION EVENT *

----


START-OF-SELECTION.

----


  • CALLING CONVERSION FUNCTION MODULE 'CONVERSION_EXIT_ALPHA_INPUT' *

----


*Conversion function module for appending 00 befor MBLNR FIELD

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = p_mblnr

IMPORTING

output = p_mblnr.

  • Call subroutine for fetching data from database

PERFORM get_data.

----


  • END-OF-SELECTION EVENT *

----


END-OF-SELECTION.

  • Call subroutine for calling and processing smartform

PERFORM call_smartform.

&----


*& Form get_data

&----


  • Subroutine for fetching data from database

----


FORM get_data .

  • Fetching data from MKPF table with using parameters MBLNR and MJAHR

SELECT SINGLE * FROM mkpf

INTO i_mkpf

WHERE mblnr = p_mblnr

AND mjahr = p_mjahr.

IF sy-subrc EQ 0.

  • Fetching data from MSEG with using parameters MBLNR,ZEILE and MJAHR

SELECT SINGLE * FROM mseg

INTO i_mseg

WHERE mblnr = i_mkpf-mblnr

AND mjahr = i_mkpf-mjahr

AND zeile = p_zeile.

IF sy-subrc NE 0.

CLEAR i_mseg.

ENDIF.

ELSE.

MESSAGE i000.

EXIT.

ENDIF.

ENDFORM. " get_data

&----


*& Form call_smartform

&----


  • Subroutine for calling smartform

----


FORM call_smartform .

  • Local template used in the processing output of smartform

TYPES: BEGIN OF lt_ztable,

mandt TYPE sy-mandt,

mblnr TYPE mseg-mblnr,

flag(1) TYPE c,

END OF lt_ztable.

CONSTANTS: c_x(1) TYPE c VALUE 'X'.

  • Workarea

DATA: lw_ztable TYPE lt_ztable.

*Variable used in the smartform

DATA: lv_form(30) TYPE c,

lv_fm_name(30) TYPE c.

lv_form = 'ZPTPFRM202L_POGR'.

*Calling function module SSF_FUNCTION_MODULE_NAME which gives new name

*to the function module that will generated by smartform.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = lv_form

IMPORTING

fm_name = lv_fm_name

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.

*Calling function module that will be generated by smartform

IF r_disp = c_x.

i_output_options-tdimmed = space.

i_output_options-tdnewid = c_x.

i_output_options-tddest = 'LOCL'.

i_control-no_dialog = 'X'.

i_control-preview = 'X'.

ELSEIF r_print = c_x.

i_output_options-tdimmed = c_x.

i_output_options-tddest = 'LOCL'.

i_control-no_dialog = c_x.

ELSE.

i_output_options-tdimmed = space.

i_output_options-tdnewid = c_x.

i_output_options-tddest = 'LOCL'.

i_control-getotf = 'X'.

i_control-preview = space.

i_control-no_dialog = c_x.

flag = c_x.

ENDIF.

CALL FUNCTION lv_fm_name

EXPORTING

control_parameters = i_control

output_options = i_output_options

user_settings = space

zmkpf = i_mkpf

zmseg = i_mseg

IMPORTING

document_output_info = zdoc_output_info

job_output_info = zjob_output_info

job_output_options = zjob_output_opts

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.

  • Modify the database table if it found the print command

IF zjob_output_opts-tdpreview NE c_x.

lw_ztable-mandt = sy-mandt.

lw_ztable-mblnr = p_mblnr.

lw_ztable-flag = c_x.

MODIFY zgr_table FROM lw_ztable.

CLEAR lw_ztable.

ENDIF.

IF flag EQ c_x.

DATA: li_lines LIKE tline OCCURS 100 WITH HEADER LINE.

DATA: lv_file TYPE string,

lbin_fsiz TYPE i.

lv_file = v_file.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

IMPORTING

bin_filesize = lbin_fsiz

TABLES

otf = zjob_output_info-otfdata

lines = li_lines

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

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

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = lbin_fsiz

filename = lv_file

filetype = 'BIN'

TABLES

data_tab = li_lines

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.

ENDIF.

ENDFORM. " call_smartform

Hope this resolves your query.

Reward all the helpful answers.

Regards