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: 

Regarding ALV report

Former Member
0 Kudos

Hi,

I am having some problem with ALV report.

Need to get check boxes in alv grid, for further process.

exact requirement is I have to select idoc numbers whichdisplayed in alv grid and it has to populate in t.code bd87.

I am sending that program. can u plz help me regarding that.

report zsafmreport." NO STANDARD PAGE HEADING LINE-COUNT 40 .

  • -- Type-Pools---

type-pools : slis.

tables: edidc,comh.

*--


Types--


types:begin of ty_edidc,

docnum type edi_docnum,

mestyp type edi_mestyp,

direct type direct,

status type edi_status,

credat type edi_upddat,

cretim type edi_updtim,

sndprt type edi_sndprt,

sndprn type edi_sndprn,

rcvprt type edi_rcvprt,

rcvprn type edi_rcvprn,

idoctp type edi_idoctp,

cimtyp type edi_cimtyp,

end of ty_edidc,

begin of ty_report,

docnum type edi_docnum,

mestyp type edi_mestyp,

direct type direct,

status type edi_status,

creation(50) type c,

sender(50) type c,

receiver(50) type c,

idoc_structure(50) type c,

end of ty_report.

*--


Work Areas--


data:st_edidc type ty_edidc,

st_report type ty_report,

st_fieldcat type slis_fieldcat_alv,

st_event type slis_alv_event,

st_layout type slis_layout_alv.

*--


INTERNAL TABLES--


data: t_edidc type standard table of ty_edidc,

t_report type standard table of ty_report,

t_fieldcat type slis_t_fieldcat_alv,

t_event type slis_t_event,

t_layout type standard table of slis_layout_alv.

  • - --------------------------------------------------------------------

  • -- Selection-Screen Definitions

  • - --------------------------------------------------------------------

selection-screen begin of block b1 with frame title text-001.

select-options: s_credat for edidc-credat, "Date Created

s_cretim for edidc-cretim. "Time Created

selection-screen end of block b1.

  • --------------------------

selection-screen begin of block b2 with frame title text-002.

select-options: s_mestyp for edidc-mestyp, "Log Mess Type

s_direct for edidc-direct. "Direction

parameters: p_status like edidc-status.

selection-screen end of block b2.

*----


selection-screen begin of block b3 with frame title text-003.

select-options: s_werk for comh-werk, " Plant

s_source for comh-source, "Sender of the process message

s_mscla for comh-mscla. "Process message category

parameters: p_errkz like comh-errkz, "Processing status of the process

" message/the control recipe

p_tstkz like comh-tstkz. "Indicator: message or control

"RECIPE FOR TEST PURPOSES

selection-screen end of block b3.

----


  • Validation for Date Created

----


at selection-screen on s_credat.

perform validate_date_created.

----


  • Validation for Time Created

----


at selection-screen on s_cretim.

perform validate_time_created.

----


  • Validation for Log Mess Type

----


at selection-screen on s_mestyp.

perform validate_log_msg_type.

----


  • Validation for Direction

----


at selection-screen on s_direct.

perform validate_direction.

----


  • Validation for PLANT

----


at selection-screen on s_werk.

perform validate_plant.

----


  • Validation for Sender of the process message

----


at selection-screen on s_source.

perform validate_sender_of_the_process.

----


  • Validation for Process message category

----


at selection-screen on s_mscla.

perform validate_process_message_categ.

  • Filling events internal table

st_event-name = 'PF_STATUS_SET'.

st_event-form = 'MY_STATUS'.

append st_event to t_event.

clear st_event.

st_event-name = 'USER_COMMAND'.

st_event-form = 'EVENT'.

append st_event to t_event.

clear st_event.

  • Filling layout

st_layout-box_fieldname = 'CHECKBOX'.

append st_layout to t_layout.

----


  • Validation for Processing status of the process

  • message/the control recipe

----


*

*AT SELECTION-SCREEN ON P_ERRKZ .

*

  • PERFORM VALIDATE_PROCESSING_STATUS_PROCESS.

*

*----


    • Validation for Indicator: message or control

    • RECIPE FOR TEST PURPOSES

*----


*

*AT SELECTION-SCREEN ON P_TSTKZ.

*

  • PERFORM VALIDATE_INDICATOR_MESSAGE_OR_CONTROL.

**&----


**

**& Form VALIDATE_DATE_CREATED

**&----


**

    • text

**----


**

    • --> p1 text

    • <-- p2 text

**----


top-of-page.

write:/ ' IDoc Lists'.

end-of-page.

write:/ sy-pagno.

**

  • - --------------------------------------------------------------------

  • -- START-OF-SLECTION

  • - --------------------------------------------------------------------

start-of-selection.

*-- Read Sales orders from table vbak based on enterd the selection

*-- screen.

perform read_selction.

  • - --------------------------------------------------------------------

  • --END-OF-SLECTION

  • - --------------------------------------------------------------------

end-of-selection.

perform new_data_fields using:'DOCNUM' 'DOC NO',

'MESTYP' 'Logical message type',

'DIRECT' 'Direction',

'STATUS' 'Status',

'CREATION' 'CREATION',

'SENDER' 'SENDER',

'RECEIVER' 'RECEIVER',

'IDOC_STRUCCTURE' 'IDoc STRUCTURE'.

*-- Display report.

perform display.

----


  • FORM VALIDATE_DATE_CREATED *

----


  • ........ *

----


form validate_date_created.

check not s_credat[] is initial.

data : lv_credat like edidc-credat.

select credat

into lv_credat

from edidc

up to 1 rows

where credat in s_credat.

endselect.

if sy-subrc ne 0.

message e000(0) with 'Invalid DATE'.

endif.

endform. " VALIDATE_DATE_CREATED

&----


*& Form VALIDATE_TIME_CREATED

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form validate_time_created.

check not s_cretim[] is initial.

data : lv_cretim like edidc-cretim.

select cretim

into lv_cretim

from edidc

up to 1 rows

where cretim in s_cretim.

endselect.

if sy-subrc ne 0.

message e000(0) with 'Invalid TIME CREATED ENTERD'.

endif.

endform. " VALIDATE_TIME_CREATED

&----


*& Form VALIDATE_LOG_MSG_TYPE

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form validate_log_msg_type.

check not s_mestyp[] is initial.

data : lv_mestyp like edidc-mestyp.

select mestyp

into lv_mestyp

from edidc

up to 1 rows

where mestyp in s_mestyp.

endselect.

if sy-subrc ne 0.

message e000(0)

with 'Invalid Logical message type'.

endif.

endform. " VALIDATE_LOG_MSG_TYPE

&----


*& Form VALIDATE_DIRECTION

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form validate_direction.

check not s_direct[] is initial.

data : lv_direct like edidc-direct.

select direct

into lv_direct

from edidc

up to 1 rows

where mestyp in s_direct.

endselect.

if sy-subrc ne 0.

message e000(0) with 'Invalid DIRECTION'.

endif.

endform. " VALIDATE_DIRECTION

&----


*& Form VALIDATE_PLANT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form validate_plant.

check not s_werk[] is initial.

data : lv_werk like comh-werk.

select werk

into lv_werk

from comh

up to 1 rows

where werk in s_werk.

endselect.

if sy-subrc ne 0.

message e000(0)

with 'Invalid PLANT Number.'.

endif.

endform. " VALIDATE_PLANT

&----


*& Form VALIDATE_SENDER_OF_THE_PROCESS

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form validate_sender_of_the_process.

check not s_source[] is initial.

data : lv_source like comh-source.

select source

into lv_source

from comh

up to 1 rows

where werk in s_source.

endselect.

if sy-subrc ne 0.

message e000(0)

with 'Invalid SENDER_OF_THE_PROCESS.'.

endif.

endform. " VALIDATE_SENDER_OF_THE_PROCESS

&----


*& Form VALIDATE_PROCESS_MESSAGE_CATEG

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form validate_process_message_categ.

check not s_mscla[] is initial.

data : lv_mscla like comh-mscla.

select mscla

into lv_mscla

from comh

up to 1 rows

where werk in s_mscla.

endselect.

if sy-subrc ne 0.

message e000(0)

with 'Invalid PROCESS_MESSAGE_CATEG'.

endif.

endform. " VALIDATE_PROCESS_MESSAGE_CATEG

&----


*& Form READ_SELCTION

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form read_selction.

select docnum

mestyp

direct

status

credat

cretim

sndprt

sndprn

rcvprt

rcvprn

idoctp

cimtyp

into table t_edidc

from edidc

where credat in s_credat

and cretim in s_cretim

and mestyp in s_mestyp

and direct in s_direct

and status = p_status.

loop at t_edidc into st_edidc.

move: st_edidc-docnum to st_report-docnum,

st_edidc-mestyp to st_report-mestyp,

st_edidc-direct to st_report-direct,

st_edidc-status to st_report-status,

st_edidc-direct to st_report-direct,

st_edidc-direct to st_report-direct.

concatenate st_edidc-credat st_edidc-cretim into st_report-creation

separated by space.

concatenate st_edidc-sndprt st_edidc-sndprn into st_report-sender

separated by space.

concatenate st_edidc-rcvprt st_edidc-rcvprn into st_report-receiver

separated by space.

concatenate st_edidc-idoctp st_edidc-cimtyp into

st_report-idoc_structure separated by space.

append st_report to t_report.

endloop.

endform. " READ_SELCTION

&----


*& Form DISPLAY

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form display.

*LOOP AT T_EDIDC INTO ST_EDIDC.

*

*WRITE:/ ST_EDIDC-DOCNUM,

  • ST_EDIDC-CREDAT,

  • ST_EDIDC-CRETIM,

  • ST_EDIDC-MESTYP,

  • ST_EDIDC-DIRECT,

  • ST_EDIDC-STATUS.

data : lv_repid like sy-repid.

lv_repid = sy-repid.

sort t_edidc[] by: mestyp, docnum.

  • call function 'REUSE_ALV_LIST_DISPLAY'

  • exporting

  • i_callback_program = lv_repid

  • it_fieldcat = t_fieldcat

  • it_events = t_event

  • tables

  • t_outtab = t_report.

*

  • CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

  • EXPORTING

  • i_callback_program = sy-cprog

  • it_fieldcat = t_fieldcat

  • TABLES

  • t_outtab = t_report.

*

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = sy-cprog

  • is_layout = st_layout

it_fieldcat = t_fieldcat

it_events = t_event

tables

t_outtab = t_report.

endform. " DISPLAY

&----


*& Form NEW_DATA_FIELDS

&----


  • text

----


  • -->P_0282 text

  • -->P_0283 text

----


form new_data_fields using value(p_0282)

value(p_0283).

st_fieldcat-fieldname = p_0282.

st_fieldcat-seltext_l = p_0283.

append st_fieldcat to t_fieldcat.

clear st_fieldcat.

endform. " NEW_DATA_FIELDS

----


  • FORM PF_STATUS *

----


  • ........ *

----


  • --> *

----


form my_status changing ex_tab type slis_t_extab.

set pf-status 'MY_STATUS'.

endform.

----


  • FORM EVENT *

----


  • ........ *

----


  • --> UCOMM *

  • --> T_SEL *

----


form event using ucomm type sy-ucomm

t_sel type slis_selfield.

case ucomm.

when '&IC1'.

read table t_report into st_report index t_sel-tabindex.

if st_report-status ge 49.

set parameter id 'DCN' field st_report-docnum.

*set parameter id 'DCN' field st_report-docnum.

*set parameter id 'DCN' field st_report-docnum.

*set parameter id 'DCN' field st_report-docnum.

*set parameter id 'DCN' field st_report-docnum.

*set parameter id 'DCN' field st_report-docnum.

*set parameter id 'DCN' field st_report-docnum.

call transaction 'BD87' and skip first screen..

else.

call transaction 'BD88'.

endif.

endcase.

endform.

1 ACCEPTED SOLUTION

former_member2382
Active Participant
0 Kudos

Add these steps into ur code.

Step 1.

Define this field into ur final internal table(ie.., t_report) that ur passing into the function module.

check TYPE c.

as shown below..

begin of ty_report,

docnum type edi_docnum,

mestyp type edi_mestyp,

direct type direct,

status type edi_status,

creation(50) type c,

sender(50) type c,

receiver(50) type c,

idoc_structure(50) type c,

check TYPE c,

end of ty_report.

Step 2.

add this line into ur fieldcatalog.

gt_layout-box_fieldname = 'CHECK'.

as shown below..

orm new_data_fields using value(p_0282)

value(p_0283).

st_fieldcat-fieldname = p_0282.

st_fieldcat-seltext_l = p_0283.

gt_layout-box_fieldname = 'CHECK'.

append st_fieldcat to t_fieldcat.

clear st_fieldcat.

endform. " NEW_DATA_FIELDS

Regards,

Parvez.

reward point if helpful.

5 REPLIES 5

former_member632991
Active Contributor
0 Kudos

Hi,

take this

<b>FIELDCATALOG-CHECKBOX = 'X' .

FIELDCATALOG-EDIT = 'X' .</b>

use FORM_USER_COMMAND to do further processing based on ur selection.

<b>FORM FORM_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM</b> RS_SELFIELD TYPE SLIS_SELFIELD..

DATA: GD_REPID LIKE SY-REPID, "Exists

REF_GRID TYPE REF TO CL_GUI_ALV_GRID. "new *then insert the

"FOLLOWING CODE IN YOUR USER_COMMAND ROUTINE...

IF REF_GRID IS INITIAL.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

E_GRID = REF_GRID.

ENDIF.

IF NOT REF_GRID IS INITIAL.

CALL METHOD REF_GRID->CHECK_CHANGED_DATA .

ENDIF.

rs_sELFIELD-refresh = 'X'.

CASE R_UCOMM.

WHEN 'REL'.

<b>LOOP AT IT_EKKO WHERE CHECK = 'X' .</b>

*IT_FINAL-VBELN = IT_EKKO-VBELN .

*IT_FINAL-GC_CHECK = IT_EKKO-GC_CHECK .

*IT_FINAL-STAT1 = 'X' .

*IT_FINAL-VBELN = IT_EKKO-VBELN .

MOVE-CORRESPONDING IT_EKKO TO IT_FINAL .

*****MOVE 'X' TO IT_FINAL-STAT1 .

<b>write ur code here. </b>

ENDCASE.

ENDFORM. "user_command

Regards,

Sonika

0 Kudos

Thanks for u r replay,

But i am not getting check bobes in out put by using reuse_alv_grid.

Is there any parameter to get check box as one field in out put

regards

sarath

0 Kudos

Hi,

yes as i have explained u earlier, u have to take an extra field , and define its checkbox property as X and editable mode also selected.

take this

FIELDCATALOG-FIELDNAME = 'CHECK'. "<b>CHECK IS A FIELD IN THE FINAL INTERNAL TABLE AS A CHAR.</b> FIELDCATALOG-CHECKBOX = 'X' .

FIELDCATALOG-EDIT = 'X' .

now u will get the field as check box.

Regards,

Sonika

former_member2382
Active Participant
0 Kudos

Add these steps into ur code.

Step 1.

Define this field into ur final internal table(ie.., t_report) that ur passing into the function module.

check TYPE c.

as shown below..

begin of ty_report,

docnum type edi_docnum,

mestyp type edi_mestyp,

direct type direct,

status type edi_status,

creation(50) type c,

sender(50) type c,

receiver(50) type c,

idoc_structure(50) type c,

check TYPE c,

end of ty_report.

Step 2.

add this line into ur fieldcatalog.

gt_layout-box_fieldname = 'CHECK'.

as shown below..

orm new_data_fields using value(p_0282)

value(p_0283).

st_fieldcat-fieldname = p_0282.

st_fieldcat-seltext_l = p_0283.

gt_layout-box_fieldname = 'CHECK'.

append st_fieldcat to t_fieldcat.

clear st_fieldcat.

endform. " NEW_DATA_FIELDS

Regards,

Parvez.

reward point if helpful.

0 Kudos

Thanks

its working

One more in that one

after selecting the boxes it has to populate in BD87

can u please help me in that one.

regards

sarath