SAP ABAP Syntax for FETCH

Basic form

FETCH NEXT CURSOR c target.

Effect

Uses the cursor c to read the next line or lines from the data set of a database table determined by OPEN CURSOR . The cursor must be a variable of the type CURSOR and must be explicitly opened with OPEN CURSOR . To specify the target area into which you read the selected data, use INTO clause target .

FETCH belongs to the Open SQL command set.

After each execution of the FETCH statement, the system field SY-DBCNT contains the number of lines read so far.

The return code value is set as follows:

SY-SUBRC = 0 At least one line was read.

SY_SUBRC = 4 No line was read.

Example

Output the passenger list for the Lufthansa flight 0400 on 28- 02.1995:

TABLES SBOOK.
DATA C TYPE CURSOR,
WA LIKE SBOOK.
OPEN CURSOR C FOR SELECT * FROM SBOOK
WHERE
CARRID = 'LH ' AND
CONNID = '0400' AND
FLDATE = '19950228'
ORDER BY PRIMARY KEY.
DO.
FETCH NEXT CURSOR C INTO WA.
IF SY-SUBRC <> 0.

CLOSE CURSOR C. EXIT.
ENDIF.
WRITE: / WA-BOOKID, WA-CUSTOMID, WACUSTTYPE,
WA-SMOKER, WA-LUGGWEIGHT, WA-WUNIT,
WA-INVOICE.
ENDDO.


RELATED POST


MySAP CRM business intelligence at work
CRM data administration in mysap and business intelligence

SAP ABAP Syntax for EXPORT part two

This article is in continuation with SAP ABAP SYNTAX CHECK FOR EXPORT PART ONE.

Variant 2

EXPORT obj1 ... objn TO DATABASE dbtab(ar) ID key.

Additions

1. ... FROM g (for each field to be exported)

2. ... CLIENT h (after dbtab(ar) )

3. ... USING form

Effect

Exports the objects obj1 ... objn (fields, structures or tables) as a data cluster to the database table dbtab . The database table dbtab must have a standardized structure .The database table dbtab is divided into different logically related areas ( ar , 2-character name).You can export collections of data objects (known as data clusters ) under a freely definable key (field key ) to an area of this database.IMPORT allows youto import individual data objects from this cluster.

Notes

The table dbtab specified after DATABASE must be declared under TABLES .The header lines of internal tables cannot be exported because specifying the name of an internal table with a header line always exports the actual table data.

Example

Export two fields and an internal table to the database table INDX :

TABLES INDX.

DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE',

F1(4), F2 TYPE P, BEGIN OF ITAB3 OCCURS 2, CONT(4), END OF ITAB3.

* Before the export, the data fields in
* front of CLUSTR are filled.
INDX-AEDAT = SY-DATUM.
INDX-USERA = SY-UNAME.
* Export der Daten.
EXPORT F1 F2 ITAB3 TO DATABASE INDX(ST) ID INDXKEY.

Addition 1

... FROM g (for each object to be exported)

Effect

Exports the contents of the field g and stores them under the specified name in the database.

Addition 2

... CLIENT h (after dbtab(ar) )

Effect

Stores the data objects in the client h (if the import/export database table dbtab is client-specific).

Addition 3

... USING form

Effect

Does not export the data to the database table. Instead, calls the FORM routine form for every record written to the database without this addition. This routine can take the data from the database table work area and therefore has no parameters.

Runtime errors

Errors in the structure of the EXPORT / IMPORT database can cause runtime errors .

Variant 3

EXPORT obj1 ... objn TO DATASET dsn(ar) ID key.

Runtime errors

EXPORT_DATASET_CANNOT_OPEN : Unable to describe file.
EXPORT_DATASET_WRITE_ERROR : File write error.


RELATED POST

SAP CRM Business Transactions
SAP CRM marketing Management Campaign

Real Time Interview Questions SAP ABAP part Four

51)how do u transport standard text.

A) by using a program RSTXTRANS.

52)function modules in scripts BY ORDER

OPEN_FORM
START_FORM
WRITE_FORM
END_FORM
CLOSE_FORM

53) steps in creation of basic idoc creation .

A)create segments WE31.

Create IDOC we30.

Assign segments to the idoc

Develop idoc interface program.

Configuration of idoc.

54) explain binary search linear search and hash algorithm.

55) what type of request r used to transport reprository objects.

A) workbench request.

Two types of change request

a) customizing request deals with customizing objects like changes made to spro.

b) workbench request .changes made to the reprository objects.

56) name the system field that is not always displayed in the debugger.

A) SY-LISEL.

57) what marks the beginning of new screen in the internal table of structure bdcdata.

A) DYNBEGIN

61)what are v2 updates.

A) an update request is divided into one primary (V1) and several secondary components (V2). Time critical operations are placed in V1 component and those whose timing is less critical are placede in V2 components.If a V1 update fails , V2 components will not be processed.

62)what is the tcode for termination updates.

A) SM13.

RELATED POST


SAP Solution Manager Overview
People Centric SAP CRM Introduction
CRM Technical Infrastructure

Real Time Interview Questions SAP ABAP part three

36) In call transaction there r totally 10 records. While processing it if system crashes after 5th record, is it possible to start again from 6th record.

A) NO, it is not possible to start from 6th record; again we have to restart the process from first record.

37)Is multiple page format is possible in SAP SCRIPTS.

A) Not possible in sap scripts.

38)what do u mean by tabs in paragraph formats.

A) These tabs r similar to the word processing tabs.Only exception is in tabs we can give the user defined gaps.

39)what is the difference between TABLE CONTROLS and STEPLOOPS.

A) Table controls is the enhanced version of step loops.

Table control is the look and feel of a table.

40)Give an example of GET CURSOR in interactive report.

A)it is used to call a report with in a report or to call a transaction from d.

41)what do u mean by selection text.

A)generally selection text will have 8 characters which doesn’t give any meaningful message to the end user .here we use selection text.

42)how do u dynamically inactive fields in selection screen.

A)using event AT SELECTION –SCREEN ON OUTPUT.

43)Which event is equivalent of PBO in reports.

A) AT SELECTION –SCREEN ON OUTPUT.

44)What is the purpose of START_FORM in scripts.

A)to print several identical forms containing different data with single SPOOL REQUEST. EX: portrait, landscape. When we have a requirement of printing layout sets with different page formats then in the print program call each one individually using START_FORM.

45)What do u mean by extended table maintenance.

A) extended table maintenance is a tool used to maintain (create,delete,insert) the data in the database tables through data dictionary only possible when table maintenance flag is set in attributes of table definition.

Steps:

1)if it is single table utilities -> extended table maintenance

2)for multiple tables create a maintenance view.

3)go with SE54(modal dialog box generator)

one step table maintenance dialog: only one maintenance screen is processed during extended table maintenance.the entries are displayed in list form.

Two step maintenance: two maintenance screens are processed . 1st one is overview screen , the entries are displayed in list form.

In 2nd screen one entry is displayed .

49)when u transport a object will the text elements are also transported.

A)most of the times they are not transported .so ,it is suggested to transport them individually.

50)how do u transport scripts across landscapes(between different servers).

A)by using a program RSTXSERP. By using this program we download the script into flat file on operating system level. Again we upload this using the same program into thereceiving system.

RELATED POST

CRM Sales Cycle Management
CRM Sales opportunity management
Sales process in Quotation and order management in CRM
CRM Interaction Center Agent Perform
CRM Technical Architecture

Real Time Interview Questions SAP ABAP part two

20) Diff B/W scripts and smart forms.

A) Upon activating smart forms a function module is generated.

(2) Multiple page formats r possible in smart form.

(3) web based

(4) less coding efforts.

(5) Labeling is not possible in Smart forms.

(6) Main window is not compulsory in smart forms ( it is only possible if the smart forms has single page).

21. In scripts there is a paragraph with 5 lines, now I reduced font size of this paragraph, now in the output the gap b/w the lines is more. My question is how to reduce this gap.

A) It is possible through line spacing option in paragraphs.

22) How to call a smart form.

A) By using a function module SF_FUNCTION_MODULE_NAME

23) Explain SD flow with Transaction Codes.

A) Enquire – VA11

RFQ - VA21

Sales order – VA01

Delivery – VL01N

INVOICE- VF21

BILLING – VF01

24) Diff B/W Hide and Get cursor.

HIDE is limited Interactive programming, GET CURSOR can be used anywhere in ABAP Programming .

25) where does IDOC posting occurs and why.

A) IDOC posting occurs in Application layer of Inbound side and results are passed to
ALE Service layer.

26) When top page triggers.

a) during the first write statement

27) Sequence of events.

INITILIZATION

AT SELECTION SCREEN ON OUTPUT

AT SELECTION SCREEN ON s/p

AT SELECTION SCREEN

START-OF-SELECTION

END-OF-SELECTION

28) How do u debug scripts.

A) SE71 main screen -> utilities -> activate debugger . or execute program RSTXDEBUG.

29) Whether layout sets are client independent.

A) NO, they r client dependent.

30) In Idoc creation prog What r the input parameters.

A) Control record, data record, etc.

31) If u don’t write close_form in scripts. What will happen.

A) No output appears on the print or screen. We wont get any syntax error.

32) What will happen if we don’t close BDC_Open with BDC_CLOSE.

A) We wont get any syntax error, but at the same time we cant process the session, this is
because the status of the created session will be “BEING CREATED”.

33) In BDC session method, when we will get the status as ‘beging created’

A) When we don’t close BDC_OPEN with BDC_Close.

(2) When system crashes or power failure or switched of your GUI (In foreground) while BDC Program is executing .

34) after session created, where does the data pertaining to the transactions (screen no screen fields and data of those fields) are stored.

A) APQI and APQD.

35) What is the purpose of MASTER_IDOC_DISTRIBUTE.

A) It will invoke the ALE service layer and pass the master IDOC to it.

34) what is Status Code 29.

A) stand for ALE Service layer error. Possible chances of occurring are

(1) Error in partner profiles
(2) Error Idoc generation program.

RELATED POST

CRM Interaction Center Agent Perform
CRM Technical Architecture 
SAP CRM Software Architecture

Real Time Interview Questions for SAP ABAP

1. Can we write sy-subrc in between select and endselect..
A) yes, but we cannot use statements like MESSAGE , CALL TRANSACTION, CALL DIALOG , SUBMIT, BREAK-POINT, COMMIT WORK, ROLL BACK etc, because these cause DB cursor to close,
2. What is the diff between select single star and select up to.
A) While retrieving data based on primary key use select single where as retrieving based on non primary key use select up to.
3. Purpose of SMOD and CMOD
A) SMOD - to identify the enhancements available in a particular development class
B) CMOD – for projects.
4. Instead of send immediately can we send based on time schedule?
A) yes it is possible. In ALE , we can use Collect IDOCS and after collecting, to send the IDOCS use executable program RESOUT00.
B) IN case EDI It possible by changing the Control record MN05.
5) Define partner profiles.
6) IDOC test tool WE19.
7) While processing through WE19 will the IDOC number will be same or changed.
A) it will change .
8) Working on IDOC testing.
9) Process flow of change pointer and what is the diff b/w change pointers and executable program.
10) What is Message control.
A) is a IDOC triggering mechanism Which works on Output determination.
11) What is NACE.
A) It is T-Code which consists of Procedures, output types, Access sequence, Control Record and Fields.
12) What is the key in NACE.
A) Two character Application ID Ex: EF for purchasing V1 for Sales.
13) Call Transaction Syntax.
A) CALL TRANSACTION ‘TCODE’ USING ‘BDCDATA’ MODE ‘A’ UPDATE ‘S’ MESSAGES INTO ‘BDCMSGCOLL’.
14) Diff B/W call transaction and session method.
A) (1)Process is asynchronous in session whereas it is synchronous in call transaction. (2) Session – background and foreground, call transaction – foreground only. (3) implicit error log , explicit error log. (4) Sessions are client independent. ETC
15) When will AT LINE-SELECTION TRIGGERS.
RELATED POST

SAP ABAP Syntax for EXPORT

Variants

1. EXPORT obj1 ... objn TO MEMORY.
2. EXPORT obj1 ... objn TO DATABASE dbtab(ar) ID key.
3. EXPORT obj1 ... objn TO DATASET dsn(ar) ID key.

Variant 1

EXPORT obj1 ... objn TO MEMORY.

Additions

1. ... FROM g (for each field to be exported)
2. ... ID key

Effect

Exports the objects obj1 ... objn (fields, structures or tables) as a data cluster to ABAP/4 memory . If you call a transaction, report or dialog module (with CALL TRANSACTION , SUBMIT or CALL DIALOG ), the contents of ABAP/4 memory are retained, even across several levels. The called transaction can then retrieve the data from there using IMPORT ... FROM MEMORY . Each new EXPORT ... TO MEMORY statement overwrites any old data, so no data is appended.

If the processing leaves the deepest level of the call chain, the ABAP/4 memory is released.

Note

The header lines of internal tables cannot be exported, because specifying the name of an Internal table with a header line always exports the actual table data.

Addition 1

... FROM g (for each object to be exported)

Effect

Exports the contents of the data object g and stores them under the name specified before FROM .

Addition 2

... ID key

Effect

Stores the exported data under the ID key in ABAP/4 memory . You can then use the ID to read it in again (with IMPORT ). The ID can be up to 32 characters long.

Note

If you store data both with and without an ID , the data stored without an ID remains separate and you can re-import it (using IMPORT without ID ).


RELATED POST

SAP ABAP SYNTAX FOR EXEC
CRM Middle ware System Architecture
CRM Middle ware Enhancement

SAP ABAP Syntax for EXEC

Basic form

EXEC SQL.

Addition

... PERFORMING form

Effect

Executes the Native SQL command enclosed by the statements EXEC SQL and ENDEXEC . In contrast to Open SQL , addressed database tables do not have to be known to the ABAP/4.Dictionary and the ABAP/4 program does not have to contain appropriate TABLES statements.

Example

Create the table AVERI_CLNT :

EXEC SQL.

CREATE TABLE AVERI_CLNT (
CLIENT CHAR(3) NOT NULL,
ARG1 CHAR(3) NOT NULL,
ARG2 CHAR(3) NOT NULL,
FUNCTION CHAR(10) NOT NULL,
PRIMARY KEY (CLIENT, ARG1, ARG2)
)
ENDEXEC.

With Native SQL commands, passing data between an ABAP/4 program and the database is achieved using host variables . A host variable is an ABAP/4 variable prefixed by a "*" in the
Native SQL statement.

Example TWO

Display a section of the table AVERI_CLNT :

DATA: F1(3), F2(3), F3(3).
F3 = ' 1 '
EXEC SQL.
SELECT CLIENT, ARG1 INTO :F1, :F2 FROM
AVERI_CLNT
WHERE ARG2 = :F3
ENDEXEC.
WRITE: / F1, F2.

To simplify the spelling of INTO lists in the SELECT command, you can specify a single structure as the target area as in Open SQL .

Example THREE

Display a section of the table AVERI_CLNT :
DATA: BEGIN OF WA,
CLIENT(3), ARG1(3), ARG2(3),
END OF WA.
DATA F3(3).
F3 = ' 1 '
EXEC SQL.
SELECT CLIENT, ARG1 INTO :WA FROM AVERI_CLNT
WHERE ARG2 = :F3
ENDEXEC.
WRITE: / WA-CLIENT, WA-ARG1.

IMPORTANT POINTS

In contrast to Open SQL , a client field in Native SQL is a field like any other and must be specified explicitly in calls.

Authorization checks cannot be properly realized in EXEC SQL . You should perform these in the program.

When you start the R/3 System, a CONNECT to the current database is executed automatically. An explicit CONNECT is unnecessary.

A Native SQL command can (but does not have to) end with a ";". Under no circumstances should it end with a ".".

Some database systems allow upper and lower case in table names and field names. If you want to take advantage of this, you must ensure that the spelling of names is correct. To enable entry of lower case letters in names in the ABAP/4 editor, you must set the attribute for upper/lower case in the report.

Since there are no arrays in ABAP/4 , array operations are not possible in Native SQL . If the result of a SELECT command is a table, you can read this table line by line either with the
Native SQL command FETCH or with the addition ...

PERFORMING form .

Unlike in ABAP/4 programs, the character " in a Native SQL statement does not introduce a comment until the end of the editor line.

Addition

... PERFORMING form

Effect

If the result of a SELECT command is a table, you can read this table line by line in a processing loop. The subroutine form is called once for each line. In this subroutine, you can leave the loop by using EXIT FROM SQL . If the result of the selection is a single record, the subroutine is called only once.

Example

Display a section of the table AVERI_CLNT :
DATA: F1(3), F2(3), F3(3).
F3 = ' 1 '
EXEC SQL PERFORMING WRITE_AVERI_CLNT.
SELECT CLIENT, ARG1 INTO :F1, :F2 FROM
AVERI_CLNT
WHERE ARG2 = :F3
ENDEXEC.
FORM WRITE_AVERI_CLNT.
WRITE: / F1, F2.
ENDFORM.

RELATED POST

SAP ABAP SYNTAX FOR ELSE AND ELSE IF
SAP CRM Technology Overview
Analytical SAP CRm Overview
SAP CRM Solution Monitoring
CRM Backup Restoring System

SAP ABAP SYNTAX FOR ELSE AND ELSE IF

Basic form

ELSE.

Effect

Within an " IF ... ENDIF " processing block, precedes the code to be executed if the logical expression specified by IF fails.

Example

DATA: RESULT TYPE I,
OP1 TYPE I,
OP2 TYPE I.
...
RESULT = OP1 - OP2.
IF RESULT > 0.

WRITE / 'Result greater than zero.'.
ELSE.
WRITE / 'Result less or equal zero.'.
ENDIF.

Depending on the value of RESULT , both different texts are output.

ELSE IF

ELSEIF logexp.

Effect

Within a processing block enclosed by " IF ... ENDIF ", this statement indicates the processing to be executed if the logical expressions specified by IF and the preceding ELSEIF s are false, but the logical exprEssion in this ELSEIF processing block is true.

Between the IF and ENDIF statements, there may be any number of ELSEIF s. These may be followed, optionally, by an ELSE statement, but this is executed only if none of the logical
expressions under IF or ELSEIF is true.

Example

DATA RESULT TYPE I.
...
IF RESULT < 0. WRITE / 'Result less than zero'. ELSEIF RESULT = 0. WRITE / 'Result equal zero'. ELSE. WRITE / 'Result greater than zero'. ENDIF. Depending on the value of RESULT , the three different texts are output. RELATED POST

SAP ABAP SYNTAX FOR EDITOR CALL PART TWO
MySAP CRM Marketing Introduction
Marketing and Advertizing in CRM
MySAP CRM Marketing Calender

SAP ABAP Syntax for Editor call part two

EDITOR-CALL FOR REPORT prog.

Addition

... DISPLAY-MODE

Effect

Reads the program prog from the library and places it in the ABAP/4 Editor.When you save (with F11 ), the program is written back to the library.

Addition

... DISPLAY-MODE

Effect

Calls the editor in display mode. Changes are not allowed here, but you can switch to change mode from within the editor.

Example

Call the ABAP Editor for the report SAPTEST in display mode:

EDITOR-CALL FOR REPORT 'SAPTEST' DISPLAY-MODE

RELATED POST

SAP ABAP SYNTAX FOR EDITOR CALL PART ONE
How Customer Relationship management makes company Leader
CRM Uses and how to get best results with CRM
CRM software solutions and mysap advantage

SAP ABAP SYNTAX FOR Editor Call

Basic form
EDITOR-CALL FOR itab.

Additions

1. ... TITLE text
2. ... DISPLAY-MODE

Effect

Displays the internal table itab in the ABAP/4 Editor. You can then use normal editor functions (e.g. insert, delete, search, replace) to make changes. When you save (with F11 ) or leave (with F3 ), any changes are adopted.

The return code value is set as follows:


SY-SUBRC = 0 Changes saved before leaving editor.
SY_SUBRC = 4 Changes not saved before leaving editor.

Notes

The internal table can contain only type C components.
The lines of the internal table can be up 72 characters long.

Addition 1

... TITLE text

Effect

Displays the specified text string (up to 30 characters) in the editor header line.

Addition 2

.. DISPLAY MODE

&ABAP_EFFETC& Calls the editor in display mode. You can neither make changes here nor switch to change mode.

Example

Define and fill the internal table T . Then, use EDITOR-CALL to present it to the user for modification. Finally, output the table.

DATA: BEGIN OF T OCCURS 200,
TEXT1(60),TEXT2(12),
END OF T.

T-TEXT1 = 'Text 1'. T-TEXT2 = 'A'. APPEND T.
T-TEXT1 = 'Text 2'. T-TEXT2 = 'B'. APPEND T.
T-TEXT1 = 'Text 3'. T-TEXT2 = 'C'. APPEND T.
T-TEXT1 = 'Text 4'. T-TEXT2 = 'D'. APPEND T.

EDITOR-CALL FOR T TITLE 'Editor for internal tables'.

LOOP AT T.
WRITE: / T-TEXT1, T-TEXT2.
ENDLOOP.

RELATED POST

SMART FORMS PART THREE
MySAP CRM and customer relationship management
My SAP CRM , Business Scenarios and SAP Solutions
Business View and Mysap.com
Customer Relationship Management Software and Interaction with Customer

SAP SMART FORMS PART THREE

This is in continuation with SAP SMART FORMS PART TWO.

5. Calling SMARTFORMS from your ABAP program Calling SMARTFORMS from your ABAP program.
* Collecting all the table data in your program, and pass once to SMARTFORMS
* SMARTFORMS
* Declare your table type in :-
* Global Settings -> Form Interface
* Global Definintions -> Global Data
* Main Window -> Table -> DATA





  • TABLES: MKPF.

  • DATA: FM_NAME TYPE RS38L_FNAM.
    DATA: BEGIN OF INT_MKPF OCCURS 0.
    INCLUDE STRUCTURE MKPF.
    DATA: END OF INT_MKPF.
    SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
    SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
    MOVE-CORRESPONDING MKPF TO INT_MKPF.
    APPEND INT_MKPF.
    ENDSELECT.
    • At the end of your program.
      * Passing data to SMARTFORMS

    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = 'ZSMARTFORM'
    * VARIANT = ' '
    * DIRECT_CALL = ' '
    IMPORTING
    FM_NAME = FM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    if sy-subrc <> 0.
    WRITE: / 'ERROR 1'.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    call function FM_NAME
    * EXPORTING
    * ARCHIVE_INDEX =
    * ARCHIVE_INDEX_TAB =
    * ARCHIVE_PARAMETERS =
    * CONTROL_PARAMETERS =
    * MAIL_APPL_OBJ =
    * MAIL_RECIPIENT =
    * MAIL_SENDER =
    * OUTPUT_OPTIONS =
    * USER_SETTINGS = 'X'
    * IMPORTING
    * DOCUMENT_OUTPUT_INFO =
    * JOB_OUTPUT_INFO =
    * JOB_OUTPUT_OPTIONS =
    TABLES
    GS_MKPF = INT_MKPF
    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.
    Additional Fonts for your SMARTFORMS:
    You can create additional fonts and style with transaction SMARTSTYLES
    This can then be define in the paragraph and character formats, which you can then be assign to texts and fields in the Smart Form.
    The character formats includes effects such as superscript, subscript, barcode and font attributes.

    Creating a new Smart Forms part two

    Difference with SMART FORMS vs. Sap Script(SE71)

    The Following are the differences :-
    a) Multiple page formats are possible in smart forms which is not the case in SAP Scripts
    b) It is possible to have a smart form without a main window .
    c) Labels cannot be created in smart forms.
    d) Routines can be written in smart forms tool.
    e) Smart forms generates a function module when activated.


    Smart forms can be used for creating and maintaining forms for mass printing in SAP Systems. The output medium for Smart forms support printer, fax, e-mail, or the Internet (by using the generated XML output).


    According to SAP, you need neither have any programming knowledge nor use a Script language to adapt standard forms. However, basic ABAP programming skills are required only in special cases (for example, to call a function module you created or for complex and extensive conditions).

    1.Create a new smartforms

    Transaction code SMARTFORMS
    Create new smartforms call ZSMART

    2.Define looping process for internal table

    Pages and windows
    First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)
    Here, you can specify your title and page numbering
    &SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)
    Main windows -> TABLE -> DATA
    In the Loop section, tick Internal table and fill in
    ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2

    3. Define table in smartforms

    Global settings :
    Form interface
    Variable name Type assignment Reference type
    ITAB1 TYPE Table Structure
    Global definitions
    Variable name Type assignment Reference type
    ITAB2 TYPE Table Structure

    4. To display the data in the form

    Make used of the Table Painter and declare the Line Type in Tabstrips Table
    e.g. HD_GEN for printing header details,
    IT_GEN for printing data details.
    You have to specify the Line Type in your Text elements in the Tabstrips Output options.
    Tick the New Line and specify the Line Type for outputting the data.
    Declare your output fields in Text elements
    Tabstrips - Output Options
    For different fonts use this Style : IDWTCERTSTYLE
    For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&

    RELATED POST

    Creating Smart Forms

    Retrieving the application data:
    Write an ABAP program to retrieve data or include a retrieval routine into the application. This code consists of statements that select data from databases according to certain selection criteria. Store the retrieved data in internal tables, structures or variables and transfer it to the form in one step.
    Readers has to excuse me as i am unable to finish this post due to technical problems.Any way a complete discussion is done about smart forms including the introduction and you can fine that series here at SAP SMART FORMS COMPLETE.
















    RELATED POST

    SAP ABAP SMART FORMS Introduction

    Smart Forms are used in SAP to create and maintain forms for mass printing. The Smart Forms offers the following advantages:
    Creating and maintaining forms require half the time.
    Adapting to forms without any programming techniques due to GUI.
    Web publishing using the generated XML output.
    Migration from SAPScript to Smart Form is supported in smart forms. The important features in smart forms are as listed below:
    The smart forms allow the user to execute simple modifications to the form and in the form logic by using simple graphical tools.
    To print a form the user will need a program for the data retrieval and a smart form that contains the entire form logic. As these two are separate one should adapt the smart form if changes to the form logic is necessary. The application program passes the data via a function module interface to the smart form. When activating the smart form the system automatically generates the function module and at the runtime process this.
    The user designs the form using the graphical form painter and the graphical table painter. The form logic is represented by the hierarchical structure that consists of individual nodes, such as nodes for global settings, nodes for texts, nodes for output tables or nodes for graphics. To make any changes one has to use the Drag&Drop, Cut&Paste. These actions do not include writing of coding lines or using a script language.
    For web publishing, the system provides a generated XML output of the processed form.One can insert static and dynamic tables. These include the line feeds in the individual table cells, triggering events for table headings and subtotals and sorting data before output.
    The smart forms allow the user to include graphics, which can be displayed as a part of the form or as background graphics. During printout the user can suppress the background graphic as and when necessary.The smart forms also supports the postage optimizing.
    When a smart form is activated , the system generates a function module that encapsulates all the attributes of the smart form.As soon as the application program calls the function module, the smart form uses the module interface to transfer any table data previously selected and to print the form according to the form description.

    SAP BUSINESS WORK FLOW

    SAP Business Workflow is a cross-application tool enabling the integration of business tasks across whole application areas. This tool is also used in many areas of SAP. 

    Defination : The automation of a business process in whole or part, during which documents, information or tasks are passed from one participant to another for action, according to a set of procedural rules. Workflow uses the organization structure to determine the person responsible for executing a task..
    We can view workflow development as a programming environment. The workflow development environment is a true object-oriented development environment. The basic component in workflow is a business object on which operations are carried out. These operations are implemented as methods.
    BAPIs
    (Business Application Programming Interface) are special methods implemented in the business objects. Events which are part of the business object, are triggered for changes in the state of the object.
    Organizational plans:
    An organizational plan represents the complete information about a company’s organization structure. The main elements of an organizational plan are as follows.
    Hierarchy among various organizational units ( In a company we can have several organizational units broken down by function for example : A company can have several divisions, such as engineering, Manufacturing and Finance. )
    Jobs performed in a company ( A job involves performing one or more business tasks. For example Manager, Secretary, Sales Order Clerk, Purchasing Clerk etc.)

    Positions held by the organizations employees in the organization and the reporting structure.

    Organizational Units :
    An Organizational unit is reponsible for a specific function in a company. This units are linked in a hierarchical fashion to form the entire organization structure. 
     
    Jobs :
     
    Jobs represent a flexible means of identifying a user and describes a set of tasks performed by a person holding a position to which that job is assigned.

    Position :

    A position in a company represents a rank. Positions are linked in hierarchical fashion to represent the chain of command in a company.
    Users: A user is a person who has been granted access to the SAP system to use its various functions. A user ID identifies a user in the system .
    Business Objects: A business object represents a business entity that has a definite state and various properties. You can carry various functions on the objects. Several business objects are defined in the system and organized in the BOR (BUSINESS OBJECT REPOSITORY). 
     
    Tasks : Tasks defines a piece of work that can be executed and tracked in the system technically. A task points to a method of an object.

    We can create new Username by using Tcode - 'SU01' .


    SAP ABAP Syntax for DO part three

    This in continuation with syntax for data part two.

    Variant 2

    DO n TIMES.

    Addition


    ... VARYING f FROM f1 NEXT f2 (similar to variant 1)

    Effect

    Repeats the processing enclosed by the DO and ENDDO statements n times. If n changes within the loop, this has no effect on loop passes.

    Example


    DATA COUNT TYPE I.
    DO 10 TIMES.
    ADD SY-INDEX TO COUNT.
    ENDDO.

    The field COUNT now contains 55 (1+2+...+10).

    Performance
     
    The run time required to pass once through an empty DO loop is about 11 msn (standardized microseconds). For 100 loop passes, about 230 msn would be needed.
    If possible, use a
    WHILE loop instead of a DO / EXIT construction because this improves the performance slightly and is clearer.

    SAP ABAP Syntax for DO part two

    This is post is in continuation with SAP ABAP SYNTAX FOR DO PART ONE.

    Addition 1

    ... VARYING f FROM f1 NEXT f2

    Effect

    This addition is useful if you have a series of fields of the same type and the same distance from each other.f is a variable which you define in a DATA statement. On each loop pass, f contains a new value. The field f1 after " FROM " specifies the first value of the variable f , while the field f2 after " NEXT " specifies the value to be assigned to the variable f in the second pass. For each subsequent pass, the variable f contains the next value in the sequence determined by the distance between the fields f1 and f2 in memory.
    The fields f1 and f2 should be type-compatible and convertible to f .If the value of f changes during the loop pass, the new value is then placed in the appropriate field fn assigned to f (transfer type: pass by value and result). If the loop pass terminates because of a dialog message, the new value is not passed back if f changes.The addition ... VARYING f FROM f1 NEXT f2 can be used several times in a DO statement.

    Example

    DATA: BEGIN OF WORD,
    ONE VALUE 'E',
    TWO VALUE 'x',
    THREE VALUE 'a',
    FOUR VALUE 'm',
    FIVE VALUE 'p',
    SIX VALUE 'l',
    SEVEN VALUE 'e',
    EIGHT VALUE '!',
    END OF WORD,
    LETTER1, LETTER2.
    DO VARYING LETTER1 FROM WORD-ONE THEN WORD-THREE
    VARYING LETTER2 FROM WORD-TWO THEN WORD-FOUR.
    WRITE: LETTER1, LETTER2.
    IF LETTER2 = '!'.
    EXIT.
    ENDIF.
    ENDDO.

    The resulting output is the character string

    "E x a m p l e !".

    Note
    When using this addition, ensure that the DO loop terminates at the "right" time, in order to avoid assigning meaningless values that happen to be in memory after this sequence of fields. This could result in a runtime error.

    Calling a BADI and uses

    Calling Badi in the Application

    1. When we define BAdi, enhancement management generates a class that implements the interface. The application developer uses a factory method to create an instance of adapter class in the application program and calls corresponding method. The adapter class method generated by the enhancement management decide by checking the entries in the table whether one or several active implementations need to be called. If required, the implementations are subsequently executed. The application program ensures only the adapter class method is called. The application program doesn’t know which implementations are called.
    2. Call the string conversion Business Add-in, the program calling the Business Add-in. Following is the ABAP source code

    REPORT ZMPTEST_BADI.
    * Declaring the handler
    class: cl_exithandler definition load.
    * Interface Reference
    data: badi_interface type ref to ZIF_EX_BUSINESSADDIN.
    * String
    data: w_str(15) type c value 'baddi test'.
    *************************************************
    ****Start of Selection Event.....................
    ************************************************
    start-of-selection.
    call method cl_exithandler=>get_instance
    changing
    instance = badi_interface.
    write: / 'Please click here'.
    *************************************************
    ****At line-selection Event.....................
    ************************************************
    at line-selection.
    write: / 'original word', w_str.
    if not badi_interface is initial.
    call method badi_interface->conversion
    changing parameter = w_str.
    endif.
    write: / 'Converted word', w_str.

    Filter dependent Badi

    1. Business Add-in definition level (for example a country, industry sector) we can have filter dependent option. If an enhancement for country specific versions then it is likely that different partners can implement this enhancement. The individual countries can create and activate their own implementation.
    2. In the enhancement definition, all the methods created in the enhancement’s interface need to have filter value as their importing parameter. The application program provides the filter values for the implementation method.
    3. Filter dependent BAdi is called using one filter value only, it is possible to check active implementation for the filter value using the function module SXC_EXIT_CHECK_ACTIVE.

    Multiple use Badi

    1. There are multiple use and single use Business Add-ins. This option can be choose at Business Add-in definition.
    2. The distinction is base on the procedure or event character of an enhancement. In the first case the program waits for the enhancement to return a return code. Typical example is benefit calculation in HR depending on the implementation, alternative calculations can be executed. In case of multiple use add-ins, an event that may be interest to other components in program flow. Any number of components could use this event as a hook to hang their own additional actions on to.
    3. There is no sequence control for multiple-use implementations of BAdi’s. Sequence control is technically impossible, at the time of the definition the interface does not know which implementations parameters will be change the implementations.
    4. The concept of multiple use of the Business Add-in is that has been implemented once already can be implemented again by right of the software chain.

    Difference between different enhancement technique with BADI

    1. Difference between Business Transaction Events and BADI’s.
    1. The concept of the BADI is similar to Business Transaction Events (Open FI). BTE’s was developed specific to Financial Accounting module. But were as BADI’s was developed in generalised to all modules.
    2. BTE’s can only be used to make the program enhancements. You cannot enhance user interface with Open FI, but you can with Business Add-ins.
    3. Open FI assumes that enhancement can only take place on three levels i.e. SAP- partners – customers, but in case of BAdi’s you can create and implement enhancements in as many software layers as you like.
    4. Function modules are used for program enhancements in Open FI. With BAdi’s, ABAP Objects is used to enhance programs.
    1. Difference between customer exits and BAdi’s.
    1. Customer exits assume a two-tiered system infrastructure (SAP - Customers). Where as in case of BAdi’s you can created and implement enhancements in as many software layers as you like.
    2. BAdi’s are considered as generalized BTE’s that can be used to bundle program, menu and screen enhancements into a single add-in. BAdi’s can be created and employed in each of the various software levels.

    Advantages of BADI’s

    1. This enhancement technique has the advantage of being based on a multi-level system landscape (SAP, country versions, IS solutions, partner, customer and so on).
    2. We can create definitions and implementations of business add-ins at any level of the system landscape.TRE
    1. Following are the Tables which are relevant to BAdi’s
    SOME IMPORTENT BADI'S
    1. SXS_ATTRT - BAdi Definition list
    2. V_EXT_ACT - Active implementations of an exit
    3. V_EXT_ IMP - Implementation class for an interface+filter
    4. V_EXT_M - BAdi’s with filters
    1. Transaction related to BAdi’s
    1. SE18 - Business Add-in builder
    2. SE19 – Implementation of Badi
    3. SE24 – Class/Interface Builder