Skip to Content
0
Former Member
Sep 30, 2009 at 05:49 PM

BDC FK02 for table control withholding tax : Problem in 3rd page with 'P+'

165 Views

Hi Guru!!

please provide me that how to go to 3 page with 'P+', because here in my company some vendors have more than 2 page withholding tax codes assigns. So with such scenario up to 2 pages my code is working correctly but when it will get 3rd page its overwriting the 2nd page withholding tax code. Please help me out .

PERFORM BDC_DYNPRO USING 'SAPMF02K' '0106'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'RF02K-D0610'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'RF02K-LIFNR'

RECORD-LIFNR_001.

PERFORM BDC_FIELD USING 'RF02K-BUKRS'

RECORD-BUKRS_002.

PERFORM BDC_FIELD USING 'RF02K-D0610' 'X'.

PERFORM BDC_DYNPRO USING 'SAPMF02K' '0610'.

PERFORM BDC_FIELD USING 'BDC_OKCODE' 'P+'.

PERFORM BDC_FIELD USING 'BDC_CURSOR' 'LFB1-QLAND'.

PERFORM BDC_FIELD USING 'LFB1-QLAND' 'IN'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'LFBW-QSREC(01)'.

PERFORM BDC_FIELD USING 'LFB1-QLAND' 'IN'.

SELECT COUNT(*) INTO CNT

FROM LFBW AS A

WHERE A~LIFNR = ITAB-LIFNR

AND A~BUKRS = ITAB-BUKRS.

IF CNT > '06'.

TME = CNT / 06.

CNT = CNT MOD 6.

DO TME TIMES.

PERFORM BDC_DYNPRO USING 'SAPMF02K' '0610'.

PERFORM BDC_FIELD USING 'BDC_CURSOR' 'LFBW-QSREC(01)'.

PERFORM BDC_FIELD USING 'BDC_OKCODE' 'P+'.

ENDDO.

ENDIF.

PERFORM BDC_DYNPRO USING 'SAPMF02K' '0610'.

PERFORM BDC_FIELD USING 'BDC_OKCODE' 'P++'.

PERFORM BDC_FIELD USING 'BDC_CURSOR' 'LFB1-QLAND'.

LOOP AT JTAB WHERE LIFNR = ITAB-LIFNR

AND BUKRS = ITAB-BUKRS.

IF CNT = '06'.

PERFORM BDC_DYNPRO USING 'SAPMF02K' '0610'.

PERFORM BDC_FIELD USING 'BDC_OKCODE' 'P+'.

PERFORM BDC_DYNPRO USING 'SAPMF02K' '0610'.

PERFORM BDC_FIELD USING 'BDC_CURSOR' C_WITHT.

CNT = '01'.

ENDIF.

CNT = CNT + 1.

C_WITHT = CC_WITHT.

C_WITHCD = CC_WITHCD.

C_SUBJ = CC_SUBJ.

C_QSREC = CC_QSREC.

REPLACE 'XY' WITH CNT INTO C_WITHT.

REPLACE 'XY' WITH CNT INTO C_WITHCD.

REPLACE 'XY' WITH CNT INTO C_SUBJ.

REPLACE 'XY' WITH CNT INTO C_QSREC.

CONDENSE: C_WITHT,C_SUBJ,C_WITHCD,C_QSREC.

PERFORM BDC_FIELD USING 'BDC_CURSOR' C_WITHT.

PERFORM BDC_FIELD USING C_WITHT JTAB-WITHT.

PERFORM BDC_FIELD USING C_WITHCD JTAB-WT_WITHCD.

PERFORM BDC_FIELD USING C_SUBJ JTAB-WT_SUBJCT.

PERFORM BDC_FIELD USING C_QSREC JTAB-QSREC.

ENDLOOP.

PERFORM BDC_DYNPRO USING 'SAPMF02K' '0610'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=UPDA'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'LFB1-QLAND'.

PERFORM BDC_FIELD USING 'LFB1-QLAND' 'IN'.

PERFORM BDC_TRANSACTION USING 'FK02'.

ENDLOOP.

PERFORM CLOSE_GROUP.