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

Capturing Reversal document number from FB08 t-code

Former Member
0 Likes
2,489

Hi All,

I am developing a report progrm to Post Open Purchase Orders. To do so i am using BAPI_ACC_DOCUMENT_POST,

after a PO is posted successfully, i have to call t-code FB08 and pass the document number to it. I am using BDC call transaction to call FB08 t-code.

The t-code FB08 creates reversal document number of the document number being passed to it.

My requirement is to capture this reversal document number and display it in the output.

Now my doubts is

1) Hw to capture reversal document number?

regards

balu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,107

Hi,

it_messages should be of type BDCMSGCOLL.

Regards

Guru

12 REPLIES 12
Read only

Former Member
0 Likes
2,107

Hi ,

are u using BDCMSGCOLL to capture msgs , it will have that rev.doc. no.

sytax---> call transaction 'XXXX' message into BDCMSGCOLL.

Regards

prabhu

Read only

Former Member
0 Likes
2,107

Hi ,

are u using BDCMSGCOLL to capture msgs ?

Regards

prabhu

Read only

0 Likes
2,107

Actually i havent written BDC prgm yet.

Please let me know wt steps needs to be followed to achieve my functionality.

Read only

0 Likes
2,107

Actually what u want....U need BDC r reversal document number....

What purpose u r doing in BDC

Ex: Vendor payment upload,customer payment upload,Gl

Read only

0 Likes
2,107

From BDC i'm calling FB08 t-code and passing an document num to it.

Then FB08 t-code creates reversal doc num for the doc num which i have passed .

I need to capture reversal doc num created by fb08.

for ex.

if 1000 is the doc num passed to fb08 tcode from BDC prgm,

and if 2000 is the reversal doc num created by FB08.

i need to capture 2000.

Read only

0 Likes
2,107

Refer this code...

Once you collect all the valid reversal document number and use a select on it. Read the itab only when it is found.

LOOP AT IT_MESSAGES INTO WA_MESSAGES.

IF WA_MESSAGES-MSGTYP = 'E'.

WA_LOG-MSGTYP = WA_MESSAGES-MSGTYP .

W_MSGNO = WA_MESSAGES-MSGNR.

W_MSGV1 = WA_MESSAGES-MSGV1.

W_MSGV2 = WA_MESSAGES-MSGV2.

W_MSGV3 = WA_MESSAGES-MSGV3.

W_MSGV4 = WA_MESSAGES-MSGV4.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = WA_MESSAGES-MSGID

NO = W_MSGNO

V1 = W_MSGV1

V2 = W_MSGV2

V3 = W_MSGV3

V4 = W_MSGV4

IMPORTING

MSG = WA_LOG-MESSAGE

EXCEPTIONS

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

APPEND WA_LOG TO IT_LOG .

CLEAR WA_LOG.

ELSE.

IF WA_MESSAGES-MSGTYP = C_S AND

WA_MESSAGES-MSGID = C_MSGID AND

WA_MESSAGES-MSGNR = C_MSGNR.

W_ADJDOC = WA_MESSAGES-MSGV1+0(10).

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = W_ADJDOC

IMPORTING

OUTPUT = W_ADJDOC.

*Get Adjustment Document no,posting date,entry date and entry time

SELECT BELNR BUDAT

CPUDT CPUTM

INTO CORRESPONDING FIELDS OF TABLE IT_ADJ

FROM BKPF

WHERE BUKRS IN S_BUKRS

AND GJAHR = P_GJAHR

AND BELNR EQ W_ADJDOC

AND BLART = C_AL.

IF SY-SUBRC = 0.

READ TABLE IT_ADJ INTO WA_ADJ WITH KEY

BELNR = W_ADJDOC.

IF SY-SUBRC = 0.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

INPUT = WA_ADJ-BELNR

IMPORTING

OUTPUT = WA_ADJ-BELNR.

WA_ALVOUT-BELNR1 = WA_ADJ-BELNR. "Adjustment Doc No.

WA_ALVOUT-BUDAT1 = WA_ADJ-BUDAT. "Adjustment Posting date

WA_ALVOUT-CPUDT1 = WA_ADJ-CPUDT. "Adjustment entry date

WA_ALVOUT-CPUTM1 = WA_ADJ-CPUTM. "Adjustment entry time

APPEND WA_ALVOUT TO IT_ALVOUT.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

ENDFORM. " BDC_POSTING

Thanks and Regards

Guru

Read only

0 Likes
2,107

Thnks for ur tips.

Read only

Former Member
0 Likes
2,107

Hi,

Declare and internal and collect the reersal document number and then loop at itab to display it.

Regrads

Guru

Read only

0 Likes
2,107

if internal table has to be declared,wt fields should the internal table contain?

The reversal doc num is of the type BELNR.

Read only

Former Member
0 Likes
2,107

Hi,

U can get the reverse document or line item display.

Example:

Suppose ur document no Vendor means it will displayed in FBL1N

Costomer mean:FBL3N

There u find ur reverse document number.

Regards:

Prabu

Read only

Former Member
0 Likes
2,108

Hi,

it_messages should be of type BDCMSGCOLL.

Regards

Guru

Read only

Former Member
0 Likes
2,107

thnks