Archived discussions are read-only. Learn more about SAP Q&A

sample code of fm RV_CREATE_DELIVERY

hi everybody

can anybody send me a sample code of fm RV_CREATE_DELIVERY, mine is not working and i cant see my error

regards

anjali

Tags:
replied

Hi Anjali,

function rv_delivery_create.

*"----

-


""Globale Schnittstelle:

*" IMPORTING

*" VALUE(SELEKTIONSDATUM) LIKE LV50C-DATBI OPTIONAL

*" VALUE(VBSK_I) LIKE VBSK STRUCTURE VBSK

*" VALUE(I_LIEFERART) LIKE TVLK-LFART DEFAULT SPACE

*" REFERENCE(IT_VORGABE_DATEN) TYPE VLGGT_VORGABE_DATEN_T OPTIONAL

*" REFERENCE(IF_NUR_VORGABE_POS) LIKE RVSEL-XFELD DEFAULT SPACE

*" VALUE(IF_VBLS_POS_RUECK) LIKE RVSEL-XFELD OPTIONAL

*" VALUE(IF_SYNCHRON) LIKE RVSEL-XFELD DEFAULT 'X'

*" VALUE(IF_NO_COMMIT) LIKE RVSEL-XFELD OPTIONAL

*" VALUE(IF_NO_DEQUE) TYPE XFELD DEFAULT SPACE

*" VALUE(IT_HU_SERNR) TYPE VSEP_T_HUSERNR OPTIONAL

*" VALUE(IT_HANDLING_UNITS) TYPE HUM_REHANG_HU_T OPTIONAL

*" REFERENCE(IS_DELIVERY_EXTEND) TYPE LESHP_DELIVERY_EXTEND_RV

*" OPTIONAL

*" REFERENCE(IS_CONTROL) TYPE LESHP_DELIVERY_PROC_CONTROL_IN

*" OPTIONAL

*" VALUE(IF_CHECK_SPEVI) TYPE XFELD OPTIONAL

*" EXPORTING

*" VALUE(VBSK_E) LIKE VBSK STRUCTURE VBSK

*" VALUE(ET_SPLITPROT) TYPE VLIKP_T_SPLITPROT

*" TABLES

*" LVBAK STRUCTURE VBAK

*" LVBAP STRUCTURE VBAPVB

*" LVBEP STRUCTURE VBEPVB

*" LVBFA STRUCTURE VBFAVB

*" LVBFS STRUCTURE VBFS

*" LVBKD STRUCTURE VBKDVB

*" LVBLS STRUCTURE VBLS

*" LVBPA STRUCTURE VBPAVB

*" LVBUK STRUCTURE VBUK

*" LVBUP STRUCTURE VBUPVB

*" IT_VERKO STRUCTURE VERKO OPTIONAL

*" IT_VERPO STRUCTURE VERPO OPTIONAL

*" ET_VBUK STRUCTURE VBUKVB OPTIONAL

*" ET_VBUP STRUCTURE VBUPVB OPTIONAL

*" ET_VBFA STRUCTURE VBFAVB OPTIONAL

*"----

-


data: xlikp_lines type p,

anzlp like sy-tabix,

lf_subrc type sysubrc,

lf_vbeln like xlikp-vbeln,

lt_pre_set_data type shp_vorgabe_daten_t. "n_524706

breakvl10.

  • refresh at the beginning "wbr 46c

  • Aufruf der Initalisierung von Bereichen des Funktionsbausteins *

perform text_memory_init.

clear v50agl. "v_n_632434

v50agl-sammelgang = charx.

v50agl-synchron = if_synchron.

v50agl-no_commit = if_no_commit.

perform set_v50agl_from_control using is_control "AIP

changing v50agl. "AIP

perform set_v50agl_check_mode using is_control-check_mode "AIP

changing v50agl. "^_n_632434

  • not nice, but correct: disable dequeue all, this is done at the end

  • in beleg_daten_init_afterwards !!!

perform global_data_init_sammg using charx.

perform beleg_daten_init.

perform global_data_init_sammg using space.

refresh: cvbak,

cvbuk.

clear material_vorstep_gelaufen.

clear *mtcom.

  • lines deleted n_632434

gs_mhpar-glomd = gc_glomd-background.

read table it_vorgabe_daten index 1 transporting no fields.

if sy-subrc = 0.

v50agl-vorgabe_daten = charx.

endif.

if et_splitprot is requested.

v50agl-splitprot_requested = charx.

else.

get parameter id 'LESHP_SPLIT_ANALYSIS' "470

field v50agl-splitprot_requested.

endif.

perform global_data_init(sapmv50a).

perform global_data_init_sammg using if_no_deque.

perform partner_data_complete tables lvbpa. "50A TAX

perform kopieren_beginn.

  • Reset ZLIKP

clear: zlikp,

zposn.

refresh: zlikp,

zposn.

  • Übernehmen von Parametern

vbsk = vbsk_i.

if vbsk-vstel is initial.

PERFORM MESSAGE_HANDLING USING posnr_low

'113'

'E'

'VL'

SPACE

SPACE

SPACE

SPACE.

exit.

endif.

perform check_vorgabe_daten using it_vorgabe_daten "v_n_524706

lvbap[]

changing lt_pre_set_data

lf_subrc.

check lf_subrc is initial. "^_n_524706

  • extend delivery "wbr 46c

if not is_delivery_extend is initial.

perform match_delivery_into_com_part using is_delivery_extend

changing lf_subrc.

check lf_subrc is initial.

endif.

perform tvst_select using vbsk-vstel

sy-subrc.

perform steuerung_zentral using lt_pre_set_data. "n_524706

perform vorgabe_vse_uebernehmen.

if v50agl-splitprot_requested ne space and "N_399912

not et_splitprot is requested.

perform add_splitprot_to_log using gt_splitprot.

endif.

  • Endrunde Kopieren

perform kopieren_endrunde.

*---- Fehlerprotokoll aufbereiten -

-


describe table xlikp lines xlikp_lines.

if xlikp_lines gt 0.

describe table xlips lines anzlp.

vbsk-anzlp = vbsk-anzlp + anzlp.

  • Die abhängigen Tabellen werden sortiert *

sort xlikp by mandt vbeln descending.

  • Aufruf der Verbuchung *

perform lieferungen_buchen using xlikp_lines.

else.

  • Verbuchen des Fehlerprotokolls

call function 'RV_DELIVERY_CC_ERRORLOG_ADD' in update task

exporting

fvbsk = vbsk

tables

fvbfs = cvbfs

fvbss = cvbss.

if if_no_commit is initial.

commit work.

endif.

endif.

*----


*

  • Setzen Rückgabeparameter *

*----


*

  • Positionsbezogenes CVBLS-Protokoll aufbauen

if if_vbls_pos_rueck = 'X'.

sort xlikp by mandt vbeln.

sort xlips by mandt vbeln posnr.

loop at xlips where updkz <> updkz_delete.

if xlips-vbeln <> lf_vbeln.

lf_vbeln = xlips-vbeln. "neuer Lieferkopf

read table xlikp with key vbeln = xlips-vbeln

binary search.

endif.

perform protokoll_pos_aufbauen.

endloop.

endif.

vbsk_e = vbsk.

loop at cvbls.

lvbls = cvbls.

append lvbls.

endloop.

loop at cvbfs.

lvbfs = cvbfs.

append lvbfs.

endloop.

  • Evtl. Geänderte Auftragsinformationen zurückgeben, wenn angefordert

if et_vbuk is requested.

et_vbuk[] = xvbuk[].

endif.

if et_vbup is requested.

et_vbup[] = xvbup[].

endif.

if et_vbfa is requested.

et_vbfa[] = xvbfa[].

endif.

if et_splitprot is requested.

et_splitprot[] = gt_splitprot[].

endif.

  • main part of the refresh now at the beginning of "wbr 46c

  • this function module, rest here

perform beleg_daten_init_afterwards.

endfunction.

regs

rams

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question