Tuesday, July 10, 2012

ALV Errors


ALV errors can be majorly corrected by the changing the field catalog.
Errors observed
·           When alv output is transferred to EXCEL it was going to dump
Sol: Do consistency check by clicking the (Shift+2 right clicks), it will display fields which are not assigned properly define them or remove unwanted fields.
·           When summing a column in ALV the output is going to dump MESSAGE_TYPE_X
Sol: This might be due to wrong assignment of fieldcatlog; check the field name and field catalog are same and do changes accordingly

Thursday, July 5, 2012

Dynamic change of selection screens using push button in single program


Dynamic selection screen can be created using push buttons declared in single program
1. Declare parameters with modif id and declare push buttons.
2.In initialization get the user command stored in the memory location using import function and update the selection screen accordingly(disabling some parameters)
3. Selection screen gets displayed, whenever other button is clicked then event AT SELECTION-SCREEN gets triggered, if the sy-ucomm is ‘FC01 or FC02’ export it to the memory location else do screen validations.
4. In the event AT SELECTION-SCREEN OUTPUT change the screen by using LOOP AT SCREEN and MODIF ID



For test program find the attachment attachment

Tuesday, July 3, 2012

Dynamic selection screen using PF status between two programs


Dynamic selection screen using PF status between two programs
1. Changing initial screen options can be done as follows
2. PF status (MENU from SE41 Menu painter) need to be created.
3. In the event AT SELECTION-SCREEN OUTPUT following need to used

AT SELECTION-SCREEN OUTPUT.
*Use a custom PF-STATUS instead of the standard one
CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'.
EXPORTING
p_status = 'EDIT_TEXT'
TABLES
p_exclude = exclitab.

DATA: exclitab TYPE TABLE OF sy-ucomm.


4. While creating the push button following need to be taken care, ie Function type need to be ‘E’—Exit command

5. Later in the event AT SELECTION-SCREEN ON EXIT-COMMAND, depending on the command declared in the menu painter get the selection screen inputs if required and submit it to the program.

AT SELECTION-SCREEN ON EXIT-COMMAND.
IF sy-ucomm = <command declared in menu painter> 
PERFORM submit_program.
ENDIF.

FORM submit_program .
DATA: sel_table TYPE TABLE OF rsparams.
CLEAR sel_table.
CLEAR p_detlay.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = sy-repid
TABLES
selection_table = sel_table.

SUBMIT < to_which_program this need to be submitted> 
VIA SELECTION-SCREEN WITH SELECTION-TABLE sel_table
AND RETURN.
ENDFORM. " submit_program

Read SELECT-OPTIONS using DYNP_VALUES_READ


In general we use DYNP_VALUES_READ to read data in the screen. It will be very simple to get data from the screen when the required field is declared from parameter.
1. Declaration: Declare data for input and for output DATA: dynfields TYPE TABLE OF dynpread WITH HEADER LINE,
return_tab TYPE TABLE OF ddshretval WITH HEADER LINE.
2.Pass the required value to dynfields dynfields-fieldname = 'P_BUKRS'.
APPEND dynfields.

3.Get the data from selection screen CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
translate_to_upper = 'X'
TABLES
dynpfields = dynfields

4.Get the data from to the fields from selection to the fields READ TABLE dynfields WITH KEY fieldname = 'P_BUKRS'.
lv_bukrs = dynfields-fieldvalue.

5.Get the data from the required table to display SELECT bukrs branch name
FROM j_1bbranch
INTO CORRESPONDING FIELDS OF TABLE it_j_1bbranch
WHERE bukrs = lv_bukrs.

6.Display the using FM F4IF_INT_TABLE_VALUE_REQUEST CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'BRANCH'
dynprofield = 'S_BRANCH-LOW'
value_org = 'S'
TABLES
value_tab = it_j_1bbranch
return_tab = return_tab.

7.Pass the data to output field READ TABLE return_tab WITH KEY fieldname = 'BRANCH'.
IF lv_shelp_low = 'X'.
s_branch-low = return_tab-fieldval.
ENDIF.


But when to get the data from SELECT-OPTIONS will be challenge, in order to overcome this we need to follow the below procedure in the attached document. Attachement for select options

Wednesday, June 20, 2012

Authorization Check


Authorization Check can be checked in SU20 – List Of Authorization Fields And SU21- List Of Object Class
Syntax:
AUTHORITY-CHECK OBJECT 'ZMM_WERKS
ID 'ACTVT' FIELD '03' "Display
ID 'WERKS' FIELD t001w-werks.

IF SY-SUBRC <> 0.
“User has no authority
ENDIF.

Saturday, June 16, 2012

Copy Varient from One report to another


To be able to test our changes on real data, we sometimes create a copy of a program, modify it and test it. The function RS_COPY_SELECTION_SETS will copy the variant content. You run it directly in the production system (carefully!) in SE37.

NOTE: “Create” and “Change” user for all variants will be user who does the copy! If you rely on those fields to search for variants, the user information will be lost.

SNOTE


Steps need to be followed during NOTE
1.     Go to transaction SNOTE and check(CTRL+F) whether the note is applied or not
2.      If not applied need to go to services.sap.com and check the note,
·        Note can be applied if the version of the particular service mentioned is higher than our server version
·        Whether it is information note?  If it is information note then no need to apply
·        Any manual corrections are there? For manual correction need to have access key
·        Prerequisites are there? Same process follows
3.     Download the note and apply it, for manual corrections need to go there and do the changes.

CTRL+F8 to download the note
CTRL+F9 to find all the details of note when it applied who has applied it