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: 

differences

Former Member
0 Kudos

Hi All,

i want to know the differences between

1. ON-INPUT & ON-REQUEST.

2. BAPI, BADI & Function Modules.

3. Search help & POV in Dialog programming.

i am fully confused of these, so please explain me in details.

Thanks in Advance.

Regards,

Ramana Prasad

5 REPLIES 5

former_member189059
Active Contributor
0 Kudos

1. refer these

Former Member
0 Kudos

Hi,

Hi,

ON INPUTThe ABAP module is called only if the field contains a value other than its initial value. This initial value is determined by the data type of the field: Space for character fields, zero for numeric fields. Even if the user enters the initial value of the screen as the initial value, the module is not called. (ON REQUEST, on the other hand, does trigger the call in this case.)

ON REQUEST

The module <mod> is only called if the user has entered something in the field. This includes cases when the user overwrites an existing value with the same value, or explicitly enters the initial value.

In general, the ON REQUEST condition is triggered through any form of "manual input".

3.

the search help that is created in the pov section will be specific to the program in which the pov code is there.

if u create search help in the database, it is across all programs that use the data element for which yo uhave created the search help

2.

In simple words.

BAPI - > used to communicate between SAP and NON SAP system.

Function Module -> Communicate only within SAP system

Th advantages of BAPI:

1. Simple to use (its just an FM)

2. Not cumbersome like bdc

where we have to record each and every screen

sequence.

3. SAP guarantees the consistency

of bapi in future releases.

One of the big plusses for BAPIs is that the interface and function are not supposed to change. This is a big plus when you do upgrades or hot packs because the transaction can change (format, required inputs etc) which means you then need to update the call transaction.

Some of the BAPIs are better documented and easier to use than others.

You usually need to perform the BAPI that actually does the COMMIT after you call your BAPI.

The Program coding for calling a BAPI is usually cleaner than setting up the screen flow etc for the Call Transaction.

You don't need to worry about special data circumstances interrupting the normal data flow of the screens and causing errors because of that.

BAPIs probably have better performance since they don't do the screen flow processing.

In general if the BAPI exists for the transaction you want to perform and you can figure out how to use it the BAPI is probably the best way to go.

Also please check this link for more information on advantages of BAPIs.

http://help.sap.com/saphelp_nw04/helpdata/en/7e/5e11dc4a1611d1894c0000e829fbbd/frameset.htm

<b>

Reward points</b>

Regards

Former Member
0 Kudos

Hi

So many things in a single query

1.for ON-INPUT and ON-REQUEST see the Chain--endchain doc

To ensure that one or more PAI modules are only called when several screen fields meet a particular condition, you must combine the calls in the flow logic to form a processing chain. You define processing chains as follows:

CHAIN.

...

ENDCHAIN.

All flow logic statements between CHAIN and ENDCHAIN belong to a processing chain. The fields in the various FIELD statements are combined, and can be used in shared conditions.

CHAIN.

FIELD: <f1>, <f 2>,...

MODULE <mod1> ON CHAIN-INPUT|CHAIN-REQUEST.

FIELD: <g1>, <g 2>,...

MODULE <mod2> ON CHAIN-INPUT|CHAIN-REQUEST.

...

ENDCHAIN.

When this command is used, all of the fields on the screen that belong to the processing chain (all of the fields listed in the field statements) are made ready for input again. Other fields are not ready for input. Whenever the MODULE statement appears within a processing chain, even if there is only one FIELD attached to it, all of the fields in the chain (not only the affected field) are made ready for input again, allowing the user to enter new values. If the fields in the processing chain are only checked once, the PAI processing continues directly after the FIELD statement, and the preceding modules are not called again.

CHAIN.

FIELD: <f1>, <f 2>,...

MODULE <mod1> ON CHAIN-INPUT|CHAIN-REQUEST.

FIELD: <g1>, <g 2>,...

MODULE <mod2> ON CHAIN-INPUT|CHAIN-REQUEST.

...

ENDCHAIN.

Check this out

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbabbd35c111d1829f0000e829fbfe/content.htm

http://help.sap.com/saphelp_47x200/helpdata/en/d1/801ca2454211d189710000e8322d00/frameset.htm

2. BAPI is an interface which is an API method of a Business object

BADI is like an user exit which is used for most of the Enjoy transaction

DEFINING THE BADI

1) execute Tcode SE18.

2) Specify a definition Name : ZBADI_SPFLI

3) Press create

4) Choose the attribute tab. Specify short desc for badi.. and specify the type :

multiple use.

5) Choose the interface tab

6) Specify interface name: ZIF_EX_BADI_SPFLI and save.

7) Dbl clk on interface name to start class builder . specify a method name (name,

level, desc).

Method level desc

Linese;ection instance methos some desc

😎 place the cursor on the method name desc its parameters to define the interface.

Parameter type refe field desc

I_carrid import spfli-carrid some

I_connid import spefi-connid some

9) save , check and activate…adapter class proposed by system is

ZCL_IM_IM_LINESEL is genereated.

IMPLEMENTATION OF BADI DEFINITION

1) EXECUTE tcode se18.choose menuitem create from the implementation menubar.

2) Specify aname for implementation ZIM_LINESEL

3) Specify short desc.

4) Choose interface tab. System proposes a name fo the implementation class.

ZCL_IM_IMLINESEL which is already generarted.

5) Specify short desc for method

6) Dbl clk on method to insert code..(check the code in “AAA”).

7) Save , check and activate the code.

Some useful URL

http://www.esnips.com/doc/e06e4171-29df-462f-b857-54fac19a9d8e/ppt-on-badis.ppt

http://www.esnips.com/doc/10016c34-55a7-4b13-8f5f-bf720422d265/BADIs.pdf

http://www.esnips.com/doc/43a58f51-5d92-4213-913a-de05e9faac0d/Business-Addin.doc

http://www.esnips.com/doc/1e10392e-64d8-4181-b2a5-5f04d8f87839/badi.doc

www.sapgenie.com/publications/saptips/022006%20-%20Zaidi%20BADI.pdf

http://www.sapdevelopment.co.uk/enhance/enhance_badi.htm

http://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e10000000a11402f/content.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/c2/eab541c5b63031e10000000a155106/frameset.htm

Now write a sample program to use this badi method..

Look for “BBB” sample program.

“AAA”

data : wa_flights type sflight,

it_flights type table of sflight.

format color col_heading.

write:/ 'Flight info of:', i_carrid, i_connid.

format color col_normal.

select * from sflight

into corresponding fields of table it_flights

where carrid = i_carrid

and connid = i_connid.

loop at it_flights into wa_flights.

write:/ wa_flights-fldate,

wa_flights-planetype,

wa_flights-price currency wa_flights-currency,

wa_flights-seatsmax,

wa_flights-seatsocc.

endloop.

“BBB”

&----


*& Report ZBADI_TEST *

*& *

&----


REPORT ZBADI_TEST .

tables: spfli.

data: wa_spfli type spfli,

it_spfli type table of spfli with key carrid connid.

*Initialise the object of the interface.

data: exit_ref type ref to ZCL_IM_IM_LINESEL,

exit_ref1 type ref to ZIF_EX_BADISPFLI1.

selection-screen begin of block b1.

select-options: s_carr for spfli-carrid.

selection-screen end of block b1.

start-of-selection.

select * from spfli into corresponding fields of table it_spfli

where carrid in s_carr.

end-of-selection.

loop at it_spfli into wa_spfli.

write:/ wa_spfli-carrid,

wa_spfli-connid,

wa_spfli-cityfrom,

wa_spfli-deptime,

wa_spfli-arrtime.

hide: wa_spfli-carrid, wa_spfli-connid.

endloop.

at line-selection.

check not wa_spfli-carrid is initial.

create object exit_ref.

exit_ref1 = exit_ref.

call method exit_ref1->lineselection

EXPORTING

i_carrid = wa_spfli-carrid

i_connid = wa_spfli-connid.

clear wa_spfli.

BAPI

what is BAPI?

BAPI stands for Business API(Application Program Interface).

A BAPI is remotely enabled function module ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..

You can make your function module remotely enabled in attributes of Function module but

A BAPI are standard SAP function modules provided by SAP for remote access. Also they are part of Businees Objest Repository(BOR).

BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. in this case u only specify the business object and its method from external system in BAPI there is no direct system call. while RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.

The following standardized BAPIs are provided:

Reading instances of SAP business objects

GetList ( ) With the BAPI GetList you can select a range of object key values, for example, company codes and material numbers.

The BAPI GetList() is a class method.

GetDetail() With the BAPI GetDetail() the details of an instance of a business object type are retrieved and returned to the calling program. The instance is identified via its key. The BAPI GetDetail() is an instance method. BAPIs that can create, change or delete instances of a business object type

The following BAPIs of the same object type have to be programmed so that they can be called several times within one transaction. For example, if, after sales order 1 has been created, a second sales order 2 is created in the same transaction, the second BAPI call must not affect the consistency of the sales order 2. After completing the transaction with a COMMIT WORK, both the orders are saved consistently in the database.

Create( ) and CreateFromData! ( )

The BAPIs Create() and CreateFromData() create an instance of an SAP business object type, for example, a purchase order. These BAPIs are class methods.

Change( )

The BAPI Change() changes an existing instance of an SAP business object type, for example, a purchase order. The BAPI Change () is an instance method.

Delete( ) and Undelete( ) The BAPI Delete() deletes an instance of an SAP business object type from the database or sets a deletion flag.

The BAPI Undelete() removes a deletion flag. These BAPIs are instance methods.

Cancel ( ) Unlike the BAPI Delete(), the BAPI Cancel() cancels an instance of a business object type. The instance to be cancelled remains in the database and an additional instance is created and this is the one that is actually canceled. The Cancel() BAPI is an instance method.

Add<subobject> ( ) and Remove<subobject> ( ) The BAPI Add<subobject> adds a subobject to an existing object inst! ance and the BAPI and Remove<subobject> removes a subobject from an object instance. These BAPIs are instance methods.

BAPI-step by step

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

list of all bapis

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

for BAPI's

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://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

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

http://www.topxml.com/sap/sap_idoc_xml.asp

http://www.sapdevelopment.co.uk/

http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf

Also refer to the following links..

www.sappoint.com/abap/bapiintro.pdf

www.sap-img.com/bapi.htm

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

www.planetsap.com/Bapi_main_page.htm

www.sapgenie.com/abap/bapi/index.htm

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

u can check the below the material also

Example Code

U need to give the step_nr, item_nr, cond_count and cond_type so the correct conditon will be updated. If no condition exists for the given parameters, a new condition will be created.

U can find these parameters for a particular condition type in table KONV.

&----


*& Form saveTransactionJOCR

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM saveTransactionJOCR .

data: salesdocument like BAPIVBELN-VBELN,

order_header_inx like bapisdh1x,

order_header_in like bapisdh1,

return type standard table of bapiret2 with header line,

conditions_in type standard table of bapicond with header line,

conditions_inx type standard table of bapicondx with header line,

logic_switch like BAPISDLS,

step_nr like conditions_in-cond_st_no,

item_nr like conditions_in-itm_number,

cond_count like conditions_in-cond_count,

cond_type like conditions_in-cond_type.

salesdocument = wa_order_information-VBELN.

LOGIC_SWITCH-COND_HANDL = 'X'.

order_header_inx-updateflag = 'U'.

  • conditions

clear conditions_in[].

clear conditions_inx[].

clear: step_nr,

item_nr,

cond_count,

cond_type.

step_nr = '710'.

item_nr = '000000'.

cond_count = '01'.

cond_type = 'ZCP2'.

CONDITIONS_IN-ITM_NUMBER = item_nr.

conditions_in-cond_st_no = step_nr.

CONDITIONS_IN-COND_COUNT = cond_count.

CONDITIONS_IN-COND_TYPE = cond_type.

CONDITIONS_IN-COND_VALUE = 666.

CONDITIONS_IN-CURRENCY = 'EUR'.

append conditions_in.

CONDITIONS_INX-ITM_NUMBER = item_nr.

conditions_inx-cond_st_no = step_nr.

CONDITIONS_INX-COND_COUNT = cond_count.

CONDITIONS_INX-COND_TYPE = cond_type.

CONDITIONS_INX-UPDATEFLAG = 'U'.

CONDITIONS_INX-COND_VALUE = 'X'.

CONDITIONS_INX-CURRENCY = 'X'.

append conditions_inx.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

SALESDOCUMENT = salesdocument

ORDER_HEADER_IN = order_header_in

ORDER_HEADER_INX = order_header_inx

LOGIC_SWITCH = logic_switch

TABLES

RETURN = return

CONDITIONS_IN = conditions_in

CONDITIONS_INX = conditions_inx

.

if return-type ne 'E'.

commit work and wait.

endif.

ENDFORM. " saveTransactionJOCR

Bdc to Bapi

The steps to be followed are :

1. Find out the relevant BAPI (BAPI_SALESORDER_CHANGE for VA02).

[for VA01 use BAPI_SALESORDER_CREATEFROMDAT2]

2. Create a Z program and call the BAPi (same as a Funtion module call).

2. Now, if you see this BAPi, it has

-> Importing structures.

eg: SALESDOCUMENT: this will take the Sales order header data as input.

-> Tables parameters:

eg: ORDER_ITEM_IN: this will take the line item data as input.

Note :

Only specify fields that should be changed

Select these fields by entering an X in the checkboxes

Enter a U in the UPDATEFLAG field

Always specify key fields when changing the data, including in the checkboxes

The configuration is an exception here. If this needs to be changed, you need to complete it again fully.

Maintain quantities and dates in the schedule line data

Possible UPDATEFLAGS:

U = change

D = delete

I = add

Example

1. Delete the whole order

2. Delete order items

3. Change the order

4. Change the configuration

Notes

1. Minimum entry:

You must enter the order number in the SALESDOCUMENT structure.

You must always enter key fields for changes.

You must always specify the update indicator in the ORDER_HEADER_INX.

2. Commit control:

The BAPI does not run a database Commit, which means that the application must trigger the Commit so that the changes are read to the database. To do this, use the BAPI_TRANSACTION_COMMIT BAPI.

For further details... refer to the Function Module documentation for the BAPi.

Bapi to VB(Visual Basic)

Long back I had used the following flow structure to acheive the same.

Report -> SM59 RFC destination -> COM4ABAP -> VB.exe

my report uses the rfc destination to create a COM session with com4abap. com4abap calls the vb.exe and manages the flow of data between sap and vb exe.

You need to have com4abap.exe

If com4abap is installed you will find it in sapgui installatin directory , C:\Program Files\SAPpc\sapgui\RFCSDK\com4abap.

else refer OSS note 419822 for installation of com4abap

after making the settings in com4abap to point to the vb program and setting up rfc destination in sm59 to point to com4abap session , you can use the following function modules to call the vb code.

for setting up com4abap and rfc destination please refer to the documentation for com4abap.

  • Invoke NEW DCOM session

call function 'BEGIN_COM_SESSION'

exporting

service_dest = service_dest "(this will be a RFC destination created in SM59)

importing

worker_dest = worker_dest

exceptions

connect_to_dcom_service_failed = 1

connect_to_dcom_worker_failed = 2

others = 3.

call function 'create_com_instance' destination worker_dest

exporting

clsid = g_c_clsid

typelib = g_c_typelib

importing

instid = g_f_oid

exceptions

communication_failure = 1 message g_f_msg

system_failure = 2 message g_f_msg

invalid_instance_id = 3

others = 4.

call function 'com_invoke' destination worker_dest

exporting

%instid = g_f_oid

%method = 'UpdatePDF'

sntemp = g_v_const_filent

snsysid = sy-sysid

snflag = 'N'

tables

rssaptable = g_t_pdfdetail1

%return = g_t_pdfdetail1 "t_test

exceptions

communication_failure = 1 message g_f_msg

system_failure = 2 message g_f_msg

invalid_instance_id = 3

others = 4.

then close the com session , using

FM delete_com_instance

FM END_COM_SESSION

FUN MODULES

Function Modules;

Check this matter.

Function Modules are Global ABAP programs created by SAP for reusable purpose.they have IMPORT,EXPORT and TABLE parameters, and EXCEPTIONS to through when error occurs.

You can create them from TCode SE37.

Go through the following doc:

Function modules are cross-program, reusable procedures that are organized into function groups, and whose functions are implemented between the statements FUNCTION and ENDFUNCTION. Function modules and their interfaces are created in the Function Builder.

Function Module Interfaces

The parameter interface of a function module is defined in the Function Builder. It includes the definition of interface parameters and the specification of exceptions that can be triggered by a function module. The Function Builder automatically generates comment lines below the FUNCTION statement in the source code of the function module, which represent the interface of the function module with the following syntax:

Syntax

... [IMPORTING parameters]

[EXPORTING parameters]

[CHANGING parameters]

[TABLES table_parameters]

[{RAISING|EXCEPTIONS} exc1 exc2 ...]

The syntax and semantics of IMPORTING, EXPORTING, CHANGING, RAISING, and EXCEPTIONS mainly correspond to the definition of method interfaces with [CLASS-]METHODS. The additional option of defining table parameters using TABLES is obsolete.

Interface parameters

The interface parameters are defined on the relevant tab pages in the Function Builder.

IMPORTING parameters are input parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input parameter. The content of the actual parameter is passed to the input parameter when the call is made. The content of an input parameter for which 'pass by reference' is defined cannot be changed in the function module.

EXPORTING parameters are output parameters. When the function module is called, a suitable actual parameter can be specified for every output parameter. The content of an output parameter that is defined for 'pass by value' is transferred to the actual parameter if the function module is completed without errors. An output parameter that is defined for pass by reference is not initialized when the function module is called.

CHANGING parameters are input and output parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input or output parameter. When the function module is called, the content of the actual parameter is passed to the input/output parameter, and when the function module is completed, the content of the input/output parameter is passed to the actual parameter.

TABLES parameters are table parameters. Table parameters are obsolete CHANGING parameters that are typed as standard tables with a header line. If an internal table without a header line or a table body is passed as an actual parameter to a formal parameter of this type, an empty local header line is generated in the function module. If an internal table with a header line is used as an actual parameter, both the table body and the header line are passed to the function module. Pass by value is not possible in formal parameters defined using TABLES. Formal parameters defined with TABLES can be replaced by formal parameters defined with CHANGING. A local work area can be created for the internal table in the function module by using the addition LIKE LINE OF itab of the DATA statement.

Exceptions

The exception of a function module are defined on the Exceptions tab page in the Function Builder. Here you can select exception classes to define whether class-based exceptions are declared or non-class-based exception are defined. Class-based exceptions are represented in the above syntax by RAISING, and non-class-based exceptions are represented by EXCEPTIONS.

The addition RAISING is used to declare class-based exceptions that can be propagated from the function module to the caller. Exceptions in the categories CX_STATIC_CHECK and CX_DYNAMIC_CHECK must be explicitly declared, otherwise a propagation can lead to an interface violation. A violation of the interface leads to the treatable exception CX_SY_NO_HANDLER. Exceptions of the category CX_NO_CHECK are implicitly always declared. The declaration of exceptions of the category CX_STATIC_CHECK is statically checked in the syntax check. For exceptions of the category CX_DYNAMIC_CHECK, the check is not performed until runtime. In a function module in which class-based exceptions are declared with the RAISING addition, the statement CATCH SYSTEM-EXCEPTIONS cannot be used. Instead, the relevant treatable exceptions should be handled in a TRY control structure.

The addition EXCEPTIONS is used to define a list of non-class-based exceptions that can be triggered in the function module using the statements RAISE or MESSAGE RAISING. Exceptions defined in this way - as with formal parameters - are bound to the function module and cannot be propagated. If an exception of this type is triggered in a function module, and no return value has been assigned to it with the homonymous addition EXCEPTIONS of the CALL FUNCTION statement when the call was made, this leads to a runtime error.

Note

For new developments after release 6.10, SAP recommends that you work with class-based exceptions that are independent of the function module.

RFC is a technology which is used to access a functions (Modules) from

the remote systems.

If a function module is set as remote enabled which can be access from

the remote system via RFC.Eg: U can access the Remote enabled function modules in ur VB,Webdynpro,Java,Visual composer program.

A function module can be set as remote enabled by SE37->Go to ur FM->click the option Button "remote enabled".

But Normal function modules can not accessd from the remote system.

Good Example for RFC enabled function module is : BAPI(Business Application Programming Interface)

Note: All BAPIs are Remote enabled but not all remote enabled function modules are BAPI.

CALLING A FUNCTION MODULE:

1)In U ABAP Editor --> Click "Patter" ---> Selection Option Button "Call Function"

--> Write the Corresponding FM name --> Hit Enter

2)The appropriate import ,export Parameters will be displayed in ur editor

3)Pass the Values Here.

Also check these links.

http://www.geocities.com/victorav15/sapr3/abapfun.html

Check this link:

http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm

Check this link:

http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm

See the following links:

http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm

3. Search Helps

1) Elementary search helps describe a search path. The elementary search help must define where the data of the hit list should be read from (selection method), how the exchange of values between the screen template and selection method is implemented (interface of the search help) and how the online input help should be defined (online behavior of the search help).

2) Collective search helps combine several elementary search helps. A collective search help thus can offer several alternative search paths.

3)An elementary search help defines the standard flow of an input help.

4) A collective search help combines several elementary search helps. The user can thus choose one of several alternative search paths with a collective search help.

5)A collective search help comprises several elementary search helps. It combines all the search paths that are meaningful for a field.

6)Both elementary search helps and other search helps can be included in a collective search help. If other collective search helps are contained in a collective search help, they are expanded to the level of the elementary search helps when the input help is called.

CREATION:

Go to SE11 Tcode

select search help

give the 'z' search help name and create

select the selection method ur table name eg : 'mara'

dialog module 'display value immediately'.

add the field whatever u want and lpos = 1 and spos = 1 and check import and export parameter.

where left position when displaying and spos = search position

and then save and activate ..

See the links:

http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee38446011d189700000e8322d00/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee45446011d189700000e8322d00/content.htm

https://forums.sdn.sap.com/click.jspa?searchID=3173469&messageID=2176485

https://forums.sdn.sap.com/click.jspa?searchID=3173469&messageID=3601619

pls go through this for search help creation

http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm

Search Help Exits:

POV

For F4 Values on Screen:

PROCESS ON VALUE_REQUEST

using module call starting with FIELD i.e FIELD field MODULE module

There are number of function modules that can be used for the purpose, but these

can fullfill the task easily or combination of them.

DYNP_VALUE_READ

F4IF_FIELD_VALUE_REQUEST

F4IF_INT_TABLE_VALUE_REQUEST

POPUP_WITH_TABLE_DISPLAY

DYNP_VALUE_READ

This function module is used to read values in the screen fields. Use of this

FM causes forced transfer of data from screen fields to ABAP fields.

There are 3 exporting parameters

DYNAME = program name = SY-CPROG

DYNUMB = Screen number = SY-DYNNR

TRANSLATE_TO_UPPER = 'X'

and one importing TABLE parameter

DYNPFIELDS = Table of TYPE DYNPREAD

The DYNPFIELDS parameter is used to pass internal table of type DYNPREAD

to this FM and the values read from the screen will be stored in this table.This

table consists of two fields:

FIELDNAME : Used to pass the name of screen field for which the value is to

be read.

FIELDVALUE : Used to read the value of the field in the screen.

e.g.

DATA: SCREEN_VALUES TYPE TABLE OF DYNPREAD ,

SCREEN_VALUE LIKE LINE OF SCREEN_VALUES.

SCREEN_VALUE-FIELDNAME = 'KUNNR' . * Field to be read

APPEND SCREEN_VALUE TO SCREEN_VALUES. * Fill the table

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = SY-CPROG

DYNUMB = SY-DYNNR

TRANSLATE_TO_UPPER = 'X'

TABLES

DYNPFIELDS = SCREEN_VALUES.

READ TABLE SCREEN_VALUES INDEX 1 INTO SCREEN_VALUE.Now the screen value for field KUNNR is in the SCREEN_VALUE-FIELDVALUE and can be used for further processing like using it to fill the internal table to be used as parameter in F4IF_INT_TABLE_VALUE_REQUEST ETC.

F4IF_FIELD_VALUE_REQUEST

This FM is used to display value help or input from ABAP dictionary.We have to pass the name of the structure or table(TABNAME) along with the field name(FIELDNAME) . The selection can be returned to the specified screen field if three

parameters DYNPNR,DYNPPROG,DYNPROFIELD are also specified or to a table if RETRN_TAB is specified.

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

EXPORTING

TABNAME = table/structure

FIELDNAME = 'field name'

DYNPPROG = SY-CPROG

DYNPNR = SY-DYNR

DYNPROFIELD = 'screen field'

IMPORTING

RETURN_TAB = table of type DYNPREAD

.

F4IF_INT_TABLE_VALUE_REQUEST

This FM is used to dsiplay values stored in an internal table as input

help.This FM is used to program our own custom help if no such input help

exists in ABAP dictionary for a particular field. The parameter VALUE_TAB is used to pass the internal table containing input values.The parameter RETFIELD

is used to specify the internal table field whose value will be returned to the screen field or RETURN_TAB.

If DYNPNR,DYNPPROG and DYNPROFIELD are specified than the user selection is passed to the screen field specified in the DYNPROFIELD. If RETURN_TAB is specified the selectionis returned in a table.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = field from int table whose value will be returned

DYNPPROG = SY-CPROG

DYNPNR = SY-DYNNR

DYNPROFIELD = 'screen field'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = internal table whose values will be shown.

RETURN_TAB = internal table of type DDSHRETVAL

EXCEPTIONS

parameter_error = 1

no_values_found = 2

others = 3.

POPUP_WITH_TABLE_DISPLAY

This FM is used to display the contents of an internal table in a popup window.The user can select a row and the index of that is returned in the CHOISE

parameter.The VALUETAB is used to pass the internal table.

A suitable title can be set using TITLETEXT parameter. The starting and end position of the popup can be specified by the parameters STARTPOS_COL / ROW and ENDPOS_ROW / COL .

CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

EXPORTING

ENDPOS_COL =

ENDPOS_ROW =

STARTPOS_COL =

STARTPOS_ROW =

TITLETEXT = 'title text'

IMPORTING

CHOISE =

TABLES

VALUETAB =

EXCEPTIONS

BREAK_OFF = 1

OTHERS = 2.

e.g.

DATA: w_choice TYPE SY-TABIX.

DATA: BEGIN OF i_values OCCURS 0 WITH HEADER LINE,

values TYPE I,

END OF i_values.

PARAMETRS : id TYPE I.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR id

i_values-values = '0001'.

APPEND i_values.

i_values-values = '0002'.

APPEND i_values.

i_values-values = '0003'.

APPEND i_values.

i_values-values = '0004'.

APPEND i_values.

CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'

EXPORTING

ENDPOS_COL = 40

ENDPOS_ROW = 12

STARTPOS_COL = 20

STARTPOS_ROW = 5

TITLETEXT = 'Select an ID'

IMPORTING

CHOISE = w_choice

TABLES

VALUETAB = i_values

EXCEPTIONS

BREAK_OFF = 1

OTHERS = 2.

CHECK w_choice > 0.

READ TABLE i_values INDEX w_choice....now we can process the selection as it is contained

...in the structure i_values.

Other FM that may be used to provide input help is HELP_START .

<b>Reward points for useful Answers</b>

Regards

Anji

former_member189059
Active Contributor
0 Kudos

Difference between RFC and BAPI

BAPI are RFC enabled function modules. The difference between RFC and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. In this case u only specify the business object and its method from external system. in BAPI there is no direct system call. While RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.

check these links

http://searchsap.techtarget.com/ateQuestionNResponse/0,289625,sid21_cid558752_tax293481,00.html

http://www.sap-img.com/abap/interview-question-on-bapi-rfc-abap-objects-tables.htm

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

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

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.

BAPI

BAPI stands for Business API(Application Program Interface).

A BAPI is remotely enabled function module

ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..

You can make your function module remotely enabled in attributes of Function module but

A BAPI are standard SAP function modules provided by SAP for remote access.

Also they are part of Businees Objest Repository(BOR).

BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects.

You create business objects and those are then registered in your BOR (Business Object Repository)

which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA.

In this case u only specify the business object and its method from external system

in BAPI there is no direct system call. while RFC are direct system call.

Some BAPIs provide basic functions and can be used for most SAP business object types.

These BAPIs should be implemented the same for all business object types.

Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs.

Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.

Badi......

BADI(Business Add-In) is the object oriented method of user exits...

Each BAdI has a definition and more than one implementation. The definition means the methods(in class concept) that are used for performing various functions. The BAdI definition can be viewed in SE18 transaction(for standard ones) and user-defined BAdIs can be created in the same transaction as well.

When you create a BAdI definition, an class interface will be automatically created and you can define your methods in the interface. The implementation of the methods can be done in SE19 transaction

Check these links for info about badi..

http://help.sap.com/saphelp_erp2005/helpdata/en/73/7e7941601b1d09e10000000a155106/frameset.htm

http://support.sas.com/rnd/papers/sugi30/SAP.ppt

Intro.....

http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e10000000a11402f/content.htm

refer

/thread/299756 [original link is broken]

Former Member
0 Kudos

<b>FIELD - MODULE </b>

Syntax

FIELD dynp_field MODULE mod {ON INPUT}

| {ON REQUEST}

| {ON *-INPUT}

| {ON {CHAIN-INPUT}|{CHAIN-REQUEST}}

| {AT CURSOR-SELECTION}.

Extras:

1. ... ON INPUT

2. ... ON REQUEST

3. ... ON *-INPUT

4. ... ON {CHAIN-INPUT}|{CHAIN-REQUEST}

5. ... AT CURSOR-SELECTION

Effect

After the FIELD statement of the dynpro flow logic, at the event PAI you can call the dialog module mod using the MODULE statement. If no condition ON or AT is specified, the module is called immediately after the data transport specified in FIELD.

Besides two conditions of the normal module call, after FIELD you can specify special conditions for the call of the dialog module, which concern the screen field dynp_field.

Addition 1

... ON INPUT

Effect

With this condition, module mod is called only if the screen field dynp_field has a non-initial content. Initial character-type screen fields contain only blanks, initial numeric screen fields contain the value 0.

If the input field has the special attribute *-Input and the user has entered an asterisk as first character in the input field of screen field dynp_field , the condition ON INPUT is not met. Instead, the condition ON *-INPUT is fulfilled (see below).

Note

The module is not even called if the user explicitly entered the initial value of the field.

Addition 2

... ON REQUEST

Effect

With this condition, module mod is called only if the value of the screen field dynp_field has been changed by input after the event PBO. It is considered as input if the existing input is overwritten with the same value or if the initial value of the field is entered explicitly. Besides user input, the following value input results in a call of mod:

Transfer of a default value set via System &#8594; User Profile &#8594; Hold Data. However, this requires the dynpro property Hold Data to be active.

Tansfer of a default value from the SAP Memory. This requires that in the PARAMETER-ID property of a screen element an SPA/GPA parameter is specified.

Transfer of data that is passed in the call of a dialog transaction using the addition USING of the DS:ABAP.CALL_TRANSACTION>CALL TRANSACTION statement.

Transfer of a default value predefined in the system or in the ABAP Dictionary for input/output fields of certain types.

Addition 3

... ON *-INPUT

Effect

With this condition, module mod is called only if the user endered an asterisk ("*") as first character in the input field of screen field dynp_field and if the input field has the special attribute *-Input. The content of dynp_field is passed to the ABAP program without the leading asterisk.

Addition 4

... ON {CHAIN-INPUT}|{CHAIN-REQUEST}

Effect

The conditions ON CHAIN-INPUT and ON CHAIN-REQUEST have the same meaning as if used after a stand-alone MODULE statement.

Addition 5

... AT CURSOR-SELECTION

Effect

The condition AT CURSOR-SELECTION has the same meaning as if used after a stand-alone MODULE statement.

BAPI - Business Application - commonly a function module that is normally RFC enabled as well and acts as a method of a business object. For example, Sales Order as the business object with a method of create - the BAPI is BAPI_SALESORDER_CREATEFROMDAT2.

A BADI is a Business Add-in - one of SAP's methods of implementing a user-exit or change to standard SAP code. BADI's are ABAP object based changes instead of the more common subroutines/function modules.

FM - Local Function Module which runs in a particular system.

Function modules are procedures that are defined in special ABAP programs only, so-called function groups, but can be called from all ABAP programs. Function groups act as containers for function modules that logically belong together. You create function groups and function modules in the ABAP Workbench using the Structure Function Builder.

Function modules allow you to encapsulate and reuse global functions in the SAP System. They are managed in a central function library. The SAP System contains several predefined functions modules that can be called from any ABAP program. Function modules also play an important role during updating and in interaction between different SAP systems, or between SAP systems and remote systems through remote communications.

Unlike subroutines, you do not define function modules in the source code of your program. Instead, you use the Structure Function Builder. The actual ABAP interface definition remains hidden from the programmer. You can define the input parameters of a function module as optional. You can also assign default values to them. Function modules also support exception handling. This allows you to catch certain errors while the function module is running. You can test function modules without having to include them in a program using the Structure Function Builder.

The Structure Function Builder also has a release process for function modules. This ensures that incompatible changes cannot be made to any function modules that have already been released. This applies particularly to the interface. Programs that use a released function module will not cease to work if the function module is changed.

<b>POV </b>

Process On Value Request, Dynpro-event. Triggered when requesting the input help (F4) for an input field on the screen.

<b>SEARCH HELP</b>

A repository object maintained in the ABAP Dictionary. It supplies input fields on Dynpros with single- or multi-column input helps. Search helps can be linked in the Dictionary with components from structures, data elements, and check tables. A search help enables you to search for entry values with assigned data, without you having to know the exact spelling of the value.

Regards,

Pavan