Code: Alles auswählen.
SELECT LAND1 BZIRK FKDAT PLTYP BSTNK_VF SPART FKART VKORG VBELN FROM VBRK INTO CORRESPONDING FIELDS OF vbrkk.
it_invoice-prd_level6_code = VBRKK-PLTYP.
it_invoice-sales_dist_code = VBRKK-BZIRK.
it_invoice-market_code = VBRKK-LAND1.
it_invoice-invoice_no1 = VBRKK-VBELN.
it_invoice-date = VBRKK-FKDAT.
it_invoice-project = VBRKK-BSTNK_VF.
CASE vbrkk-vkorg.
WHEN '0002'.
CONCATENATE it_invoice-market_code 'EW' INTO it_invoice-market_code.
it_invoice-prd_resp_unit_code = 'xy'.
it_invoice-prd_area_code = 'xy'.
WHEN '0022'.
CONCATENATE it_invoice-market_code 'FM' INTO it_invoice-market_code.
it_invoice-prd_resp_unit_code = 'xy'.
it_invoice-prd_area_code = 'xy'.
ENDCASE.
CASE vbrkk-spart.
WHEN '05'.
it_invoice-sales_type_code = 'DD'.
WHEN OTHERS.
it_invoice-sales_type_code = 'EK'.
ENDCASE.
CASE vbrkk-fkart.
WHEN 'IV'.
it_invoice-sales_type_code = 'SS'.
WHEN OTHERS.
it_invoice-sales_type_code = 'EK'.
ENDCASE.
ENDSELECT.
SELECT KZWI1 KZWI2 KZWI3 KZWI4 KZWI5 KZWI6 SPARA MATKL MATNR ZZAUART ZZMOD AUGRU_AUFT ZZFCD ZZMCD
FKIMG AUBEL FROM VBRP INTO CORRESPONDING FIELDS OF vbrpk WHERE VBELN = VBPAK-VBELN.
it_invoice-net_bc= vbrpk-KZWI1.
it_invoice-net_euro = VBRPK-KZWI2.
it_invoice-net_bc_bu = VBRPK-KZWI3.
it_invoice-net_lc = VBRPK-KZWI4.
it_invoice-gross_bc_bu = VBRPK-KZWI5.
it_invoice-gross_lc = VBRPK-KZWI6.
it_invoice-prd_level6_code = VBRKK-PLTYP.
it_invoice-sales_dist_code = VBRKK-BZIRK.
it_invoice-prd_no = VBRPK-MATNR.
it_invoice-branch_region_code = VBRPK-SPARA.
it_invoice-prd_type_code = VBRPK-MATKL.
it_invoice-prd_fam_code = VBRPK-ZZAUART.
it_invoice-prd_level4_code = VBRPK-ZZMOD.
it_invoice-loc_order_type = VBRPK-ZZAUART.
it_invoice-reason_code = VBRPK-AUGRU_AUFT.
it_invoice-cust_group = vbpavbk-kunnr.
it_invoice-esp_prd_no = VBRKK-VBELN.
it_invoice-prd_level5_code = VBRPK-ZZFCD.
CASE VBRPK-ZZELEM.
WHEN 'X'.
it_invoice-quant_cab = VBRPK-FKIMG.
ENDCASE.
CONCATENATE it_invoice-prd_level5_code VBRPK-ZZMCD INTO it_invoice-prd_level5_code.
ENDSELECT.
SELECT KUNNR VBELN PARVW POSNR FROM VBPA INTO CORRESPONDING FIELDS OF vbpak WHERE VBELN = VBRKK-VBELN.
it_invoice-cust_no = VBPAK-KUNNR.
CALL FUNCTION 'SD_VBPA_SINGLE_READ'
EXPORTING
I_VBELN = VBPAK-VBELN
I_PARVW = VBPAK-PARVW
I_POSNR = VBPAK-POSNR
* I_BYPASSING_BUFFER = ' '
* I_REFRESH_BUFFER =
* IMPORTING
* EXCEPTIONS
* RECORD_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.
SELECT SINGLE PSTLZ FROM KNA1 INTO CORRESPONDING FIELDS OF wak WHERE KUNNR = VBPAK-KUNNR.
it_invoice-zip_code = wak-PSTLZ.
CONCATENATE VBRKK-LAND1 it_invoice-zip_code INTO it_invoice-zip_code.
SELECT VBELN MATNR FROM VBAP INTO CORRESPONDING FIELDS OF vbapk WHERE VBELN = VBRPK-AUBEL.
SELECT VBELN FROM EKKN INTO CORRESPONDING FIELDS OF ekknk WHERE VBELN = VBRPK-AUBEL.
SELECT EBELN EBELP MATNR FROM EKPO INTO CORRESPONDING FIELDS OF ekpok WHERE EBELN = EKKNK-EBELN AND EBELP = EKKNK-EBELP AND MATNR = VBAPK-MATNR.
SELECT EBELN LIFNR FROM EKKO INTO CORRESPONDING FIELDS OF ekkok WHERE EBELN = EKPOK-EBELN.
SELECT LIFNR FROM LFA1 INTO CORRESPONDING FIELDS OF lfa1k WHERE LIFNR = EKKOK-LIFNR.
it_invoice-prd_budget_group_code = EKKOK-LIFNR+4.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
Code: Alles auswählen.
SELECT LAND1 BZIRK FKDAT PLTYP BSTNK_VF SPART FKART VKORG VBELN FROM VBRK INTO CORRESPONDING FIELDS OF vbrkk.
it_invoice-prd_level6_code = VBRKK-PLTYP.
it_invoice-sales_dist_code = VBRKK-BZIRK.
it_invoice-market_code = VBRKK-LAND1.
it_invoice-invoice_no1 = VBRKK-VBELN.
it_invoice-date = VBRKK-FKDAT.
it_invoice-project = VBRKK-BSTNK_VF.
CASE vbrkk-vkorg.
WHEN '0002'.
CONCATENATE it_invoice-market_code 'EW' INTO it_invoice-market_code.
it_invoice-prd_resp_unit_code = '242'.
it_invoice-prd_area_code = 'FA'.
WHEN '0022'.
CONCATENATE it_invoice-market_code 'FM' INTO it_invoice-market_code.
it_invoice-prd_resp_unit_code = '241'.
it_invoice-prd_area_code = 'FB'.
ENDCASE.
CASE vbrkk-spart.
WHEN '05'.
it_invoice-sales_type_code = 'DD'.
WHEN OTHERS.
it_invoice-sales_type_code = 'EK'.
ENDCASE.
CASE vbrkk-fkart.
WHEN 'IV'.
it_invoice-sales_type_code = 'SS'.
WHEN OTHERS.
it_invoice-sales_type_code = 'EK'.
ENDCASE.
SELECT KUNNR VBELN PARVW POSNR FROM VBPA INTO CORRESPONDING FIELDS OF vbpak WHERE VBELN = VBRKK-VBELN.
it_invoice-cust_no = VBPAK-KUNNR.
CALL FUNCTION 'SD_VBPA_SINGLE_READ'
EXPORTING
I_VBELN = VBPAK-VBELN
I_PARVW = VBPAK-PARVW
I_POSNR = VBPAK-POSNR
* I_BYPASSING_BUFFER = ' '
* I_REFRESH_BUFFER =
* IMPORTING
* E_VBPAVB = VBPAVB "VBPAVB-PERNR "vbpavb
* E_VBPA = vbpavb
* EXCEPTIONS
* RECORD_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.
SELECT PSTLZ FROM KNA1 INTO CORRESPONDING FIELDS OF wak WHERE KUNNR = VBPAK-KUNNR.
it_invoice-zip_code = wak-PSTLZ.
CONCATENATE VBRKK-LAND1 it_invoice-zip_code INTO it_invoice-zip_code.
ENDSELECT.
SELECT KZWI1 KZWI2 KZWI3 KZWI4 KZWI5 KZWI6 SPARA MATKL MATNR ZZAUART ZZMOD AUGRU_AUFT ZZFCD ZZMCD
FKIMG AUBEL FROM VBRP INTO CORRESPONDING FIELDS OF vbrpk WHERE VBELN = VBPAK-VBELN.
it_invoice-net_bc= vbrpk-KZWI1.
it_invoice-net_euro = VBRPK-KZWI2.
it_invoice-net_bc_bu = VBRPK-KZWI3.
it_invoice-net_lc = VBRPK-KZWI4.
it_invoice-gross_bc_bu = VBRPK-KZWI5.
it_invoice-gross_lc = VBRPK-KZWI6.
it_invoice-prd_level6_code = VBRKK-PLTYP.
it_invoice-sales_dist_code = VBRKK-BZIRK.
it_invoice-prd_no = VBRPK-MATNR.
it_invoice-branch_region_code = VBRPK-SPARA.
it_invoice-prd_type_code = VBRPK-MATKL.
it_invoice-prd_fam_code = VBRPK-ZZAUART.
it_invoice-prd_level4_code = VBRPK-ZZMOD.
it_invoice-loc_order_type = VBRPK-ZZAUART.
it_invoice-reason_code = VBRPK-AUGRU_AUFT.
it_invoice-cust_group = vbpavbk-kunnr.
it_invoice-esp_prd_no = VBRKK-VBELN.
it_invoice-prd_level5_code = VBRPK-ZZFCD.
CASE VBRPK-ZZELEM.
WHEN 'X'.
it_invoice-quant_cab = VBRPK-FKIMG.
ENDCASE.
CONCATENATE it_invoice-prd_level5_code VBRPK-ZZMCD INTO it_invoice-prd_level5_code.
ENDSELECT.
SELECT VBELN MATNR FROM VBAP INTO CORRESPONDING FIELDS OF vbapk WHERE VBELN = VBRPK-AUBEL.
SELECT VBELN FROM EKKN INTO CORRESPONDING FIELDS OF ekknk WHERE VBELN = VBRPK-AUBEL.
SELECT EBELN EBELP MATNR FROM EKPO INTO CORRESPONDING FIELDS OF ekpok WHERE EBELN = EKKNK-EBELN AND EBELP = EKKNK-EBELP AND MATNR = VBAPK-MATNR.
SELECT EBELN LIFNR FROM EKKO INTO CORRESPONDING FIELDS OF ekkok WHERE EBELN = EKPOK-EBELN.
SELECT LIFNR FROM LFA1 INTO CORRESPONDING FIELDS OF lfa1k WHERE LIFNR = EKKOK-LIFNR.
it_invoice-prd_budget_group_code = EKKOK-LIFNR+4.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
....nicht nur das.... für einen LOOP fehlt noch dasChristl hat geschrieben:Hallo Alex,
Wenn Du Werte mit dem Inhalt der internen Tabellen vergleichst fehlt meiner Meinung nach LOOP. Das könnte der Grund dafür sein, dass du nur einen Datensatz zurückbekommst.
Grüsse,
Christl
Alles klar, vielen Dank. Ich habe einen solchen Zugang; El Jefe hat ihn für mich eingerichtet.wreichelt hat geschrieben:Hallo,
OSS-Hinweise findest du unter service.sap.com
Allerdings ist dort ein OSS-User notwendig.
Gruß Wolfgang