Application Development and Automation 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: 
Read only

Problem while using Alv Block List

Former Member
0 Likes
457

HI All,

PLZ help me .

By using this code I select data from TXT file and insert data in CS13 transaction then I want to show each material which present in TXT file as ALV BLOCK DISPLAY.

Suppose txt file contain 4 material so report will show 4 list block .means data of every material showing in different blocks in the report.

Code which I am using showing showing data only for last material which present in the table it_matmaster in every block.

Please guide me what is the problem.

I am pasting changed code for you.

i am using below codes..........

&----


*& Report ZCS13 *

*& *

&----


*& *

*& *

&----


REPORT zcs13 .

TABLES:

mara,

stpo,

t001w,

stko.

TYPE-POOLS: slis.

DATA: BEGIN OF it_stb OCCURS 0.

INCLUDE STRUCTURE zstpox.

DATA:END OF it_stb.

DATA: BEGIN OF it_matmaster OCCURS 0,

matnr TYPE matnr,

werks TYPE werks,

  • stlal type stlal,

  • capid type capid,

emeng TYPE emeng,

END OF it_matmaster.

DATA : ievent TYPE slis_t_event.

DATA: it_stb2 LIKE stpox OCCURS 0 WITH HEADER LINE,

it_stb3 LIKE stpox OCCURS 0 WITH HEADER LINE,

temp_cat TYPE slis_fieldcat_alv,

sline TYPE slis_listheader,

gt_list_top_of_page TYPE slis_t_listheader,

gs_layout TYPE slis_layout_alv ,

gt_events TYPE slis_t_event,

gt_sort TYPE slis_t_sortinfo_alv,

w_msg(255) TYPE c,

int TYPE i VALUE 0.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.

PARAMETERS:p_file LIKE rlgrap-filename OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b1 .

CONSTANTS c_x VALUE 'X'.

DATA: w_topmat LIKE cstmat,

fieldcat TYPE slis_t_fieldcat_alv ,

wa_fieldcat TYPE slis_fieldcat_alv.

DATA:v_file TYPE string.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

field_name = 'P_FILE'

IMPORTING

file_name = p_file.

START-OF-SELECTION.

v_file = p_file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = v_file

filetype = 'ASC'

has_field_separator = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

data_tab = it_matmaster

EXCEPTIONS

file_open_error = 1

file_read_error = 2

no_batch = 3

gui_refuse_filetransfer = 4

invalid_type = 5

no_authority = 6

unknown_error = 7

bad_data_format = 8

header_not_allowed = 9

separator_not_allowed = 10

header_too_long = 11

unknown_dp_error = 12

access_denied = 13

dp_out_of_memory = 14

disk_full = 15

dp_timeout = 16

OTHERS = 17

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

EXPORTING

i_callback_program = 'ZCS13'

  • I_CALLBACK_PF_STATUS_SET = PFSTATUS

i_callback_user_command = ''

  • IT_EXCLUDING =

.

  • PERFORM fldcat.

LOOP AT it_matmaster.

PERFORM explode_assembly.

PERFORM fldcat.

PERFORM append_blocklist.

  • PERFORM alv_display_grid.

ENDLOOP.

PERFORM alv_display_grid.

&----


*& Form EXPLODE_ASSEMBLY

&----


  • text

----


FORM explode_assembly.

CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'

EXPORTING

capid = 'BEST'

cuols = c_x

datuv = sy-datum

emeng = it_matmaster-emeng

knfba = c_x

ksbvo = c_x

mehrs = c_x

mbwls = c_x

  • mdmps = c_x

mktls = c_x

  • stlal = it_matmaster-stlal

  • stlan = p_bomap

mtnrv = it_matmaster-matnr

werks = it_matmaster-werks

  • svwvo = 'X'

  • vrsvo = 'X'

IMPORTING

topmat = w_topmat

TABLES

stb = it_stb

EXCEPTIONS

alt_not_found = 1

call_invalid = 2

material_not_found = 3

missing_authorization = 4

no_bom_found = 5

no_plant_data = 6

no_suitable_bom_found = 7

conversion_error = 8

OTHERS = 9.

IF sy-subrc <> 0.

  • MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

  • WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4

  • INTO w_msg.

  • WRITE: / w_msg.

  • EXIT.

ENDIF.

ENDFORM. "explode_assembly

&----


*& Form fldcat

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fldcat .

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = 'ZCS13'

  • i_internal_tabname = 'IT_STB'

i_structure_name = 'ZSTPOX'

  • I_CLIENT_NEVER_DISPLAY = 'X'

i_inclname = 'ZCS13'

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

ct_fieldcat = fieldcat[]

  • EXCEPTIONS

  • INCONSISTENT_INTERFACE = 1

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

ENDFORM. " fldcat

&----


*& Form alv_display_grid

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM alv_display_grid .

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'

EXPORTING

i_interface_check = 'x_print_layout'

  • IS_PRINT =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

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. " alv_display_grid

&----


*& Form append_blocklist

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM append_blocklist .

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

is_layout = gs_layout

it_fieldcat = fieldcat

i_tabname = 'IT_STB[]'

it_events = gt_events

it_sort = gt_sort

  • I_TEXT = ' '

TABLES

t_outtab = it_stb[]

EXCEPTIONS

program_error = 1

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

ENDFORM. " append_blocklist

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
410

Hi ,

Use the upload function 'WS_UPLOAD' . Declare ITAB of type table of your choice.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = FILENAME( Has to specified by you )

FILETYPE = 'ASC'

TABLES

DATA_TAB = ITAB

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

OTHERS = 10.

LOOP AT ITAB.

Use Split function to seperate the fields of the Internal table and append to a new Internal table of your choice.

ENDLOOP.

2 REPLIES 2
Read only

Former Member
0 Likes
411

Hi ,

Use the upload function 'WS_UPLOAD' . Declare ITAB of type table of your choice.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = FILENAME( Has to specified by you )

FILETYPE = 'ASC'

TABLES

DATA_TAB = ITAB

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

OTHERS = 10.

LOOP AT ITAB.

Use Split function to seperate the fields of the Internal table and append to a new Internal table of your choice.

ENDLOOP.

Read only

0 Likes
410

HI,

Thanks for your response.

I am not getting you .please tell in my code where i have to make changes.

and how i to use split function module...

Message was edited by:

rakesh singh