cancel
Showing results for 
Search instead for 
Did you mean: 

Customer Master u2013 Credit Card by Ship-To

Former Member
0 Kudos

I need to populate the credit card for payment from the ship-to partner instead of the customer master.

I implemented the following code in the FORM USEREXIT_SAVE_DOCUMENT_PREPARE , but it doesn't work.

Points will be assign.

Please take a look:

DATA: i_xfplt LIKE xfplt OCCURS 0,

s_xfplt LIKE xfplt,

  • it_vckun TYPE TABLE OF vckun,

it_vbpa type table of vbpa with header line,

it_vcnum type table of vcnum with header line,

it_vckun type table of vckun with header line,

s_vckun TYPE vckun,

s_vcnum type vcnum.

  • Check if the order is being created in the background

  • IF T180-TRTYP = 'H' AND sy-batch = 'X'.

  • Only apply logic for Order type

  • IF vbak-auart = '***'.

break-point.

IF VBAK-ZZ_PAYS_BY_PCARD = 'Y' or VBAK-ZZ_PAYS_BY_PCARD = 'X'.

i_xfplt[] = xfplt[].

it_vbpa[] = xvbpa[].

"select * into table it_vbpa from vbpa where vbeln = vbak-vbeln.

SORT i_xfplt BY ccnum.

DELETE ADJACENT DUPLICATES FROM i_xfplt COMPARING ccnum.

LOOP AT it_vbpa WHERE parvw = 'WE'.

    • Check credit card in the customer master

CALL FUNCTION 'SD_CCARD_READ'

EXPORTING

i_kunnr = it_vbpa-kunnr

TABLES

t_vcnum = it_vcnum

t_vckun = it_vckun.

ENDLOOP.

IF it_vcnum IS INITIAL.

  • When the credit card is not mainained in the ship-to look in the

  • Bill to

LOOP AT it_vbpa WHERE parvw = 'RE'.

    • Check credit card in the customer master Bill to

CALL FUNCTION 'SD_CCARD_READ'

EXPORTING

i_kunnr = it_vbpa-kunnr

TABLES

t_vcnum = it_vcnum

t_vckun = it_vckun.

ENDLOOP.

ENDIF.

IF NOT it_vcnum IS INITIAL.

  • When the customer has at least one CC mantained in the master

READ TABLE it_vckun INTO s_vckun

WITH KEY ccdef = 'X'.

IF sy-subrc = 0.

  • s_xfplt-mandt = sy-mandt.

  • s_xfplt-fplnr = '$000000001'.

  • s_xfplt-fpltr = '000001'.

  • s_xfplt-fpttp = '01'.

  • s_xfplt-waers = 'USD'.

  • s_xfplt-updkz = 'I'.

  • --Replace 4 digits with Token with customer master

s_xfplt-ccins = s_vckun-ccins.

s_xfplt-ccnum = s_vckun-ccnum.

read table it_vcnum into s_vcnum

with key ccnum = s_vckun-ccnum.

if sy-subrc = 0.

s_xfplt-ccname = s_vcnum-ccname.

s_xfplt-datbi = s_vcnum-datbi.

endif.

  • append s_xfplt to i_xfplt.

modify i_xfplt from s_xfplt index 1.

ELSE.

  • No Default Card in the Customer Master.

ENDIF.

ENDIF.

xfplt[] = i_xfplt[].

ENDIF.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I have the same request I would like to populate the credit card number by ship-to when creating an order. Have you found a solution with this issue?
And also when placing an order to get the credit card first of all from the ship-to and then the Payer-to

via the mactcode.
Thanks