cancel
Showing results for 
Search instead for 
Did you mean: 

FAQ's plz try to answer them

Former Member
0 Kudos

12. Local file

Name Card name number

- master -

- visa -

- visa -

- master -

- master -

- master -

Write a code for how many master and visa records present in the table.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Sagarika,

Try this code.

types: begin of st_carddetails,

cardname(20),

cardnum type i,

end of st_carddetails.

data: gf_fpath type string,

gf_card type st_carddetails-cardname,

gf_total type i .

data: gt_carddetails type table of st_carddetails,

wa_carddetails type st_carddetails.

parameters: p_fpath(30) .

start-of-selection.

gf_fpath = p_fpath.

call function 'GUI_UPLOAD'

exporting

filename = gf_fpath

tables

data_tab = gt_carddetails

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.

else.

loop at gt_carddetails into wa_carddetails.

if gf_card <> wa_carddetails-cardname.

if not gf_card is initial.

write:/ gf_card,

gf_total.

endif.

gf_total = 1.

gf_card = wa_carddetails-cardname.

else.

gf_total = gf_total + 1.

endif.

endloop.

endif.

****Don't forget to reward useful replies***

Former Member
0 Kudos

Hi,

DATA : W_MCOUNT TYPE I, W_COUNT TYPE I.

LOOP AT ITAB.

IF CARDNAME = 'MASTER'.

W_MCOUNT = W_MCOUNT + 1

ELSECARDNAME = 'VISA'.

W_VCOUNT = W_VCOUNT + 1

ENDIF.

ENDLOOP.

WRITE 😕 W_MCOUNT, W_VCOUNT.

Regards,

Ravi

Note : Please mark the helpful answers