Hierarchy Function Modules (or Methods)?
I am trying to retrieve all hierarchies, and their children nodes, below a main node. Is there a function module in SEM/BCS for doing this?
Are there other function modules that come in handy with hierarchies?
Thank-You.
There isn't a single FM that I'm aware of. You can piggy back the standard BCS functionality and acheive something similar.
You need to know period, year, version and fiscal year variant.
Then...for this structure:
CG1
- CG2
- CG3
- - CG4
you can pass CG1 as your "parent" and retreive CG2, CG3, and CG4 as selections (according to date-from date-to in your CG master data).
I'll try to include the relevant section for this (it's from a number of methods in a class I created for an outbound interface)....I'm sure I don't have all the data declarations, and I might have a few unnecessary sections.
global variables
data DO_AREA type ref to IF_UC_AREA .
data DO_MODEL type ref to IF_UC_MODEL .
data DO_MD_FACTORY type ref to IF_UG_MD_FACTORY .
initialize objects
*** method for initialize objects
DATA:
lo_factory TYPE REF TO if_ug_md_factory,
lo_char TYPE REF TO if_ug_md_char,
lo_value TYPE REF TO if_ug_md_char_value,
lt_field_val TYPE ugmd_ts_field_val,
ls_field_val TYPE ugmd_s_field_val.
* Initialize master data factory
CALL METHOD cl_uc_area=>if_uc_area~get_md_factory
EXPORTING
i_area = c_cons_area
IMPORTING
eo_md_factory = lo_factory.
do_md_factory = lo_factory.
* get area object, if it's not set
IF do_area IS NOT BOUND.
lo_char = do_md_factory->get_char_instance(
i_fieldname = uc00_cs_fld-area ).
ls_field_val-fieldname = uc00_cs_fld-area.
ls_field_val-value = c_cons_area.
INSERT ls_field_val INTO TABLE lt_field_val.
lo_value = lo_char->get_value_instance(
it_value = lt_field_val ).
do_area ?= lo_value.
* get data model
IF do_model IS NOT BOUND.
CALL METHOD do_area->get_model
IMPORTING
eo_model = do_model.
ENDIF.
ENDIF.
determine lower level consolidation groups
**Include lower level consolidation group nodes in cube selection.
DATA:
lo_context TYPE REF TO if_uc_context,
lt_value TYPE uc0_ts_value,
ls_value TYPE uc0_s_value,
ls_o_sel TYPE uct_sx_sel,
lt_sel TYPE uc0_ts_sel,
ls_sel TYPE uc0_s_sel,
ls_sid TYPE ucd_s_sid,
ls_sel_node TYPE uc0_s_sel_node_sid,
lt_sel_node TYPE uc0_ts_sel_node_sid,
lt_o_sel TYPE uct_t_sel.
CLEAR lt_value.
ls_value-fieldname = c_cgcomp_fieldname. ' /1FB/SEM_CGCOMP
ls_value-value = i_sem_cgcomp. ' "parent" consolidation group
APPEND ls_value TO lt_value.
CALL METHOD do_model->do_sidmap->convert_value_to_sid
EXPORTING
i_fieldname = c_cgcomp_fieldname
it_value = lt_value
IMPORTING
es_sid = ls_sid
EXCEPTIONS
not_found = 1
OTHERS = 2.
CLEAR lt_sel_node.
ls_sel_node-fieldname = c_cgcomp_fieldname.
ls_sel_node-sign = uc00_cs_ra-sign_i.
ls_sel_node-s_node = ls_sid.
INSERT ls_sel_node INTO TABLE lt_sel_node.
CLEAR lt_sel.
CLEAR lt_value.
CALL METHOD do_model->do_data_factory->create_sel
EXPORTING
it_node_sid = lt_sel_node
RECEIVING
eo_sel = ls_o_sel-o_sel.
APPEND ls_o_sel TO lt_o_sel.
CLEAR ls_value.
ls_value-fieldname = '/1FB/CS_VERSION'. " CS Version
ls_value-value = g_cs_version.
APPEND ls_value TO lt_value.
CLEAR ls_value.
ls_value-fieldname = '/BIC/BCS_VERS'. " Custom Version
ls_value-value = g_bcs_vers.
APPEND ls_value TO lt_value.
CLEAR ls_value.
ls_value-fieldname = 'FISCPERIOD'.
ls_value-value = g_fiscperiod.
APPEND ls_value TO lt_value.
CLEAR ls_value.
ls_value-fieldname = 'FISCVARNT'.
ls_value-value = g_fiscvarnt.
APPEND ls_value TO lt_value.
CLEAR ls_value.
ls_value-fieldname = 'FISCYEAR'.
ls_value-value = g_fiscyear.
APPEND ls_value TO lt_value.
CALL METHOD do_model->derive_context
EXPORTING
it_value = lt_value
IMPORTING
eo_context = lo_context
EXCEPTIONS
info_missing = 1
OTHERS = 2.
CALL METHOD ls_o_sel-o_sel->set_context
EXPORTING
io_context = lo_context.
CALL METHOD ls_o_sel-o_sel->get_sel
IMPORTING
et_sel = lt_sel.
* lt_sel will contain the lower-level consolidation groups, beneath the "parent" consolidation group (i_sem_cgcomp)
* Add cons groups to selection criteria
DELETE gt_range WHERE chanm = c_objnm_cgcomp. ' 0SEM_CGCOMP
LOOP AT lt_sel INTO ls_sel.
CLEAR gs_range.
gs_range-chanm = c_objnm_cgcomp. ' 0SEM_CGCOMP
gs_range-sign = ls_sel-sign.
gs_range-compop = ls_sel-option.
gs_range-low = ls_sel-low.
gs_range-high = ls_sel-high.
APPEND gs_range TO gt_range.
ENDLOOP.
Hope that helps...if not, you might be able to do a find for some of the sections of the code to find exactly how SAP is doing (I can only say that this functionality worked in my situation, not sure it works in all consolidation scenarios). FYI - I was using this to read from the virtual cube in a custom task in order to outbound consolidated results.
- Chris
Similar Messages
-
How to Send Internal table to SAP Spool using Function Modules or Methods?
Hi Experts,
How to Send Internal table to SAP Spool using Function Modules or Methods?
Thanks ,
KiranThis is my code.
I still get the no ABAP list data for the spool, even tho I can see it sp01?
REPORT Z_MAIL_PAYSLIP.
* Declaration Part *
tables: PERNR, PV000, T549Q, V_T514D, HRPY_RGDIR.
infotypes: 0000, 0001, 0105, 0655.
data: begin of ITAB occurs 0,
MTEXT(25) type C,
PERNR like PA0001-PERNR,
ABKRS like PA0001-ABKRS,
ENAME like PA0001-ENAME,
USRID_LONG like PA0105-USRID_LONG,
end of ITAB.
data: W_BEGDA like HRPY_RGDIR-FPBEG,
W_ENDDA like HRPY_RGDIR-FPEND.
data: RETURN like BAPIRETURN1 occurs 0 with header line.
data: P_INFO like PC407,
P_FORM like PC408 occurs 0 with header line.
data: P_IDX type I,
MY_MONTH type T549Q-PABRP,
STR_MY_MONTH(2) type C,
MY_YEAR type T549Q-PABRJ,
STR_MY_YEAR(4) type C,
CRLF(2) type x value '0D0A'.
data: W_CMONTH(10) type C.
data: TAB_LINES type I,
ATT_TYPE like SOODK-OBJTP.
data: begin of P_INDEX occurs 0,
INDEX type I,
end of P_INDEX.
constants: begin of F__LTYPE, "type of line
CMD like PC408-LTYPE value '/:', "command
TXT like PC408-LTYPE value 's', "textline
end of F__LTYPE.
constants: begin of F__CMD, "commands
NEWPAGE like PC408-LINDA value '',
end of F__CMD.
data: P_LIST like ABAPLIST occurs 1 with header line.
*data: OBJBIN like SOLISTI1 occurs 10 with header line,
data: OBJBIN like LVC_S_1022 occurs 10 with header line,
DOCDATA like SODOCCHGI1,
OBJTXT like SOLISTI1 occurs 10 with header line,
OBJPACK like SOPCKLSTI1 occurs 1 with header line,
RECLIST like SOMLRECI1 occurs 1 with header line,
OBJHEAD like SOLISTI1 occurs 1 with header line,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_buffer type string,
l_no_of_bytes TYPE i,
l_pdf_spoolid LIKE tsp01-rqident,
l_jobname LIKE tbtcjob-jobname.
data: file_length type int4,
spool_id type rspoid,
line_cnt type i.
*-------------------------------------------------------------------* * INITIALIZATION *
OBJBIN = ' | '.
append OBJBIN.
OBJPACK-HEAD_START = 1.
data: S_ABKRS like PV000-ABKRS.
data: S_PABRP like T549Q-PABRP.
data: S_PABRJ like T549Q-PABRJ.
* SELECTION SCREEN *
selection-screen begin of block BL1.
parameters: PAY_VAR like BAPI7004-PAYSLIP_VARIANT default 'ESS_PAYSLIPS' obligatory.
selection-screen end of block BL1.
START-OF-SELECTION.
s_ABKRS = PNPXABKR.
S_PABRP = PNPPABRP.
s_pabrj = PNPPABRJ.
w_begda = PN-BEGDA.
w_endda = PN-ENDDA.
get pernr.
* "Check active employees
rp-provide-from-last p0000 space pn-begda pn-endda.
CHECK P0000-STAT2 IN PNPSTAT2.
* "Check Payslip Mail flag
rp-provide-from-last p0655 space pn-begda pn-endda.
CHECK P0655-ESSONLY = 'X'.
rp-provide-from-last p0001 space pn-begda pn-endda.
* "Find email address
RP-PROVIDE-FROM-LAST P0105 '0030' PN-BEGDA PN-ENDDA.
if p0105-usrid_LONG ne ''.
ITAB-PERNR = P0001-PERNR.
ITAB-ABKRS = P0001-ABKRS.
ITAB-ENAME = P0001-ENAME.
ITAB-USRID_LONG = P0105-USRID_LONG.
append itab.
clear itab.
endif.
"SY-UCOMM ='ONLI'
END-OF-SELECTION.
*------------------------------------------------------------------* start-of-selection.
write : / 'Payroll Area : ', S_ABKRS.
write : / 'Payroll Period/Year : ',STR_MY_MONTH,'-',STR_MY_YEAR. write : / 'System Date : ', SY-DATUM.
write : / 'System Time : ', SY-UZEIT.
write : / 'User Name : ', SY-UNAME.
write : / SY-ULINE.
sort ITAB by PERNR.
loop at ITAB.
clear : P_INFO, P_FORM, P_INDEX, P_LIST, OBJBIN, DOCDATA, OBJTXT, OBJPACK, RECLIST, TAB_LINES.
refresh : P_FORM, P_INDEX, P_LIST, OBJBIN, OBJTXT, OBJPACK, RECLIST.
* Retrieve Payroll results sequence number for this run
select single * from HRPY_RGDIR where PERNR eq ITAB-PERNR
and FPBEG ge W_BEGDA
and FPEND le W_ENDDA
and SRTZA eq 'A'.
* Produce payslip for those payroll results
if SY-SUBRC = 0.
call function 'GET_PAYSLIP'
EXPORTING
EMPLOYEE_NUMBER = ITAB-PERNR
SEQUENCE_NUMBER = HRPY_RGDIR-SEQNR
PAYSLIP_VARIANT = PAY_VAR
IMPORTING
RETURN = RETURN
P_INFO = P_INFO
TABLES
P_FORM = P_FORM.
check RETURN is initial.
* remove linetype from generated payslip
loop at p_form.
objbin = p_form-linda.
append objbin.
line_cnt = line_cnt + 1.
endloop.
file_length = line_cnt * 1022.
* create spool file of paylsip
CALL FUNCTION 'SLVC_TABLE_PS_TO_SPOOL'
EXPORTING
i_file_length = file_length
IMPORTING
e_spoolid = spool_id
TABLES
it_textdata = objbin.
IF sy-subrc EQ 0.
WRITE spool_id.
ENDIF.
DESCRIBE table objbin.
DATA PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = spool_id
NO_DIALOG = ' '
DST_DEVICE = 'MAIL'
* PDF_DESTINATION =
* IMPORTING
* PDF_BYTECOUNT = l_no_of_bytes
* PDF_SPOOLID = l_pdf_spoolid
* LIST_PAGECOUNT =
* BTC_JOBNAME =
* BTC_JOBCOUNT =
TABLES
PDF = pdf
EXCEPTIONS
ERR_NO_ABAP_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DESTDEVICE = 5
USER_CANCELLED = 6
ERR_SPOOLERROR = 7
ERR_TEMSEERROR = 8
ERR_BTCJOB_OPEN_FAILED = 9
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 11
OTHERS = 12
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Download PDF file C Drive
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\itab_to_pdf.pdf'
filetype = 'BIN'
TABLES
data_tab = pdf.
* Transfer the 132-long strings to 255-long strings
* LOOP AT pdf.
* TRANSLATE pdf USING ' ~'.
* CONCATENATE gd_buffer pdf INTO gd_buffer.
* ENDLOOP.
* TRANSLATE gd_buffer USING '~ '.
* DO.
* it_mess_att = gd_buffer.
* APPEND it_mess_att.
* SHIFT gd_buffer LEFT BY 255 PLACES.
* IF gd_buffer IS INITIAL.
* EXIT.
* ENDIF.
* ENDDO.
OBJHEAD = 'Objhead'.
append OBJHEAD.
* preparing email subject
concatenate W_ENDDA(6)
' Payslip-'
ITAB-ENAME+0(28)
ITAB-PERNR+4(4) ')'
into DOCDATA-OBJ_DESCR.
DOCDATA-OBJ_NAME = 'Pay Slip'.
DOCDATA-OBJ_LANGU = SY-LANGU.
OBJTXT = 'Pay Slip.'.
append OBJTXT.
*prepare email lines
OBJTXT = DOCDATA-OBJ_DESCR.
append OBJTXT.
OBJTXT = 'Please find enclosed your current payslip.'.
append OBJTXT.
* Write Attachment(Main)
* 3 has been fixed because OBJTXT has fix three lines
read table OBJTXT index 3.
* DOCDATA-DOC_SIZE = ( 3 - 1 ) * 255 + strlen( OBJTXT ).
clear OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = 3.
OBJPACK-DOC_TYPE = 'RAW'.
append OBJPACK.
* Create Message Attachment
ATT_TYPE = 'PDF'.
describe table OBJBIN lines TAB_LINES.
read table OBJBIN index TAB_LINES.
* OBJPACK-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + strlen( OBJBIN ).
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = ATT_TYPE.
OBJPACK-OBJ_NAME = 'ATTACHMENT'.
OBJPACK-OBJ_DESCR = 'Payslip'.
append OBJPACK.
* Create receiver list refresh RECLIST.
clear RECLIST.
RECLIST-RECEIVER = itab-USRID_long.
translate RECLIST-RECEIVER to lower case.
RECLIST-REC_TYPE = 'U'.
append RECLIST.
* Send the document
*SO_NEW_DOCUMENT_ATT_SEND_API1
call function 'SO_DOCUMENT_SEND_API1'
exporting
DOCUMENT_DATA = DOCDATA
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
tables
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = pdf
CONTENTS_TXT = OBJTXT
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
RECEIVERS = RECLIST
exceptions
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
others = 8.
if SY-SUBRC NE 0.
ITAB-MTEXT = 'Message Not Sent to : '.
else.
ITAB-MTEXT = 'Message Sent to : '.
endif.
* else.
* ITAB-MTEXT = 'Message Not Sent to : '.
* endif.
else.
"SY-SUBRC Not = 0
ITAB-MTEXT = 'Payroll data not found : '.
endif.
"end of SY-SUBRC = 0.
modify ITAB.
endloop. "end loop at ITAB
sort ITAB by MTEXT PERNR.
loop at ITAB.
at new MTEXT.
uline.
write : / ITAB-MTEXT color 4 intensified on.
write : / 'Emp. Code' color 2 intensified on,
12 'Emp. Name' color 2 intensified on,
54 'Email ID' color 2 intensified on.
endat.
write : / ITAB-PERNR, 12 ITAB-ENAME, 54 ITAB-USRID_LONG.
endloop. -
Process an Interactive Form in a function module or method
Hello,
If I process an interactive form in a report everthing works fine. But when I execute the same coding in a function module or method nothing works! The call of the function module fm_name returns sy-subrc = 1 (usage error).
I believe that function call of 'FP_JOB_OPEN' cause the problems. I can't spool this job in an function module or method.
What can I do for using interactive Forms in a method.
If anybody had the same problem a piece of of coding will help.
Thanks a lot in advance
Roger
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = 'Z_EXPORT_FORM_01'
IMPORTING
e_funcname = fm_name.
Set output parameters and open spool job
fp_outputparams-nodialog = 'X'. " suppress printer dialog popup
fp_outputparams-getpdf = 'X'. " launch print preview
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
Set form language and country (->form locale)
fp_docparams-langu = 'E'.
fp_docparams-country = 'US'.
fp_docparams-fillable = 'X'.
call the generated function module
CALL FUNCTION fm_name
EXPORTING
/1bcdwb/docparams = fp_docparams
/vwk/z_tla_vw_export = wa_z_export
it_vehicle = lt_vehicle
ddinit = ddinit
ddcomplaint = ddcomplaint
ddinformation = ddinformation
ddpraise = ddpraise
ddidea = ddidea
IMPORTING
/1bcdwb/formoutput = fp_formoutput
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.Yes I did.
I have written the code as given below. It is not working either. Can you please check my code.
DATA:
FM_NAME TYPE RS38L_FNAM,
FP_DOCPARAMS TYPE SFPDOCPARAMS,
FP_OUTPUTPARAMS TYPE SFPOUTPUTPARAMS.
fp_outputparams-nodialog = 'X'.
fp_outputparams-getpdf = 'X'.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
Get the name of the generated function module
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = 'ZHR_APPT'
IMPORTING
e_funcname = fm_name.
Set form language and country (->form locale)
fp_docparams-langu = 'E'.
fp_docparams-country = 'US'.
fp_docparams-fillable = 'X'.
call the generated function module
CALL FUNCTION FM_NAME
EXPORTING
/1BCDWB/DOCPARAMS = FP_DOCPARAMS
T_HR = wa_emphr1
IMPORTING
/1BCDWB/FORMOUTPUT =
EXCEPTIONS
USAGE_ERROR = 1
SYSTEM_ERROR = 2
INTERNAL_ERROR = 3.
Thx,
John -
Function module or Method for changing a program with transport
Hi,
Can anybody please let me know if there is any Function module or Method to change a program under a Transport request
(so it needs to go to next Version for the program). I tried using
INSERT REPORT .... with all options for this command. It is changing the program successfully but all are creating the program locally.
I successfully found CIF_PROGRAM_INSERT for creating new program under a TR.
But struggling a lot to find the same kind of FM or Method to change a program.
Can anybody help?
//KothandHi,
Thanks. But i am asking for a Function module which can edit a program and keep it inside a Transport request.
This FM is to import any change request.
//Kothand -
Account Hierarchy : Function Module to get all the nodes of a hierarchy
Hi Experts,
Is there a function module which will give as output all the Node GUIDs for a particular account hierarchy in SAP CRM,when the Node GUID of any single node in the same tree is given as input?
Best Regards,
Ashish DhagatThanks mate.
Edited by: pankaj kandhare on Aug 14, 2011 7:56 AM -
Difference between Function Module Vs Method in Class Module
1) Can you please tell the difference between the Function module used in abap program and the method of the class module used in abap programming.
2) does it necessary to do commit statement after calling the function module.
Thankyou for you time.
Bhaskar.Hi,
1)
Check this difference..
The main difference between real object orientation and function groups is that although a program can work with the instances of several function groups at the same time, it cannot work with several instances of a single function group. Suppose a program wanted to use several independent counters, or process several orders at the same time. In this case, you would have to adapt the function group to include instance administration, for example, by using numbers to differentiate between the instances.
2) COMMIT WORK is required for BAPI..And not required when you normally call a function module..Unless required ..
Example
Update function modules requires COMMIT WORK to execute the function module.
Thanks,
Naren -
How to call ABAP function module/ class method through web service?
Hi Colleagues,
I need to write an iphone version of current ABAP program. I want to call ABAP method and function module through my iphone so that I can re-use the ABAP APIs.So I choose web service. Can you give me any details information about how to do that?
Thank you very muchHi,
you need to create webservice out of FM. goto SE80 and follow the webservice creation wizard. Finally use webservice url for calling FM (remote enabled) from your iPhone.
Regards,
Gourav -
Function Modules or Methods to Retrieve texts in Material Master
Hi All,
Can you get me a list of Function Modules which retrieve the text from Material Master.
My requirement is to extract texts:
Basic Text - at material level
Purchase Order text - at material level
Sales Texts - at material-sales org level
Thanks in Advance.
Sure Points for all Valuable answers
Regards
Vinayakhi
u can get using read_text FM ask ur functionl person to give you the ID and other details required..
u can also get it from STXH table... from which even the FM gets data.. -
How to call function module/ class method of another system.
Suppose now i am working in System A. And i need to check the system Status of System B, System C, System D....
my design is to provide an interface. and each system realize the interface individually.now my question is how cani call the interface, because they are in different systems.
of course i know about the host name, port and logon information over these systems.
who can give my some suggestions or other solutions.
thanks in advance.
Johnney.Hello,
If u want to call a FM of the other system then that FM should be a RFC enable on one.
<b>CALL FUNCTION func DESTINATION dest.</b>
Effect
Executes the function module from an external source (as a Remote Function Call or RFC); dest can be a literal or a variable.
Depending on the specified destination, the function module is executed in another R/3 or R/2 System. Externally callable function modules must be flagged as such in the Function Builder (of the target system).
Since each destination defines its own program context, further calls to the same or different function modules with the same destination can access the local memory (global data) of these function modules.
To maintain existing destinations, choose Tools -> Administration, Administration -> Network -> RFC destinations
Note
Under certain circumstances, an RFC may trigger a database commit. For this reason, RFCs must not be used between pairs of SQL statements that open and close a database cursor (such as SELECT... ENDSELECT).
Vasanth -
BOR object cannot use function module as method
Hi All,
I have a function module with an import parameter referring to data element DE_ABC. BOR indicates that it doesn't support this data type. However, if I define a DB table with a field whose type is DE_ABC and use that field as reference in FM interface definition, that FM can be used by the BOR object. Does anybody have any idea about this issue?
Best Regards
JeromeHello,
Please always mention version. It may help if you told us what data type, but to give a theoretical answer I'd say this would be correct behaviour.
BOR is old, it was created to bring some kind of OO to then procedural ABAP. It has also not changed much, therefore doesn't support some of the newer data types. On the other hand it doesn't look at the components of a structure, so placing an unsupported element into a structure is a perfect workaround.
Be careful however when using deep structures or one of the variable length types such as STRING. As I use classes most of the time I have no idea how they would behave but a quick test should verify whether it works.
Hope that helps,
Mike -
BW - Hierarchy function module
Is there a function module that will return all descendant leaves for HierID/NodeId across all branches?
check this code sample
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9c4de790-0201-0010-6c91-9cae75daa09f
Regards
Raja -
Regarding Function modules and methods
Hi,
which of these calls to GUI_UPLOAD is more efficient?
CALL METHOD cl_gui_frontend_services=>gui_upload
or
CALL FUNCTION GUI_UPLOADboth does the same job. if you look at the code inside the method cl_gui_frontend_services=>gui_upload
it would be calling GUI_UPLOAD function.
in terms of performance efficiency, there will be a very negligible differece and call function will be slightly better in my opinion.
Regards
Raja -
Function Module or Method needed to Convert Nodes?
When I read hierarchies of nodes, the first parent node can be lets say 3, its children are 2. Old logic the I have expects 0, not three for the parent. I can write some logic to convert all but wondering if their was an SAP FM or method I could use instead.
Thank-YouHi Vishnu,
Have a look at this FM.
<b>CO_MP_CREATE_PURCHASE_ORDER</b>
and also this
<b>OIO_RS_M_CREATE_PURCHASE_ORDER</b>
<b>Reward points if this helps,</b>
Kiran -
Calling a Selection Screen from a Function Module/Method
Hi,
I would like to call a selection screen from a function module or method. I understand it is not possible by the definition. Are there any alternative options as I am looking for the Variants Save option on the screen. Any thoughts?
Thanks
RaghavSince i don't know your exact requirements (standard SAP selection screen? your own selection screen?) the onl;y thing i can come up with is:
1. in your function pool create your own screen with a subscreen area
2. create your own selection screen as a subscreen.
3. include the selection subscreen in the first screen
4. call the first screen in your function. -
How to display error message in case of function module ?
In the report i was using " message-id " to display error message....
how to use in function module ?Hi,
Messages in Function Modules and Methods
Messages have two different functions in function modules and methods:
Normal Messages
If you use messages in function modules and methods without the RAISING addition in the MESSAGE statement, and the caller does not catch the message, the message is handled
normally according to the context in which it is called within the function module or method.
Triggering Exceptions with Messages
If you use messages in function modules and methods with the addition
... RAISING <exc>
the way in which the message is handled depends on whether the calling program handles the exception <exc> or not.
If the calling program does not handle the exception, the message is displayed and handled according to the context in which it occurs in the function module or method from which it
was called.
If the calling program handles the exception, the message is not displayed. Instead, the procedure is interrupted in accordance with the message type, and processing returns to the calling program. The contents of the message are placed in the system fields SY-MSGID, SY-MSGTY, SY-MSGNO, and SY-MSGV1 to SY-MSGV4.
Catching Message in the Calling Program
You can catch messages from function modules that are not sent using the RAISING addition in the MESSAGE statement by including the implicit exception ERROR_MESSAGE in the
EXCEPTIONS list of the CALL FUNCTION statement. The following conditions apply:
Type S, I, and W messages are ignored (but logged during background processing)
Type E and A messages trigger the exception ERROR_MESSAGE
Type X messages trigger the usual runtime error and short dump.
Catching messages is not currently supported for methods.
Regards,
Bhaskar
Maybe you are looking for
-
Hi all, In f-48 I need to make an advance payment with reference of Purchase order and its payment terms. Say suppose payment term of Purchase order is 25% then in the advance payment(f-48) you enter should not be more than 25% of the total amount o
-
Converted raw (or .dng) will not open in ACR?
OK, now that I've gotten sort-of over the hurdle of synching all the pieces associated with a smart object, I've hit the NEXT hurdle (SOs appear to be the usual double-edged sword - kinda handy in a way but rife with pitfalls and hurdles)... I open a
-
which profile came with my 17 inch macbook pro. I have been playing around with calibration and don't know what the original was called that it came with! just want to click on it and see what it looks like thanks diana
-
Now we contemplate an upgrade from Solaris 8 to 10. What kind of case are the operations of "X Window" needed when upgrading from 8 to 10 ? In the following cases, we need the operations of X Window. *installation and maintainance(?) of business soft
-
Initial Load - AS ABAP - getting only user with a group
Hi, when i start initial load, i just get users with groups. Is that standard? Br, Philip