Feching Eccn code and HTS code from GTS to ECC

Hi Gurus,
I am extending a standard delivery idoc (DELVRY05) for some of the header and items fields.
i have tried to pull them throgh the FM /SAPSLL/***_DOCS_SD0C_GET_R3 i have passed the sales order number, item number and VBTYP to this FM to pull the Eccn code and HTS code.but all the tables are containing the zero entries.
Please help me. i have to populate the ECCN code and HTS code at the item level in my EXTENDED (Z)DELVRY05 idoc.
I have the SO number POSNR and material with me in the program.

Hi All,
I am now fetching the ECCN code and HTS code as beow:
You need to write an RFC enabled function module in GTS system, and then call this FM from ECC6.0 passing the RFC destination with help of the FM:  /SAPSLL/CD_ALE_RECEIVER_GET_R3.
Call the FM as below:
Coding in ECC 6.0.
data:   lv_rfc_dest   TYPE bdibapi_dest-rfc_dest.
clear : w_so.
          w_so-vbeln = w_e1edl24-vgbel." It can be the SO number or the delivery number which will be passed to the RFC ZFM to GTS to fetch the ECCN and HTS code.
          append w_so to t_so .
          clear: w_so.
   CALL FUNCTION '/SAPSLL/CD_ALE_RECEIVER_GET_R3'
            IMPORTING
              ev_rfc_dest                   = lv_rfc_dest.
   IF lv_rfc_dest IS NOT INITIAL.
   CALL FUNCTION 'ZS_HS_ECCN_SCHB_COPY'
              DESTINATION lv_rfc_dest
              EXPORTING
                PRVSY              = <fs_lips>-matnr
              IMPORTING
                ECCN               = lv_eccn
                HSCODE             = lv_stawn
                TABLES
                REFNO              = t_so
              EXCEPTIONS
                systen_error       = 1
                connection_failure = 2.
Lv_eccn and Lv_Stawn contains the ECCN and HTS code.
Coding of the ZFM in GTS:
Note: tables parameter of FM  RefNo is optional, where as the material number is mandatory parameter for the FM.
   FUNCTION ZS_HS_ECCN_SCHB_COPY.
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(PRVSY) TYPE  /SAPSLL/PRVSY
*"  EXPORTING
*"     VALUE(ECCN) TYPE  /SAPSLL/CCNGN
*"     VALUE(HSCODE) TYPE  /SAPSLL/CCNGN
*"     VALUE(SCHB) TYPE  /SAPSLL/CCNGN
*"     VALUE(RADIO) TYPE  /SAPSLL/CCNGN
*"     VALUE(RADIO_ECCN) TYPE  /SAPSLL/CCNGN
*"     VALUE(TEXT) TYPE  /SAPSLL/TEXT60
*"  TABLES
*"      REFNO STRUCTURE  /SAPSLL/API6800_DLN_LC_S OPTIONAL
    DATA:lv_prtyp TYPE /sapsll/prtyp VALUE '01'.
  DATA: lv_rptdt    TYPE /sapsll/rptdt.
  DATA:lr_datab TYPE /sapsll/rptst_r_t,
       lr_datbi TYPE /sapsll/rptet_r_t.
  TYPES : BEGIN OF s_pr,
         guid_pr TYPE /sapsll/guid_16,
         END OF s_pr.
  DATA: w_pr TYPE s_pr.
  DATA: t_pr TYPE STANDARD TABLE OF s_pr.
  TYPES : BEGIN OF s_hscode,
         guid_ctsnum TYPE /sapsll/guid_16,
         stcts TYPE /sapsll/stcts,
         datbi TYPE /sapsll/rptet,
         datab TYPE /sapsll/rptst,
         END OF s_hscode.
TYPES : BEGIN OF s_corref,
        GUID_POBJ TYPE /SAPSLL/CORREF-GUID_POBJ,
        REFNO  TYPE /SAPSLL/CORREF-REFNO ,
      end of s_corref.
TYPES: begin of s_cuit,
         GUID_CUHD  TYPE  /SAPSLL/CUIT-GUID_CUHD,
         GUID_PR    TYPE  /SAPSLL/CUIT-GUID_PR,
         CTYDP      TYPE  /SAPSLL/CUIT-CTYDP,
        end of s_cuit.
TYPES : BEGIN OF s_t606g,
         LGREG TYPE /SAPSLL/T606G-LGREG,
         GGLND TYPE /SAPSLL/T606G-GGLND,
        end of s_t606g.
TYPES : BEGIN OF s_TLEGSU ,
        LGREG  TYPE /SAPSLL/TLEGSU-LGREG ,
        CTSEX TYPE /SAPSLL/TLEGSU-CTSEX,
    end of s_TLEGSU .
TYPES  : BEGIN OF s_ctsnum,
      GUID_CTSNUM TYPE /SAPSLL/ctsnum-GUID_CTSNUM ,
      STCTS       TYPE  /SAPSLL/ctsnum-STCTS ,
      CCNGN       TYPE  /SAPSLL/ctsnum-CCNGN ,
  END OF s_ctsnum.
  DATA: w_hscode TYPE s_hscode.
  DATA: t_hscode TYPE STANDARD TABLE OF s_hscode,
        t_corref TYPE STANDARD TABLE OF s_corref,
        t_cuit TYPE STANDARD TABLE OF s_cuit,
        t_t606g TYPE STANDARD TABLE OF s_t606g,
        t_tlegsu TYPE STANDARD TABLE OF s_tlegsu,
        t_ctsnum TYPE STANDARD TABLE OF s_ctsnum,
        w_ctsnum TYPE s_ctsnum,
        w_tlegsu TYPE s_tlegsu,
        w_cuit TYPE s_cuit,
        lv_refno TYPE  /sapsll/corref-refno,
        t_refno type STANDARD TABLE OF /SAPSLL/API6800_DLN_LC_S,
        w_refno TYPE /SAPSLL/API6800_DLN_LC_S.
  TYPES : BEGIN OF s_eccn,
         ccngn TYPE  /sapsll/ccngn,
         guid_ctsnum TYPE /sapsll/guid_16,
         END OF s_eccn.
DATA: lv_pname TYPE sy-repid,
       t_ztuhcd1 type STANDARD TABLE OF ztuhcd1,
       w_ztuhcd1 type ztuhcd1.
  CONSTANTS: c_eccn  TYPE char7 VALUE 'ECCN',
             c_HSCODE TYPE char7 value 'HSCODE'.
  DATA: w_eccn TYPE s_eccn.
  DATA: t_eccn TYPE STANDARD TABLE OF s_eccn.
  DATA: w_radio TYPE s_eccn.
  DATA: t_radio TYPE STANDARD TABLE OF s_eccn.
  DATA:w_text TYPE /sapsll/text60.
  REFRESH: t_pr,t_hscode,t_eccn,t_radio,lr_datbi,lr_datab, t_cuit,t_t606g,t_tlegsu,t_ctsnum.
  CLEAR: t_pr,t_hscode,t_eccn,w_radio,hscode,eccn,schb,lr_datbi,lr_datab,lv_rptdt,w_ctsnum,w_tlegsu.
  GET TIME STAMP FIELD lv_rptdt.
*BREAK-POINT.
  CALL FUNCTION '/SAPSLL/VALID_RANGES_PREPARE'
    EXPORTING
      iv_rptdt  = lv_rptdt
      iv_option = 'LT'
    IMPORTING
      er_datab  = lr_datab
      er_datbi  = lr_datbi.
  CALL FUNCTION 'CONVERSION_EXIT_SLLPR_INPUT'
    EXPORTING
      input  = prvsy
    IMPORTING
      output = prvsy.
  SELECT  guid_pr
          INTO TABLE t_pr
          FROM /sapsll/pntpr
          WHERE grvsy = 'LSG_ECC'
          AND   prvsy = prvsy
          AND   prtyp = lv_prtyp.
if refno[] is initial.
   IF NOT t_pr[] IS INITIAL.
    SELECT guid_ctsnum
           stcts
           datbi
           datab
           INTO TABLE t_hscode
           FROM    /sapsll/prcts
           FOR ALL ENTRIES IN t_pr
           WHERE guid_pr = t_pr-guid_pr
           AND   stcts  IN ('US_HTS','EARECCN','US_SCHB','NRC_SCHB', 'NRCECCN')
           AND datbi IN lr_datbi[]
           AND datab IN lr_datab[].
  ENDIF.
  IF NOT  t_hscode[] IS INITIAL.
    SELECT  ccngn
            guid_ctsnum
            INTO TABLE t_eccn
            FROM    /sapsll/ctsnum
            FOR ALL ENTRIES IN t_hscode
            WHERE guid_ctsnum  = t_hscode-guid_ctsnum.
  ENDIF.
  LOOP AT t_eccn INTO w_eccn.
    READ TABLE t_hscode INTO w_hscode WITH KEY guid_ctsnum = w_eccn-guid_ctsnum.
    IF sy-subrc = 0.
      IF w_hscode-stcts = 'US_HTS'.
        hscode = w_eccn-ccngn.
      ELSEIF w_hscode-stcts = 'EARECCN'.
        eccn = w_eccn-ccngn.
      ELSEIF  w_hscode-stcts = 'US_SCHB'.
        schb =  w_eccn-ccngn.
      ELSEIF  w_hscode-stcts = 'NRC_SCHB'.
        radio =  w_eccn-ccngn.
      ELSEIF  w_hscode-stcts = 'NRCECCN'.
        radio_eccn =  w_eccn-ccngn.
      ENDIF.
      IF NOT radio IS INITIAL OR
         NOT radio_eccn IS INITIAL .
        SELECT SINGLE text
          INTO w_text
          FROM    /sapsll/ctsnumt
          WHERE guid_ctsnum  = w_hscode-guid_ctsnum
          AND ctstt = 'F'
          AND   langu = 'EN'.
        IF sy-subrc = 0.
          text = w_text.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDLOOP.
Else.
  IF NOT t_pr[] IS INITIAL.
    SELECT guid_ctsnum
           stcts
           datbi
           datab
           INTO TABLE t_hscode
           FROM    /sapsll/prcts
           FOR ALL ENTRIES IN t_pr
           WHERE guid_pr = t_pr-guid_pr
           AND datbi IN lr_datbi[]
           AND datab IN lr_datab[].
  endif.
  read table refno into w_refno index 1.
  if sy-subrc eq 0.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      INPUT         = w_refno-refno
   IMPORTING
     OUTPUT        = lv_refno.
  endif.
select GUID_POBJ
       REFNO
       from /sapsll/corref into TABLE t_corref
       where REFNO = lv_REFNO.
if t_corref is not initial.
select GUID_CUHD
       GUID_PR
       CTYDP
       from /sapsll/cuit into table t_cuit
       for all entries in t_corref
       where GUID_CUHD = t_corref-GUID_POBJ.
   endif.
if t_cuit is not initial .
select LGREG GGLND from  /SAPSLL/T606G
                   into table t_T606G
                  for all entries in t_cuit
                  where  GGLND = t_cuit-CTYDP.
endif.
if t_T606G is not initial.
select LGREG
       CTSEX from /SAPSLL/TLEGSU
                   into TABLE t_TLEGSU
                   FOR ALL ENTRIES IN t_T606G
                   where LGREG = t_T606G-LGREG.
endif.
if t_hscode[] is not INITIAL.
select GUID_CTSNUM
       STCTS
       CCNGN
      from  /SAPSLL/CTSNUM
      into TABLE t_CTSNUM FOR ALL ENTRIES IN t_hscode
      where GUID_CTSNUM = t_hscode-GUID_CTSNUM .
endif.
  REFRESH: t_ztuhcd1.
  CLEAR:   t_ztuhcd1,w_ztuhcd1.
* loop at t_TLEGSU into w_TLEGSU.
READ TABLE t_cuit INTO w_cuit index 1.
  lv_pname = sy-repid.
* To retrive all the hard coded values
  w_ztuhcd1-name  = c_eccn.
*  w_ztuhcd1-field = c_eccn.
  w_ztuhcd1-zkey  = w_cuit-ctydp.
  APPEND w_ztuhcd1 TO t_ztuhcd1.
  CLEAR: w_ztuhcd1,lv_pname.
* To retrive all the hard coded values
  CALL FUNCTION 'Z_UHARD_CODE_VALUE'
       TABLES
            t_ztuhcd1     = t_ztuhcd1
       EXCEPTIONS
            no_data_found = 1
            OTHERS        = 2.
if sy-subrc eq 0.
loop at t_ztuhcd1 into w_ztuhcd1 .
read table t_CTSNUM into w_CTSNUM with key STCTS =  w_ztuhcd1-low.
if sy-subrc eq 0.
    eccn = w_CTSNUM-CCNGN.
  endif.
  endloop.
  endif.
  REFRESH: t_ztuhcd1.
  CLEAR:   t_ztuhcd1,w_ztuhcd1.
*  lv_pname = sy-repid.
* To retrive all the hard coded values
  w_ztuhcd1-name  = c_HSCODE.
*  w_ztuhcd1-field = c_HSCODE.
  w_ztuhcd1-zkey  = w_cuit-ctydp.
  APPEND w_ztuhcd1 TO t_ztuhcd1.
  CLEAR w_ztuhcd1.
* To retrive all the hard coded values
  CALL FUNCTION 'Z_UHARD_CODE_VALUE'
       TABLES
            t_ztuhcd1     = t_ztuhcd1
       EXCEPTIONS
            no_data_found = 1
            OTHERS        = 2.
if sy-subrc eq 0.
loop at t_ztuhcd1 into w_ztuhcd1 .
read table t_CTSNUM into w_CTSNUM with key STCTS =  w_ztuhcd1-low.
if sy-subrc eq 0.
    HSCODE = w_CTSNUM-CCNGN.
  endif.
  endloop.
  endif.
endif.
ENDFUNCTION.

Similar Messages

  • Differrence between HTS Code and Commodity Code

    Hi All,
    What is the difference between commodity code and HTS code in US. Also what's the significance of both the codes.
    Regards,
    Prabu

    Hi Prabhu,
    The difference between HTS and Commodity codes are as below
    HTS is Harmonized Tariff Schedule which is a product classification used when using for US Customs import Declaration
    Commodity Codes known as Schedule B Numbers are the product classification numbers used when in doing the Customs Export Declaration.
    Commodity Codes or HTS or HS codes are mainly depend on the basic commonly agreed numbering schemes maintained by World Customs Organization(WCO).
    The common thing among these two numbering schemes is the first 6 digits are same and rest are different.
    Mark if helpful.
    Regards,
    Shiva

  • 48 Hours ago I started to upgrade to Mtn Lion on a now 10 day old IMac - 30 minutes ago I got the email with the content code and redeem code for the download from the app store - it said download was happening, but nothing happened for 30 min - FIX IT!

    48 Hours ago I started to upgrade to Mountain Lion on a now 10 day old IMac - 30 minutes ago I got the email with the content code and redeem code for the download from the app store - it said download was happening, but nothing happened for 30 min - HOW DO I (or you) FIX IT!?

    This is a User's Forum, yelling at us won't help. You have 90 days of customer support via telephone. Use them as they can interact with their system and hopefully get you back on track. Otherwise take it to them at the Genius Bar and have them make it good.

  • How to derive Company Code and Vendor Number from CDHDR / CDPOS ?

    Hi everyone,
    This is my first post and my apologies if this is a wrong forum to ask this.
    I'm creating an analytic that will track changes to the vendor master.  I know that I have to look into CDHDR and CDPOS tables and that CDHDR.OBJECTCLAS = KRED.
    However, part of the requirements is to be able to filter the results by Company Code and Vendor Number as well.  How do I do this? How can I link CDHDR to LFA1/LFB1 to get the company code and vendor code?
    Any information will be highly appreciated
    Thanks!

    I think you would have gotten answers sooner in the abap forum :P. Anyways the change pointer tables are kept in a different format, not in the normal flatly structured tables. What this means is that the data which comes through the pointer tables are somewhat encrypted. The object class and id present you records; Each change in master data (where the option is set) is recorded in these pointer tables.
    I believe there is a function module for converting the data into a readable format; that data should have your company code/vendor number in it.  You cannot link the chdr and lfa tables directly- you will need to first convert the data from the pointer tables

  • HT4436 i dont remember my Apple ID Security Code and always asking from me in my iphone what should i do?

    i dont remember my Apple ID Security Code and always asking from me in my iphone what should i do?

    What Apple ID security code?
    If you're talking acount the iCloud keychain security code, read here: http://support.apple.com/kb/HT5834.

  • A table mapping between country code and currency code

    Hi experts,
    I want to know whether there is a table mapping between country code and currency code.I have found the table T005(Countries).But I don't why the filed of WAERS(Country currency) hasn't maintained in talbe T005?Whether country code and currency code hasn't direct relation?
    Regards,
    Kelvin

    Dear Kelvin
    The said field (WAERS) can be fetched from many tables.  To name a few, below are some of the tables in which, you can see the field for currency.
    1)  BKKI4
    2)  BKKI5
    3)  BWPOS
    4)  KNKA
    5)  KNVV
    6)  MSEG
    thanks
    G. Lakshmipathi

  • Commodity code and import code no

    hi SAP SD guys,
                                can any body explains about commodity codes and import
    codes number? for what purpose it is used?

    when trading internationally, then you need to find the correct commodity code for your goods , so you can fill out the customs paperwork accuratly. the code is minimum 8digit, but can be more. depending on the code you can lookup duty rates and import export restrictions.
    commodity code and import code no and HTS harmonized tariff schedule is basically the same and captured in just one single field in SAP. It is used as well for European trade statistics such as Intrastat and extrastat.

  • Lost my SIM card's PIN code and PUK code!!!!

    I lost my SIM card's PIN codes and PUK code.
    Our mobile provider is not helpful. We have to give around $100 to unlock these codes. I cannot spend $100 for it. I'm from Myanmar (Burma).
    My phone is Nokia E63. But I still got that problem in all other handsets like; Nokia 6300 and Nokia 1280
    Is there any ways to unlock my phone?
    Please help me.
    Queenie

    Exactly.
    Either way round you must remember that the SIM and any codes related to it are the property of your network. THEY control what happens to it.
    http://techyoddsandends.blogspot.com/2009/09/pin-code-puk-code-security-code-lock.html
    Message Edited by grschinon on 21-Nov-2009 11:44 AM
    Was this post helpful? If so, please click on the white "Kudos!" star below. Thank you!

  • PO to accept multiple GL codes and cost codes

    PO to accept multiple GL codes and cost codes. Since the system POs are not accepting more than one GL code and Cost code, this functionality is not being used for some of the service providers like Car Hire, Air ticket vendors, Stationery vendors, Utility vendors.
    Is there anything to releated to field selection ?
    is there anyway to upload the excel file in case if I have more than 1 G/L and cost center during PO creation
    Thanks in advance

    HI
    Yes the setting will let you use multiple account assignments.
    If you need to upload alot of PO's in this way then the best way is to use the BAPI - BAPI_PO_CREATE1.
    This will help you in craeting any number of line items witha nay number of account assignments.
    LSMW and BDC will not be  able to control the table structures being used.
    Please take help of ABAPEer in bulding the program  using the BAPI.
    Thanks & Regards
    kishore

  • Bapi_Acc_Document_Post - E 018 : Invalid tax code and company code combination

    Hi All,
    I need the help of this forum once again.
    I am using bapi Bapi_Acc_Document_Post to create KR documents in SAP. The bapi works absolutely fine except for one scenario:
    For a particular type of invoice coded to Company "XXXX" with lines having tax code "I0", the bapi returns error message "E 018 : Invalid tax code and company code combination". The tax code "I0" and the company code "XXXX" has been mapped in SAP and if I try to create the invoice manually in SAP using the GUI, the invoice gets created without any issue.
    I have tried searching the forum but could not find any post on this topic.
    Therefore, requesting the masters to please help me out on this.
    Best Regards
    Sutirtha Roy

    Hi Gowthami,
    how have you solved your problem, because I am facing the similiar issue and trying desperately to post the following combination with BAPI_ACC_POST_DOCUMENT:
    001 40       490100     Aufw. aus Marge PP              R2                 15,92
    002 31       10000003   Kreditor                                R2                 15,92-
    003 50       175060     Abzugsverfahren USt            R2                  3,18-
    004 40       154060     Abzugsverfahren Vst             R2                  3,18
    THANX!
    Regards
    Marko

  • Importing a journal voucher with GL Codes and BP Codes

    Hi Experts,
    I'm trying to get a DTW import for Journal Vouchers working on 8.8 PL05. I have a journal voucher template with GL Codes and BP Codes that I need to import as this is part of some integration.
    If I leave out the BP Codes it works fine but if I add them into the sheet is gives a DTW error "invalid account code application-defined or object-defined error 65171".
    I have tried to add BP code to shortname and add contra account.
    Please any help would be appreciated.
    Regards
    Lou van Wyk

    Welcome to SAP forum Lou...
    I do not know about 8.8 Journal vouchers, but some time ago we were importing with BP codes and we ran into a somewhat similar situation.  I believe we had to format the BP codes to Text in Excel before saving the file to CSV.
    Another time I was working with an individual who had not set up two BP Master Data records before doing transactions like it states in SAP's User Guide titled Data Migration and Opening Balances...
    Maybe that helps?
    Regards,
    Zal

  • Company code and other codes

    Hi Gurus
    Can I dislose the company code and other codes like Business area, sales organisation etc of my previous project to the interviewer?
    Thanks gurus

    hi,
    infact its better you tell how those things have been configured so that they understand how much you know and how the naming conventions were followed.
    Everything can be talked as long as its in the premise of professionalism and work.
    Thanks
    Sadhu Kishore

  • Can i install cs 6 on a new powerfull computer ? I have license code and product code

    can i install cs 6 on a new powerfull computer ? I have license code and product code. I buy a student & teacher edition up 2013

    Sure. It's yours.
    Mylenium

  • Case created without business partner, reason code and  result code

    In our CRM system, some cases was created without business partner, reason code and result code.
    We created some customer functions to make these fields as mandatory, it always work for our technique people and process expert, but it didn't work for some users occasionally. We cannot debug it.  
    Can anyone tell me why and how to solve it?
    Please help me !
    Regards,
    Shirley

    Hello Shirley,
    Well, then I would check the code, which calls your custom function modules.
    It may be possible, that you have an IF in the 'Main' program, which makes it possible to skip the custom FM for these users.
    The reason I am assuming this, is that normally you need just to change attributes for a field to make it mandatory, or customizing like SHD0 makes this possible. If you use custom FM, you have to call them somewhere and this is the point I would be looking for.
    Check the traces for the users and you should find, that the custom FM are not called for them.
    My opinion, of course
    Award points if this helps.
    Regards,
    Martin Kuma

  • Dealer code and Mother code

    Hi
    Can somebody tell me what is dealer and mother code in SAP. I have an issue wherin the dealer code 514573 is wrong in SAP and the mother code is 3151153.
    Issue to be resolved very urgent. Pl help me.
    Srikkanth

    Hi Srikanth,
                     Can you please give explnation on the same mother code and dealer code,How did you resolve the issue
    Regards
    Narayana

Maybe you are looking for

  • Integrate KDE notifications with Openbox?

    Hi, I'm using openbox with whole set of KDE programs (I prefer it this way over KDE with OB as WM). Is there any way of integrating KDE notifications with OB to make it look neat? Cheers vi3dr0

  • Inconsistent domain logon times

    I have logon times that vary from 5 to 90 seconds for a domain login. If the user logs on for the first time it takes about 90 seconds; this appears fair due to the work that is do with preparing the desktop and copying profiles... etc. The next time

  • Any Way to Set Default Settings for HDR Toning?

    I have developed a nice set of parameters for the HDR Toning feature and have saved them as Noels Defaults, but I don't see a way to make them the default settings for HDR Toning.  Frankly I find the default color settings for the tool very garish. 

  • Resetting the date and time after the phone has be...

    Hi, I keep having to reset the date and time very time I turn my phone off. I was thinking it was to do with the battery so I fully charged it, turned it off then turned it on again and it asks me for the date and time. I only noticed this because I'

  • Doubt in jms

    Hi all, i got a requirement to get data from another application using JMS api what are the steps need to get data using jms any 1 help me out thanks in advance