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

Problem with VA01 by create new sales document with copy reference

Former Member
0 Likes
1,348

Hi guys,

i ve a big problem creating a new sales document with copy reference.

i m creating a document type ZESS by copying a sales document type ZOSS.

the problem is in Sales area because zess type and zoss are not matching in sales area.

i tried to create a routine in VOFM  in copying requirements--> order

this routine contains code copied from standard routine '002'.

i post my routine :

{   REPLACE        ITDK945454                                        2

*\FORM BEDINGUNG_PRUEFEN_912

*\  USING BP_SUBRC.

FORM BEDINGUNG_PRUEFEN_912.

*}   REPLACE

*{   INSERT         ITDK945451                                        1

***Copia da ZOS a ZOSR rotosud - copia modificata della 002

  DATA: BP_DATUM_AUSGABE(10).   " Datumsfeld für editierte Ausgabe

* Was the reference document fully referenced?

  IF VBUK-RFGSK = CHARC AND

    HVBAK-VBTYP NE CHARH AND

    HVBAK-VBTYP NE CHARI AND

    HVBAK-VBTYP NE CHARK AND

    HVBAK-VBTYP NE CHARL.

    MESSAGE E015.

  ENDIF.

* Is the reference document complete?

  IF VBUK-UVALS CN ' C' OR

     VBUK-UVALL CN ' C'.

    MESSAGE W118.

  ENDIF.

* Is the currency the same in the source and the target?  (Mandatory)

  IF HVBAK-WAERK NE SPACE AND

     HVBAK-WAERK NE VBAK-WAERK.

    MESSAGE E006 WITH HVBAK-WAERK VBAK-WAERK.

  ENDIF.

* Check the validity period of the reference document

  IF VBAK-ANGDT > 0 AND

     VBAK-ANGDT > SY-DATLO.

    WRITE VBAK-ANGDT TO BP_DATUM_AUSGABE DD/MM/YYYY.

    MESSAGE W008 WITH BP_DATUM_AUSGABE.

  ENDIF.

  IF VBAK-BNDDT > 0 AND

     VBAK-BNDDT < SY-DATLO.

    WRITE VBAK-BNDDT TO BP_DATUM_AUSGABE DD/MM/YYYY.

    MESSAGE W009 WITH BP_DATUM_AUSGABE.

  ENDIF.

* Payment Cards                             "CCARD

* Check Number of Payment Card Plan Type

  IF NOT VBAK-RPLNR IS INITIAL.        "CCARD

    MESSAGE W045(V/).                  "CCARD

  ENDIF.                               "CCARD

* Are reference and target customer the same?

  IF HVBPA-KUNNR CN '0 ' AND

     VBPA-KUNNR  CN '0 '.

    IF HVBPA-KUNNR <> VBPA-KUNNR .

      MESSAGE W005 WITH HVBPA-KUNNR VBPA-KUNNR.

    ENDIF.

  ENDIF.

  IF NOT HVBAK-VKORG IS INITIAL AND

     NOT HVBAK-VTWEG IS INITIAL AND

     NOT HVBAK-SPART IS INITIAL.

*NON controllo la corrispondenza di VKORG

** Is the sales org. the same in both reference and target?

*    IF HVBAK-VKORG NE VBAK-VKORG.

*      MESSAGE E007 WITH HVBAK-VKORG VBAK-VKORG.

*    ENDIF.

* Is the dist. channel the same in both reference and target?

    IF HVBAK-VTWEG NE VBAK-VTWEG.

      MESSAGE E011 WITH HVBAK-VTWEG VBAK-VTWEG.

    ENDIF.

* Is the division the same in both reference and target?

    IF HVBAK-SPART NE VBAK-SPART.

      MESSAGE E012 WITH HVBAK-SPART VBAK-SPART.

    ENDIF.

  ENDIF.

*}   INSERT

ENDFORM.

-------------------------------------

i need to change sales area data : vkorg - vtweg - spart fields both in header and in position.

can you help guys ? thanks in advance.

Maurizio

Hi guys,

i ve a big problem creating a new sales document with copy reference.

i m creating a document type ZESS by copying a sales document type ZOSS.

the problem is in Sales area because zess type and zoss are not matching in sales area.

i tried to create a routine in VOFM  in copying requirements--> order

this routine contains code copied from standard routine '002'.

i post my routine :

{   REPLACE        ITDK945454                                        2

*\FORM BEDINGUNG_PRUEFEN_912

*\  USING BP_SUBRC.

FORM BEDINGUNG_PRUEFEN_912.

*}   REPLACE

*{   INSERT         ITDK945451                                        1

***Copia da ZOS a ZOSR rotosud - copia modificata della 002

  DATA: BP_DATUM_AUSGABE(10).   " Datumsfeld für editierte Ausgabe

* Was the reference document fully referenced?

  IF VBUK-RFGSK = CHARC AND

    HVBAK-VBTYP NE CHARH AND

    HVBAK-VBTYP NE CHARI AND

    HVBAK-VBTYP NE CHARK AND

    HVBAK-VBTYP NE CHARL.

    MESSAGE E015.

  ENDIF.

* Is the reference document complete?

  IF VBUK-UVALS CN ' C' OR

     VBUK-UVALL CN ' C'.

    MESSAGE W118.

  ENDIF.

* Is the currency the same in the source and the target?  (Mandatory)

  IF HVBAK-WAERK NE SPACE AND

     HVBAK-WAERK NE VBAK-WAERK.

    MESSAGE E006 WITH HVBAK-WAERK VBAK-WAERK.

  ENDIF.

* Check the validity period of the reference document

  IF VBAK-ANGDT > 0 AND

     VBAK-ANGDT > SY-DATLO.

    WRITE VBAK-ANGDT TO BP_DATUM_AUSGABE DD/MM/YYYY.

    MESSAGE W008 WITH BP_DATUM_AUSGABE.

  ENDIF.

  IF VBAK-BNDDT > 0 AND

     VBAK-BNDDT < SY-DATLO.

    WRITE VBAK-BNDDT TO BP_DATUM_AUSGABE DD/MM/YYYY.

    MESSAGE W009 WITH BP_DATUM_AUSGABE.

  ENDIF.

* Payment Cards                             "CCARD

* Check Number of Payment Card Plan Type

  IF NOT VBAK-RPLNR IS INITIAL.        "CCARD

    MESSAGE W045(V/).                  "CCARD

  ENDIF.                               "CCARD

* Are reference and target customer the same?

  IF HVBPA-KUNNR CN '0 ' AND

     VBPA-KUNNR  CN '0 '.

    IF HVBPA-KUNNR <> VBPA-KUNNR .

      MESSAGE W005 WITH HVBPA-KUNNR VBPA-KUNNR.

    ENDIF.

  ENDIF.

  IF NOT HVBAK-VKORG IS INITIAL AND

     NOT HVBAK-VTWEG IS INITIAL AND

     NOT HVBAK-SPART IS INITIAL.

*NON controllo la corrispondenza di VKORG

** Is the sales org. the same in both reference and target?

*    IF HVBAK-VKORG NE VBAK-VKORG.

*      MESSAGE E007 WITH HVBAK-VKORG VBAK-VKORG.

*    ENDIF.

* Is the dist. channel the same in both reference and target?

    IF HVBAK-VTWEG NE VBAK-VTWEG.

      MESSAGE E011 WITH HVBAK-VTWEG VBAK-VTWEG.

    ENDIF.

* Is the division the same in both reference and target?

    IF HVBAK-SPART NE VBAK-SPART.

      MESSAGE E012 WITH HVBAK-SPART VBAK-SPART.

    ENDIF.

  ENDIF.

*}   INSERT

ENDFORM.

-------------------------------------

i need to change sales area data : vkorg - vtweg - spart fields both in header and in position.

can you help guys ? thanks in advance.

Maurizio

2 REPLIES 2
Read only

FredericGirod
Active Contributor
0 Likes
838

Hi Maurizio,

did you have check for an available form in the program (exit) MV45AFZZ ?

regards

Fred

Read only

0 Likes
838

hi frederic, there is a form in the include you mentioned..

how can i have access for it?

do you think that could be helpful so i can solve that problem? thx in advance

Maurizio

EDIT : other thing, i tried to set a break in the include MV45AFZZ but when i try to click Create with reference -> order TAB -> copy button.

but nothing happened..