Macros in ABAP-HR
Hi
I Have worked some macros using PNP Logical database but Can i use macros in PCH logical database?? How can i do?
Some examples please.
Regards
Gregory
I do agree with Robert's statement but sometimes these are so easy that you write just one line and you get the data so nicely into your internal tables.
For example :
data : it_0002 type table of pa0002.
RP-READ-INFOTYPE pernr 0002 it_0002 begda enda returns all valid data for that employee into the table it_0002.This is very usually to find the presently active record when you give :
RP-READ-INFOTYPE pernr 0002 it_0002 sy-datum sy-datum.
Other commonly used macros are :
The macro RP-PROVIDE-FROM-LAST retrieves the last(latest) data record which is valid in the data selection period.
The macro RP-PROVIDE-FROM-FRST retrieves the first(start)data record which is valid in the data selection period.
Mathews
Similar Messages
-
Hi Gurus,
What is the exact use of macros in abap-hr.Because in normal abap also these macros are existing , but we will not use these in normal abap programming.So is there any specific reason for using macros in ABAP-HR.
Thanks in advance..
Regards,
Rakesh.This is similar to Logical Database usage. We use LDBs in HR more than in other module. SAP has created many macros that can be used in HR. Ex: you have some macros to make use of when using PNP LDB in your program. Similarly SAP provided macros to read text from PCL1 cluster table. Same thing with reading payroll results. In addition you also can define your own macros in the program and use them in the code.
-
Hi
Is there any way I can see the Macros in abap? ( I mean over view ) .
Cheers
UsmanYes See the table in SM30 <u><b>TRMAC</b></u> . Youll get all Macros ..
Please award point if its help you .
Thanks
SK
Message was edited by: Saquib Khan -
How to translate an excel macro to ABAP code
Hi Guys,
My requirement is need to put the subtotaling option w.r.t divison when i download the file to an excel sheet via OLE.
Iam able to get the records in the excel sheet but unable to write the macro in ABAP code.
the macro which i recorded in Excel is
Range("A1:C3").Select
Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(3), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
how do i convert this into ABAP code .Pls help. Thanks...
the data might be like
NAME DIVISION AMOUNT
ABC IT 400
DEF BPO 500
HTG IT 400Hi,
You can run an excel macro like this
CREATE OBJECT h_excel 'EXCEL.APPLICATION'.
Call Method of h_excel 'WORKBOOKS' = h_mapl.
set property of h_excel 'VISIBLE' = 0.
Call Method of h_mapl 'OPEN'
EXPORTING
#1 = d_file.
CALL METHOD OF H_EXCEL 'ActiveWorkbook' = h_book .
CALL METHOD OF H_book 'Activesheet' = H_sheet .
CALL METHOD OF h_excel 'RUN'
EXPORTING
#1 = ld_macro.
Check the links below as well
http://sample-code-abap.blogspot.com/2009/07/controlling-excel-using-ole-automation.html
http://arthur_ong.tripod.com/xab017.htm -
Translating an excel macro to ABAP
Hi Guys,
My requirement is need to put the subtotaling option w.r.t divison when i download the file to an excel sheet via OLE.
Iam able to get the records in the excel sheet but unable to write the macro in ABAP code.
the macro which i recorded in Excel is
Range("A1:C3").Select
Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(3), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
how do i convert this into ABAP code .Pls help. Thanks...
the data might be like
NAME DIVISION AMOUNT
ABC IT 400
DEF BPO 500
HTG IT 400Hi,
You can run an excel macro like this
CREATE OBJECT h_excel 'EXCEL.APPLICATION'.
Call Method of h_excel 'WORKBOOKS' = h_mapl.
set property of h_excel 'VISIBLE' = 0.
Call Method of h_mapl 'OPEN'
EXPORTING
#1 = d_file.
CALL METHOD OF H_EXCEL 'ActiveWorkbook' = h_book .
CALL METHOD OF H_book 'Activesheet' = H_sheet .
CALL METHOD OF h_excel 'RUN'
EXPORTING
#1 = ld_macro.
Check the links below as well
http://sample-code-abap.blogspot.com/2009/07/controlling-excel-using-ole-automation.html
http://arthur_ong.tripod.com/xab017.htm -
How to call HR Macros in ABAP-Webdynpro
HI all,
I want to extract HR data in webdynpro view.
Where should I give Logical Database PNP?
The ifnotypes key word is not accepting in Webdynpro coding?
Where should I give GET PERNR event in Webdynpro?
When I use RP_PROVIDE_FROM_LAST .... says error message
Statement "RP_PROVIDE_FROM_LAST" is not defined. Check your spelling .
How to use the Macros in Webdynpro (VIEW) methods.
First time I'm working in ABAP-HR Webynpro.
Please help me out..
Thanks,
PrasadHi,
How did u solve this? pls provide the solution.
Regards,
Lakshmi. -
Calling HR Macros in ABAP-Webdynpro
HI all,
I want to extract HR data in webdynpro view.
Where should I give Logical Database PNP?
The ifnotypes key word is not accepting in Webdynpro coding?
Where should I give GET PERNR event in Webdynpro?
When I use RP_PROVIDE_FROM_LAST .... says error message
Statement "RP_PROVIDE_FROM_LAST" is not defined. Check your spelling .
How to use the Macros in Webdynpro (VIEW) methods.
First time I'm working in ABAP-HR Webynpro.
Please help me out..
Thanks,
PrasadHi,
I suspect that you are in a right forum. Please post it to appropriate forum. -
Running Excel macros from ABAP
Hello everyone,
I am trying to execute an Excel macro from an ABAP program. We are currently on a 46C system. While doing some research on help.sap.com I came across the method execute_macro in class i_oi_document_proxy. Ive never used methods in ABAP before and Im not really sure what Im doing. Has anyone got this to work? When I try to run the program it dumps with error OBJECTS_OBJREF_NOT_ASSIGNED.
Thanks,
Becky
Here is the program:
REPORT ztest_program.
INCLUDE ole2incl.
DATA gs_excel TYPE ole2_object .
DATA gs_wbooks TYPE ole2_object .
DATA gs_wbook TYPE ole2_object .
DATA gs_application TYPE ole2_object .
DATA: h_sheet TYPE ole2_object.
DATA: document TYPE REF TO i_oi_document_proxy.
*Name of the macro in Excel
DATA: macro_string(50) TYPE c
VALUE 'FB03process.FromTheBeginning',
no_flush TYPE c,
param_count TYPE i VALUE 0,
script_name TYPE c VALUE 'X',
error TYPE REF TO i_oi_error
OCCURS 0 WITH HEADER LINE,
retcode TYPE soi_ret_string,
error_string(50) TYPE c,
retvalue(30) TYPE c.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = text-007
EXCEPTIONS
OTHERS = 1.
CREATE OBJECT gs_excel 'EXCEL.APPLICATION' .
SET PROPERTY OF gs_excel 'Visible' = 1 .
GET PROPERTY OF gs_excel 'Workbooks' = gs_wbooks .
GET PROPERTY OF gs_wbooks 'Application' = gs_application .
*--Opening the existing document
CALL METHOD OF gs_wbooks 'Open' = gs_wbook
EXPORTING #1 = 'D:\temp\FB03process.xls' .
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
text = text-009
EXCEPTIONS
OTHERS = 1.
GET PROPERTY OF gs_excel 'ACTIVESHEET' = h_sheet.
CALL METHOD document->execute_macro
EXPORTING macro_string = macro_string
param_count = param_count
script_name = script_name
no_flush = no_flush
IMPORTING error = error
retcode = retcode
CHANGING error_string = error_string
retvalue = retvalue.
disconnect from Excel
FREE OBJECT gs_excel.
PERFORM err_hdl.
FORM err_hdl.
IF sy-subrc <> 0.
WRITE: / 'Fehler bei OLE-Automation:'(010), sy-subrc.
STOP.
ENDIF.
ENDFORM. " ERR_HDLHi,
Please correct me if I am wrong but it seems that you have not fetched a handle to the document object before issuing the statement CALL METHOD document->execute_macro. Hence the error OBJECTS_OBJREF_NOT_ASSIGNED is being dislayed. If you want to use SAP Desktop Office Integration using ABAP Objects, take a look at this article at http://www.intelligenterp.com/feature/archive/ or http://www.sapinfo.net/public/en/index.php4/article/comvArticle-193333c63b4bd807d2/en/articleStatistic
Hope this helps.
Regards
Message was edited by: Shehryar Khan -
Hi everybody,
Could someone help me finding a way to run a macro of an excel sheet with an ABAP program.
Explanation:
- I launch an abap program that opened an excel sheet with that kind of code
include ole2incl.
DATA : w_excel type ole2_object,
w_books type ole2_object,
w_book type ole2_object,
w_sheets type ole2_object,
w_sheet type ole2_object,
w_cell type ole2_object,
w_rows type ole2_object,
w_font type ole2_object.
create object w_excel 'Excel.Application'.
CALL METHOD OF W_EXCEL 'WORKBOOKS' = W_BOOKS.
CALL METHOD OF W_SHEET 'CELLS' = W_CELL
exporting #1 = row
#2 = column.
CALL METHOD OF W_SHEET 'SAVEAS'.
With my ABAP program:
- i can open my excel template.
- i can write and format data inside my excel sheet.
- i can close and save my excel sheet.
but i don't how to run the macro that exists in my excel template.
Thank you in advance.Hi,
Executing Excel Macro from SAP ABAP
I am populating data in excel sheet using OLE. This excel document contains Macro.
Is there any way I can start execution of Macro as soon as data is populated in Excel sheet.
If you are using OLE to populate the Excel Sheet then, then yes you can run a macro.
CALL METHOD OF OBJ_EX_APP 'Run'
EXPORTING #1 = MACROSTR.
Adding a Field Exit
To add a field exit first find the data element that is linked to the screen field- the screen number and program
Run program RSMODPRF. You will need to create two function modules one FIELD_EXIT_MEPO_VENDOR and
FIELD_EXIT_MEPO_VENDOR_A
FIELD_EXIT_MEPO_VENDOR should have code simply of input = ouput.
FIELD_EXIT_MEPO_VENDOR_A should have the code for whatever the functionality is required
Go back to RSMODPRF and run the program without parameters. Use the push buttons to assign the screen, 'A' and program. Use the drop down to activate the field list.
This should now work, but there is no way of debugging. For further information look at OSS 29377
program zzdirlist.
for AIX this method also works.
DATA: BEGIN OF TABL OCCURS 0,
TEXT(80) TYPE C,
END OF TABL.
DATA: COMMAND(256) TYPE C.
COMMAND = 'ls'.
CALL FUNCTION 'RFC_REMOTE_PIPE' DESTINATION 'SERVER_EXEC'
EXPORTING COMMAND = COMMAND
READ = 'X'
TABLES PIPEDATA = TABL.
LOOP AT TABL.
WRITE:/ TABL-text.
ENDLOOP.
Open the following link,
http://www.sap-img.com/abap/questions-about-bar-code-printing-in-sap.htm
Regards,
Jagadish. -
Hi all,
I have the following macro recorded in my excel and want to 'translate' it to abap.
The problem is that though it does not give any error and not sy-subrc <> 0 don't works well.
When I select the cells to which I have put a name, this name does not appear, if I execute the macro from the excel yes it works well.
This is the macro;
ActiveWorkbook.Names.Add Name:="nums", RefersToR1C1:="=Hoja1!R3C1:R8C1"
Though also it works this way;
ActiveSheet.Names.Add Name:="nums", RefersToR1C1:="=Hoja1!R3C1:R8C1"
And this de abap code;
CREATE OBJECT application 'Excel.Application'.
CALL METHOD OF application 'Workbooks' = workbooks.
CALL METHOD OF workbooks 'Add' = workbook.
SET PROPERTY OF application 'Visible' = 0.
GET PROPERTY OF application 'ACTIVESHEET' = worksheet.
SET PROPERTY OF worksheet 'Name' = 'Unidades'.
*....fill cells...
*Option 1;
CALL METHOD OF application 'ActiveWorkbook' = o_workbook.
CALL METHOD OF o_workbook 'names' = o_names.
*Option 2;
*CALL METHOD OF application 'ActiveSheet' = worksheet.
*CALL METHOD OF worksheet 'names' = o_names.
CALL METHOD OF o_names 'Add'
EXPORTING
#1 = 'nums'
#2 = 'Unidades!R3C1:R8C1'.
The problem is to instantiate the object o_name. after "CALL METHOD OF o_workbook 'names' = o_names" if in debbuging I do double-click on the variable, it is empty.
any idea?
Thanks in advance.I did it !!!
CALL METHOD OF application 'ActiveSheet' = worksheet.
CALL METHOD OF worksheet 'Cells' = o_cellstart
EXPORTING
#1 = 3
#2 = 1.
CALL METHOD OF worksheet 'Cells' = o_cellend
EXPORTING
#1 = 184
#2 = 1.
CALL METHOD OF worksheet 'range' = range
EXPORTING
#1 = o_cellstart
#2 = o_cellend.
CALL METHOD OF range 'select'.
SET PROPERTY OF range 'Name' = 'nums'. -
Dear All,
I am trying to debug a Macro in SAP standard Extractor. I am unable to understand the line in bold. following is the Macro code:
DEFINE sel.
when &1.
sort s_t_select by fieldnm.
do.
fetch next cursor g_cursor into id.
if sy-subrc eq 0.
<b> import &2 from database &3(bw) id id.</b>
loop at &2.
cond_select = true.
loop at s_t_select.
"delete" entry if select-option does not fit
assign component s_t_select-fieldnm of
structure &2 to <fs_field>.
if sy-subrc ne 0.
log_write 'E' "message type
'MCEX' "message class
'022' "message number
i_isource "message variable 1
s_estruc. "message variable 2
raise error_passed_to_mess_handler.
endif.
move-corresponding s_t_select to cond_select_tab.
append cond_select_tab.
at end of fieldnm.
if not <fs_field> in cond_select_tab.
cond_select = false.
refresh cond_select_tab.
exit.
endif.
refresh cond_select_tab.
endat.
endloop.
if cond_select eq true.
append &2 to e_t_data.
add 1 to counter.
endif.
endloop.
if s_maximum_size le counter.
exit.
endif.
else.
close cursor g_cursor.
s_flg_no_more_data = true.
exit.
endif.
enddo.
END-OF-DEFINITION.
The call is as follow:
sel 'MC13VD0ITM' mc13vd0itm_tab mc13vd0itmsetup.Hi pooja,
1. import &2 from database &3(bw) id id.
IMPORT
(See F1 Help )
2. The macro line
is importing
from database cluster :
internal table &2
from cluster table &3
3. where &2 &3 are the parameters
passed to the macro while calling.
regards,
amit m. -
Error : in placement of Macro with ABAP code
Hi,
I have to replace the Macro rp-provide-from-last for 0105 infotype with subtype 05 and pn-begda ,pn-endda.please send me the code.
thanks in advance.
bye
raj.Write as :
sort p0105 by pernr SUBTY begda descending.
loop at P0105 where SUBTY = '05'
and endda >= pn-begda
and begda <= pn-endda.
i_p0105 = p0105. <----
endloop. -
Hi,
Is it possible to create a special xls template for the ABAP report in sap. Uh, our key users want to have stock report in xls, which should have the company template form and colored columns
Do you have any experience with that?
Br
sasono response
-
DEFINE macro_split_row_define.
..selection-screen begin of line.
..selection-screen position 10.
..parameters: sp_s&1 as checkbox default 'X' modif id noi.
..selection-screen position 12.
..selection-screen comment (1) text-f41 for field sp_s&1.
..parameters: sp_p&1 like rv56_vt04-f_gestext.
..selection-screen comment (1) text-f41 for field sp_p&1.
..selection-screen pushbutton 62(4) sp&1 user-command sp&1
modif id dsp.
..selection-screen end of line.
END-OF-DEFINITION.
Why they are using periods before selection-screen pleasee help me its urgent?The dots (.) before the selection-screen does not matter at all. It still works the same way as without dots before the selection-screen.
Hope this helps.
Thanks,
Balaji -
Macro swc_set_objectkey in ABAP Class
Hello,
I want to use macro swc_set_objectkey in ABAP class. macro swc_set_objectkey is present in include <object>. I can not include <object> in ABAP class because it gives syntax error "You may only define classes, interfaces, or types in a CLASS-POOL". Can you please let me know what should be done in this case ?
Edited by: Ashwin Sonkusare on Apr 6, 2011 1:55 PMHi Rick,
Is possible to use macros in abap classes ,
review link
http://help.sap.com/saphelp_nw70/helpdata/en/c5/e4b130453d11d189430000e829fbbd/frameset.htm
Regards.
maopacheco.
Maybe you are looking for
-
Seriously, every single step, I've tried. Doesn't work.
-
Cisco WCS 7.x TACACS+ with ACS 5.2
Ok, so I took my bday off today so I could stay home and setup my lab for ie v2 and have the birthday wish of 'leave daddy alone for awhile' come true. Here we are at 7:00pm and everything is flowing good including my blue moons and I decided to get
-
Acrobat Reader X no longer allows search highlights from an external highlight server.
Why did Adobe kill this feature? This really kills my use of dtSearch on my website. Does anyone have a work around or another product as good as dtsearch? This really stinks!!!!
-
GoPro Hero 3 App Preview Problem
I have a GoPro Hero 3 camera which I'm using with the iPad App to preview and import video and photos via WiFi. The App seems to work great, but there's one problem: The prefered video format I want to use 960p/30 fails to load over wifi for preview.
-
HT4623 iPad is locked; problem with iCloud
my iPad is locked up, showing only the message iCloud Backup is unable to access my account. I can't shut it down or go to Settings. What to do?