ABAP code used in transaction SU01
Hi all,
Can anyone tell me that whether is there any method by which I can pass the user id and can know whether that user has the SAP_ALL profile or not.
The above is done by using the transaction SU01,but I need the ABAP code that is being used in this transaction.
Regards,
Varun.
YOu can query the table:
UST04
select single * from UST04 where BNAME = sy-uname
and PROFILE = 'SAP_ALL'.
if sy-subrc = 0.
write:/ 'The User' sy-uname 'has SAP_ALL profile'.
endif.
Regards,
Ravi
Similar Messages
-
Hi Gurus;
Can some one send me the abap codes used mainly for reporting OR can some one give me some sample code used in reporting. my mail id "[email protected]".smod > rsr0001 > EXIT_SAPLRRS0_001 > ZXRSRU01 >
CASE I_VNAM.
WHEN 'ZE_FPPT'.
CALL FUNCTION 'Z_VAR_FP4'
EXPORTING
I_VNAM = i_vnam
I_STEP = i_step
I_T_VAR_RANGE = I_T_VAR_RANGE
IMPORTING
E_T_RANGE = E_T_RANGE.
FUNCTION Z_VAR_FP4.
""Local Interface:
*" IMPORTING
*" REFERENCE(I_VNAM) LIKE RSZGLOBV-VNAM
*" REFERENCE(I_STEP) TYPE I DEFAULT 0
*" REFERENCE(I_T_VAR_RANGE) TYPE RRS0_T_VAR_RANGE
*" EXPORTING
*" VALUE(E_T_RANGE) TYPE RSR_T_RANGESID
data: l_s_range type rsr_s_rangesid.
data: LOC_VAR_RANGE LIKE RRRANGEEXIT.
data: year(4).
data: mth(2).
IF I_STEP = 2 .
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE
( VNAM = '0I_FPER' ).
year = LOC_VAR_RANGE-HIGH+0(5).
mth = LOC_VAR_RANGE-HIGH+5(2).
if mth < 10.
concatenate '0' mth into mth.
endif.
concatenate year '0' mth into L_S_RANGE-HIGH.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
ENDLOOP.
ENDIF.
ENDFUNCTION.
Regards,
BWer
Assign points if helpful.
Message was edited by: BWer -
How To debug ABAP code using sapui5 application on NWBC
Hi All
I am working on NWBC with SAP_PAO_HRPROFESSIONAL_3 Role. This role contains SAPUI5 application. I am trying debug the ABAP code called while executing this application.
Please help me how to get into ABAP debugger while executing this application.
Thank you
UjjHI Ujj,
First thing to do is look at the role and see which UI5 application is being executed. The UI5 application will be running in the web container of NWBC, you can make it open in a standalone browser (hold down the CTRL key in NWBC and go to the Help Menu) and then turn on the debugging tools (F12) in the browser. There you will see which Gateway services are being called. You will need to set your ABAP breakpoint in the implementation of the Gateway services. Find the class in SE80.
Hth,
Simon -
Debug ABAP code used for ABAP mapping
Hi Experts,
I have worked on Abap mapping. I have executed the code in SE24 to acheive desired mapping and the desired output is also generated.
attached below is a part of the code i have used:
method IF_MAPPING~EXECUTE.
* initialize iXML
TYPE-POOLS: ixml.
CLASS cl_ixml DEFINITION LOAD.
* create main factory
DATA: ixmlfactory TYPE REF TO if_ixml.
ixmlfactory = cl_ixml=>create( ).
* create stream factory
DATA: streamfactory TYPE REF TO if_ixml_stream_factory.
streamfactory = ixmlfactory->create_stream_factory( ).
* create input stream
DATA: istream TYPE REF TO if_ixml_istream.
istream = streamfactory->create_istream_xstring( source ).
* parse input document =================================================
* initialize input document
DATA: idocument TYPE REF TO if_ixml_document.
idocument = ixmlfactory->create_document( ).
* parse input document
DATA: iparser TYPE REF TO if_ixml_parser.
iparser = ixmlfactory->create_parser( stream_factory = streamfactory
istream = istream
document = idocument ).
iparser->parse( ).
I just want to debug and see if an input is provided how does each of these methods make a difference to it.
I tried to input some value in the SOURCE parameter on executing the code but it is not working fine.
Could you please suggest hiw i should go about so that i can see the exact way the input Xstring is affected by each of these methods in the debugger.
Help will be appreciated.
Many thanks,
Neha
Edited by: Neha Nagrani on Jul 7, 2008 11:46 AMHi Neha,
Write a Small Report as Folows:
1. Create your XMl payload of Type xSTRING.
2. Call the method EXECUTE
Place a Breakpoint on the method. and then keep debugging inside.
the SetParamter method is obviously called from inside.
This is the Simplesrt Solution.
Reward points if useful
Regards,
Abhishek -
Enhancing existing Abap code: using values that doesn't exist in table
Hi,<br><br>
I would like to enhance this code . My requirement is as follows.<br><br>
I have two tables customer and product<br><br>
<pre>KNVP customer master data table
Customer PF Person
700008 YF 45555
700008 YQ 46666
700008 ZF 46666
700008 YM 49999
700008 ZQ 44444
700008 ZM 43333
T179 product hierarchy table*
product hier PF
1000014000 ZM
1000015000 ZF
1000033000 ZQ
The current extractor is showing YM for all YPF values
Customer Zperson ZPF YPF YPerson
700008 46666 ZF YM 49999
700008 43333 ZQ YM 49999
700008 44444 ZM YM 49999</pre>
<br><br>
Case 1:IF customer doesn't have Partner function value YQ in master data then partner function YF person and partner function should be use.
<br><br>
case 2: IF customer doesn't have Partner function value YF in master data then partner function YQ person and partner function should be use.
<br><br>
case3:IF customer doesn't have Partner function value YQ and YF in master data then partner function YM person and partner function should be use.
<br><br>
The tricky part is that YQ doesn't exist in T179 table
<br><br>
<pre>
LOOP AT T_DATA.
ZIDX = SY-TABIX.
CLEAR T179.
Select partner function, assigned to current
product hierarchy level 2
SELECT * FROM T179
WHERE STUFE = '2'
AND PRODH = T_DATA-PRODH.
ENDSELECT.
Replace value with new partner function.
by replacing first letter to 'Y'
CONCATENATE 'Y' T179-ZZPARVW+1(1) INTO NEWPF.
Try to find new sales employee with this new partner function
CLEAR KNVP.
SELECT * FROM KNVP UP TO 1 ROWS
WHERE KUNNR = T_DATA-KUNNR
AND VKORG = T_DATA-VKORG
AND PARVW = NEWPF.
ENDSELECT.
IF SY-SUBRC EQ 0.
New partner found with this partner function
T_DATA-ZPARVW = NEWPF.
T_DATA-ZPERNR = KNVP-PERNR.
ELSE.
NEWPF = 'YM'.
Try to find new sales employee with partner function 'YM'
CLEAR KNVP.
SELECT * FROM KNVP UP TO 1 ROWS
WHERE KUNNR = T_DATA-KUNNR
AND VKORG = T_DATA-VKORG
AND PARVW = NEWPF.
ENDSELECT.
T_DATA-ZPARVW = NEWPF.
T_DATA-ZPERNR = KNVP-PERNR.
ENDIF.
MODIFY T_DATA INDEX ZIDX TRANSPORTING ZPARVW ZPERNR.
</pre>
<br><br>Edited by: Matt on Aug 24, 2010 9:31 AM - fixed formattingHi,
thanks for your input, I have written it like this and it is working well for YQ and YF partner functions but YM is not showing when both are missing.
LOOP AT T_DATA.
ZIDX = SY-TABIX.
CLEAR T179.
* Select partner function, assigned to current
* product hierarchy level 2
SELECT * FROM T179
WHERE STUFE = '2'
AND PRODH = T_DATA-PRODH.
ENDSELECT.
* Replace value with new partner function.
* by replacing first letter to 'Y'
CONCATENATE 'Y' T179-ZZPARVW+1(1) INTO NEWPF.
IF SY-SUBRC EQ 0.
IF NEWPF EQ 'YF'.
READ TABLE T_KNVP WITH KEY PARVW = 'YF'.
IF SY-SUBRC EQ 0. "YF exists in master data
CLEAR KNVP.
SELECT * FROM KNVP UP TO 1 ROWS
WHERE KUNNR = T_DATA-KUNNR
AND VKORG = T_DATA-VKORG
AND PARVW = 'YF'.
ENDSELECT.
T_DATA-ZPARVW = 'YF'.
T_DATA-ZPERNR = KNVP-PERNR.
ELSE.
READ TABLE T_KNVP WITH KEY PARVW = 'YQ'.
IF SY-SUBRC EQ 0. "YQ exists in master data
CLEAR KNVP.
SELECT * FROM KNVP UP TO 1 ROWS
WHERE KUNNR = T_DATA-KUNNR
AND VKORG = T_DATA-VKORG
AND PARVW = 'YQ'.
ENDSELECT.
T_DATA-ZPARVW = 'YQ'.
T_DATA-ZPERNR = KNVP-PERNR.
ENDIF.
ENDIF.
ENDIF.
IF NEWPF EQ 'YQ'.
READ TABLE T_KNVP WITH KEY PARVW = 'YQ'.
IF SY-SUBRC EQ 0. "YQ exists in master data
CLEAR KNVP.
SELECT * FROM KNVP UP TO 1 ROWS
WHERE KUNNR = T_DATA-KUNNR
AND VKORG = T_DATA-VKORG
AND PARVW = 'YQ'.
ENDSELECT.
T_DATA-ZPARVW = 'YQ'.
T_DATA-ZPERNR = KNVP-PERNR.
ELSE.
READ TABLE T_KNVP WITH KEY PARVW = 'YF'.
IF SY-SUBRC EQ 0. "YF exists in master data
CLEAR KNVP.
SELECT * FROM KNVP UP TO 1 ROWS
WHERE KUNNR = T_DATA-KUNNR
AND VKORG = T_DATA-VKORG
AND PARVW = 'YF'.
ENDSELECT.
T_DATA-ZPARVW = 'YF'.
T_DATA-ZPERNR = KNVP-PERNR.
ENDIF.
ENDIF.
ENDIF.
ELSE.
NEWPF = 'YM'.
* Try to find new sales employee with partner function 'YM'
CLEAR KNVP.
SELECT * FROM KNVP UP TO 1 ROWS
WHERE KUNNR = T_DATA-KUNNR
AND VKORG = T_DATA-VKORG
AND PARVW = NEWPF.
ENDSELECT.
T_DATA-ZPARVW = NEWPF.
T_DATA-ZPERNR = KNVP-PERNR.
ENDIF.
MODIFY T_DATA INDEX ZIDX TRANSPORTING ZPARVW ZPERNR.
ENDLOOP.
thanks
Edited by: Bhat Vaidya on Aug 30, 2010 1:31 PM -
Can not see ABAP code of programs and FM using SE37, SE38, SE80
Hi, all!
When I try to open ABAP-code using transactions SE37, SE38, SE80, they don't display it. Instead it current mode hangs, but I can open another one.
System ECC 6.0, SAP_ABA package SAPKA70021, GUI Patch 17.
I have 2 laptops, one of them works with these transaction properly, another gives described problem. Other my colleagues don't have such problems.
Can anybody help me to solve this problem?
BR,
Borishi friend,
I had the same problem the problem than you, the problem isn´t the gui, the probelm is the msxml parser .
Follow the next sollution and you will solve your problem.
http://scn.sap.com/thread/1853701
My original problem was the "SAP signature theme" was black and with a lot of problems, changing to "Enjoy theme" everything appear works perfecly, but when I tryed to display any source code the screen was thinking without end.
The problem is solved uninstalling any SAP software from your machine also msxml program from SAP and reinstalling first msxml 4.0 and msxml 6.0 after shut down install sap logon behind, when ended everything will work again.
This my actual version and it works.
kind regards,
Miguel Angel Orihuela -
How to insert Method in ABAP code
Hi Gurus,
Plz tell me how to insert a METHOD in ABAP code as we do in the case of inserting function in ABAP code using PATTERN.Button
Rgds
rajeshHi,
Try this.
Click pattern tab ans select AABAP object patterns.
Select call method.
Then give the instance name , class/interface name and the method name.
Sharin. -
Error in determining Paper Format for Printout triggering from ABAP Code
Hi Experts,
I am trying to trigger a printout from my ABAP code using "NEW-PAGE PRINT ON ...... NEW-PAGE PRINT OFF" statement.
I am passing the Print Parameters using the FM "GET_PRINT_PARAMETERS" as below:
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = ls_options-tddest
copies = 1
list_name = 'Notification'
list_text = 'ERROR NOTIFICATION'
immediately = 'X'
release = 'X'
new_list_id = ' '
* expiration =
line_size = 79
line_count = 23
layout = 'X_65_80'
sap_cover_page = ' '
receiver = 'SAP*'
department = 'System'
no_dialog = 'X'
IMPORTING
out_parameters = lv_params.
But I am facing a problem. Though I am passing X_65_80 to the LAYOUT in the Function Module, it is trying to print in LETTER format. But the specified printer as the printer supports only A4 paper format and as a result, I am not getting any printout.
Kindly help me with your suggestions to resolve this.
Thanks in advance.
Regards,
KeerthiHi,
I just found that this problem is even stranger.
I am able to print the said message on my local printer but when I try to print the same message on a different printer located at a different location, the printout does not get triggered. I am not getting any error messages also in this case.
What could be the possible reason for this?
Kindly share your views/experience with me on this one.
Thank you.
Regards,
Keerthi -
How to restrict a user from using the transaction code SU01?
How can I grant a profile to a user with the profile SAP_ALL except running the transaction code SU01?
I know how to lock the transaction code using SM01 but is there any other way to do it.Go to S_TCODE
Double click on it and give the combinations like A* - X*
SU00
SU02 - Z*
Try this one definately it will work. -
How to find currently editing transaction code details using ABAP code
Hi,
if some user is using VA02 tcode.i want to know for which sales order(i.e Sales order number)he is making changes.
i want ABAP code sample for this scenario.
Cheers,
JagHi,
For this you need to create Lock Object from se11 .It will automatically crate Two Function modules for enque and deque.
In you case If you want to see the Details for Va02 use.
CALL FUNCTION 'ENQUEUE_EVVBAKE'
EXPORTING
VBELN = VBELN
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2.
CASE SY-SUBRC.
WHEN 1.
MESSAGE E042(V1) WITH vbeln RAISING ERROR_IN_COPY.
ENDCASE.
Regds, -
Creating a long text using ABAP code.. fm SAVE_TEXT
When you create an order via IW31 one of the options is to click on the text button and create a long text. I am basically trying to mimic this action from within my ABAP code.
The text id details are as follows:
Text Name 500000015000046 which is (5000000 + order number)
Language EN
Text ID KOPF Order header text
Text Object AUFK Order text
If i manually create the text within the transaction i am then able to view and update it via function modules READ_TEXT and SAVE_TEXT. But if the text has not already been created READ_TEXT obviously returns nothing as it does not exist and SAVE_TEXT does not seem to created it!
Anyone know how i would go about creating this text using ABAP code?
Hope this make a bit of sense
Thanks in advance
MartI have implemented the code as i think it should be. See below, can any see what is wrong. If i add init_text it makes no difference and adding the commit_text just makes it hang
DATA: IT_TEXTS type standard table of TLINE,
wa_texts like line of it_texts,
wa_txtheader type THEAD.
wa_txtheader-TDID = 'KOPF'.
wa_txtheader-TDSPRAS = 'EN'.
wa_txtheader-TDNAME = '500000015000056'.
wa_txtheader-TDOBJECT = 'AUFK'.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = wa_txtheader
INSERT = 'X'
SAVEMODE_DIRECT = ' '
OWNER_SPECIFIED = 'X'
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
TABLES
LINES = IT_TEXTS
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
How to execute a report using a transaction code?
Hi team,
I am new in ABAP and I want to do a very simple report and then call this report using a transaction code.
Steps:
1) create the report (SE38)
the report is: Z_DEMO
2) generate a transaction code for this report (SE93)
note: the transaction code is ZDEMO
3) call the transaction generated on step 2
When I execute the report using SE38, everythig is ok and the records are inserted in my table zdemo2.
But when I call my transaction ZDEMO there is no insertion. Why?
The report ask for parameters and then fowards me to SAP's main menu.
Thanks,
Walter.
The report is:
REPORT Z_DEMO.
tables: zdemo2.
parameters:
nombre like zdemo2-nombre,
edad like zdemo2-edad.
data:
begin of tabla occurs 0,
nombre like zdemo2-nombre,
edad like zdemo2-edad,
end of tabla.
zdemo2-nombre = nombre.
zdemo2-edad = edad.
insert zdemo2.Hi,
While creating the transaction for your program
1>Make sure u give the program name and screen number
2>Important thing is a option "GUI SUPPORT"
Check all the checkboxes or atleast SAPGUI for Windows to ensure that the Code runs in SAP GUI.
Thank you. -
LSMW--- I am not seeing some variables, which r using in abap code!
Hi Experts,
Am enhancing the LSMW---> Create_Material, so I hv some basic doubts, pls. clarify,
1 - In the following satemenrts of the code, the programmer used my_langu(variable?), so, Where the programmer has declared(attributes & value) the my_langu ? I searched in FIXED VALUES radio button, Global data, double clicking, abap code radio button, I culd not find it!
Target Field: E1BP_MLTX-LANGU Language key
E1BP_MLTX-LANGU = my_fv_langu. (like theses many variables r using in the abap code, but I culd not track them to see, thrier attributes!)
2 - In abap code, the programmer is using <b><i>skip_transaction</i></b>! but, we dont hv skip_transaction in ABAP code?
thanq.Hi,
skip_transdaction is a LSMW Global Function and not an ABAP command:
Global function Description
transfer_record. Transfers the current record (i.e. for the current target structure) to the output buffer.
transfer_this_record '...'. Transfers a record of another target structure to the output buffer. The name of the target structure has to be specified as argument in single quotes.
at_first_transfer_record. Transfers the current record to the output buffer, if it is the first transaction.
on_change_transfer_record. Transfers the current record to the output buffer, if it has changed compared to the last record.
transfer_transaction. Writes the current transaction to an output file. All records of the output buffer are transferred to the output file.
skip_record. The current record is not transferred to the output buffer.
skip_transaction. The current transaction is not written to the output file.
I'm not sure about the my_langu(variable?).
Hope it helps some. -
ABAP code for calculation rule in transaction M/08
Hi,
In M/08 transaction, we need to do this:
When maintaining a PO, the user manually creates a condition like this:
ZXXX Value (+10 %) positive value.
However, in order to get the belonging negative condition (for accounting purpose), we need to automatically create that when the one above has been created:
Automatic at the same time:
ZYYY Value (- 10 %) negative value.
In transaction M/08 you can enter ABAP code to each condition in the calculation rule. How can I program that ZYYY is created at the same time as ZXXX, when created for a PO ?
Any help is appreciated.Hi Peter,
This calculations rules are know as routines you can create with them using T code VOFM and then go the menu option -
> Formula---->Condition value.Double click on that and you will get the ABAP code.
Here you can amend the existing one or can create the way you like your logic to move and assign it to M/08 T code.
Hope this will help you.
Thanks,
Birender Agnihotri -
Starting SAP transaction in between ABAP code
Hi,
How can I start a particular transaction in between ABAP code if certain condition is true.
Regards,
Tushar.If a program has a transaction code, there are two ways of starting it from another program.
If you do not want to return to the calling program at the end of the new transaction, use the statement:
LEAVE TO TRANSACTION <tcod> [AND SKIP FIRST SCREEN].
This statement ends the calling program and starts transaction <tcod>. This deletes the call stack (internal sessions) of all previous programs. At the end of the transaction, the system returns to the area menu from which the original program in the call stack was started.
If, on the other hand, you do not want to return to the calling program at the end of the new transaction, use the statement:
CALL TRANSACTION <tcod> [AND SKIP FIRST SCREEN] [USING <itab>].
This statement saves the data of the calling program, and starts transaction <tcod>. At the end of the transaction, the system returns to the statement following the call in the calling report. If the LEAVE statement occurs within the called transaction, the transaction ends and control returns to the program in which the call occurred.
You can use a variable to specify the transaction <tcod>. This allows you to call transactions statically as well as dynamically.
The addition AND SKIP FIRST SCREEN allows you to prevent the initial screen of the new transaction from being displayed. The first screen to be displayed is then the specified Next screen in the screen attributes of the initial screen. If the first screen calls itself as the next screen, you cannot skip it.
Furthermore, the AND SKIP FIRST SCREEN option works only if all mandatory fields on the initial screen of the new transaction are filled completely and correctly with input values from SPA/GPA parameters.
The USING ITAB addition in the CALL TRANSACTION statement allows you to pass an internal table <itab> to the new transaction. <itab> has the form of a batch input table. For further information about batch input tables, refer to Importing Data With Batch Input.
Cheers
Nishanth
Maybe you are looking for
-
Here is what I would like to do: I want to take the 'redo size' statistic (or any arbitrarily-chosen statistic) from DBA_HIST_SYSSTAT and arrange the values into hourly columns. In other words, each row would represent a day of data and the columns r
-
Finder does not start after 10.5.2 update
After updating to 10.5.2, Finder will not start up at all. I've repaired permissions several times getting: ACL found but not expected on "Applications/Utilities". as well as on "Applications" and "Library". I've tried to launch finder from terminal.
-
I have installed Oracle 10g. I can browse through Enterprise Manager, can create/delete objects. When I see the Status of my Database Server, it shows Status Status Pending Status Pending Since Apr 13, 2005 Why the Status is still pending and why it
-
Hello, I have a field 'A' that is CHAR(8) How do I trim this field to compare with other records that are Varchar2() fields? Will the Trim function work? like trim(A). I know you can trim a Varchar2 field.
-
Lost all my HDD space after cancelling partition!
Short Story...Ive lost all my HDD space after cancelling partition, i had 1TB now i only have 13gb Long story...I installed parraeles desktop 8, went to install windows 7, it said i only had 60gb free, went to disk utility to try and partition to 150