How to use a BAPI function module in programs?
Hi,
I have developed a BAPI enabled Function module & object type in 4.7. I want to use it to retrieve data from table T001 in 4.7 and display the output in 5.0. I am not able to get the data into 5.0. Please suggest me how to do this.
A program example would be appreciated.
Hi Prabhu,
Firstly to say Bapis are version independent though the version is changed it does nt effect .. But as u said u want to fetch the data frm 4.7 tht too from table t005 observe tht the table data is not independent it is dependent tht is the reason why u r able to call the bapi but not able to display the data here . hope u know the procedue to call it in editor ...So now try it and check tht wether data is present in tht 5.0 version table ...t005 . thn it will be solved..if at all it is not working thn it might be problem with the bapi business object u created might be wrong check...
Regards,
Sana.
reward if useful ...
Similar Messages
-
HOw to find the BAPI function module
Hi all,
I have a field called IEVER in table EIKP.
How to find the related BAPI function module and BAPI structure for this filed.
Thanks in advance
KPHi KP,
can you tell us the name of the transaction in which you saw this field?
If it is in PO Creation or Change you can probably look at the bapis
BAPI_PO_CREATE or BAPI_PO_CHANGE
Regards,
Ravi -
How to use SWC_CREATE_OBJECT in Function Module
Hi All,
I need to create a one function module to fill the work flow container field. this work flow builder had only one task, that task is triggering through QM Action box. I need to maintain this function module in AM Action box, FM when saving field.
Please help me how to create a new function module in QM Acion box. When run the QM02 with usage decesion option is triggered Associated task is triggering, now how i will pass the notification number to work flow container.
Please help meI think you can
SWC_CREATE_OBJECT 'QMObject' Object Key
Or you can pass the QM number to the Workflow and use GENERICINSTANTIATE Method of Business Object SYSTEM to instantiate the QM Business Object.
Thanks
Arghadip -
How to use Change doc Function Module?
Fn mod:ZSUBTESTCHG_WRITE_DOCUMENT
Import parameters Value
OBJECTID ZSUBTESTCHG
TCODE SE37
UTIME 00:00:00
UDATE 09.03.2009
USERNAME 'TESTUSER'
PLANNED_CHANGE_NUMBER
OBJECT_CHANGE_INDICATOR I
PLANNED_OR_REAL_CHANGES R
NO_CHANGE_POINTERS
UPD_ICDTXT_ZSUBTESTCHG I
N_ZSUBTEST 2 TEST
O_ZSUBTEST 2 TEST
UPD_ZSUBTEST I
Tables Value
ICDTXT_ZSUBTESTCHG 0 Entries
I have a ztable 'ZSUBTEST' with 2 fields DEPTID and DEPNAME and ticked "change document" for data element.
I have created the above change doc write fn module. I am trying to insert a new reocrd into table.
How to use ZSUBTESTCHG_WRITE_DOCUMENT so that even if i try to change an existing record in ztable the old and new values for a particulat ztable will be filled in CDPOS Table.
Would appreciate if you can suggest me how to use in1) Update and 2) Insert scenarios.
Thanks,
Subbahi check this,
Types Declaration***
types: BEGIN OF X_audit,
Field of ZAUDIT TABLE OR a custom created table------
END OF X_audit.
Data Declaration***
Data: w_newvalues type X_audit,
w_oldvalues type X_audit.
DATA: BEGIN OF t_cdtxt OCCURS 0.
INCLUDE STRUCTURE cdtxt.
DATA: END OF t_cdtxt.
DATA: l_tcode type cdhdr-tcode ,
l_time type cdhdr-utime,
l_usnam type cdhdr-username,
l_date type cdhdr-udate.
**Constants****
CONSTANTS : l_objectid TYPE cdhdr-objectid VALUE 'ZAUDIT_CD'.
Initialization.
Clear: l_tcode,l_time, l_usnam, l_date.
Clear: w_newvalues, w_oldvalues.
**Start-Of-Selection**
Start-of-selection.
*Populating w_oldvalues workarea with old values from the table
Select single * from zaudit_t
Into w_oldvalues
Where belnr eq belnr_1
And gjahr eq gjahr_1
And bukrs eq bukrs_1. u201C where, belnr_1, gjahr_1, bukrs_1 are the fields on selection screen.
here we are populating w_newvalues workarea with new values
W_newvalues-f1 = w_oldvalues-f1
f2 = u2018XXXXXXXu2019 -
f3 = u2018YYYYYYYu2019
f4 = u2018ZZZZZZZu2019
l_tcode = sy-tcode.
l_time = sy-uzeit.
l_usnam = sy-uname.
l_date = sy-datum.
modify the table with new values***
MODIFY zaudit_t FROM w_submit.
IF sy-subrc EQ 0.
MESSAGE 'Document Updated' TYPE 'S'.
call function 'ZAUDIT_CD1_WRITE_DOCUMENT'
exporting
objectid = l_objectid
tcode = l_tcode
utime = l_time
udate = l_date
username = l_usnam
PLANNED_CHANGE_NUMBER = ' '
object_change_indicator = 'U' u201CU-update, I-insert, D-delete
PLANNED_OR_REAL_CHANGES = ' '
NO_CHANGE_POINTERS = ' '
upd_icdtxt_zaudit_cd = 'U'
n_zaudit_t = w_newvalues u201Cpass the work area containing new values
o_zaudit_t = w_oldvalues u201Cpass the work area containing old values
upd_zaudit_t = 'U' u201C this parameter gives the values in the columns(new value, old value and changed field name) of table CDPOS.
tables
icdtxt_zaudit_cd = t_cdtxt
ELSE.
MESSAGE 'Document Not Updated' TYPE 'S'.
ENDIF. u201CIF sy-subrc EQ 0. -
How to use the alv function module
hi all,
can any one help me out how to use reuse_alv_block_list_append function module, what parameters shall i pass to it, so that i get top of page and end of page events and report data in two blocks, can any one tell how can i didvide the data into block, at a particular linehi,
this is my simple alv blockedlist programme.go through it.it will definrtley help u.
REPORT z50870alv_blocked.
TYPE-POOLS : slis.
*& structure declaration
TYPES : BEGIN OF st_ekko,
ebeln TYPE ekko-ebeln, "Purchasing Document Number
bstyp TYPE ekko-bstyp, "Purchasing Document Category
bsart TYPE ekko-bsart, "Purchasing Document Type
aedat TYPE ekko-aedat, "record created on
ernam TYPE ekko-ernam, "Person who Created the Object
END OF st_ekko.
TYPES : BEGIN OF st_ekpo,
ebeln TYPE ekko-ebeln,
ebelp TYPE ekpo-ebelp, "Item Number of Purchasing Document
ematn TYPE ekpo-ematn, "Material number
matkl TYPE ekpo-matkl, "Material group
netpr TYPE ekpo-netpr, "Net price in purchasing document
END OF st_ekpo.
*& internal table and work area declaration
DATA : it_ekpo TYPE STANDARD TABLE OF st_ekpo,
it_ekko TYPE STANDARD TABLE OF st_ekko,
it_fieldcat1 TYPE slis_t_fieldcat_alv,
wa_fieldcat1 TYPE slis_fieldcat_alv,
it_fieldcat2 TYPE slis_t_fieldcat_alv,
wa_fieldcat2 TYPE slis_fieldcat_alv,
it_events Type slis_t_event,
wa_layout TYPE slis_layout_alv.
*& data declaration
DATA : v_ebeln TYPE ekko-ebeln.
*& selection-screen
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-000.
SELECT-OPTIONS : so_ebeln FOR v_ebeln.
SELECTION-SCREEN END OF BLOCK a.
*& At-selection-screen
at selection-screen on so_ebeln.
perform validate_ebeln.
*& start-of-selection
START-OF-SELECTION.
PERFORM data_retrieval.
*& end-of-selection
END-OF-SELECTION.
PERFORM initialize_alv_block.
PERFORM build_fieldcatalog1.
PERFORM build_fieldcatalog2.
PERFORM build_layout.
PERFORM get_events .
PERFORM append_ekkodata_to_alv_block.
PERFORM append_ekpodata_to_alv_block.
PERFORM display_blocked_alv.
*& FORM initialize_alv_block
FORM initialize_alv_block.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = sy-repid.
endform.
*& FORM validate_ebeln
form validate_ebeln.
select ebeln
from ekko
into table it_ekko
where ebeln in so_ebeln.
if sy-subrc ne 0.
message text-003 type 'W'.
endif.
endform.
*& FORM data_retrieval
FORM data_retrieval.
SELECT ebeln bstyp bsart aedat ernam
FROM ekko
INTO TABLE it_ekko
WHERE ebeln IN so_ebeln.
if sy-subrc ne 0.
message text-001 type 'I'.
endif.
SELECT ebeln ebelp ematn matkl netpr
FROM ekpo
INTO TABLE it_ekpo
WHERE ebeln IN so_ebeln.
if sy-subrc ne 0.
message text-002 type 'I'.
endif.
endform.
*& Form build_fieldcatalog1
FORM build_fieldcatalog1.
wa_fieldcat1-fieldname = 'EBELN'.
wa_fieldcat1-seltext_l = 'PURCHASE ORDER'.
wa_fieldcat1-col_pos = 0.
APPEND wa_fieldcat1 TO it_fieldcat1.
wa_fieldcat1-fieldname = 'BSTYP'.
wa_fieldcat1-seltext_l = 'DOCUMENT CATEGORY'.
wa_fieldcat1-col_pos = 1.
APPEND wa_fieldcat1 TO it_fieldcat1.
wa_fieldcat1-fieldname = 'BSART'.
wa_fieldcat1-seltext_l = 'DOCUMENT TYPE'.
wa_fieldcat1-col_pos = 2.
APPEND wa_fieldcat1 TO it_fieldcat1.
wa_fieldcat1-fieldname = 'AEDAT'.
wa_fieldcat1-seltext_l = 'DATE'.
wa_fieldcat1-col_pos = 3.
APPEND wa_fieldcat1 TO it_fieldcat1.
wa_fieldcat1-fieldname = 'ERNAM'.
wa_fieldcat1-seltext_l = 'NAME'.
wa_fieldcat1-col_pos = 4.
APPEND wa_fieldcat1 TO it_fieldcat1.
ENDFORM. "build_fieldcatalog
*& Form build_fieldcatalog2
FORM build_fieldcatalog2.
wa_fieldcat2-fieldname = 'EBELN'.
wa_fieldcat2-seltext_l = 'PURCHASE ORDER'.
wa_fieldcat2-col_pos = 0.
APPEND wa_fieldcat2 TO it_fieldcat2.
wa_fieldcat2-fieldname = 'EBELP'.
wa_fieldcat2-seltext_l = 'ITEM NUMBER'.
wa_fieldcat2-col_pos = 1.
APPEND wa_fieldcat2 TO it_fieldcat2.
wa_fieldcat2-fieldname = 'EMATN'.
wa_fieldcat2-seltext_l = 'MATERIAL TYPE'.
wa_fieldcat2-col_pos = 2.
APPEND wa_fieldcat2 TO it_fieldcat2.
wa_fieldcat2-fieldname = 'MATKL'.
wa_fieldcat2-seltext_l = 'MATERIAL GROUP'.
wa_fieldcat2-col_pos = 3.
APPEND wa_fieldcat2 TO it_fieldcat2.
wa_fieldcat2-fieldname = 'NETPR'.
wa_fieldcat2-seltext_l = 'NET PRICE'.
wa_fieldcat2-col_pos = 4.
wa_fieldcat2-do_sum = 'X'.
APPEND wa_fieldcat2 TO it_fieldcat2.
ENDFORM. "build_fieldcatalog
*& form build_layout.
FORM build_layout.
wa_layout-zebra ='X'.
wa_layout-no_vline = 'X'.
wa_layout-no_hline = 'X'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-window_titlebar = 'PURCHASE ORDER HEADER AND ITEM DETAILS'.
ENDFORM. "build_layout
*& form append_ekkodata_to_alv_block
FORM append_ekkodata_to_alv_block.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout
it_fieldcat = it_fieldcat1
i_tabname ='it_ekko'
it_events = it_events[]
IT_SORT = IT_SORT
I_TEXT = ' '
TABLES
t_outtab = it_ekko
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 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.
endform.
*& form append_ekpodata_to_alv_block
FORM append_ekpodata_to_alv_block.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = wa_layout
it_fieldcat = it_fieldcat2
i_tabname ='it_ekpo'
it_events = it_events[]
IT_SORT = IT_SORT
I_TEXT = ' '
TABLES
t_outtab = it_ekpo
EXCEPTIONS
PROGRAM_ERROR = 1
MAXIMUM_OF_APPENDS_REACHED = 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.
endform.
*& FORM display_blocked_alv.
FORM display_blocked_alv.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
endform.
*& Form GET_EVENTS
FORM get_events .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 2
IMPORTING
et_events = it_events[]
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " GET_EVENTS\
regards,
pavan t. -
How to use fieldtab with Function Module F4IF_INT_TABLE_VALUE_REQUEST
Hi,
I'm using the function module F4IF_INT_TABLE_VALUE_REQUEST to build a matchcode in a selection screen parameter.
The internal table that I use have 3 fields:
GROUPID like APQI-GROUPID,
CREDATE like APQI-CREDATE,
STATE type string.
STATE is not in ABAP dictionary, so the function doesn't show this field. I need this field having field label 'STATUS'
I have tried to use table FIELDTAB, but I cannot resolv the problem.
Can anyone help me?
Kind RegardsHi
See the following ex:
TYPES: BEGIN OF TY_MBLNR,
MBLNR LIKE MKPF-MBLNR,
END OF TY_MBLNR.
DATA: IT_MBLNR TYPE STANDARD TABLE OF TY_MBLNR WITH HEADER LINE.
data: it_ret like ddshretval occurs 0 with header line.
At selection-screen on value-request for s_mat-low.
Select MBLNR from mkpf into table it_mblnr.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'MBLNR'
PVALKEY = ' '
DYNPPROG = ' '
DYNPNR = ' '
DYNPROFIELD = ' '
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
VALUE_TAB = IT_MBLNR
FIELD_TAB =
RETURN_TAB = IT_RET
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 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.
IF SY-SUBRC = 0.
read table it_ret index 1.
move it_ret-fieldval to S_mat-low.
ENDIF.
Go through the test program.
REPORT Ztest_HELP .
TABLES : MARA.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_MATNR(10) TYPE C.
SELECTION-SCREEN END OF BLOCK B1.
DATA : BEGIN OF ITAB OCCURS 0,
MATNR TYPE MATNR,
END OF ITAB.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.
SELECT MATNR
FROM MARA
INTO TABLE ITAB
UP TO 10 ROWS.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'MATERIAL NUMBER'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_MATNR'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = ITAB
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
Regards
Anji -
How to Use F4 help in Module Pool Programming??????
Hi Friends,
This is Jagadeesh, I have an issue Module Pool Programming. Any of you can go through on this and can give an required answer.
Issue is as follows,
I have an Input/Output field for that i need to give f4 help, based on that field the related data should sit in to my table control. The thing is there is no relation between the input/output field and the table control fields.
Is this possible? If so how can i do this.Hi Jagadeesh,
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 .
regards,
Dj
reward for all useful answers. -
How to use macro's functionality in a programe...?
hi,
i am siva,
i am new to abap,
i am not having clarity on how to use macro in a programe,
please send me any source code of a programe which
contain functionality of macros..?
and explain functionality of macros...?
i any of u know answer..
please send me source code of a programe that use macros...?
reguars,
siva.Hi,
<u>Macros:</u>
If you want to reuse the same set of statements more than once in a program, you can include
them in a macro. For example, this can be useful for long calculations or complex WRITE
statements. You can only use a macro within the program in which it is defined, and it can only
be called in lines of the program following its definition.
The following statement block defines a macro <macro>:
DEFINE <macro>.
<statements>
END-OF-DEFINITION.
You must specify complete statements between DEFINE and END-OF-DEFINITION. These
statements can contain up to nine placeholders (&1, &2, ..., &9). You must define the macro
before the point in the program at which you want to use it.
Macros do not belong to the definition part of the program. This means that the DEFINE...ENDOF-
DEFINITION block is not interpreted before the processing blocks in the program. At the
same time, however, macros are not operational statements that are executed within a
processing block at runtime. When the program is generated, macro definitions are not taken
into account at the point at which they are defined. For this reason, they do not appear in the
overview of the structure of ABAP programs [Page 44].
A macro definition inserts a form of shortcut at any point in a program and can be used at any
subsequent point in the program. As the programmer, you must ensure that the macro
definition occurs in the program before the macro itself is used. Particular care is required if you
use both macros and include programs, since not all include programs are included in the syntax
check (exception: TOP include).
To use a macro, use the following form:
<macro> [<p1> <p2> ... <p9>].
When the program is generated, the system replaces <macro> by the defined statements and
each placeholder &i by the parameter <pi>. You can use macros within macros. However, a
macro cannot call itself.
Ex:
DATA: RESULT TYPE I,
N1 TYPE I VALUE 5,
N2 TYPE I VALUE 6.
DEFINE OPERATION.
RESULT = &1 &2 &3.
OUTPUT &1 &2 &3 RESULT.
END-OF-DEFINITION.
DEFINE OUTPUT.
WRITE: / 'The result of &1 &2 &3 is', &4.
END-OF-DEFINITION.
OPERATION 4 + 3.
OPERATION 2 ** 7.
OPERATION N2 - N1.
The produces the following output:
The result of 4 + 3 is 7
The result of 2 ** 7 is 128
The result of N2 - N1 is 1
Here, two macros, OPERATION and OUTPUT, are defined. OUTPUT is nested in
OPERATION. OPERATION is called three times with different parameters. Note how
the placeholders &1, &2, ... are replaced in the macros.
Regards,
Bhaskar -
How to use table control in module pool programming
Hi
I want to use a table control to fetch some data from mara table.
Please guide me with the procedure and the steps which I can follow to complete my program correctly.
thanks
Lalit GuptaAs [vinraaj|http://forums.sdn.sap.com/profile.jspa?userID=3968041] wrote, call transaction SE51, there is a Wizard to help you generate the table control, it will create the table control and some includes with PBO/PAI modules > Read [Using the Table Control Wizard|http://help.sap.com/saphelp_bw/helpdata/en/6d/150d67da1011d3963800a0c94260a5/frameset.htm]
Also there is a tutorial in the wiki, read [Learn Making First Table Control |http://wiki.sdn.sap.com/wiki/display/ABAP/LearnMakingFirstTableControl] by [Krishna Chauhan|http://wiki.sdn.sap.com/wiki/display/~nc0euof]
Regards,
Raymond -
Stuck with Bapi Function module BAPI_STSRVAPS_SAVEMULTI2
Hi all,
I have been given the requirement to get the stock quantity using the bapi function module BAPI_STSRVAPS_GETLIST2 from the Livacache and depending upon some stock reservation percent split the stock into two as (NEW STOCK and STOCK RESERVED ).And then write it back to Livecache as change and create.
Please do tell me how to proceed with it.
Thanks and Regards.
syed.hi
hope the following helps u to know what is to be passsed.
1. Required entries :
BILLING_DATA_IN-SALESORG
BILLING_DATA_IN-DISTR_CHAN
BILLING_DATA_IN-DIVISION
BILLING_DATA_IN-DOC_TYPE
BILLING_DATA_IN-ORDBILLTYP
BILLING_DATA_IN-SOLD_TO
BILLING_DATA_IN-ITEM_CATEG
BILLING_DATA_IN-REQ_QTY
BILLING_DATA_IN-SALES_UNIT
BILLING_DATA_IN-CURRENCY
If a material is billed for which a material master needs to be
determined (BILLING_DATA_IN-NO_MATMAST = ' '), you must make the
following entries :
BILLING_DATA_IN-PLANT
BILLING_DATA_IN-MATERIAL
If, on the other hand, a material is billed for which no material
master is to be determined (BILLING_DATA_IN_NO_MATMAST = 'X'), you
must make the following entries :
BILLING_DATA_IN-COUNTRY
BILLING_DATA_IN-MATERIAL
BILLING_DATA_IN-TAXCL_1MAT
2. COMMIT control :
In the update run (TESTRUN = ' ') the update is carried out by
COMMIT
WORK as part of the method available. -
How to config Check Digits function module for Student Number Validation
Hi SLCM Experts,
In the SAP-SLCM, How to use check digits function module for validate student number. Just only config it or need to customizing program.
*Any idea to student number validation in SLCM?*
Best Regards,
Suvatchai K.Hi ,
Can you expalin it further ?
You configure the St. no in piq_matr . And set it as external or internal no. range which suits your business .
What is the validation you are looking for ?
Regards
Gajalakshmi -
Using subroutines in Function Module
Hi , experts ,
I want to know how to use performs in function module,
If created subroutine must be used in all FM in Func.Group ?
if you have articles about this or any information , I will be glad .
Please help.
Regards,
Tatiana.If i am not mistaken you want to use forms in function module.
To enable forms in function module you have to follow these steps:
Create a Z include in your function module.
INCLUDE ZTEST_INCLUDE.
Inside this include you need to write your form routine which will be accessable from your function module.
Now you can use perform statement in your funtion module.
Thnaks & Regards,
Lalit Mohan Gupta -
BAPI Function module to change the schedule agreement
Hello Experts,
Can anyone tell me Bapi function module to change the scheduling agreement,
my requirement is i will get the new AEDAT(Delivery date in schedule line)
and WMENG(Quantity) Every time customer sends me a flat file which has got
revised schedule delivery date and Quantity. It needs to be updated in my system
using a BAPI Functional Module.Hi Vivek,
You must use the correct or most appropriate forum, so this thread will be moved from to .
The forum is dedicated to: Data Transfer Techniques, Batch Data Communication, Legacy System Migration Workbench, Application Link Enabling, IDOCs, BAPIs.
Please see the [Forum Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] before posting.
Also read this thread Welcome and Rules of Engagement.
Greetings,
Marcelo Ramos -
How to define null or empty value in BAPI function modules?
Hi,
I have problem with BAPI functions, where some parameters are mandatory.
For example: when I try to use HR BAPI's(BAPI_PERSDATA_CHANGE, etc.) I have to insert parameters like SUBTYPE,OBJECTID,LOCKINDICATOR. The PA0002 table that is used from this BAPI doesn't have SUBTYPE, OBJECTID, LOCKINDICATOR, for any of the records that I would like to select.
So what I tried, was to put a ' ', to indicate that is empty. It returned an error message saying "Make an entry in all required fields". Next tried to put in some values for these fields -- and it returned an error message saying "No data selected from 0002 for this period".
I also tried to run BAPI_FAMILY_CHANGE that uses data from table PA0021. Here I found some records with SUBTYPE, OBJECTID fields that were not empty, but LOCKINDICATOR was still missing. So I tried to put LOCINDICATOR value directly in to database (with MS SQL Enterprise Manager). After that I was able to use BAPI_FAMILY_CHANGE.
I think that manually inserting data in database is not normal procedure.
Is there something that I have missed out?
I mean -- how can I get this to work without inserting data directly in database?
How can I define null or empty value in BAPI function modules?
Thank you in advance.
Best regards,
MihailDefining an empty value for a parm in a table is easy.
First get the function's definition from the SAP system
Second only populate the fields for which you have a value to set
Third execute the function.
The JCO takes care of the rest.
Enjoy -
How to find Exits in Function Module & BAPI
Hi,
How to find exits in Function Module & BAPI.
Thanks In advanceHi,
i ve a standard FM IDOC_INPUT_SALESORDER_CREATEFR which creates sales order using BAPI (inbound process).
Now my requirement is to check for some custom segment field if its not initial i ve to change item category field in line item for sales order.
could u pls help me in this.
Thanks in advance.
Maybe you are looking for
-
I have an Apple TV (3rd Gen) and Apple Time Capsule (4th Gen). How can I access Movies and Music stored in the Time Capsule from Apple TV. This is very n't give frustrating that Apple doesn't give their customers with an straight forward access to t
-
I am an apple fanatic and sometime last year I purchased an iPhone 4 from another guy in Pretoria. The phone had no battery and the screen was broken. I went on to fix all these problems. The phone was working perfectly but when I went on to see that
-
Conditions Types during creation of Quotation
Dear All , I want to know from where the condition types are fetched during creation of quotation in ME47 . These condition types are not fetched from vendor schema thats for sure . I want to know which pricing procedure is responsible for
-
My daughter's 13" late 2011 MacBook Pro has frozen (null sign displays) after Yosemite installation. I can, however, boot from a clone of my MacBook Air that is on an external drive. I reinstalled Yosemite on the MBP HD, but it still hangs in mid ins
-
How do I add a picture box that can be filled in by customers?
Hi I am trying to make a fill in form that has a field that whoever is filling in the form can add their own picture, please help