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: 

Re: BDC for VL04.

hitesh2
Participant
0 Kudos
100

Hi,

How to get delivery note number when create delivery note ( VL04 ) by Call transaction in SAP 4.6C ?

Thanks.

Hitesh

1 ACCEPTED SOLUTION

0 Kudos
69

Hi Hitesh,

That's a little bit tricky: One possibility would be to use FORM USEREXIT_SAVE_DOCUMENT (include MV50AFZ1) to export field VBSK-SAMMG to memory (contains the number of the collective run). After the call transaction you could select in table VBSS all created deliveries with the imported field VBSK-SAMMG.

If you are sure, that you create only one delivery per call of VL04, you could also export internal table CVBSS, which contains the number of the collective run and the created deliveries.

Best regards, Ulrich

2 REPLIES 2

0 Kudos
70

Hi Hitesh,

That's a little bit tricky: One possibility would be to use FORM USEREXIT_SAVE_DOCUMENT (include MV50AFZ1) to export field VBSK-SAMMG to memory (contains the number of the collective run). After the call transaction you could select in table VBSS all created deliveries with the imported field VBSK-SAMMG.

If you are sure, that you create only one delivery per call of VL04, you could also export internal table CVBSS, which contains the number of the collective run and the created deliveries.

Best regards, Ulrich

hitesh2
Participant
0 Kudos
69

Ulrich,

Thanks for reply. Above suggestion seems to be solution for my issue. How about the error messages if create delivery fails in VL04.

CALL TRANSACTION tcode USING bdc_tab

MODE ctumode

UPDATE cupdate

MESSAGES INTO messtab.

LOOP AT messtab.

SELECT SINGLE * FROM t100

WHERE sprsl = messtab-msgspra

AND arbgb = messtab-msgid

AND msgnr = messtab-msgnr.

IF sy-subrc = 0.

l_mstring = t100-text.

REPLACE '&1' WITH messtab-msgv1 INTO l_mstring.

REPLACE '&2' WITH messtab-msgv2 INTO l_mstring.

REPLACE '&3' WITH messtab-msgv3 INTO l_mstring.

REPLACE '&4' WITH messtab-msgv4 INTO l_mstring.

ENDIF.

CONDENSE l_mstring.

IF messtab-msgtyp <> 'W'.

WRITE: / l_mstring.

ENDIF.

ENDLOOP.