Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

hi i am sushma ,i want to know abt alv interactive reports ,

Former Member
0 Kudos
111

how to create alv interactive reports.

6 REPLIES 6

Former Member
0 Kudos
71

Use this statement.

FORM LISTDISP USING V_UCOMM LIKE SY-UCOMM HIDEV TYPE SLIS_SELFIELD.

SELECT * FROM MAKT INTO TABLE I_MAKT WHERE MATNR = HIDEV-VALUE.

PERFORM LIST.

ENDFORM. "LISTDISP

This just acts as the hide and get cursor statements you use in classical reports.V_comm gets the user command performed on the ALV list and HIDEV gets the value of the field you have clicked.

Go through this code for clarrification.

Use this code , This produce an interactive alv of the details of makt based on the value clicked in the first list containing mara table values.

REPORT ZMK_ALVREP.

TYPE-POOLS:SLIS.

TYPES: BEGIN OF TY_MARA.

INCLUDE STRUCTURE MARA.

TYPES: END OF TY_MARA.

TYPES: BEGIN OF TY_MAKT.

INCLUDE STRUCTURE MAKT.

TYPES: END OF TY_MAKT.

DATA: I_MARA TYPE TABLE OF TY_MARA,

W_MARA TYPE TY_MARA,

I_MAKT TYPE TABLE OF TY_MAKT,

W_MAKT TYPE TY_MAKT.

DATA : I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

W_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

I_EVENT TYPE SLIS_T_EVENT,

I_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.

SELECT * FROM MARA INTO TABLE I_MARA.

SELECT * FROM MAKT INTO TABLE I_MAKT.

PERFORM POPULATE.

PERFORM GRID.

FORM POPULATE .

W_FIELDCAT-FIELDNAME = 'MATNR'.

W_FIELDCAT-TABNAME = 'I_MAKT'.

W_FIELDCAT-REF_FIELDNAME ='MATNR'.

W_FIELDCAT-REF_TABNAME ='MAKT'.

W_FIELDCAT-SELTEXT_M = 'MATNR'.

APPEND W_FIELDCAT TO I_FIELDCAT.

CLEAR W_FIELDCAT.

W_FIELDCAT-FIELDNAME = 'ERSDA'.

W_FIELDCAT-TABNAME = 'I_MAKT'.

W_FIELDCAT-REF_FIELDNAME ='ERSDA'.

W_FIELDCAT-REF_TABNAME ='MAKT'.

W_FIELDCAT-SELTEXT_M = 'ERSDA'.

APPEND W_FIELDCAT TO I_FIELDCAT.

CLEAR W_FIELDCAT.

ENDFORM. " populate

FORM GRID .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

I_CALLBACK_USER_COMMAND = 'LISTDISP'

IT_FIELDCAT = I_FIELDCAT

TABLES

T_OUTTAB = I_MAKT

.

ENDFORM. " Grid

FORM LISTDISP USING V_UCOMM LIKE SY-UCOMM HIDEV TYPE SLIS_SELFIELD.

SELECT * FROM MAKT INTO TABLE I_MAKT WHERE MATNR = HIDEV-VALUE.

PERFORM LIST.

ENDFORM. "LISTDISP

FORM LIST .

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

I_STRUCTURE_NAME = 'MAKT'

TABLES

T_OUTTAB = I_MAKT.

ENDFORM. " List

Former Member
0 Kudos
71

Hi,

in your ALV code write .....

PERFORM LIST.

FORM LIST USING <USERCOMMAND> LIKE SY-UCOMM

SLIS TYPE SLIS-SELFIELD.

IF SLIS_FIELDNAME = 'YYY-XXXX'

SLIS-VALUE = 'ZZZZZ'.

SELECT......................WHERE DDDD = ZZZZZ.

REUSE_ALV_GRID/LIST_DISPLAY.

Reward if helpful,

Thanks.

uwe_schieferstein
Active Contributor
0 Kudos
71

Hello

A good start is the reuse library ( SE83 ) which shows you various sample reports. All of them can be found in package SLIS (e.g. BCALV_EDIT_02 ).

You may also have a look at transaction DWDM.

Finally, you may search the SDN for my sample reports (all beginning with ZUS_SDN_... ) which demonstrate various aspects of ALV programming in a simplified style.

Example:

Regards

Uwe

Former Member
0 Kudos
71

Hi bhethanabhotla sushmarao,

I think before post the thread you should search your problem because a lot of problem on ALV has been discussed on this forum and also you will get more solutions after searching your problem...

Kind Regards

Yogesh

Former Member
0 Kudos
71

hi Sushama,

Interactive reports are those where user interaction is required to display the details in suitable or separate page or window. This can be achived with the help of function modules or methods.

To acheive intreactive action we have to make use of Events.

Refer the sample code:

&----


*& Report ZUK_WIP04_ALV_INTERACTIVE

*&

&----


*&

*&

&----


REPORT ZUK_WIP04_ALV_INTERACTIVE NO STANDARD PAGE HEADING MESSAGE-ID ZMSG44

LINE-SIZE 225 LINE-COUNT 65(3).

****************************************************************************************

  • TYPE-POOLS

****************************************************************************************

TYPE-POOLS : SLIS.

****************************************************************************************

  • DDIC TABLES

****************************************************************************************

TABLES : VAPMA, VBAK,VBAP,VBEP.

****************************************************************************************

  • ALV-PARAMETERS DECLERATION

****************************************************************************************

DATA : W_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA : I_LAYOUT TYPE SLIS_LAYOUT_ALV.

DATA : W_EVENTS TYPE SLIS_ALV_EVENT,

I_EVENTS TYPE SLIS_T_EVENT.

DATA : I_LISTHEADER TYPE SLIS_T_LISTHEADER,

W_LISTHEADER TYPE SLIS_LISTHEADER.

  • Interactive params

DATA : W_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV,

I_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.

*****************************************************************************************

  • iNTERNAL TABLES DECLERATION

*****************************************************************************************

TYPES : BEGIN OF S_VAPMA,

CH TYPE CHECKBOX,

MATNR LIKE VAPMA-MATNR,

VKORG LIKE VAPMA-VKORG,

TRVOG LIKE VAPMA-TRVOG,

VTWEG LIKE VAPMA-VTWEG,

SPART LIKE VAPMA-SPART,

AUART LIKE VAPMA-AUART,

VBELN LIKE VAPMA-VBELN,

POSNR LIKE VAPMA-POSNR,

END OF S_VAPMA.

DATA : I_VAPMA TYPE TABLE OF S_VAPMA,

W_VAPMA TYPE S_VAPMA.

TYPES : BEGIN OF S_VBAK,

VBELN LIKE VBAK-VBELN,

ERDAT LIKE VBAK-ERDAT,

AUDAT LIKE VBAK-AUDAT,

VBTYP LIKE VBAK-VBTYP,

TRVOG LIKE VBAK-TRVOG,

AUART LIKE VBAK-AUART,

NETWR LIKE VBAK-NETWR,

WAERK LIKE VBAK-WAERK,

END OF S_VBAK.

DATA : I_VBAK TYPE TABLE OF S_VBAK,

W_VBAK TYPE S_VBAK.

TYPES : BEGIN OF S_VBAP,

VBELN LIKE VBAP-VBELN,

POSNR LIKE VBAP-POSNR,

MATNR LIKE VBAP-MATNR,

ARKTX LIKE VBAP-ARKTX,

END OF S_VBAP.

DATA : I_VBAP TYPE TABLE OF S_VBAP,

W_VBAP TYPE S_VBAP.

TYPES : BEGIN OF S_VBEP,

VBELN LIKE VBEP-VBELN,

POSNR LIKE VBEP-VBELN,

ETENR LIKE VBEP-ETENR,

WMENG LIKE VBEP-WMENG,

MEINS LIKE VBEP-MEINS,

END OF S_VBEP.

DATA : I_VBEP TYPE TABLE OF S_VBEP,

W_VBEP TYPE S_VBEP.

types : BEGIN OF S_RESULT,

CH TYPE CHECKBOX,

MATNR LIKE VAPMA-MATNR,

TRVOG LIKE VAPMA-TRVOG,

VBELN LIKE VBAP-VBELN,

POSNR LIKE VBAP-POSNR,

ARKTX LIKE VBAP-ARKTX,

ETENR LIKE VBEP-ETENR,

WMENG LIKE VBEP-WMENG,

MEINS LIKE VBEP-MEINS,

END OF S_RESULT.

DATA : I_RESULT TYPE TABLE OF S_RESULT,

W_RESULT TYPE S_RESULT.

TYPES : BEGIN OF S_VBFA,

VBELV LIKE VBFA-VBELV,

POSNV LIKE VBFA-POSNV,

VBELN LIKE VBFA-VBELN,

POSNN LIKE VBFA-POSNN,

VBTYP_N LIKE VBFA-VBTYP_N,

END OF S_VBFA.

data : I_VBFA TYPE TABLE OF S_VBFA,

W_VBFA TYPE S_VBFA.

****************************************************************************************

  • GLOBAL VARIABLES

****************************************************************************************

DATA : V_STR(30) TYPE C.

data : V_REPID LIKE SY-REPID,

v_matnr like VAPMA-MATNR.

****************************************************************************************

  • SELECTION-SCREEN

****************************************************************************************

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001 .

SELECT-OPTIONS : S_MATNR FOR VAPMA-MATNR OBLIGATORY .

PARAMETERS : P_VKORG LIKE VAPMA-VKORG OBLIGATORY VALUE CHECK.

PARAMETERS : P_TRVOG LIKE VAPMA-TRVOG.

PARAMETERS : P_VTWEG LIKE VAPMA-VTWEG OBLIGATORY VALUE CHECK.

PARAMETERS : P_SPART LIKE VAPMA-SPART OBLIGATORY VALUE CHECK.

SELECTION-SCREEN END OF BLOCK B1.

******************************************************************************************

  • INITIALIZATION

******************************************************************************************

INITIALIZATION.

S_MATNR-LOW = '000000000000000001'.

S_MATNR-HIGH = '000000000000000100'.

APPEND S_MATNR.

CLEAR S_MATNR.

P_VKORG = '0001'.

P_TRVOG = '0'.

P_VTWEG = '01'.

P_SPART = '01'.

V_REPID = SY-REPID.

PERFORM BUILD_FIELD_CATALOG.

PERFORM EVENT_CALL.

PERFORM EVENT_BUILD.

*********************************************************************************************

  • Validation on Matrl no

*********************************************************************************************

AT SELECTION-SCREEN ON S_MATNR.

select single MATNR

FROM VAPMA

INTO V_MATNR

WHERE MATNR IN S_MATNR.

IF NOT SY-SUBRC IS INITIAL.

MESSAGE E999 WITH TEXT-002.

ENDIF.

*********************************************************************************

  • START-OF-SELECTION

*********************************************************************************

START-OF-SELECTION.

PERFORM BUILD_LAYOUT.

PERFORM GET_DATA.

PERFORM DISPLAY_DATA.

&----


*& Form BUILD_LAYOUT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM BUILD_LAYOUT .

I_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

I_LAYOUT-ZEBRA = 'X'.

I_LAYOUT-F2CODE = 'PICK'.

ENDFORM. " BUILD_LAYOUT

&----


*& Form BUILD_FIELD_CATALOG

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM BUILD_FIELD_CATALOG .

REFRESH I_FIELDCAT1.

W_FIELDCAT1-COL_POS = '1'.

W_FIELDCAT1-FIELDNAME = 'CH'.

W_FIELDCAT1-tabname = 'I_RESULT'.

w_fieldcat1-checkbox = 'X'.

w_fieldcat1-edit = 'X'.

APPEND W_FIELDCAT1 TO I_FIELDCAT1.

CLEAR W_FIELDCAT1.

W_FIELDCAT1-COL_POS = '2'.

W_FIELDCAT1-FIELDNAME = 'MATNR'.

W_FIELDCAT1-tabname = 'I_RESULT'.

W_FIELDCAT1-SELTEXT_L = 'Material number'.

W_FIELDCAT1-seltext_M = 'Matrl no'.

W_FIELDCAT-KEY = 'X'.

W_FIELDCAT1-HOTSPOT = 'X'.

W_FIELDCAT1-EMPHASIZE = 'C110'.

APPEND W_FIELDCAT1 TO I_FIELDCAT1.

CLEAR W_FIELDCAT1.

W_FIELDCAT1-COL_POS = '3'.

W_FIELDCAT1-FIELDNAME = 'TRVOG'.

W_FIELDCAT1-tabname = 'I_RESULT'.

W_FIELDCAT1-SELTEXT_L = 'Trans group'.

W_FIELDCAT1-seltext_M = 'Trans group'.

  • W_FIELDCAT-KEY = 'X'.

W_FIELDCAT1-HOTSPOT = 'X'.

W_FIELDCAT1-EMPHASIZE = 'C210'.

APPEND W_FIELDCAT1 TO I_FIELDCAT1.

CLEAR W_FIELDCAT1.

W_FIELDCAT1-COL_POS = '4'.

W_FIELDCAT1-FIELDNAME = 'VBELN'.

W_FIELDCAT1-tabname = 'I_RESULT'.

W_FIELDCAT1-SELTEXT_L = 'Sales ordernumber'.

W_FIELDCAT1-seltext_M = 'Sales ord' .

  • W_FIELDCAT-KEY = 'X'.

W_FIELDCAT1-HOTSPOT = 'X'.

W_FIELDCAT1-EMPHASIZE = 'C310'.

APPEND W_FIELDCAT1 TO I_FIELDCAT1.

CLEAR W_FIELDCAT1.

W_FIELDCAT1-COL_POS = '5'.

W_FIELDCAT1-FIELDNAME = 'POSNR'.

W_FIELDCAT1-tabname = 'I_RESULT'.

W_FIELDCAT1-SELTEXT_L = 'Item'.

  • W_FIELDCAT-KEY = 'X'.

W_FIELDCAT1-HOTSPOT = 'X'.

W_FIELDCAT1-EMPHASIZE = 'C400'.

APPEND W_FIELDCAT1 TO I_FIELDCAT1.

CLEAR W_FIELDCAT1.

W_FIELDCAT1-COL_POS = '6'.

W_FIELDCAT1-FIELDNAME = 'ARKTX'.

W_FIELDCAT1-tabname = 'I_RESULT'.

W_FIELDCAT1-SELTEXT_L = 'Description'.

  • W_FIELDCAT-KEY = 'X'.

W_FIELDCAT1-HOTSPOT = 'X'.

W_FIELDCAT1-EMPHASIZE = 'C510'.

APPEND W_FIELDCAT1 TO I_FIELDCAT1.

CLEAR W_FIELDCAT1.

W_FIELDCAT1-COL_POS = '7'.

W_FIELDCAT1-FIELDNAME = 'MEINS'.

W_FIELDCAT1-tabname = 'I_RESULT'.

W_FIELDCAT1-SELTEXT_L = 'Order qty in sales units'.

W_FIELDCAT1-seltext_M = 'Order qty'.

  • W_FIELDCAT-KEY = 'X'.

W_FIELDCAT1-HOTSPOT = 'X'.

W_FIELDCAT1-EMPHASIZE = 'C610'.

APPEND W_FIELDCAT1 TO I_FIELDCAT1.

CLEAR W_FIELDCAT1.

ENDFORM. " BUILD_FIELD_CATALOG

&----


*& Form EVENT_CALL

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM EVENT_CALL .

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = I_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. " EVENT_CALL

&----


*& Form EVENT_BUILD

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM EVENT_BUILD .

READ TABLE I_EVENTS INTO W_EVENTS WITH KEY NAME = 'TOP_OF_PAGE'.

IF SY-SUBRC EQ 0.

W_EVENTS-FORM = 'TOP_OF_PAGE'.

MODIFY I_EVENTS FROM W_EVENTS TRANSPORTING FORM WHERE NAME = W_EVENTS-NAME.

ENDIF.

READ TABLE I_EVENTS INTO W_EVENTS WITH KEY NAME = 'USER_COMMAND'.

IF SY-SUBRC EQ 0.

W_EVENTS-FORM = 'ALV_USER_COMMAND'.

MODIFY I_EVENTS FROM W_EVENTS TRANSPORTING FORM WHERE NAME = W_EVENTS-NAME.

ENDIF.

READ TABLE I_EVENTS INTO W_EVENTS WITH KEY NAME = 'PF_STATUS_SET'.

IF SY-SUBRC EQ 0.

W_EVENTS-FORM = 'ALV_SET_PF_STATUS'.

MODIFY I_EVENTS FROM W_EVENTS TRANSPORTING FORM WHERE NAME = W_EVENTS-NAME.

ENDIF.

READ TABLE I_EVENTS INTO W_EVENTS WITH KEY NAME = 'END_OF_PAGE'.

IF SY-SUBRC EQ 0.

W_EVENTS-FORM = 'END_OF_PAGE'.

MODIFY I_EVENTS FROM W_EVENTS TRANSPORTING FORM WHERE NAME = W_EVENTS-NAME.

ENDIF.

ENDFORM. " EVENT_BUILD

&----


*& Form GET_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_DATA .

SELECT MATNR

VKORG

TRVOG

VTWEG

SPART

AUART

VBELN

POSNR

FROM VAPMA

INTO CORRESPONDING FIELDS OF TABLE I_VAPMA

WHERE MATNR IN S_MATNR

AND VKORG = P_VKORG

AND TRVOG = P_TRVOG

AND VTWEG = P_VTWEG

AND SPART = P_SPART.

IF NOT I_VAPMA IS INITIAL.

SELECT VBELN

ERDAT

AUDAT

VBTYP

TRVOG

AUART

NETWR

WAERK

FROM VBAK

INTO TABLE I_VBAK

FOR ALL ENTRIES IN I_VAPMA

WHERE VBELN = I_VAPMA-VBELN.

ENDIF.

IF NOT I_VBAK IS INITIAL.

SELECT VBELN

POSNR

MATNR

ARKTX

FROM VBAP

INTO TABLE I_VBAP

FOR ALL ENTRIES IN I_VBAK

WHERE VBELN = I_VBAK-VBELN.

ENDIF.

IF NOT I_VBAP IS INITIAL.

SELECT VBELN

POSNR

ETENR

WMENG

MEINS

FROM VBEP

INTO TABLE I_VBEP

FOR ALL ENTRIES IN I_VBAP

WHERE VBELN = I_VBAP-VBELN.

ENDIF.

LOOP AT I_VBAK INTO W_VBAK.

READ TABLE I_VBAP INTO W_VBAP WITH KEY VBELN = W_VBAK-VBELN.

IF SY-SUBRC IS INITIAL.

MOVE-CORRESPONDING W_VBAP TO W_RESULT.

ENDIF.

READ TABLE I_VBEP INTO W_VBEP WITH KEY VBELN = W_VBAK-VBELN.

IF SY-SUBRC IS INITIAL.

MOVE-CORRESPONDING W_VBEP TO W_RESULT.

ENDIF.

MOVE-CORRESPONDING W_VBAK TO W_RESULT.

APPEND W_RESULT TO I_RESULT.

CLEAR W_RESULT.

ENDLOOP.

ENDFORM. " GET_DATA

&----


*& Form DISPLAY_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DISPLAY_DATA .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = V_REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

IS_LAYOUT = I_LAYOUT

IT_FIELDCAT = I_FIELDCAT1

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = I_EVENTS

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = I_RESULT

EXCEPTIONS

PROGRAM_ERROR = 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. " DISPLAY_DATA

FORM TOP_OF_PAGE .

W_LISTHEADER-TYP = 'H'.

W_LISTHEADER-INFO = 'SD Index: Order items by Material'.

append W_LISTHEADER TO I_LISTHEADER.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = I_LISTHEADER

I_LOGO = 'ENJOYSAP_LOGO'

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

.

REFRESH I_LISTHEADER.

ENDFORM. "

FORM END_OF_PAGE .

WRITE : / 'Page no: ',SY-PAGNO.

ENDFORM. " END_OF_PAGE

FORM ALV_SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.

SET PF-STATUS 'UKINT'.

ENDFORM. " ALV_SET_PF_STATUS

FORM ALV_USER_COMMAND using R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

data : V_FCODE LIKE SY-UCOMM.

DATA : V_SEL_LINE LIKE RS_SELFIELD-TABINDEX.

DATA : V_SEL_VALUE LIKE RS_SELFIELD-VALUE.

  • data : v_field like RS_SELFIELD-FIELDNAME.

MOVE RS_SELFIELD-TABINDEX TO V_SEL_LINE.

MOVE RS_SELFIELD-VALUE TO V_SEL_VALUE.

  • MOVE RS_SELFIELD-FIELDNAME TO V_FIELD.

V_FCODE = R_UCOMM.

CASE V_FCODE.

WHEN 'PICK'.

PERFORM AT-LINE-SELECTION USING V_SEL_LINE.

WHEN 'DISP'.

PERFORM GRID_CB_DISPLAY USING V_SEL_VALUE V_SEL_LINE.

WHEN 'EXIT'.

PERFORM EXIT_PROGRAM.

ENDCASE.

ENDFORM. " ALV_USER_COMMAND

FORM EXIT_PROGRAM .

DATA : RS_SELFIELD TYPE SLIS_SELFIELD.

RS_SELFIELD-EXIT = 'X'.

ENDFORM. " EXIT_PROGRAM

&----


*& Form AT-LINE-SELECTION

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM AT-LINE-SELECTION USING V_INDEX.

DATA : V_SEL_LINE1 TYPE I.

  • DATA : V_VALUE TYPE RS_SEL_FIELD-VALUE.

V_SEL_LINE1 = V_INDEX.

READ TABLE I_RESULT INTO W_RESULT INDEX V_SEL_LINE1 .

if SY-SUBRC IS INITIAL.

SELECT VBELV

POSNV

VBELN

POSNN

VBTYP_N

FROM VBFA

INTO TABLE I_VBFA

WHERE VBELV = W_RESULT-VBELN

AND POSNV = W_RESULT-POSNR.

ENDIF.

PERFORM BUILD_FIELDCAT1.

  • PERFORM GET_DATA1.

PERFORM DISPLAY_DATA1.

ENDFORM. " AT-LINE-SELECTION

&----


*& Form GRID_CB_DISPLAY

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GRID_CB_DISPLAY USING V_VALUE V_NUM.

DATA : V_VALUE1(65) TYPE C.

DATA : V_SEL_LINE TYPE SLIS_SELFIELD-TABINDEX.

V_VALUE1 = V_VALUE.

V_SEL_LINE = V_NUM.

if V_VALUE1 = '1'.

READ TABLE I_RESULT INTO W_RESULT INDEX V_SEL_LINE.

  • LOOP AT I_RESULT INTO W_RESULT WHERE CH = 'X'.

if SY-SUBRC IS INITIAL.

SELECT VBELV

POSNV

VBELN

POSNN

VBTYP_N

FROM VBFA

INTO TABLE I_VBFA

WHERE VBELV = W_RESULT-VBELN

AND POSNV = W_RESULT-POSNR.

  • APPEND W_VBFA TO I_VBFA.

  • CLEAR W_VBFA.

  • ENDLOOP.

ENDIF.

ENDIF.

PERFORM BUILD_FIELDCAT1.

  • PERFORM GET_DATA1.

PERFORM DISPLAY_DATA1.

ENDFORM. " GRID_CB_DISPLAY

&----


*& Form BUILD_FIELDCAT1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM BUILD_FIELDCAT1 .

REFRESH I_FIELDCAT.

W_FIELDCAT-COL_POS = '1'.

W_FIELDCAT-FIELDNAME = 'VBELV'.

W_FIELDCAT-tabname = 'I_VBFA'.

W_FIELDCAT-SELTEXT_L = 'Preceding sales document'.

W_FIELDCAT-seltext_M = 'Preceding sales'.

W_FIELDCAT-KEY = 'X'.

  • W_FIELDCAT-HOTSPOT = 'X'.

W_FIELDCAT-EMPHASIZE = 'C110'.

APPEND W_FIELDCAT TO I_FIELDCAT.

CLEAR W_FIELDCAT.

W_FIELDCAT-COL_POS = '2'.

W_FIELDCAT-FIELDNAME = 'POSNV'.

W_FIELDCAT-tabname = 'I_VBFA'.

W_FIELDCAT-SELTEXT_L = 'Preceding Item'.

W_FIELDCAT-seltext_M = 'Preceding Item'.

W_FIELDCAT-seltext_s = 'Pre Item'.

W_FIELDCAT-KEY = 'X'.

  • W_FIELDCAT-HOTSPOT = 'X'.

W_FIELDCAT-EMPHASIZE = 'C210'.

APPEND W_FIELDCAT TO I_FIELDCAT.

CLEAR W_FIELDCAT.

W_FIELDCAT-COL_POS = '3'.

W_FIELDCAT-FIELDNAME = 'VBELN'.

W_FIELDCAT-tabname = 'I_VBFA'.

W_FIELDCAT-SELTEXT_L = 'Subsequent sales document'.

W_FIELDCAT-seltext_M = 'Subsequent sales '.

W_FIELDCAT-KEY = 'X'.

  • W_FIELDCAT-HOTSPOT = 'X'.

W_FIELDCAT-EMPHASIZE = 'C310'.

APPEND W_FIELDCAT TO I_FIELDCAT.

CLEAR W_FIELDCAT.

W_FIELDCAT-COL_POS = '4'.

W_FIELDCAT-FIELDNAME = 'POSNN'.

W_FIELDCAT-tabname = 'I_VBFA'.

W_FIELDCAT-SELTEXT_L = 'Subsequent Item'.

W_FIELDCAT-seltext_M = 'subseq item'.

W_FIELDCAT-KEY = 'X'.

  • W_FIELDCAT-HOTSPOT = 'X'.

W_FIELDCAT-EMPHASIZE = 'C410'.

APPEND W_FIELDCAT TO I_FIELDCAT.

CLEAR W_FIELDCAT.

W_FIELDCAT-COL_POS = '5'.

W_FIELDCAT-FIELDNAME = 'VBTYP_N'.

W_FIELDCAT-tabname = 'I_VBFA'.

W_FIELDCAT-SELTEXT_L = 'Document cat'.

W_FIELDCAT-seltext_M = 'Document cat'.

W_FIELDCAT-KEY = 'X'.

  • W_FIELDCAT-HOTSPOT = 'X'.

W_FIELDCAT-EMPHASIZE = 'C510'.

APPEND W_FIELDCAT TO I_FIELDCAT.

CLEAR W_FIELDCAT.

ENDFORM. " BUILD_FIELDCAT1

&----


*& Form DISPLAY_DATA1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DISPLAY_DATA1 .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = V_REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

I_GRID_TITLE = 'Sales document flow'

  • I_GRID_SETTINGS =

IS_LAYOUT = I_LAYOUT

IT_FIELDCAT = I_FIELDCAT

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = I_VBFA

EXCEPTIONS

PROGRAM_ERROR = 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.

reward if helpful

Rgds

Umakanth

ENDFORM. " DISPLAY_DATA1

Former Member
0 Kudos
71

Hi Sushma,

Here am giving u the code of a prgm for "Sales order change history"

Description : The standard Sales Order Change History

RVSCD100 does not meet the user requirement.

This is a result of the output shown for only

one document which is not specific for

Sales Orders.

A new report needs to be created in order to provide a clear list of changes made to the sales order.

Inputs : It takes the inputs as sold-to-party or material number and date

Output: It shoes the changed document detalis.

This code includes ALV INTERACTIVE and also code for disabling the other options on toolbar in pop windows .

&----


*& TYPE-POOLS

&----


TYPE-POOLS: SLIS. "Global types for generic cunning components

&----


*& TABLE USED *

&----


TABLES: VBAK, "Sales Document: Header Data

VBPA, "Sales Document: Partner

CDHDR, "Change document header

CDPOS, "Change document items

VBUK. "Sales Document: Header Status and Administrative Data

&----


*& INTERNAL TABLE STRUCTURE *

&----


TYPES: BEGIN OF TY_KUNNR,

KUNNR TYPE KUNNR, "Customer Number

END OF TY_KUNNR.

TYPES: BEGIN OF TY_MATNR,

MATNR TYPE MATNR, "Material Number

END OF TY_MATNR.

TYPES:BEGIN OF TY_VBAK,

VBELN TYPE VBELN, "Sales Document

KUNNR TYPE KUNNR, "Sold-to-party

END OF TY_VBAK.

TYPES:BEGIN OF TY_VBAP,

VBELN TYPE VBELN, "Sales Document

END OF TY_VBAP.

DATA: BEGIN OF I_OUTPUT OCCURS 10.

INCLUDE STRUCTURE CDSHW.

DATA: USERNAME TYPE CDUSERNAME,

CHANGENR TYPE CDCHANGENR,

TCODE TYPE CDTCODE,

UDATE TYPE CDDATUM,

UTIME TYPE CDUZEIT,

VBELN(10),

POSNR(6),

ETENR(4),

INDTEXT(200),

END OF I_OUTPUT.

DATA: BEGIN OF I_VTEXT OCCURS 0,

PARVW LIKE TPART-PARVW,

VTEXT LIKE TPART-VTEXT,

END OF I_VTEXT.

DATA: BEGIN OF I_CDSHW OCCURS 50.

INCLUDE STRUCTURE CDSHW.

DATA: END OF I_CDSHW.

DATA: BEGIN OF I_CDHDR OCCURS 50.

INCLUDE STRUCTURE CDHDR.

DATA: END OF I_CDHDR.

&----


*& INTERNAL TABLE BODY *

&----


DATA: I_VBAK TYPE TABLE OF TY_VBAK,

I_KUNNR TYPE TABLE OF TY_KUNNR,

I_VBAK1 TYPE TABLE OF TY_VBAK,

I_MATNR TYPE TABLE OF TY_MATNR.

&----


*& INTERNAL TABLE WORKAREA *

&----


DATA: W_VBAK1 TYPE TY_VBAK,

W_VBAK TYPE TY_VBAK.

&----


*& VARIABLES USED *

&----


DATA: V_FVAL(10) TYPE N,

V_X TYPE C,

K_UTEXT(16) VALUE 'has been changed',

K_ITEXT(16) VALUE 'has been created',

K_DTEXT(16) VALUE 'has been deleted'.

&----


*& INTERNAL TABLES AND WORK AREAS FOR THE FIELD CATALOGS *

&----


DATA : I_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,

W_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV,

I_FIELDCAT2 TYPE SLIS_T_FIELDCAT_ALV,

W_FIELDCAT2 TYPE SLIS_FIELDCAT_ALV,

I_EXCLUDING TYPE SLIS_T_EXTAB,

W_EXCLUDING TYPE SLIS_EXTAB.

&----


*& SELECTION SCREENS *

&----


SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS: STPR RADIOBUTTON GROUP RAD1 DEFAULT 'X' USER-COMMAND UC, " RADIOBUTTON FOR SOLD-TO-PARTY

P_KUNNR TYPE VBAK-KUNNR MODIF ID ONE, " PARAMETER FOR SOLD-TO-PARTY

MATR RADIOBUTTON GROUP RAD1, " RADIOBUTTON FOR MATERIAL NUMBER

P_MATNR TYPE VBAP-MATNR MODIF ID TWO. " PARAMETER FOR MATERIAL NUMBER

SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN:SKIP 2.

SELECTION-SCREEN: BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.

SELECT-OPTIONS: DATE FOR VBAK-AUDAT. " SELECT OPTIONS FOR DATE

SELECTION-SCREEN: END OF BLOCK B2.

&----


*& AT SELECTION-SCREEN OUTPUT *

&----


AT SELECTION-SCREEN OUTPUT.

PERFORM SCREEN. " For enabling and disabling the parameters based on the radiobuttons checked.

&----


*& SCREEN VALIDATIONS *

&----


AT SELECTION-SCREEN .

PERFORM SCREEN.

IF STPR = 'X' AND P_KUNNR IS INITIAL.

MESSAGE E005. "#EC *

ELSEIF STPR = 'X' AND P_KUNNR IS NOT INITIAL.

SELECT SINGLE * FROM VBAK WHERE KUNNR = P_KUNNR AND AUDAT IN DATE. "#EC *

IF SY-SUBRC <> 0 .

MESSAGE E006. "#EC *

ENDIF.

ELSEIF MATR = 'X' AND P_MATNR IS INITIAL.

MESSAGE E007. "#EC *

ELSEIF MATR = 'X' AND P_MATNR IS NOT INITIAL.

SELECT VBAK~VBELN INTO TABLE I_VBAK

FROM VBAK INNER JOIN VBAP ON VBAK~VBELN = VBAP~VBELN

WHERE VBAP~MATNR = P_MATNR AND VBAK~AUDAT IN DATE.

IF SY-SUBRC <> 0 .

MESSAGE E008. "#EC *

ENDIF.

REFRESH I_VBAK.

ENDIF.

&----


*& AT SELECTION-SCREEN ON VALUE-REQUEST *

&----


AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_KUNNR.

SELECT KUNNR

FROM KNA1

INTO TABLE I_KUNNR.

SORT I_KUNNR .

DELETE ADJACENT DUPLICATES FROM I_KUNNR.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' "function module to provide f4 help to sold-to-party

EXPORTING

RETFIELD = 'SOLD-TO-PARTY'

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

DYNPROFIELD = 'P_KUNNR'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = I_KUNNR

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.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.

SELECT MATNR

FROM MARA

INTO TABLE I_MATNR .

SORT I_MATNR.

DELETE ADJACENT DUPLICATES FROM I_MATNR.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' "Function module to provide F4 help to material number

EXPORTING

RETFIELD = 'MATERIAL'

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

DYNPROFIELD = 'P_MATNR'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = I_MATNR

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.

&----


*& SELECTION STATEMENTS *

&----


START-OF-SELECTION.

IF STPR = 'X' AND P_KUNNR IS NOT INITIAL.

                • SELECT STATEMENT FOR SELECTING DOC NO. BASED ON SOLD-TO-PARTY AND DATE.

SELECT VBELN KUNNR

FROM VBAK INTO TABLE I_VBAK

WHERE KUNNR = P_KUNNR AND AUDAT IN DATE.

LOOP AT I_VBAK INTO W_VBAK.

CLEAR CDHDR.

CLEAR CDPOS.

CDHDR-OBJECTCLAS = 'VERKBELEG'.

CDHDR-OBJECTID = W_VBAK-VBELN.

PERFORM READHEADER.

IF V_X NE 'X'.

W_VBAK1-VBELN = W_VBAK-VBELN.

APPEND W_VBAK1 TO I_VBAK1.

ENDIF.

CLEAR : W_VBAK,V_X.

ENDLOOP.

ENDIF.

IF MATR = 'X' AND P_MATNR IS NOT INITIAL.

              • SELECT STATEMENT FOR SELECTING DOC NO. BASED ON MATERIAL AND DATE.

SELECT VBAK~VBELN INTO TABLE I_VBAK

FROM VBAK INNER JOIN VBAP ON VBAKVBELN = VBAPVBELN

WHERE VBAPMATNR = P_MATNR AND VBAKAUDAT IN DATE.

LOOP AT I_VBAK INTO W_VBAK.

CLEAR CDHDR.

CLEAR CDPOS.

CDHDR-OBJECTCLAS = 'VERKBELEG'.

CDHDR-OBJECTID = W_VBAK-VBELN.

PERFORM READHEADER.

IF V_X NE 'X'.

W_VBAK1-VBELN = W_VBAK-VBELN.

APPEND W_VBAK1 TO I_VBAK1.

ENDIF.

CLEAR : W_VBAK,V_X.

ENDLOOP.

ENDIF.

&----


*& AT LINE SELECTION *

&----


AT LINE-SELECTION.

REFRESH I_OUTPUT.

GET CURSOR VALUE V_FVAL.

PERFORM INTERACTIVE1.

&----


*& TOP-OF-PAGE *

&----


TOP-OF-PAGE.

IF STPR = 'X'.

WRITE:/ TEXT-005,P_KUNNR.

SKIP 1.

ELSE.

WRITE:/ TEXT-006,P_MATNR.

SKIP 1.

ENDIF.

&----


*& END-OF-SELECTION *

&----


END-OF-SELECTION.

WRITE:1(15) SY-ULINE.

FORMAT COLOR 1.

WRITE:/1 SY-VLINE,3 TEXT-007 , 15 SY-VLINE.

WRITE:/1(15) SY-ULINE.

LOOP AT I_VBAK1 INTO W_VBAK1.

FORMAT COLOR 2.

WRITE:/1 SY-VLINE,3 W_VBAK1-VBELN , 15 SY-VLINE.

ENDLOOP.

WRITE:/1(15) SY-ULINE.

&----


*& Form INTERACTIVE1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM INTERACTIVE1.

SELECT * FROM VBUK WHERE VBELN = V_FVAL.

CLEAR CDHDR.

CLEAR CDPOS.

CDHDR-OBJECTCLAS = 'VERKBELEG'.

CDHDR-OBJECTID = VBUK-VBELN.

PERFORM READHEADER.

PERFORM READPOS. "#EC *

ENDSELECT.

SELECT PARVW VTEXT FROM TPART INTO TABLE I_VTEXT WHERE SPRAS = SY-LANGU.

LOOP AT I_OUTPUT.

PERFORM ACTION.

ENDLOOP.

SORT I_OUTPUT BY UTIME DESCENDING.

DELETE ADJACENT DUPLICATES FROM I_OUTPUT COMPARING ALL FIELDS.

REFRESH I_FIELDCAT1.

CLEAR W_FIELDCAT1.

W_FIELDCAT1-FIELDNAME = 'UDATE'.

W_FIELDCAT1-TABNAME = 'I_OUTPUT'.

W_FIELDCAT1-SELTEXT_M = 'DATE'.

W_FIELDCAT1-OUTPUTLEN = '000010'.

APPEND W_FIELDCAT1 TO I_FIELDCAT1.

CLEAR W_FIELDCAT1.

W_FIELDCAT1-FIELDNAME = 'POSNR'.

W_FIELDCAT1-TABNAME = 'I_OUTPUT'.

W_FIELDCAT1-SELTEXT_M = 'ITEM NUMBER'.

W_FIELDCAT1-OUTPUTLEN = '000011'.

APPEND W_FIELDCAT1 TO I_FIELDCAT1.

CLEAR W_FIELDCAT1.

W_FIELDCAT1-FIELDNAME = 'ETENR'.

W_FIELDCAT1-TABNAME = 'I_OUTPUT'.

W_FIELDCAT1-SELTEXT_M = 'SCHEDULED LINE NUMBER'.

W_FIELDCAT1-OUTPUTLEN = '000015'.

APPEND W_FIELDCAT1 TO I_FIELDCAT1.

CLEAR W_FIELDCAT1.

W_FIELDCAT1-FIELDNAME = 'INDTEXT'.

W_FIELDCAT1-TABNAME = 'I_OUTPUT'.

W_FIELDCAT1-SELTEXT_M = 'ACTION'.

W_FIELDCAT1-OUTPUTLEN = '000040'.

APPEND W_FIELDCAT1 TO I_FIELDCAT1.

CLEAR W_FIELDCAT1.

W_FIELDCAT1-FIELDNAME = 'USERNAME'.

W_FIELDCAT1-TABNAME = 'I_OUTPUT'.

W_FIELDCAT1-SELTEXT_M = 'USERNAME'.

W_FIELDCAT1-OUTPUTLEN = '000010'.

APPEND W_FIELDCAT1 TO I_FIELDCAT1.

CLEAR W_FIELDCAT1.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' "Function module for list display

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

I_CALLBACK_USER_COMMAND = 'SUB_COMMAND1'

IT_FIELDCAT = I_FIELDCAT1

TABLES

T_OUTTAB = I_OUTPUT.

ENDFORM. " INTERACTIVE1

&----


*& Form SUB_COMMAND1

&----


  • text

----


  • -->R_UCOMM text

  • -->R_SELFIELD text

----


FORM SUB_COMMAND1 USING R_UCOMM TYPE SY-UCOMM "#EC *

R_SELFIELD TYPE SLIS_SELFIELD."#EC * "#EC CALLED

W_EXCLUDING-FCODE = '&NT1'.

APPEND W_EXCLUDING TO I_EXCLUDING.

W_EXCLUDING-FCODE = '&ETA'.

APPEND W_EXCLUDING TO I_EXCLUDING.

W_EXCLUDING-FCODE = '&ODN'.

APPEND W_EXCLUDING TO I_EXCLUDING.

W_EXCLUDING-FCODE = '&OUP'.

APPEND W_EXCLUDING TO I_EXCLUDING.

W_EXCLUDING-FCODE = '%SC'.

APPEND W_EXCLUDING TO I_EXCLUDING.

W_EXCLUDING-FCODE = '%SC+'.

APPEND W_EXCLUDING TO I_EXCLUDING.

W_EXCLUDING-FCODE = '&ILT'.

APPEND W_EXCLUDING TO I_EXCLUDING.

W_EXCLUDING-FCODE = '&OL0'.

APPEND W_EXCLUDING TO I_EXCLUDING.

W_EXCLUDING-FCODE = '&CRB'.

APPEND W_EXCLUDING TO I_EXCLUDING.

W_EXCLUDING-FCODE = '&CRL'.

APPEND W_EXCLUDING TO I_EXCLUDING.

W_EXCLUDING-FCODE = '&CRR'.

APPEND W_EXCLUDING TO I_EXCLUDING.

W_EXCLUDING-FCODE = '&CRE'.

APPEND W_EXCLUDING TO I_EXCLUDING.

REFRESH I_FIELDCAT2.

CLEAR W_FIELDCAT2.

W_FIELDCAT2-FIELDNAME = 'TABNAME'.

W_FIELDCAT2-TABNAME = 'I_OUTPUT'.

W_FIELDCAT2-SELTEXT_M = 'TABLENAME'.

W_FIELDCAT2-OUTPUTLEN = '000010'.

APPEND W_FIELDCAT2 TO I_FIELDCAT2.

CLEAR W_FIELDCAT2.

W_FIELDCAT2-FIELDNAME = 'FNAME'.

W_FIELDCAT2-TABNAME = 'I_OUTPUT'.

W_FIELDCAT2-SELTEXT_M = 'FIELD NAME'.

W_FIELDCAT2-OUTPUTLEN = '000015'.

APPEND W_FIELDCAT2 TO I_FIELDCAT2.

CLEAR W_FIELDCAT2.

W_FIELDCAT2-FIELDNAME = 'USERNAME'.

W_FIELDCAT2-TABNAME = 'I_OUTPUT'.

W_FIELDCAT2-SELTEXT_M = 'USERNAME'.

W_FIELDCAT2-OUTPUTLEN = '000010'.

APPEND W_FIELDCAT2 TO I_FIELDCAT2.

CLEAR W_FIELDCAT2.

W_FIELDCAT2-FIELDNAME = 'TCODE'.

W_FIELDCAT2-TABNAME = 'I_OUTPUT'.

W_FIELDCAT2-SELTEXT_M = 'TRANSACTION'.

W_FIELDCAT2-OUTPUTLEN = '000015'.

APPEND W_FIELDCAT2 TO I_FIELDCAT2.

CLEAR W_FIELDCAT2.

W_FIELDCAT2-FIELDNAME = 'UDATE'.

W_FIELDCAT2-TABNAME = 'I_OUTPUT'.

W_FIELDCAT2-SELTEXT_M = 'DATE'.

W_FIELDCAT2-OUTPUTLEN = '000010'.

APPEND W_FIELDCAT2 TO I_FIELDCAT2.

CLEAR W_FIELDCAT2.

W_FIELDCAT2-FIELDNAME = 'UTIME'.

W_FIELDCAT2-TABNAME = 'I_OUTPUT'.

W_FIELDCAT2-SELTEXT_M = 'TIME'.

W_FIELDCAT2-OUTPUTLEN = '000010'.

APPEND W_FIELDCAT2 TO I_FIELDCAT2.

CLEAR W_FIELDCAT2.

CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

EXPORTING

I_TITLE = 'ORDER'

I_SCREEN_START_COLUMN = 5

I_SCREEN_START_LINE = 5

I_SCREEN_END_COLUMN = 80

I_SCREEN_END_LINE = 25

I_SCROLL_TO_SEL_LINE = 'X'

I_TABNAME = 'I_OUTPUT'

IT_FIELDCAT = I_FIELDCAT2

IT_EXCLUDING = I_EXCLUDING

TABLES

T_OUTTAB = I_OUTPUT.

ENDFORM. "SUB_COMMAND1

&----


*& Form READPOS

&----


  • text

----


FORM READPOS.

LOOP AT I_CDHDR.

CHECK I_CDHDR-UDATE IN DATE.

CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'

EXPORTING

CHANGENUMBER = I_CDHDR-CHANGENR

TABLEKEY = CDPOS-TABKEY

TABLENAME = CDPOS-TABNAME

IMPORTING

HEADER = CDHDR

TABLES

EDITPOS = I_CDSHW

EXCEPTIONS

NO_POSITION_FOUND = 1

OTHERS = 2.

CASE SY-SUBRC.

WHEN '0000'.

LOOP AT I_CDSHW.

CHECK I_CDSHW-CHNGIND NE 'E'.

CLEAR I_OUTPUT.

MOVE-CORRESPONDING I_CDHDR TO I_OUTPUT. "#EC ENHOK

MOVE-CORRESPONDING I_CDSHW TO I_OUTPUT.

CASE I_OUTPUT-TABNAME.

WHEN 'KONVC'.

MOVE I_CDHDR-OBJECTID TO I_OUTPUT-VBELN.

MOVE I_CDSHW-TABKEY(6) TO I_OUTPUT-POSNR.

WHEN OTHERS.

MOVE I_CDSHW-TABKEY+3(10) TO I_OUTPUT-VBELN.

MOVE I_CDSHW-TABKEY+13(6) TO I_OUTPUT-POSNR.

MOVE I_CDSHW-TABKEY+19(4) TO I_OUTPUT-ETENR.

ENDCASE.

MOVE '& %' TO I_OUTPUT-INDTEXT.

APPEND I_OUTPUT.

CLEAR I_OUTPUT.

ENDLOOP.

WHEN OTHERS.

MESSAGE W009. "#EC *

LEAVE.

ENDCASE.

ENDLOOP.

ENDFORM. "READPOS

&----


*& Form READHEADER

&----


  • text

----


FORM READHEADER.

CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'

EXPORTING

DATE_OF_CHANGE = CDHDR-UDATE

OBJECTCLASS = CDHDR-OBJECTCLAS

OBJECTID = CDHDR-OBJECTID

TIME_OF_CHANGE = CDHDR-UTIME

USERNAME = CDHDR-USERNAME

TABLES

I_CDHDR = I_CDHDR

EXCEPTIONS

NO_POSITION_FOUND = 1

OTHERS = 2.

IF SY-SUBRC NE 0.

V_X = 'X'.

ENDIF.

ENDFORM. "READHEADER

&----


*& Form l

&----


  • text

----


FORM SCREEN.

IF STPR = 'X'.

P_MATNR = ' '.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'ONE'.

SCREEN-INPUT = '1'.

MODIFY SCREEN.

ENDIF.

IF SCREEN-GROUP1 = 'TWO'.

SCREEN-INPUT = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSEIF MATR = 'X'.

P_KUNNR = ' '.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'TWO'.

SCREEN-INPUT = '1'.

MODIFY SCREEN.

ENDIF.

IF SCREEN-GROUP1 = 'ONE'.

SCREEN-INPUT = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

ENDFORM. "SCREEN

&----


*& Form action

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM ACTION .

CASE I_OUTPUT-TABNAME.

WHEN 'VBPA'.

IF I_OUTPUT-FNAME = 'KUNNR' OR

I_OUTPUT-FNAME IS INITIAL.

MOVE I_OUTPUT-TABKEY TO VBPA.

READ TABLE I_VTEXT WITH KEY PARVW = VBPA-PARVW .

IF SY-SUBRC = 0.

REPLACE '&' WITH I_VTEXT-VTEXT INTO I_OUTPUT-INDTEXT.

ENDIF.

ENDIF.

WHEN 'VBAP'.

IF I_OUTPUT-FNAME IS INITIAL.

REPLACE '&' WITH TEXT-111 INTO I_OUTPUT-INDTEXT.

ENDIF.

ENDCASE.

IF I_OUTPUT-INDTEXT(1) EQ '&'.

REPLACE '&' WITH I_OUTPUT-FTEXT(40) INTO I_OUTPUT-INDTEXT.

ENDIF.

IF I_OUTPUT-CHNGIND = 'I'.

REPLACE '%' WITH K_ITEXT INTO I_OUTPUT-INDTEXT.

ELSEIF I_OUTPUT-CHNGIND = 'U'.

REPLACE '%' WITH K_UTEXT INTO I_OUTPUT-INDTEXT.

ELSE.

REPLACE '%' WITH K_DTEXT INTO I_OUTPUT-INDTEXT.

ENDIF.

CONDENSE I_OUTPUT-INDTEXT.

MODIFY I_OUTPUT.

ENDFORM. " action