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: 

trans.XD02 - payment card

Former Member
0 Kudos
283

Hi Experts,

i need card number of the customer.

i know that the card number is in table VCNUM.

is anyone can tell me what is the tables connection between the customer.no (kna1-kunnr) and the table vcnum?

thanks in advanced,

dana.

3 REPLIES 3

Former Member
0 Kudos
63

is anyone can help me pls????

former_member202002
Active Participant
0 Kudos
63

A good place to start is to look at function module SD_CCARD_READ. This function module is the function which SAP uses to find cards stored on a customer's master record.

The link between KNA1 and VCKUN is, as you suggested, the KUNNR field. With function SD_CCARD_READ you need only pass in the Customer Number (KUNNR) and you'll receive back 2 tables:

  • VCKUN (Cards stored on a Customer Master record)

  • VCNUM (Additional card detail not stored in VCKUN)

I hope that helps!

Eric

Former Member
0 Kudos
63

TRY to use this function.

Best regards.

Yuri.

FUNCTION ywmc019.

*"----

-


""Interface local:

*" IMPORTING

*" VALUE(CLIENTE) TYPE KUNNR

*" EXPORTING

*" VALUE(UGUI) TYPE VCKUN-CCARD_GUID

*" TABLES

*" CCREDIT STRUCTURE VCNUMVB OPTIONAL

*" RETORNO STRUCTURE BAPIRETURN OPTIONAL

*"----

-


  • Variáveis locais

DATA: secure_ccard_bin TYPE ccardec_s_bin.

  • Inicia o retorno como Erro

MOVE: 'E' TO retorno-type,

'Nenhum Cartão Atribuido' TO retorno-message.

DATA: BEGIN OF tb_vckun OCCURS 0.

INCLUDE STRUCTURE vckun.

DATA: END OF tb_vckun.

DATA: tmp_ccredit TYPE vcnum.

  • Seleção de cartões vinculados ao cliente

SELECT *

FROM vckun

INTO TABLE tb_vckun

WHERE kunnr EQ cliente.

IF sy-subrc EQ 0.

read TABLE tb_vckun index 1.

UGUI = tb_vckun-ccard_guid.

  • Desencriptar número do cartão de crédito

LOOP AT tb_vckun.

CALL FUNCTION 'CCARDEC_READ'

EXPORTING

im_ccard_guid = tb_vckun-ccard_guid

IMPORTING

ex_ccard_bin = secure_ccard_bin

EXCEPTIONS

entry_not_found = 1

OTHERS = 2.

IF sy-subrc = 0.

CALL FUNCTION 'CCARD_DEVELOPE'

EXPORTING

im_ccard_bin = secure_ccard_bin

IMPORTING

ex_ccnum = tb_vckun-ccnum

EXCEPTIONS

develope_failed = 1

OTHERS = 2.

IF sy-subrc = 0.

MODIFY tb_vckun INDEX sy-tabix.

CALL FUNCTION 'CCARDEC_BP_SELECT'

EXPORTING

i_ccins = tb_vckun-ccins

i_ccnum = tb_vckun-ccnum

IMPORTING

e_vcnum = tmp_ccredit

EXCEPTIONS

vckun_not_found = 1

vcnum_not_found = 2

OTHERS = 3.

IF sy-subrc = 0.

APPEND tmp_ccredit TO ccredit.

CLEAR tmp_ccredit.

retorno-type = 'S'.

retorno-message = 'Dados Selecionados.'.

APPEND retorno.

ELSE.

retorno-type = 'E'.

retorno-message = 'Dados não encontrados.'.

APPEND retorno.

ENDIF.

ELSE.

retorno-type = 'E'.

retorno-message = 'Dados não encontrados.'.

APPEND retorno.

ENDIF.

ELSE.

retorno-type = 'E'.

retorno-message = 'Dados não encontrados.'.

APPEND retorno.

ENDIF.

ENDLOOP.

ELSE.

retorno-type = 'E'.

retorno-message = 'Dados não encontrados.'.

APPEND retorno.

ENDIF.

ENDFUNCTION.